Closed Bug 750307 Opened 12 years ago Closed 12 years ago

"Assertion failure: isBoolean(),"


(Core :: JavaScript Engine, defect)

Not set



Tracking Status
firefox15 --- verified
firefox16 --- verified
firefox-esr10 16+ fixed


(Reporter: gkw, Assigned: jorendorff)



(Keywords: assertion, regression, testcase, Whiteboard: [js:p1:fx15])


(3 files, 1 obsolete file)

Attached file stack
        evalcx("new RegExp"),

asserts js debug shell on m-c changeset cfaf90b22fc3 without any CLI arguments at Assertion failure: isBoolean(),

autoBisect shows this is probably related to the following changeset:

The first bad revision is:
changeset:   78732:61dd23c012ee
user:        Chris Leary
date:        Fri Oct 07 03:04:00 2011 -0700
summary:     Bug 673188: Compile regexps lazily. (r=mrbkap)
Hmm. Having a little trouble tracking this one down actually. Taking.
Assignee: general → jorendorff
This should have been obvious to me at the outset. Not sure what I was thinking.

1. For cross-compartment wrappers, Object.defineProperty ultimately calls JS_DefinePropertyById.

2. JS_DefinePropertyById allows the redefinition of non-writable non-configurable properties, contrary to ES5. In particular it does not do all the checking that obj_DefineProperty does when the target object is native.

3. RegExpObject::toString assumes the values of the "ignoreCase" non-writable non-configurable property can't be changed.
To break it down a little bit:

let a = evalcx("/x/");   // make a cross-compartment wrapper around a RegExp object
Object.defineProperty(a, "ignoreCase", {value: undefined});  // see comment 2
a.toString();  // trip an assertion that ignoreCase has a boolean value
Whiteboard: js-triage-needed → [js:p1:fx15][js:ni]
My first attempt was to make JS_Define* respect the invariants.
This was doomed because the JS_Define* functions are the APIs resolve hooks are supposed to use. We'd get call stacks like:

   some kind of lookup
   -> resolve hook
   -> JS_DefineProperty
   -> do a lookup to check the invariants
   -> resolve hook

The resolve machinery has some goofy hash table to prevent runaway recursion in this case, but it still causes problems. I think causing JS_Define* to do lookups is too much of an API change for Aurora.

A more modest change is to change wrappers so that instead of using JS_DefinePropertyById directly, they enforce the invariants. Pursuing that now.
Attached patch v1 (obsolete) — Splinter Review
Attachment #630656 - Flags: review?(jwalden+bmo)
Comment on attachment 630656 [details] [diff] [review]

Review of attachment 630656 [details] [diff] [review]:

The property definition algorithms are complicated enough that I'm not especially confident I haven't missed anything here, but I think you might have covered the bases.

::: js/src/jit-test/tests/basic/bug750307.js
@@ +1,5 @@
> +var g = newGlobal('new-compartment');
> +var a = g.RegExp("x");
> +try {
> +    Object.defineProperty(a, "ignoreCase", {value: undefined});
> +} catch (exc) {}

assertEq(exc instanceof g.TypeError, true); // it's g.TypeError and not TypeError, right?  And an assert verifying that an error was actually thrown, too.
Attachment #630656 - Flags: review?(jwalden+bmo) → review+
Backed out in for the "browser_bug645699.js | an unexpected uncaught JS exception reported through window.onerror - TypeError: can't redefine non-configurable property 'location' at" etc. in and friends.
Thanks for the backout. Looks like we should just change the test, though. I'll push to try in a minute.
(In reply to Jason Orendorff [:jorendorff] from comment #10)

Try looks green - should be good to land! \o/
Keywords: checkin-needed
That must have been intended for some other bug, since every mochitest-oth which has run has a failure in the same test (plus, what's pushed to try isn't even in this bug, so checkin-needed would just reland the same thing that already bounced).
Keywords: checkin-needed
It was just a botch. Here's the fixed try run.
Carrying forward review.
Attachment #630656 - Attachment is obsolete: true
Attachment #632595 - Flags: review+
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
Flags: in-testsuite+
Depends on: 765156
Keywords: verifyme
I built Spidermonkey for the latest Firefox 15 version (beta5, Changeset	5b309ad1a88a) and run the test from comment #0. The reported assertion did not show, but instead I got the following assertion:
test750307:5: TypeError: "ignoreCase" is read-only

Is this expected?

Thank you!
QA Contact: moz.mihaelav
Confirmed testcase asserts 2012-04-30 mozilla-central debug JS shell.

Does not assert:
2012-06-14 mozilla-central debug JS shell
2012-07-01 mozilla-aurora debug JS shell
Keywords: verifyme
QA Contact: moz.mihaelav →
Whiteboard: [js:p1:fx15][js:ni] → [js:p1:fx15]
(In reply to Jason Orendorff [:jorendorff] from comment #22)
> Approval granted separately in bug 756719.

Had oranges in mochi-4 and mochi-oth across all platforms, backed out

The "part 2" patch got review and approval separately, in bug 756719.

There's no way to get a Try Server run on ESR10 at present, so I'm not as confident in these patches as I'd normally like to be, but at worst, we back them out again...
> but at worst, we back them out again...
At worst it is!  Backed out for Moth oranges.
I managed to only back out the second part, so here's another attempt to finish the job.
Moth seems to fail more with the extra ESR fix on than not, so this this is a more minimal version of the ESR fix. It's impossible to quickly figure out what's really going wrong or what's needed, but this may work. Currently running on try. I'll check again in the morning.
Attachment #668292 - Flags: review?(jorendorff)
You can't use Try for ESR-10 (it won't build), which is kind of the root of this whole problem. You'll have to run Moth locally.
(In reply to Andrew McCreight [:mccr8] from comment #28)
> You can't use Try for ESR-10 (it won't build), which is kind of the root of
> this whole problem. You'll have to run Moth locally.

That is super lame. Hopefully Jason can pick it up in the morning then.
I'm working on this now.
Attachment #668292 - Flags: review?(jorendorff)
You need to log in before you can comment on or make changes to this bug.