Closed
Bug 500846
Opened 16 years ago
Closed 16 years ago
Can't create xmlhttprequest from within JS component
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: geekboy, Assigned: mrbkap)
References
Details
Attachments
(2 files, 1 obsolete file)
|
360 bytes,
application/javascript
|
Details | |
|
9.47 KB,
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
I have a JS XPCOM component that wants to create an XMLHttpRequest:
var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Components.interfaces.nsIXMLHttpRequest);
It fails to do so with the assertion:
###!!! ASSERTION: Hmm, somebody did something evil?: '::JS_GetPrototype(cx, proto) && JS_GET_CLASS(cx, ::JS_GetPrototype(cx, proto)) == sObjectClass', file /Users/sstamm/Documents/src/firefox-csp3/dom/base/nsDOMClassInfo.cpp, line 4145
| Assignee | ||
Comment 1•16 years ago
|
||
Sid, want to try this?
The problem here is that components don't have windows, so we need to do this initialization somewhere else. Of course, when we *do* have windows, we end up needing sObjectClass when we're initializing the window, so we need to initialize sObjectClass in two places.
Assignee: nobody → mrbkap
Status: NEW → ASSIGNED
Attachment #385525 -
Flags: superreview?(bzbarsky)
Attachment #385525 -
Flags: review?(bzbarsky)
Comment 2•16 years ago
|
||
Comment on attachment 385525 [details] [diff] [review]
Proposed fix
Looks ok, but is this a regression from something? If so, from what?
Attachment #385525 -
Flags: superreview?(bzbarsky)
Attachment #385525 -
Flags: superreview+
Attachment #385525 -
Flags: review?(bzbarsky)
Attachment #385525 -
Flags: review+
| Reporter | ||
Comment 3•16 years ago
|
||
Thanks for the quick patch!
With the patch applied, I am still getting the assertion failure:
###!!! ASSERTION: Hmm, somebody did something evil?: '::JS_GetPrototype(cx, proto) && JS_GET_CLASS(cx, ::JS_GetPrototype(cx, proto)) == sObjectClass', file /Users/sstamm/Documents/src/firefox-csp3/dom/base/nsDOMClassInfo.cpp, line 4133
Breakpoint 1, nsDOMClassInfo::PostCreatePrototype (this=0x76d7b0, cx=0x893c00, proto=0x36259e0) at /Users/sstamm/Documents/src/firefox-csp3/dom/base/nsDOMClassInfo.cpp:4136
4136 if (mData->mHasClassInterface) {
(gdb) list
4131 NS_ASSERTION(::JS_GetPrototype(cx, proto) &&
4132 JS_GET_CLASS(cx, ::JS_GetPrototype(cx, proto)) == sObjectClass,
4133 "Hmm, somebody did something evil?");
4134
4135 #ifdef DEBUG
4136 if (mData->mHasClassInterface) {
4137 nsCOMPtr<nsIInterfaceInfoManager>
4138 iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
4139
4140 if (iim) {
(gdb) p sObjectClass
$1 = (const JSClass *) 0x0
(gdb) p proto
$2 = <unknown type>
(gdb) call js_DumpObject ($)
object 0x0
I'll double check with a clean clone of the tree on Monday when I'm back at my desk. If it still fails, I'll work up a reduced test case, and paste details here.
| Assignee | ||
Comment 4•16 years ago
|
||
Sid, did you build in dom/base AND layout/build?
Boris, this was a regression from bug 484764
Blocks: 484764
Comment 6•16 years ago
|
||
Thanks for taking care of this.
| Reporter | ||
Comment 7•16 years ago
|
||
Here's a small test case to reproduce assertion failure. I run it like this:
[~/$MOZ_SRC/]% ff-dbg/dist/bin/xpcshell bug500846-test.js
The assertion fails both before and after mrbkap's patch is applied (but at different locations).
mrbkap: yes, I built both dom/base and layout/build. I also attempted a clean build, and ended up with the same result. Same assertion failure on the most recent mozilla-central rev d4bd5186451e:
dom/base/nsDOMClassInfo.cpp, line 4145 (before patch applied)
dom/base/nsDOMClassInfo.cpp, line 4133 (after patch applied)
| Reporter | ||
Updated•16 years ago
|
OS: Mac OS X → All
| Assignee | ||
Comment 8•16 years ago
|
||
Attachment #385525 -
Attachment is obsolete: true
Attachment #385869 -
Flags: superreview?(bzbarsky)
Attachment #385869 -
Flags: review?(bzbarsky)
| Reporter | ||
Comment 9•16 years ago
|
||
Thanks, mrbkap. Fix v2 works!
Updated•16 years ago
|
Attachment #385869 -
Flags: superreview?(bzbarsky)
Attachment #385869 -
Flags: superreview+
Attachment #385869 -
Flags: review?(bzbarsky)
Attachment #385869 -
Flags: review+
Comment 10•16 years ago
|
||
Comment on attachment 385869 [details] [diff] [review]
Proposed fix v2
Looks ok, though it looks like sObjectClass can go back to being file-static...
| Assignee | ||
Comment 11•16 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/9e01b09a82a4 and I had to check http://hg.mozilla.org/mozilla-central/rev/608f66b040bd in because my reversion to file-static sObjectClass was mildly incomplete.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•