Closed
Bug 769483
Opened 12 years ago
Closed 12 years ago
Bug when using DOMParser.parseFromString and SDK
Categories
(Add-on SDK Graveyard :: General, defect, P1)
Tracking
(Not tracked)
RESOLVED
FIXED
1.10
People
(Reporter: lduros, Assigned: ochameau)
References
Details
Attachments
(1 file)
Whenever using the new DOMParser.parseFromString() (requires Chrome Authority), there's an error output in the console. Here's an example of the use of DOMParser in a module: var {Cc, Ci, Cu} = require("chrome"); var domParser = Cc["@mozilla.org/xmlextras/domparser;1"]. createInstance(Ci.nsIDOMParser); var dom = domParser.parseFromString(htmlText, "text/html"); This would throw the following error: error: An exception occurred. Traceback (most recent call last): File "resource://jid1-ktlzuoiikvffew-at-jetpack/librejs/lib/html_script_finder/html_parser.js", line 67, in dom = domParser.parseFromString(this.htmlText, "text/html"); File "resource://jid1-ktlzuoiikvffew-at-jetpack/api-utils/lib/system/events.js", line 58, in data: data File "resource://jid1-ktlzuoiikvffew-at-jetpack/api-utils/lib/l10n/html.js", line 49, in onContentWindow if (document.location.href.indexOf(prefixURI) !== 0) TypeError: document.location is null It does not seems to create any issue beyond this... Many thanks, Loic
Reporter | ||
Comment 1•12 years ago
|
||
I should have mentioned that this is only happening in the new SDK 1.8 Thanks,
Updated•12 years ago
|
Assignee: nobody → rFobic
Priority: -- → P1
Comment 2•12 years ago
|
||
I just tried this: var { Cc, Ci, Cu } = require('chrome'); var parser = Cc["@mozilla.org/xmlextras/domparser;1"]. createInstance(Ci.nsIDOMParser); var document = parser.parseFromString('<html><body>hello</body></html>', "text/html"); document.documentElement.innerHTML which outputs "<head></head><body>hello</body>" Are you by a chance running that from a content-script ? If you do that it won't work and that's expected behavior.
Assignee | ||
Comment 3•12 years ago
|
||
For some reason, data URI document instanciated with nsIDOMParser have a null location attribute object during document-element-inserted event dispatch. This bug doesn't break anything but just display this exception trace in console.
Assignee: rFobic → poirot.alex
Attachment #640008 -
Flags: review?(rFobic)
Reporter | ||
Comment 4•12 years ago
|
||
> Are you by a chance running that from a content-script ? If you do that it
> won't work and that's expected behavior.
Nope, I was running it from a file in the lib directory. As mentioned in the initial message, it doesn't seem to have any negative impact on the execution of the add-on. Thought I'd mention nevertheless.
Thanks,
Comment 5•12 years ago
|
||
Sorry Loic I misunderstood, I thought it was throwing that exception. Thanks for pointing this out!
Updated•12 years ago
|
Attachment #640008 -
Flags: review?(rFobic) → review+
Comment 6•12 years ago
|
||
Commits pushed to master at https://github.com/mozilla/addon-sdk https://github.com/mozilla/addon-sdk/commit/c3f1ff0b5a7ab79e567acfa229919b1fd72512bf Bug 769483: Fix exception when using data:URI documents instanciated with nsIDOMParser. https://github.com/mozilla/addon-sdk/commit/3d4b9834cbc604bcfb488a673b8e2e79a7444cda Merge pull request #480 from ochameau/bug/769483-nsIDOMParser-exception Bug 769483: Fix exception when using data:URI documents instanciated with nsIDOMParser. r=@gozala
Assignee | ||
Updated•12 years ago
|
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.10
Comment 10•12 years ago
|
||
So if Firefox 17.0.1 is currently massively spammimg my .xsession-errors with this ... File "resource://jid0-hgvz8fgqijsmepxwnky5adxk8c0-at-jetpack/api-utils/lib/l10n/html.js", line 50, in onContentWindow if (document.location.href.indexOf(assetsURI) !== 0) TypeError: document.location is null What do I do? I understand the fix went into the sdk, so this means I have to wait till the addon developer rebuilds the addon on top of the latest SDK? I'm not even sure which addon is the culprit based on that cryptic ID above.
(In reply to Leho Kraav (:macmaN @lkraav) from comment #10) > ... The beginning of the traceback might give you a clue as to what extension this is.
Comment 12•12 years ago
|
||
The add-on is 'fresh css': https://addons.mozilla.org/en-US/firefox/addon/fresh-css/ ...or some other add-on that has used the same id.
Comment 13•12 years ago
|
||
Yes, thanks guys, I was just ack'ing through mozilla profile dir for the ID and also discovered that fresh-css is responsible.
You need to log in
before you can comment on or make changes to this bug.
Description
•