haikuwebkit/LayoutTests/imported/blink/fast
Chris Dumez dc65fff7b8 Location.href setter uses wrong window to resolve relative URLs
https://bugs.webkit.org/show_bug.cgi?id=228287

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline a few WPT tests now that more checks are passing.

* web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/083-expected.txt:
* web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/084-expected.txt:
* web-platform-tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-1-expected.txt:
* web-platform-tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-2-expected.txt:

Source/WebCore:

Location::setLocation() is using "firstWindow" to resolve any input relative URL.
We rely on JSC::VM::deprecatedVMEntryGlobalObject() to get the first/entry window.
However, the test I wrote shows that we were using the wrong window as "first window"
in some cases (since this test would pass in other browsers but not in WebKit).

It turns out that JSEventListener::handleEvent() had a VMEntryScope internally that
would impact the global object being returned by JSC::VM::deprecatedVMEntryGlobalObject().
We were incorrectly using the scriptExecutionContext passed as parameter when constructing
the VMEntryScope instead of using the global object of the function we're about to call.
This bug addresses this.

Credits to Geoff Garen for identifying the issue in JSEventListener::handleEvent().

Test: http/tests/dom/window-location-set-href-relative-url.html

* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* page/Location.cpp:
(WebCore::Location::setLocation):

LayoutTests:

Add layout test coverage. This test is passing in Chome and Firefox but was failing with
WebKit.

* http/tests/dom/window-location-set-href-relative-url-expected.txt: Added.
* http/tests/dom/window-location-set-href-relative-url.html: Added.


Canonical link: https://commits.webkit.org/239980@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280333 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-27 01:07:59 +00:00
..
animation
backgrounds
beacon
block
borders
box-shadow
canvas [LayoutTests] Delete unused imported/blink resources 2021-05-21 14:21:27 +00:00
clip
cpu
css [LayoutTests] Delete unused imported/blink resources 2021-05-21 14:21:27 +00:00
css-generated-content
css-grid-layout
css-intrinsic-dimensions
css3-text/css3-text-decoration
dom Location.href setter uses wrong window to resolve relative URLs 2021-07-27 01:07:59 +00:00
dynamic
encoding
events [LayoutTests] Delete unused imported/blink resources 2021-05-21 14:21:27 +00:00
forms [LayoutTests] Delete unused imported/blink resources 2021-05-21 14:21:27 +00:00
frames [LayoutTests] Delete unused imported/blink resources 2021-05-21 14:21:27 +00:00
gradients
hidpi
history
html [LayoutTests] Delete unused imported/blink resources 2021-05-21 14:21:27 +00:00
images [LayoutTests] Delete unused imported/blink resources 2021-05-21 14:21:27 +00:00
inline
layers
layout
lists
loader [LayoutTests] Delete unused imported/blink resources 2021-05-21 14:21:27 +00:00
masking
media
multicol getBoundingClientRect() returns the incorrect rectangle on elements whose parent element is set -webkit-column-count 2021-07-17 05:42:32 +00:00
overflow
pagination Unreviewed, reverting r271644. 2021-04-22 20:25:24 +00:00
parser [LayoutTests] Delete unused imported/blink resources 2021-05-21 14:21:27 +00:00
plugins
repaint [LayoutTests] Delete unused imported/blink resources 2021-05-21 14:21:27 +00:00
replaced
ruby
scrolling
shapes
sub-pixel
table
text
text-autosizing
transforms
url
workers [LayoutTests] Delete unused imported/blink resources 2021-05-21 14:21:27 +00:00
writing-mode
xsl [LayoutTests] Delete unused imported/blink resources 2021-05-21 14:21:27 +00:00