Closed
Bug 533596
Opened 15 years ago
Closed 15 years ago
Add XPCNativeWrapper.unwrap
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
status1.9.1 | --- | wanted |
People
(Reporter: mrbkap, Assigned: mrbkap)
References
Details
(Keywords: dev-doc-complete)
Attachments
(3 files)
10.44 KB,
patch
|
peterv
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
11.53 KB,
patch
|
beltzner
:
approval1.9.2.2-
|
Details | Diff | Splinter Review |
10.41 KB,
patch
|
jst
:
review+
bzbarsky
:
superreview-
dveditz
:
approval1.9.1.8-
|
Details | Diff | Splinter Review |
This is meant to take the place of the incorrect construction in extensions:
if (obj.wrappedJSObject)
obj = obj.wrappedJSObject;
to try to unwrap an XPCNativeWrapper.
The proposed usage is:
obj = XPCNativeWrapper.unwrap(obj);
Assignee | ||
Comment 1•15 years ago
|
||
The size of this patch is rather significantly increased by the testing stuff that I needed to add.
Attachment #416826 -
Flags: review?(peterv)
Comment 2•15 years ago
|
||
Comment on attachment 416826 [details] [diff] [review]
Patch
>+nsDOMWindowUtils::GetClassName(char **aName)
>+ // first and second params must be JSObjects
There's only one param?
Attachment #416826 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 3•15 years ago
|
||
Comment on attachment 416826 [details] [diff] [review]
Patch
I guess this changes an interface.
Attachment #416826 -
Flags: superreview?(jst)
Updated•15 years ago
|
Attachment #416826 -
Flags: superreview?(jst) → superreview+
Comment 4•15 years ago
|
||
> incorrect construction in extensions
In what sense is it incorrect? Because having wrappedJSObject does not mean the object is XPCNativeWrapper-wrapped and because it can point to a different object (in the case of JS-implemented XPCOM components, XPCWrappedNative around XPCWrappedJS, right)? Any other reasons?
When documenting this it would be helpful to answer when one might need this (e.g. should I use unwrap() instead of just accessing .wrappedJSObject when I know I'm dealing with XPCNW?), and what to expect of the call (the stuff in the tests).
Keywords: dev-doc-needed
Assignee | ||
Comment 5•15 years ago
|
||
(In reply to comment #4)
> In what sense is it incorrect? Because having wrappedJSObject does not mean the
> object is XPCNativeWrapper-wrapped and because it can point to a different
> object (in the case of JS-implemented XPCOM components, XPCWrappedNative around
> XPCWrappedJS, right)? Any other reasons?
Also, if you have a SJOW already (e.g. you already unwrapped your object), then getting the .wrappedJSObject could get an entirely unrelated object. This might not be a problem right now, but with the new wrappers (that I'll write a blog post about), if you expose a COW (chrome object wrapper) to content and it sticks a property on your underlying object (which you have to explicitly allow) that is itself an object, there is currently no reliable way to test to see if that object is an XPCNativeWrapper or SJOW.
> When documenting this it would be helpful to answer when one might need this
> (e.g. should I use unwrap() instead of just accessing .wrappedJSObject when I
> know I'm dealing with XPCNW?), and what to expect of the call (the stuff in the
> tests).
Yeah, it really comes down to whether or not you know that you have an XPCNativeWrapper. If you do, then you don't have to use unwrap().
Assignee | ||
Comment 6•15 years ago
|
||
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 7•15 years ago
|
||
Comment on attachment 416826 [details] [diff] [review]
Patch
It would be good to get this in on older branches too, I think.
Attachment #416826 -
Flags: approval1.9.2.1?
Attachment #416826 -
Flags: approval1.9.1.8?
Assignee | ||
Comment 8•15 years ago
|
||
Comment on attachment 416826 [details] [diff] [review]
Patch
Except the patch needs tweaking to apply to older branches.
Attachment #416826 -
Flags: approval1.9.2.1?
Attachment #416826 -
Flags: approval1.9.1.8?
Assignee | ||
Comment 9•15 years ago
|
||
Attachment #418946 -
Flags: approval1.9.2.1?
Assignee | ||
Updated•15 years ago
|
Blocks: blazinglyfastthis
Assignee | ||
Updated•15 years ago
|
Attachment #418946 -
Attachment is patch: true
Attachment #418946 -
Attachment mime type: application/octet-stream → text/plain
Assignee | ||
Comment 10•15 years ago
|
||
I think we should get this new API in on as many branches as possible.
Attachment #421487 -
Flags: review?(jst)
Attachment #421487 -
Flags: approval1.9.1.8?
Updated•15 years ago
|
Attachment #421487 -
Flags: review?(jst) → review+
Updated•15 years ago
|
Attachment #418946 -
Flags: approval1.9.2.1? → approval1.9.2.1+
Assignee | ||
Comment 12•15 years ago
|
||
Whiteboard: [needs 1.9.2 bake before 1.9.1] → [fixed1.9.2.1]
Updated•15 years ago
|
status1.9.2:
--- → .1-fixed
Whiteboard: [fixed1.9.2.1]
Updated•15 years ago
|
status1.9.1:
--- → wanted
Comment 13•15 years ago
|
||
Comment on attachment 421487 [details] [diff] [review]
For 1.9.1
>-[scriptable, uuid(a2d8d4f8-6082-4653-b91d-f958518b6ada)]
>+[scriptable, uuid(3c155d09-efc1-4fb5-ba54-834fcb09a2c5)]
> interface nsIDOMWindowUtils : nsISupports {
Can we change this interface on a stable branch? Don't we need a nsIDOMWindowUtils_MOZILLA_1_9_1_BRANCH ?
requesting additional sr=bzbarsky to get an opinion on the above.
Attachment #421487 -
Flags: superreview?(bzbarsky)
Comment 14•15 years ago
|
||
So... How is this supposed to work, exactly? It creates an XPCWrappedJS around an XPCNativeWrapper, not an XPCWrappedJS around the underlying unsafe object, unless I'm seriously missing something.
Comment 15•15 years ago
|
||
Comment on attachment 421487 [details] [diff] [review]
For 1.9.1
Yeah, we need a new interface. And we need to get whether it works sorted out.
Attachment #421487 -
Flags: superreview?(bzbarsky) → superreview-
Updated•15 years ago
|
Attachment #421487 -
Flags: approval1.9.1.8? → approval1.9.1.8-
Comment 16•15 years ago
|
||
(In reply to comment #15)
> Yeah, we need a new interface.
Wait, we made the same change on the 1.9.2 branch after we shipped. So do we need to backout and make an interface there as well?
Comment 17•15 years ago
|
||
Uhhh, crap. Did we change the interface on mozilla-1.9.2, as well, which is now a stable branch? If so, we should back that out and quickly, before Fennec spins an RC. This may have been my fault. :(
Comment 18•15 years ago
|
||
Yes, we made that change on 1.9.2 on the 19th. See comment 12.
Assignee | ||
Comment 19•15 years ago
|
||
status1.9.2:
.1-fixed → ---
Comment 20•15 years ago
|
||
Comment on attachment 418946 [details] [diff] [review]
For 1.9.2
I think we will want a branch safe patch for this, yes.
Attachment #418946 -
Flags: approval1.9.2.1+ → approval1.9.2.1-
Comment 21•14 years ago
|
||
Keywords: dev-doc-needed → dev-doc-complete
Comment 22•14 years ago
|
||
The documentation is wrong; this was backed out from 1.9.2, so isn't present there. It was never landed in 1.9.1.
Keywords: dev-doc-complete → dev-doc-needed
Updated•14 years ago
|
OS: Linux → All
Hardware: x86 → All
Comment 23•14 years ago
|
||
The RESOLVED FIXED status of this bug is misleading if it's been backed out, fwiw. Documentation has had that bit deleted now.
Keywords: dev-doc-needed → dev-doc-complete
Comment 24•14 years ago
|
||
> The RESOLVED FIXED status of this bug is misleading if it's been backed out,
It's been backed out from the 1.9.2 branch; note the lack of a "fixed on branch" flag.
This is fixed on trunk, and we still need documentation about this being the right way to unwrap on trunk (and in Firefox 4.0).
One of these days our bug system will make it clear what's fixed where... ;)
Keywords: dev-doc-complete → dev-doc-needed
Comment 25•14 years ago
|
||
No wonder I was confused! I've put the text back, and changed the "Introduced in Gecko 1.9.2.2" to say Gecko 2.0 (Firefox 4) instead.
Keywords: dev-doc-needed → dev-doc-complete
Comment 26•13 years ago
|
||
My about:blank patch in attachment 542132 [details] [diff] [review] break the mochitest here by making the "must see expandos for a chrome sandbox" asserts fail. It seems that at the time of failure, the right XUL doc is in the docshell (based on document.documentURI).
Where should I look? Could the window object of the initial about:blank get reused with the wrong kinds of security properties or something?
You need to log in
before you can comment on or make changes to this bug.
Description
•