Bug 190539 - Window's properties such as 'location' should not become null when it loses its browsing context
Summary: Window's properties such as 'location' should not become null when it loses i...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks: 190595 190636
  Show dependency treegraph
 
Reported: 2018-10-12 14:35 PDT by Chris Dumez
Modified: 2018-10-16 13:29 PDT (History)
15 users (show)

See Also:


Attachments
Patch (68.20 KB, patch)
2018-10-12 15:46 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (67.64 KB, patch)
2018-10-12 16:06 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2018-10-12 14:35:27 PDT
Window's properties such as 'location' should not become null when it loses its browsing context. This Webkit behavior is not standard and does not match other browsers.
Comment 1 Chris Dumez 2018-10-12 15:46:52 PDT
Created attachment 352219 [details]
Patch
Comment 2 Chris Dumez 2018-10-12 16:06:39 PDT
Created attachment 352226 [details]
Patch
Comment 3 Alex Christensen 2018-10-12 17:04:45 PDT
Comment on attachment 352226 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=352226&action=review

> LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url.window-expected.txt:3
> -FAIL document.open() does not change document's URL (active but not fully active document) null is not an object (evaluating 'childWin.location.href')
> +FAIL document.open() does not change document's URL (active but not fully active document) assert_equals: expected "http://localhost:8800/common/blank.html" but got ""

