Closed Bug 307005 Opened 19 years ago Closed 19 years ago

NS_ERROR_UNEXPECTED when using evalInSandbox with XPCNativeWrapper

Categories

(Core :: XPConnect, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: boogs, Assigned: mrbkap)

References

()

Details

(Keywords: fixed1.8, testcase)

Attachments

(2 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+ Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+ If you set the __proto__ of a sandbox being used with evalInSandbox to an XPCNativeWrapper object, it doesn't work and you only get a generic error message. It should work the same as it does without the XPCNativeWrapper so long as the methods being called actually exist, and it should throw a descriptive 'method not defined' error with line number if they do not. Reproducible: Always Steps to Reproduce: 1. Run example code. Actual Results: JS console says: Error: uncaught exception: [Exception... "Unexpected error" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: file:///C:/Documents%20and%20Settings/aa/Desktop/evalInSandbox.html :: <TOP_LEVEL> :: line 6" data: no] Expected Results: It should show an alert box that says 'inside eval'. If you uncomment line 5 it works correctly.
Assignee: nobody → dbradley
Component: General → XPConnect
Keywords: testcase
Product: Firefox → Core
QA Contact: general → pschwartau
Version: unspecified → Trunk
Calling Dr. BKap! Calling Dr. BKap! /be
Status: UNCONFIRMED → NEW
Ever confirmed: true
Aaron, is there a testcase that wants to be attached to this bug?
Attached file testcase
Well, just look at the url, not? This is the testcase from the url.
Doh, I tend not to look at the URL field :( I'll try to see what's going on when my new debug build finishes building.
Assignee: dbradley → mrbkap
Attached patch FixSplinter Review
So the problem here is that XPC native wrappers can have their functions called with a |this| object that isn't a native wrapper if the native wrapper itself is in the prototype chain. This patch makes XPCNativeWrappers deal with that case.
Attachment #195793 - Flags: superreview?(brendan)
Attachment #195793 - Flags: review?(jst)
Status: NEW → ASSIGNED
Comment on attachment 195793 [details] [diff] [review] Fix Cool, glad you avoided extra null tests in the common case by testing and throwing inside the while loop. /be
Attachment #195793 - Flags: superreview?(brendan) → superreview+
We need this fixed for 1.8final/Firefox 1.5. /be
Flags: blocking1.8b5+
Attachment #195793 - Flags: review?(jst) → review+
Attachment #195793 - Flags: approval1.8b5?
Fix checked into trunk.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Attachment #195793 - Flags: approval1.8b5? → approval1.8b5+
Fix checked into MOZILLA_1_8_BRANCH.
Keywords: fixed1.8
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: