Skip to content

Fire a mozbrowsererror event if pipeline/frame panics #10334

Closed

Description

@paulrouget

Followup: #10082 (comment)

mozbrowsererror with type = "fatal".

Activity

  1. paulrouget commented on Apr 1, 2016

    @paulrouget
    ContributorAuthor

    And maybe attach the back trace or add some more details to the event to allow browserhtml to report the crash.

  2. added
    A-constellation
    on Apr 1, 2016
  3. self-assigned this
    on Apr 1, 2016
  4. asajeffrey commented on Apr 1, 2016

    @asajeffrey
    Contributor

    @paulrouget should that be type = "fatal" or type = "fatal(crash)". https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsererror has "fatal(crash)" but I think "(crash)" is just meant as a comment, not as part of the type string.

  5. asajeffrey commented on Apr 1, 2016

    @asajeffrey
    Contributor

    At the moment, our binding to mozbrowsererror doesn't allow us to specify the type (https://github.com/servo/servo/blob/master/components/script_traits/lib.rs#L418). We'd need to extend MozBrowserEvent to provide type information.

    @paulrouget How important is the type? Should we just emit a mozbrowsererror with no type info for now?

  6. asajeffrey commented on Apr 1, 2016

    @asajeffrey
    Contributor

    Also @paulrouget, should there be any other info in the event? For example, would including the stack trace in the detail be useful?

  7. jdm commented on Apr 1, 2016

    @jdm
    Member

    @asajeffrey The type is not important to maintain. We extend them as necessary.

  8. paulrouget commented on Apr 2, 2016

    @paulrouget
    ContributorAuthor

    should that be type = "fatal" or type = "fatal(crash)".

    "fatal"

    How important is the type?

    Not that important, but it's pretty easy to support: we should create a new event type in BrowserElement.webidl;

    dictionary BrowserElementErrorEventDetail {
      DOMString type;
    };
    

    For example, would including the stack trace in the detail be useful?

    Absolutely. You can add an extra field to the webidl for that.

  9. Manishearth commented on Apr 5, 2016

    @Manishearth
    Member

    From #10329 (comment)

    As far as #10334, one way to handle this might be to have a global privileged "parent window". Windows corresponding to browser.html and those using that API have this. On Servo's side we store a global once-initialized static channel to its script task, and in the panic handler if we find such a channel and sending messages to the window works (use try_send() instead of send()), send a message to the script task with panic details. This triggers an event on the bhtml Window.

    The alternative is to have each iframe mozbrowser get a special custom panic handler that bubbles it up. However, panics may not always be in the per-iframe threads, and if something else panics then there's not much we can do about it.

    Looking at this perhaps we have to use the latter option, since we need to be able to associate a panic with a specific <iframe>

  10. Manishearth commented on Apr 5, 2016

    @Manishearth
    Member

    @paulrouget For telemetry and stuff, would it be okay if the bhtml window itself could have a mozbrowsererror fired on it (not just its iframes)? This way, we can attempt to catch crashes in individual iframe threads, and if the panic is elsewhere, try to tell bhtml about it directly so that it can (attempt to) report to telemetry.

  11. paulrouget commented on Apr 5, 2016

    @paulrouget
    ContributorAuthor

    @Manishearth Do we need to have a special event for that? Could we use this instead: https://html.spec.whatwg.org/multipage/webappapis.html#handler-onerror. Because we try to make mozbrowser events map contentDocument events. mozbrowserloadend is onload for example.

    Regardless of the name of the event, it should be fired only if 1) the mozbrowser pref is on, 2) only to the very top level pipeline.

  12. Manishearth commented on Apr 5, 2016

    @Manishearth
    Member

    Could it be a mozbrowsererror instead (fired on the Window instead of the iframe)? I don't like exposing a possible exploit vector through a non-mozbrowser interface.

    (Yes, it will only trigger on Browser windows, but I like having that second step there too)

  13. paulrouget commented on Apr 5, 2016

    @paulrouget
    ContributorAuthor

    Sure. To avoid confusion, could we name it mozbrowsererror_unknownorigin or something like that?

  14. Manishearth commented on Apr 5, 2016

    @Manishearth
    Member

    sgtm

  15. 24 remaining items

  16. paulrouget commented on Apr 15, 2016

    @paulrouget
    ContributorAuthor

    It doesn't really matter. mozbrowsererror, mozbrowsererror_unknownorigin, or anything else. The target will be different, so we can differentiate.

  17. asajeffrey commented on Apr 15, 2016

    @asajeffrey
    Contributor

    #10641 adds a panic channel that can be used by any thread (not just a pipeline thread) to report panics. Next up: add the backtrace to that channel, get all threads to report panics, and hook up to mozbrowsererror.

  18. added 3 commits that reference this issue on Apr 18, 2016
  19. asajeffrey commented on Apr 23, 2016

    @asajeffrey
    Contributor

    @paulrouget what do you want me to do in the case of multiple panics? Just send the first one? Just send the first one for each pipeline? These things usually travel in packs, since panics cascade.

  20. asajeffrey commented on Apr 25, 2016

    @asajeffrey
    Contributor

    #10824 sends the panic reason and backtrace to the constellation, for error reporting.

    #10837 adds the fields to mozbrowsererror events for forwarding this information.

    Once both have landed, we can report panics to the browser chrome.

  21. asajeffrey commented on Apr 25, 2016

    @asajeffrey
    Contributor

    @paulrouget I added description and report fields to the mozbrowsererror details, intended to contain a human-readable and a machine-readable representation of the error. Do these seem sensible to you? Care to bikeshed the names?

  22. asajeffrey commented on Apr 26, 2016

    @asajeffrey
    Contributor

    #10862 allows us to test this, by making sure the root pipeline survives, even when randomly killing pipelines.

  23. added 2 commits that reference this issue on Apr 26, 2016
  24. asajeffrey commented on Apr 28, 2016

    @asajeffrey
    Contributor

    #10898 only keeps the root pipeline alive when dom.mozbrowser.enabled is true.

  25. added 2 commits that reference this issue on Apr 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-constellation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions