WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
77580
Support targetOrigin = "/" in postMessage for sending messages to same origin as source document
https://bugs.webkit.org/show_bug.cgi?id=77580
Summary
Support targetOrigin = "/" in postMessage for sending messages to same origin...
Pablo Flouret
Reported
2012-02-01 15:14:20 PST
Spec:
http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html#posting-messages
[[ 9. If the targetOrigin argument is a single literal U+002F SOLIDUS character (/), and the Document of the Window object on which the method was invoked does not have the same origin as the entry script's document, then abort these steps silently. ]] Opera supports this already.
Attachments
Patch
(8.32 KB, patch)
2012-02-01 15:27 PST
,
Pablo Flouret
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Pablo Flouret
Comment 1
2012-02-01 15:27:23 PST
Created
attachment 125031
[details]
Patch
Adam Barth
Comment 2
2012-02-01 15:34:54 PST
I thought this was removed from the spec.
Adam Barth
Comment 3
2012-02-01 15:36:52 PST
Comment on
attachment 125031
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=125031&action=review
> Source/WebCore/page/DOMWindow.cpp:837 > + target = sourceDocument->securityOrigin();
Do we need to make a cross-thread copy?
Adam Barth
Comment 4
2012-02-01 15:37:15 PST
CCing some threading experts.
Dmitry Lomov
Comment 5
2012-02-01 16:13:22 PST
Comment on
attachment 125031
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=125031&action=review
>> Source/WebCore/page/DOMWindow.cpp:837 >> + target = sourceDocument->securityOrigin(); > > Do we need to make a cross-thread copy?
No, because this is DOMWindow::postMessage - it is all single threaded.
Adam Barth
Comment 6
2012-02-01 16:54:59 PST
Comment on
attachment 125031
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=125031&action=review
Thanks!
> Source/WebCore/page/DOMWindow.cpp:836 > + if (!sourceDocument) > + return;
I wonder if we shouldn't just return right away when !sourceDocument. I can understand why you've chosen this path though.
Pablo Flouret
Comment 7
2012-02-01 17:00:57 PST
(In reply to
comment #6
)
> (From update of
attachment 125031
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=125031&action=review
> > Thanks! > > > Source/WebCore/page/DOMWindow.cpp:836 > > + if (!sourceDocument) > > + return; > > I wonder if we shouldn't just return right away when !sourceDocument. I can understand why you've chosen this path though.
Yeah, wasn't sure if the syntax error should be reported regardless, but when in doubt i guess it's always better to keep the existing behavior :P. Under what circumstances can there be no document there? (workers?)
Adam Barth
Comment 8
2012-02-01 17:08:21 PST
> Under what circumstances can there be no document there? (workers?)
The situation is very rare. Basically, if the source window is from a frame that has been destroyed (i.e., removed from the DOM). It's possible to construct those scenarios, but we don't usually care all that much about what happens then (as long as we don't crash or cause security problems).
WebKit Review Bot
Comment 9
2012-02-01 17:40:12 PST
Comment on
attachment 125031
[details]
Patch Clearing flags on attachment: 125031 Committed
r106516
: <
http://trac.webkit.org/changeset/106516
>
WebKit Review Bot
Comment 10
2012-02-01 17:40:16 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug