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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not fire error events on inactive globals #1995

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

domenic
Copy link
Member

@domenic domenic commented Oct 31, 2016

That is, on globals whose responsible document is not fully active.
Discussed in #1956.

Marking "do not merge yet" as I have two questions. We should discuss them here, since #1956 was actually about something different.

  • Is "fully active" or "active" better here? "Fully active" seemed more restrictive, which I like. Also right now the spec doesn't have an "active" concept, but I guess it would mean "is the active document of any browsing context." Note that Gecko supposedly has an active Window concept that the spec doesn't.
  • Is "responsible document" correct, given workers? Or should we only bail out if it's a Window whose document is not (fully) active? I guess I should write tests for this; grumble grumble.

馃挜 Error: Wattsi server error 馃挜

PR Preview failed to build. (Last tried on Jan 15, 2021, 7:57 AM UTC).

More

PR Preview relies on a number of web services to run. There seems to be an issue with the following one:

馃毃 Wattsi Server - Wattsi Server is the web service used to build the WHATWG HTML spec.

馃敆 Related URL

Parsing MDN data...
Parsing...



If you don't have enough information above to solve the error by yourself (or to understand to which web service the error is related to, if any), please file an issue.

That is, on globals whose responsible document is not fully active.
Discussed in #1956.
@domenic domenic added do not merge yet Pull request must not be merged per rationale in comment topic: multiple globals labels Oct 31, 2016
@domenic
Copy link
Member Author

domenic commented Oct 31, 2016

Wrote tests for the worker case as another commit in web-platform-tests/wpt#4089. Assuming I did them correctly, they show that Firefox and Edge have some kind of check that prevents the error events from firing, whereas Chrome lets them through.

@bzbarsky
Copy link
Contributor

bzbarsky commented Nov 1, 2016

@domenic You mean http://w3c-test.org/submissions/4089/workers/Worker_ErrorEvent_after_navigation.htm ?

I see it report PASS twice in Chrome. That said, the test seems to be asserting that the onerror of the window after navigation never fires? Why would it fire? I'm not quite sure what the test is trying to test....

Github is giving me a 500 error on web-platform-tests/wpt#4089 as long as I'm signed in, so I guess I'll just put my other comments here: You can presumably use assert_equals as parent.assert_equals, right?

domenic added a commit to web-platform-tests/wpt that referenced this pull request Nov 3, 2016
@domenic
Copy link
Member Author

domenic commented Nov 3, 2016

@bzbarsky you're right on all counts. I think I fixed the tests. Let me know what you think of them/the spec.

@domenic domenic removed the do not merge yet Pull request must not be merged per rationale in comment label Nov 3, 2016

<ol>

<li><p>If <var>target</var> is <span>in error reporting mode</span>, then abort these
steps; the error is <i data-x="concept-error-nothandled">not handled</i>.</p></li>

<li><p>If <var>target</var>'s <span>responsible <code>Document</code></span> is not <span>fully
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few issues here:

  1. target is a global object, right? Those don't have a "responsible document". Settings objects do.
  2. Only settings objects for windows have one; does this spec algorithm ever get run for non-window globals?
  3. Do UAs actually do the "fully active" thing? I know Gecko has no such concept, so I expect that in practice it doesn't do what this spec says to do; if other UAs don't either, that makes web compat a worry.
  4. Does anything define, at this point, what should happen for the "remove an iframe from the DOM" case? It would be really nice to at least have tests for it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Right. In light of (2), I guess I should have just gone with target's associated Document.
  2. Oops, I thought that workers had responsible documents too, but I didn't check. Of course they don't. This algorithm does get run for workers too. I was trying to test it, under the assumption that the "creator document" (not a real concept I guess) was consulted. But maybe all I was testing is that the worker gets terminated on navigation or something. Which is probably racey :-/. What would you recommend? Just skip this step for non-Windows?
  3. I'm not sure. I think Servo does given some discussion on session history tracking. As I said in the OP, I mostly picked this because it's what much of the rest of the spec uses :-/.
  4. That discards the browsing context, which means that per https://html.spec.whatwg.org/#concept-document-bc, the document no longer has a browsing context.

@domenic
Copy link
Member Author

domenic commented Nov 7, 2016

I'm happy to keep working on this, but it's a little discouraging because it seems like it's just a quagmire of underspecified and undertested behavior that keeps getting worse the more we dig into it, necessitating more tests being written and more spec text that we're unsure about, all for somewhat minimal gain. So I guess it is lower priority for me and I might have trouble getting it over the finish line.

@bzbarsky
Copy link
Contributor

bzbarsky commented Nov 8, 2016

I agree about the underspecified/undertested morass here. I'm just being a bit worried about specifying something that is not web-compatible...

I'll respond to the substance of #1995 (comment) when I have had a bit more time to think about it, tomorrow. I also plan to carefully look through the tests in web-platform-tests/wpt#4089 then.

I totally understand it if you're not terribly motivated to keep pushing on this one; I wonder whether we can get someone to pick up writing some tests around this stuff, at least, so we'd have an idea of what current UAs do.

@bzbarsky bzbarsky removed their assignment Mar 13, 2020
Base automatically changed from master to main January 15, 2021 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants