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

Mishandled JS exceptions? #18535

Closed
mateon1 opened this issue Sep 16, 2017 · 4 comments
Closed

Mishandled JS exceptions? #18535

mateon1 opened this issue Sep 16, 2017 · 4 comments

Comments

@mateon1
Copy link
Contributor

@mateon1 mateon1 commented Sep 16, 2017

Emilio told me on IRC to report these.

15:11:37 - emilio: Mateon1: I've seen that happening when you mishandle an exception from the JS vm

This behavior, aka JS halting happens even with --debug-mozjs and --with-debug-assertions.

To demonstrate this:

<script>
console.log("before");
try {
  localStorage[0] = ""; // place other snippets here
} catch (e) {
  console.log("caught error " + e);
}
console.log("after");
</script>

Note that only "before" is printed. The execution stops, not even an exception was thrown.

In place of the commented line you can also try any of:

atob.call("", localStorage);
removeEventListener.call("", "");
alert.call("");
moveTo.call(128);
Date.now.call(1024);
@emilio
Copy link
Member

@emilio emilio commented Sep 17, 2017

Let me try to track this down this real quick...

@emilio
Copy link
Member

@emilio emilio commented Sep 17, 2017

Err, got distracted, and I can't run rr from servo from where I am apparently... will investigate though

@emilio
Copy link
Member

@emilio emilio commented Sep 17, 2017

So, in the first case, the generated code for Storage::defineProperty looks like:

unsafe extern fn defineProperty(cx: *mut JSContext, proxy: HandleObject, id: HandleId, desc: Handle<PropertyDescriptor>, opresult: *mut ObjectOpResult) -> bool {
    return wrap_panic(panic::AssertUnwindSafe(|| {
        if RUST_JSID_IS_STRING(id) {
            // ...
        } else {
            return false;
        }
    }), false);
}

Return false is used to signal when an exception has been thrown, otherwise aborts the execution of the script. So we need to throw something there or otherwise the execution stops. I suspect there are similar errors in the other examples, if not the same. Looking for those

emilio added a commit to emilio/servo that referenced this issue Sep 17, 2017
Fixes part of servo#18535
bors-servo added a commit that referenced this issue Sep 17, 2017
script: a couple DOM conversion fixes

Fixes #18535
@emilio
Copy link
Member

@emilio emilio commented Sep 17, 2017

emilio added a commit to emilio/servo that referenced this issue Sep 17, 2017
Fixes part of servo#18535
bors-servo added a commit that referenced this issue Sep 17, 2017
script: a couple DOM conversion fixes

Fixes #18535

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18539)
<!-- Reviewable:end -->
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Sep 18, 2017
…lio:dom-conversion-fixes); r=nox

Fixes servo/servo#18535

Source-Repo: https://github.com/servo/servo
Source-Revision: 6f97dd1c96dbe4389d818995e2b4965b87383b61

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 2d9f0bd9c9b57d1a5ad2c74a32bcca6f172b8595
eamsen pushed a commit to eamsen/gecko-dev that referenced this issue Sep 18, 2017
…lio:dom-conversion-fixes); r=nox

Fixes servo/servo#18535

Source-Repo: https://github.com/servo/servo
Source-Revision: 6f97dd1c96dbe4389d818995e2b4965b87383b61
aethanyc pushed a commit to aethanyc/gecko-dev that referenced this issue Sep 19, 2017
…lio:dom-conversion-fixes); r=nox

Fixes servo/servo#18535

Source-Repo: https://github.com/servo/servo
Source-Revision: 6f97dd1c96dbe4389d818995e2b4965b87383b61
JerryShih pushed a commit to JerryShih/gecko-dev that referenced this issue Sep 19, 2017
…lio:dom-conversion-fixes); r=nox

Fixes servo/servo#18535

Source-Repo: https://github.com/servo/servo
Source-Revision: 6f97dd1c96dbe4389d818995e2b4965b87383b61
avadacatavra added a commit to avadacatavra/servo that referenced this issue Oct 17, 2017
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 1, 2019
…lio:dom-conversion-fixes); r=nox

Fixes servo/servo#18535

Source-Repo: https://github.com/servo/servo
Source-Revision: 6f97dd1c96dbe4389d818995e2b4965b87383b61

UltraBlame original commit: bec354d845873082a5d2c00e23500262c2cc89e5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 2, 2019
…lio:dom-conversion-fixes); r=nox

Fixes servo/servo#18535

Source-Repo: https://github.com/servo/servo
Source-Revision: 6f97dd1c96dbe4389d818995e2b4965b87383b61

UltraBlame original commit: bec354d845873082a5d2c00e23500262c2cc89e5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 2, 2019
…lio:dom-conversion-fixes); r=nox

Fixes servo/servo#18535

Source-Repo: https://github.com/servo/servo
Source-Revision: 6f97dd1c96dbe4389d818995e2b4965b87383b61

UltraBlame original commit: bec354d845873082a5d2c00e23500262c2cc89e5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.