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
209174
Add routines to check about:blank and about:srcdoc URLs
https://bugs.webkit.org/show_bug.cgi?id=209174
Summary
Add routines to check about:blank and about:srcdoc URLs
youenn fablet
Reported
2020-03-17 02:57:07 PDT
Add routines to check about:blank and about:srcdoc URLs
Attachments
Patch
(8.84 KB, patch)
2020-03-17 02:59 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(8.84 KB, patch)
2020-03-19 02:38 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(9.10 KB, patch)
2020-03-19 06:09 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(12.80 KB, patch)
2020-03-19 07:18 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(16.55 KB, patch)
2020-03-20 04:15 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
youenn fablet
Comment 1
2020-03-17 02:59:19 PDT
Created
attachment 393738
[details]
Patch
youenn fablet
Comment 2
2020-03-19 02:38:54 PDT
Created
attachment 393957
[details]
Patch
youenn fablet
Comment 3
2020-03-19 06:06:16 PDT
Two tests are failing: imported/w3c/web-platform-tests/html/dom/usvstring-reflection.https.html gets some more PASS. I believe the issue was that we were comparing "about:blank" with "about:blank#xxx" and we are now no longer checking the hash. Seems like an improvement. http/tests/dom/window-open-about-uppercase-blank-and-access-document.html is now failing and is specifically trying to do window.open("about:BLANK"). Both Firefox and Chrome pass the test but with different behaviours. They treat about:BLANK as somehow different from about:blank though. For instance Chrome will end-up loading "about:blank#blocked". Probably the navigation starts with "about:blank", tries to go to "about:BLANK" which is blocked. I guess we could make a DOMWindow::open specific fix here, or preserve for now SecurityPolicy::shouldInheritSecurityOriginFromOwner behavior.
youenn fablet
Comment 4
2020-03-19 06:09:15 PDT
Created
attachment 393971
[details]
Patch
youenn fablet
Comment 5
2020-03-19 07:18:42 PDT
Created
attachment 393976
[details]
Patch
youenn fablet
Comment 6
2020-03-20 04:15:30 PDT
Created
attachment 394076
[details]
Patch
Alex Christensen
Comment 7
2020-03-20 09:46:41 PDT
Comment on
attachment 394076
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=394076&action=review
> Source/WTF/wtf/URL.h:262 > WTF_EXPORT_PRIVATE const URL& blankURL();
I think we should rename this.
youenn fablet
Comment 8
2020-03-20 09:52:02 PDT
Comment on
attachment 394076
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=394076&action=review
>> Source/WTF/wtf/URL.h:262 >> WTF_EXPORT_PRIVATE const URL& blankURL(); > > I think we should rename this.
Agreed, it should be aboutBlankURL probably.
youenn fablet
Comment 9
2020-03-20 09:52:40 PDT
https://bugs.webkit.org/show_bug.cgi?id=209344
EWS
Comment 10
2020-03-20 10:40:50 PDT
Committed
r258769
: <
https://trac.webkit.org/changeset/258769
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 394076
[details]
.
Radar WebKit Bug Importer
Comment 11
2020-03-20 10:41:18 PDT
<
rdar://problem/60692601
>
Darin Adler
Comment 12
2020-03-20 13:01:02 PDT
Comment on
attachment 394076
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=394076&action=review
> Source/WTF/wtf/URL.cpp:1026 > + return protocolIsAbout() && path() == "blank";
Case sensitive. On purpose? I see FIXME that implies it is. But also, I would like to see test coverage.
> Source/WTF/wtf/URL.cpp:1031 > + return protocolIsAbout() && path() == "srcdoc";
Ditto.
Darin Adler
Comment 13
2020-03-20 13:05:15 PDT
Comment on
attachment 394076
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=394076&action=review
> Source/WTF/wtf/URL.cpp:878 > + static NeverDestroyed<URL> staticAboutSrcDocURL(URL(), "about:srcdoc");
I wonder if we should include const for things like this. static const NeverDestroyed<URL> ... Not sure if this has enough value to be worth including the extra keyword.
> Source/WebCore/html/HTMLFrameElementBase.cpp:156 > + return WTF::aboutSrcDocURL();
Should not need a WTF prefix. Normally for WTF we are putting "using" in the header itself. I would like to stay consistent one way or the other.
> Source/WebCore/loader/FrameLoader.cpp:3714 > - if (!equalLettersIgnoringASCIICase(url.string(), "about:srcdoc")) > + if (!url.isAboutSrcDoc())
Here we changed behavior. Do we have test coverage?
> Source/WebCore/page/SecurityPolicy.cpp:170 > + // FIXME: We also allow some URLs like "about:BLANK". We should probably block navigation to these URLs, see
rdar://problem/57966056
. > + return url.isEmpty() || url.isAboutBlank() || url.isAboutSrcDoc() || equalIgnoringASCIICase(url.string(), WTF::blankURL());
Here we preserved this old behavior, and the FIXME suggests changing bahvior. Do we have test coverage either way?
> Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:82 > - && !equalIgnoringASCIICase(openerUrl.string(), WTF::blankURL())) { > + && !openerUrl.isAboutBlank()) {
Here we changed behavior. Do we have test coverage?
youenn fablet
Comment 14
2020-03-23 02:45:28 PDT
> > Source/WebCore/html/HTMLFrameElementBase.cpp:156 > > + return WTF::aboutSrcDocURL(); > > Should not need a WTF prefix. Normally for WTF we are putting "using" in the > header itself. I would like to stay consistent one way or the other.
Will fix it.
> > Source/WebCore/loader/FrameLoader.cpp:3714 > > - if (!equalLettersIgnoringASCIICase(url.string(), "about:srcdoc")) > > + if (!url.isAboutSrcDoc()) > > Here we changed behavior. Do we have test coverage?
I do not think we are changing behavior since this is an early return. We are early returning more often but, in the cases where we were not, ownerElement->hasAttributeWithoutSynchronization(srcdocAttr) would catch the other cases.
> > Source/WebCore/page/SecurityPolicy.cpp:170 > > + // FIXME: We also allow some URLs like "about:BLANK". We should probably block navigation to these URLs, see
rdar://problem/57966056
. > > + return url.isEmpty() || url.isAboutBlank() || url.isAboutSrcDoc() || equalIgnoringASCIICase(url.string(), WTF::blankURL()); > > Here we preserved this old behavior, and the FIXME suggests changing > bahvior. Do we have test coverage either way?
We have test coverage here: http/tests/dom/window-open-about-uppercase-blank-and-access-document.html.
> > Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:82 > > - && !equalIgnoringASCIICase(openerUrl.string(), WTF::blankURL())) { > > + && !openerUrl.isAboutBlank()) { > > Here we changed behavior. Do we have test coverage?
Right. John, do you know how we can exercise that code path?
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