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

Implement ErrorEvent, Window/Worker.onerror, and proper JS error reporters #3311

Closed
jdm opened this issue Sep 12, 2014 · 7 comments
Closed
Labels
A-content/dom Interacting with the DOM from web content B-interesting-project Represents work that is expected to be interesting in some fashion

Comments

@jdm
Copy link
Member

jdm commented Sep 12, 2014

Background information: SpiderMonkey (the JavaScript engine) exposes a user-specifiable callback executing JS that throws an exception that is not caught. At the moment, the rust-mozjs library (which wraps the C-based mozjs aka SpiderMonkey) sets this callback to a simple function that logs the exception to the terminal. We want to replace this in Servo with a method that implements the error reporting specification for web browsers as described below.

Spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#runtime-script-errors
ErrorEvent interface: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#errorevent
OnError algorithm: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#the-event-handler-processing-algorithm

This will require fixing an XXXjdm comment in set_event_handler_uncompiled, too, and implementing a new SpiderMonkey error reporter that invokes the actual ErrorEvent dispatch to the window/worker.

@jdm jdm added A-content/dom Interacting with the DOM from web content B-interesting-project Represents work that is expected to be interesting in some fashion labels Sep 12, 2014
@jdm
Copy link
Member Author

jdm commented Sep 12, 2014

This is potentially being worked on by a team of students, so anyone interested in working on it should contact me first.

@jdm
Copy link
Member Author

jdm commented Sep 12, 2014

Initial step: Build Servo, add a new ErrorEvent WebIDL file and corresponding Rust implementation (stubbing whatever methods are necessary), rebuild Rust. Use other event types, such as event.rs and uievent.rs as models.

  • Create the ErrorEvent interface
  • Replicate the existing logging error reporter in script code and use that instead
  • Get the global object (JS_GetGlobalObject) in the error reporter and unwrap it (global_object_for_js_object) into a Window
  • Create an ErrorEvent and dispatch it to the window (look for uses of dispatch_event_with_target for examples)
  • Implement the remainder of the error event dispatching algorithm linked above
  • Do all the same work for Workers, too (see workerglobalscope.rs)

@jwilm
Copy link
Contributor

jwilm commented Apr 27, 2015

@jdm is this still being worked on by students? There's a bunch of easy wins in the web-platform-tests if we can finish this. I would be happy to complete this if it's not being worked on.

@jdm
Copy link
Member Author

jdm commented Apr 27, 2015

Nope, it's available!

@jwilm
Copy link
Contributor

jwilm commented Apr 27, 2015

Sweet. I'll get on it tonight.

@jdm jdm added the C-assigned There is someone working on resolving the issue label Apr 27, 2015
@wafflespeanut wafflespeanut removed the C-assigned There is someone working on resolving the issue label Mar 16, 2016
@nox
Copy link
Contributor

nox commented Jun 4, 2016

Blocks #2185.

@nox
Copy link
Contributor

nox commented Jun 4, 2016

@jdm I have some questions:

Ms2ger added a commit that referenced this issue Sep 7, 2016
Ms2ger added a commit that referenced this issue Sep 7, 2016
Ms2ger added a commit that referenced this issue Sep 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-content/dom Interacting with the DOM from web content B-interesting-project Represents work that is expected to be interesting in some fashion
Projects
None yet
Development

No branches or pull requests

4 participants