RESOLVED FIXED38285
REGRESSION: Sandboxing code breaks some javascript: URLs in empty windows
https://bugs.webkit.org/show_bug.cgi?id=38285
Summary REGRESSION: Sandboxing code breaks some javascript: URLs in empty windows
Alexey Proskuryakov
Reported 2010-04-28 14:36:02 PDT
Steps to reproduce: 1. Open a new empty window or tab. 2. Enter in address field: javascript:window.open('http://digg.com/') Results: nothing happens. Expected results: digg.com opens. The failing check is in FrameLoader::createWindow(): if (isDocumentSandboxed(SandboxNavigation)) <rdar://problem/7903453>
Attachments
naive fix (1.50 KB, patch)
2010-04-30 16:53 PDT, Alexey Proskuryakov
darin: review+
better fix (1.90 KB, patch)
2010-05-03 12:15 PDT, Alexey Proskuryakov
abarth: review+
Alexey Proskuryakov
Comment 1 2010-04-30 16:53:10 PDT
Created attachment 54835 [details] naive fix
Darin Adler
Comment 2 2010-04-30 17:18:03 PDT
Comment on attachment 54835 [details] naive fix The reason sandbox flags start with SandboxAll is the principle that it's safest to start with restrictions and relax them rather than the other way around. Changing the default setting affects an unknown set of code paths. That having been said, this change is OK with me. I'd love to hear Adam's take on it too.
Alexey Proskuryakov
Comment 3 2010-04-30 17:41:07 PDT
One thing I'm unsure about is relationship between flags in FrameLoader and in Document's security origin. FrameLoader::updateSandboxFlags() is called while opening the new tab/window, and it changes m_sandboxFlags to None. But it's too late for document's SecurityOrigin, because it's created earlier than that, so it still has the original flags from FrameLoader.
Adam Barth
Comment 4 2010-05-02 02:28:43 PDT
I'll look at this in more detail later. The sandbox flags on FrameLoader are the flags a new document loaded into that frame would get. The ones on the document's security origin are the ones the document was given when it was loaded. These can be different if someone changes the sandbox attribute after a document is loaded.
Alexey Proskuryakov
Comment 5 2010-05-03 12:15:55 PDT
Created attachment 54952 [details] better fix Adam suggested a better fix - we can propagate sandbox flags in init() earlier. This doesn't seem to affect any known behavior, but is generally nicer than starting with SandboxNone.
Adam Barth
Comment 6 2010-05-03 12:17:47 PDT
Comment on attachment 54952 [details] better fix Thanks! You might as well land the test you wrote too. It doesn't hurt to add extra tests.
Alexey Proskuryakov
Comment 7 2010-05-03 13:04:51 PDT
Note You need to log in before you can comment on or make changes to this bug.