Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put target element, form owner, and element document on scope chain of compiled events #25534

Merged
merged 1 commit into from Jan 16, 2020

Conversation

@pshaughn
Copy link
Member

pshaughn commented Jan 15, 2020

Event listeners that are created from a function object just get whatever closure the function object had, but event listeners created from a string need a special closure that acts like they were defined inside a series of with statements. This now happens. The existing WPT test for it, html/webappapis/scripting/events/compile-event-handler-lexical-scopes.html, also relies on other behavior we don't have, so I added an easier version of the test that doesn't involve bubbling or capturing and doesn't check any IDL properties we don't have. This new test will eventually be redundant when we have everything else the upstream test expects.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #25517
  • There are tests for these changes
@highfive
Copy link

highfive commented Jan 15, 2020

Heads up! This PR modifies the following files:

@pshaughn pshaughn changed the title Put target element, form owner, and document element on scope chain of compiled events Put target element, form owner, and element document on scope chain of compiled events Jan 15, 2020
@jdm
Copy link
Member

jdm commented Jan 15, 2020

@bors-servo r+
Thanks for fixing this! I'm hopeful this will help our web compat story quite a bit :)

@bors-servo
Copy link
Contributor

bors-servo commented Jan 15, 2020

📌 Commit 59f66fe has been approved by jdm

@highfive highfive assigned jdm and unassigned paulrouget Jan 15, 2020
@pshaughn
Copy link
Member Author

pshaughn commented Jan 15, 2020

I think #25478 is also needed before this will have much of a web compatibility improvement. Handlers that are just a blob of javascript with no function arguments usually want to see the event, not just the target.

bors-servo added a commit that referenced this pull request Jan 15, 2020
Put target element, form owner, and element document on scope chain of compiled events

Event listeners that are created from a function object just get whatever closure the function object had, but event listeners created from a string need a special closure that acts like they were defined inside a series of `with` statements. This now happens. The existing WPT test for it, html/webappapis/scripting/events/compile-event-handler-lexical-scopes.html, also relies on other behavior we don't have, so I added an easier version of the test that doesn't involve bubbling or capturing and doesn't check any IDL properties we don't have. This new test will eventually be redundant when we have everything else the upstream test expects.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #25517

<!-- Either: -->
- [X] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 15, 2020

Testing commit 59f66fe with merge 05cee49...

@bors-servo
Copy link
Contributor

bors-servo commented Jan 15, 2020

💔 Test failed - status-taskcluster

@pshaughn
Copy link
Member Author

pshaughn commented Jan 15, 2020

  │ FAIL [expected PASS] createProcessingInstruction
  │   → global is undefined
  │ 
  │ isObjectFromGlobal@http://web-platform.test:8000/WebIDL/current-realm.html:16:4

This is strange. I don't see any way for this code to create InternalRawUncompiledHandler and be affected by my changes, and I don't see how self[0] could fail to exist here considering that we just got self[0] before calling into here.

@pshaughn
Copy link
Member Author

pshaughn commented Jan 15, 2020

My wild guess here is that the "cannot allocate memory" problem also caused this error; it is not reproducing for me and it didn't happen on the Mac tests.

@jdm
Copy link
Member

jdm commented Jan 16, 2020

@bors-servo retry
I think this may just be an instance of an intermittent failure that we haven't seen before; I agree that it doesn't look like the test should be affected by the changed code.

@bors-servo
Copy link
Contributor

bors-servo commented Jan 16, 2020

Testing commit 59f66fe with merge 9187787...

bors-servo added a commit that referenced this pull request Jan 16, 2020
Put target element, form owner, and element document on scope chain of compiled events

Event listeners that are created from a function object just get whatever closure the function object had, but event listeners created from a string need a special closure that acts like they were defined inside a series of `with` statements. This now happens. The existing WPT test for it, html/webappapis/scripting/events/compile-event-handler-lexical-scopes.html, also relies on other behavior we don't have, so I added an easier version of the test that doesn't involve bubbling or capturing and doesn't check any IDL properties we don't have. This new test will eventually be redundant when we have everything else the upstream test expects.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #25517

<!-- Either: -->
- [X] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 16, 2020

☀️ Test successful - status-taskcluster
Approved by: jdm
Pushing 9187787 to master...

@bors-servo bors-servo merged commit 59f66fe into servo:master Jan 16, 2020
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.