Bug? Edge on iOS always throws error when a global error handler is attached.

%3CLINGO-SUB%20id%3D%22lingo-sub-1512276%22%20slang%3D%22en-US%22%3EBug%3F%20Edge%20on%20iOS%20always%20throws%20error%20when%20a%20global%20error%20handler%20is%20attached.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1512276%22%20slang%3D%22en-US%22%3E%3CP%3EWhen%20I%20have%20a%20global%20event%20handler%20attached%20to%20the%20main%20frame%2C%20Edge%20on%20iOS%20always%20seems%20to%20throw%20an%20error%20and%20the%20event.error%20object%20is%20always%20NULL.%20Is%20this%20by%20design%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-html%22%3E%3CCODE%3E%0A%0A%0A%20%20%3CTITLE%3EGlobal%20error%20handler%20test%3C%2FTITLE%3E%0A%20%20%26lt%3Bmeta%20name%3D%22viewport%22%20content%3D%22width%3Ddevice-width%2C%20initial-scale%3D1.0%22%20%2F%26gt%3B%0A%0A%0A%20%20%3CSCRIPT%20type%3D%22text%2Fjavascript%22%3E%0A%20%20%20%20window.addEventListener('error'%2C%20function(event)%20%7B%0A%20%20%20%20%20%20alert(event.message%20%2B%20%22%20-%20%22%20%2B%20event.error)%3B%0A%20%20%20%20%7D)%3B%0A%20%20%3C%2FSCRIPT%3E%0A%0A%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20viewed%20in%20Edge%20iOS%2C%20this%20will%20always%20show%20an%20alert%20showing%20%22Script%20error.%20-%26nbsp%3B%20null%22.%20If%20I%20intentionally%20throw%20an%20error%20after%20adding%20the%20handler%2C%20then%20I%20first%20get%20an%20alert%20for%20it%20with%20the%20expected%20message%2C%20but%20then%20I%20also%20get%20the%20generic%20null%20error%20message%20too.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

When I have a global event handler attached to the main frame, Edge on iOS always seems to throw an error and the event.error object is always NULL. Is this by design?

 

<!doctype HTML>
<html>
<head>
  <title>Global error handler test</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
  <script type='text/javascript'>
    window.addEventListener('error', function(event) {
      alert(event.message + " - " + event.error);
    });
  </script>
</body>
</html>

 

When viewed in Edge iOS, this will always show an alert showing "Script error. -  null". If I intentionally throw an error after adding the handler, then I first get an alert for it with the expected message, but then I also get the generic null error message too.

1 Reply

@jbarile I have come across the exact same issue with Edge for iOS version 46.2.5.  When the global error handler is assigned, it throws null errors every time the app is touched.  This only happens with Edge iOS.  Chrome and Safari work as expected.  This is, IMO, a huge BUG.

 

However, when loading a page in an IFrame, the window.onerror works fine.  It's only in the main page, or top window that has this bug.