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

Script error always thrown on page load #10817

Open
kalkih opened this issue May 19, 2022 · 6 comments
Open

Script error always thrown on page load #10817

kalkih opened this issue May 19, 2022 · 6 comments
Labels
Bug 🐞 This is a bug with existing functionality not behaving as expected

Comments

@kalkih
Copy link

kalkih commented May 19, 2022

Steps to reproduce

  1. Visit: https://kalkih.github.io/firefox-script-error-ios/
  2. An alert with the thrown ErrorEvent is shown.

The example to reproduce the issue consists of a window.addEventListener("error") which fires on the error and displays it in an alert
Source code for the example: https://github.com/kalkih/firefox-script-error-ios/blob/main/index.html

Expected behavior

No error should be thrown on page load

Actual behavior

An error is thrown on page load which fires the window.addEventListener("error")

Device & build information

  • Device: iPhone 13 Pro Max running iOS 15.4.1
  • Build version: Build version: 100.1 (9384)

Notes

With "Enhanced Tracking Protection" switched to on, the error doesn't seem to be thrown when accessing a root page. Can be reproduced by serving the index.html page in the example locally on "/"

┆Issue is synchronized with this Jira Task

@kalkih kalkih added the Bug 🐞 This is a bug with existing functionality not behaving as expected label May 19, 2022
@dnarcese
Copy link
Contributor

@kalkih can you clarify what the bug is? Is the error popup supposed to show at a different time?

@TobbeLundberg
Copy link

@kalkih I think the link to the source code is wrong. Should most likely be this: https://github.com/kalkih/firefox-script-error-ios/blob/main/index.html

@dnarcese The bug is that the alert is shown at all. It shouldn't be. It should only be shown on an error. And no error should be emitted by just loading the page.

@wxiaoguang
Copy link

wxiaoguang commented Jul 5, 2022

I think it's also related to this one:

I wrote a reproducible demo (more complex)

@TobbeLundberg
Copy link

We're still running into this bug.
I managed to get some more info out of the error message

IMG_0039

{
  "message": "Syntax Error: No identifiers allowed directly after numeric literal",
  "filename": "http://192.168.68.109:8080/",
  "lineno": 1,
  "colno": 0,
  "error": null
}

This is the source of the page

<html>
<body>
  <script>
    var errStringified = (err) =>
      JSON.stringify(
        Object.getOwnPropertyNames(Object.getPrototypeOf(err)).reduce((acc, cur) => {
          acc[cur] = err[cur];
          return acc;
        }, {})
      );

    window.addEventListener('error', e => {
      document.body.innerText = errStringified(e)
    })
  </script>
</body>
</html>

Copy link
Contributor

This issue has been automatically marked as stale. Has the issue been fixed, or does it still require the community's attention? Please leave any comment to keep this issue opened. It will be closed automatically if no further update occurs in the next 30 days. Thank you for your contributions!

@github-actions github-actions bot added the stale Stalebot use this label to stale issues and PRs label Sep 16, 2024
@wxiaoguang
Copy link

Well, nobody cared or tested the bug, just a "stale bot" tried to close the pending issues? Also see my example: Nonsense script error when inserting new elements into DOM #11191

@github-actions github-actions bot removed the stale Stalebot use this label to stale issues and PRs label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐞 This is a bug with existing functionality not behaving as expected
Projects
None yet
Development

No branches or pull requests

4 participants