• Maksim Ivanov's avatar
    Login screen: Fix JS exception in window.onerror · 3b073c15
    Maksim Ivanov authored
    Fix the window.onerror handler, added by the Login Screen cr_ui.js code,
    to avoid throwing a new exception on its own.
    
    Before this CL, the onerror handler was written to assume that the
    |error| parameter is non-null and has the |stack| property. But in some
    cases this doesn't hold - there are some standard-defined cases when the
    |error| is passed as null, and the only passed information is
    |message|=="Script error." (for example, this happens when the error
    occured in a script loaded from a different origin). In this case the
    old onerror handler was itself throwing this new exception:
    
      Uncaught TypeError: Cannot read property 'stack' of null
        at window.onerror (oobe.js:7771)
    
    This CL fixes this by adding a check into the onerror handler. We can't
    log any additional information in this case anyway, so we'll just
    silently exit from onerror in this case.
    
    Bug: none
    Change-Id: I535f378332af5484a2b6b490db554105861e30a3
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1623086Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
    Reviewed-by: default avatarDenis Kuznetsov <antrim@chromium.org>
    Commit-Queue: Maksim Ivanov <emaxx@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#662131}
    3b073c15
cr_ui.js 12.1 KB