This doesn't look great.  What's going on here?
Comment 4 Chris Dumez 2018-10-12 17:08:43 PDT
(In reply to Alex Christensen from comment #3)
> Comment on attachment 352226 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=352226&action=review
> 
> > LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url.window-expected.txt:3
> > -FAIL document.open() does not change document's URL (active but not fully active document) null is not an object (evaluating 'childWin.location.href')
> > +FAIL document.open() does not change document's URL (active but not fully active document) assert_equals: expected "http://localhost:8800/common/blank.html" but got ""
> 
> This doesn't look great.  What's going on here?

It is a progression since location is no longer null. However, we are still failing because the test expects the URL to persist after the window is detached.

We are currently discussing standardizing what the URL should be here:
https://github.com/whatwg/html/issues/3959

Right now browsers behave like so or location.href:
- Firefox and Safari (after this patch): ""
- Edge: "about:blank"
- Chrome: undefined

The test's check would fail in all browsers.
Comment 5 WebKit Commit Bot 2018-10-12 17:42:04 PDT
Comment on attachment 352226 [details]
Patch

Rejecting attachment 352226 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-02', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 352226, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Last 5000 characters of output:
sts/http/tests/security/xss-DENIED-script-inject-into-inactive-window2-pson.html
	M	LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window2.html
	M	LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window3.html
	M	LayoutTests/imported/w3c/ChangeLog
	M	LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url.window-expected.txt
	M	Source/WebCore/ChangeLog
	M	Source/WebCore/bindings/js/JSDOMBindingSecurity.cpp
	M	Source/WebCore/bindings/js/JSDOMBindingSecurity.h
	M	Source/WebCore/bindings/js/JSDOMWindowProperties.cpp
	M	Source/WebCore/bindings/js/JSLocationCustom.cpp
	M	Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
	M	Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp
	M	Source/WebCore/crypto/SubtleCrypto.cpp
	M	Source/WebCore/crypto/SubtleCrypto.h
	M	Source/WebCore/page/Crypto.cpp
	M	Source/WebCore/page/Crypto.h
	M	Source/WebCore/page/DOMWindow.cpp
	M	Source/WebCore/page/DOMWindow.h
	M	Source/WebCore/page/DOMWindow.idl
	M	Source/WebCore/workers/WorkerGlobalScope.cpp

ERROR from SVN:
A repository hook failed: Commit blocked by pre-commit hook (exit code 1) with output:
Commits are currently disabled while we update infrastructure.
W: 218abe29b566a06fd2973d601416627f65df110a and refs/remotes/origin/master differ, using rebase:
:040000 040000 6bbd0664e6a439c15f87cd969e1eee70148fe569 92eda367eb67787361b8f4da2a96959390505aa7 M	LayoutTests
:040000 040000 1d754bfd1dfd42e7ffd6131d53ac4117000f8fbe db349c7d53434e63104b36e19511df8a3253ad7d M	Source
Current branch master is up to date.
ERROR: Not all changes have been committed into SVN, however the committed
ones (if any) seem to be successfully integrated into the working tree.
Please see the above messages for details.


Failed to run "['git', 'svn', 'dcommit', '--rmdir']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

Committing to http://svn.webkit.org/repository/webkit/trunk ...
	A	LayoutTests/http/tests/dom/cross-origin-detached-window-properties-expected.txt
	A	LayoutTests/http/tests/dom/cross-origin-detached-window-properties.html
	A	LayoutTests/http/tests/dom/resources/post-message-to-parent-when-loaded.html
	A	LayoutTests/http/tests/dom/same-origin-detached-window-properties-expected.txt
	A	LayoutTests/http/tests/dom/same-origin-detached-window-properties.html
	M	LayoutTests/ChangeLog
	M	LayoutTests/fast/frames/detached-frame-property-expected.txt
	M	LayoutTests/fast/frames/detached-frame-property.html
	M	LayoutTests/http/tests/security/named-window-property-from-same-origin-inactive-document-expected.txt
	M	LayoutTests/http/tests/security/named-window-property-from-same-origin-inactive-document.html
	M	LayoutTests/http/tests/security/xss-DENIED-named-window-property-from-cross-origin-inactive-document-expected.txt
	M	LayoutTests/http/tests/security/xss-DENIED-named-window-property-from-cross-origin-inactive-document.html
	M	LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window.html
	M	LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window2-pson.html
	M	LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window2.html
	M	LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window3.html
	M	LayoutTests/imported/w3c/ChangeLog
	M	LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url.window-expected.txt
	M	Source/WebCore/ChangeLog
	M	Source/WebCore/bindings/js/JSDOMBindingSecurity.cpp
	M	Source/WebCore/bindings/js/JSDOMBindingSecurity.h
	M	Source/WebCore/bindings/js/JSDOMWindowProperties.cpp
	M	Source/WebCore/bindings/js/JSLocationCustom.cpp
	M	Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
	M	Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp
	M	Source/WebCore/crypto/SubtleCrypto.cpp
	M	Source/WebCore/crypto/SubtleCrypto.h
	M	Source/WebCore/page/Crypto.cpp
	M	Source/WebCore/page/Crypto.h
	M	Source/WebCore/page/DOMWindow.cpp
	M	Source/WebCore/page/DOMWindow.h
	M	Source/WebCore/page/DOMWindow.idl
	M	Source/WebCore/workers/WorkerGlobalScope.cpp

ERROR from SVN:
A repository hook failed: Commit blocked by pre-commit hook (exit code 1) with output:
Commits are currently disabled while we update infrastructure.
W: 218abe29b566a06fd2973d601416627f65df110a and refs/remotes/origin/master differ, using rebase:
:040000 040000 6bbd0664e6a439c15f87cd969e1eee70148fe569 92eda367eb67787361b8f4da2a96959390505aa7 M	LayoutTests
:040000 040000 1d754bfd1dfd42e7ffd6131d53ac4117000f8fbe db349c7d53434e63104b36e19511df8a3253ad7d M	Source
Current branch master is up to date.
ERROR: Not all changes have been committed into SVN, however the committed
ones (if any) seem to be successfully integrated into the working tree.
Please see the above messages for details.


Failed to run "['git', 'svn', 'dcommit', '--rmdir']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit
Updating OpenSource
Current branch master is up to date.

Full output: https://webkit-queues.webkit.org/results/9560157
Comment 6 WebKit Commit Bot 2018-10-15 07:54:32 PDT
Comment on attachment 352226 [details]
Patch

Clearing flags on attachment: 352226

Committed r237105: <https://trac.webkit.org/changeset/237105>
Comment 7 WebKit Commit Bot 2018-10-15 07:54:33 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2018-10-15 07:55:42 PDT
<rdar://problem/45271076>