[Webkit-unassigned] [Bug 162512] New: window.postMessage error with iframe and file:// protocol

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 23 13:45:23 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=162512

            Bug ID: 162512
           Summary: window.postMessage error with iframe and file://
                    protocol
    Classification: Unclassified
           Product: WebKit
           Version: Safari 10
          Hardware: Unspecified
                OS: iOS 10
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: HTML Events
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: pierbover11 at gmail.com

On iOS when trying to use window.postMessage I get 11 errors saying:

Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match.

See this screenshot: http://i.imgur.com/JJkIEy5.jpg

This happens when using WKWebView in a Cordova project or in the Safari browser when using the file:// protocol. The error doesn't happen when using UIWebView or when using the HTTP(s) protocol.

I have tested it in iOS 9 and 10 with the same result.

I have attached 2 HTMLs files. Open index.html in the Simulator with Safari iOS using a file:// protocol and click the buttons.

Here is a simple cordova project that you can test too for WKWebView.
https://github.com/PierBover/cordova-wkwebview-iframe-bug

To reproduce in the cordova project you need to install the cordova CLI and then:
1) go to the cordova folder
2) cordova emulate ios --target="iPad-Air-2, 9.3"
3) Open Safari. On the Developer menu open the JS console for the webview.
4) Click the buttons on the webview.

If you test this URL in Safari for iOS you will see the error doesn't reproduce which confirms it only happens when using file://
http://pierbover.com/pub/iframe-bug/

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160923/6d9e068a/attachment.html>


More information about the webkit-unassigned mailing list