Closed Bug 485107 Opened 15 years ago Closed 15 years ago

Do not throw in NewResolve

Categories

(Toolkit :: Storage, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: sdwilsh, Assigned: sdwilsh)

References

Details

Attachments

(1 file, 2 obsolete files)

We stop following the prototype chain when we throw.  Bad storage, bad.
Depends on: 485071
Attached patch v1.0 (obsolete) — Splinter Review
Assignee: nobody → sdwilsh
Status: NEW → ASSIGNED
Attachment #373962 - Flags: review?(bugmail)
Whiteboard: [needs review asuth]
Is it possible to get a unit test for this?  You said we didn't need one on bug 485071#13, but I'm pretty confused about what the current code is breaking.  (I had locally rolled a unit test, and I think it passed...)

Looking at the XPConnect code, I can see how the change allows the dataflow of the object to subsequent processing, but I don't actually understand it, and the documentation on https://developer.mozilla.org/En/NsIXPCScriptable#newResolve.28.29 is not sufficient to enlighten me.

I'm cool if you want to switch the review to :bent or someone to whom it's clear this is the right thing, but I would like a unit test that fails without the change or a pointer to documentation that defines the proper behavior the code is currently failing to meet so that I can be confident without having to read a large portion of the JS/XPC codebase.
Attached patch v1.1 (obsolete) — Splinter Review
With a test.  The test failed without this patch, and passes with it.  This depends on my fix in bug 489889
Attachment #373962 - Attachment is obsolete: true
Attachment #374364 - Flags: review?(bugmail)
Attachment #373962 - Flags: review?(bugmail)
Depends on: 489889
Comment on attachment 374364 [details] [diff] [review]
v1.1

Trying to free up asuth's review queue just a bit.
Attachment #374364 - Flags: review?(bugmail) → review?(bent.mozilla)
Whiteboard: [needs review asuth] → [needs review bent]
Comment on attachment 374364 [details] [diff] [review]
v1.1

>+    if (NS_FAILED(rv)) {
>+      // It's highly likely that the name doesn't exist, so let the JS engine
>+      // check the prototype chain and throw if that doesn't have the property
>+      // either.
>+      *_objp = aScopeObj;
>+      return NS_OK;
>+    }

According to mrbkap this causes the JS engine to do extra work. Set *_objp to NULL and return NS_OK.

r=me with that.
Attachment #374364 - Flags: review?(bent.mozilla) → review+
(In reply to comment #6)
> According to mrbkap this causes the JS engine to do extra work. Set *_objp to
> NULL and return NS_OK.
Ugh - one of you told me to do that in the first place :/

Will get a new patch up, and a new bug to fix it in a few other places.
Whiteboard: [needs review bent] → [needs new patch]
Attached patch v1.2Splinter Review
I had to refactor the tests just a bit to compensate for the assertion added in bug 489889.  Nothing major though, so not getting a new review.  This is good to land.
Attachment #374364 - Attachment is obsolete: true
Whiteboard: [needs new patch] → [can land]
http://hg.mozilla.org/mozilla-central/rev/c30ed3e7e0ce
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [can land]
Target Milestone: --- → mozilla1.9.2a1
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: