Closed
Bug 717566
Opened 13 years ago
Closed 8 years ago
head.js should use XHR instead of nsIDOMParser::parseFromStream
Categories
(Testing :: XPCShell Harness, defect)
Testing
XPCShell Harness
Tracking
(firefox51 fixed)
RESOLVED
FIXED
mozilla51
Tracking | Status | |
---|---|---|
firefox51 | --- | fixed |
People
(Reporter: hsivonen, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
12.45 KB,
patch
|
jmaher
:
review+
|
Details | Diff | Splinter Review |
Please migrate away from nsIDOMParser::parserFromStream so that the API can be removed.
Reporter | ||
Comment 1•13 years ago
|
||
You can get an nsIURI from nsILocalFile, then get the string spec from the nsIURI and then pass the string URL to XMLHttpRequest.
Reporter | ||
Comment 2•13 years ago
|
||
Also content/test/unit/head_content.js
Comment 3•13 years ago
|
||
We can use sync XHR in these cases, right? As long as we don't have to rewrite the API to be async this seems simple enough.
Reporter | ||
Comment 4•13 years ago
|
||
(In reply to Ted Mielczarek [:ted, :luser] from comment #3)
> We can use sync XHR in these cases, right? As long as we don't have to
> rewrite the API to be async this seems simple enough.
Currently, yes.
smaug, any plans to ban sync XHR with chrome privileges to make it harder to write un-Snappy extensions?
I guess even if such a ban was put in place, we could make an exception for test harnesses.
Comment 5•13 years ago
|
||
Ah, good idea. Sync XHR should be banned in chrome at some point (in window context).
But so far, haven't heard of any plans.
Comment 6•12 years ago
|
||
Do we still want to fix this bug? Is it ok to use sync XHR in the test harnesses?
Reporter | ||
Comment 7•12 years ago
|
||
(In reply to Raymond Lee [:raymondlee] from comment #6)
> Do we still want to fix this bug?
Yes.
> Is it ok to use sync XHR in the test harnesses?
That's a question for smaug.
Flags: needinfo?(bugs)
Comment 8•12 years ago
|
||
Hmm, so where is parseFromStream used? If chrome JS only, I think that is ok.
We don't expose it to content JS anymore, since we're using
webidl bindings for DOMParser
http://mxr.mozilla.org/mozilla-central/source/dom/webidl/DOMParser.webidl?force=1
Flags: needinfo?(bugs)
Comment 9•12 years ago
|
||
Though, parseFromString is bad API. but so is sync XHR.
The best option would be to use *async* XHR.
Comment 10•8 years ago
|
||
Here's a patch, if we still want to do this. A try run seems fine: https://treeherder.mozilla.org/#/jobs?repo=try&revision=a1e18a08c4f7&selectedJob=26082554
Attachment #8783228 -
Flags: review?(jmaher)
Comment 11•8 years ago
|
||
Comment on attachment 8783228 [details] [diff] [review]
717566-remove-use-of-parseFromStream-from-head.js.diff
Review of attachment 8783228 [details] [diff] [review]:
-----------------------------------------------------------------
a couple of questions.
::: dom/base/test/unit/test_xmlserializer.js
@@ +72,3 @@
>
> +function run_namespace_tests(doc) {
> + const de = Components.interfaces.nsIDocumentEncoder;
where is this new const 'de' used?
::: mobile/android/tests/browser/robocop/robocop_head.js
@@ -658,5 @@
> - parser = null;
> - stream = null;
> - lf = null;
> - return doc;
> -}
why do we need to edit the robocop tests?
Attachment #8783228 -
Flags: review?(jmaher) → review-
Comment 12•8 years ago
|
||
>where is this new const 'de' used?
In the encoder.init lines nearer the bottom of the function. I could declare it only once in the outer namespace, if that's cleaner.
>why do we need to edit the robocop tests?
We don't, but it's an unused function and the overall aim of these bugs was to get rid of parseFromStream entirely, so I figured it was worth removing it from the other file with head.js in its name. But I don't mind leaving it alone or making a new bug just for getting rid of it.
Flags: needinfo?(jmaher)
Updated•8 years ago
|
Attachment #8783228 -
Flags: review- → review+
Comment 15•8 years ago
|
||
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/fx-team/rev/b2947c489cc7
Remove use of parseFromStream in xpcshell head.js and android robocop_head.js. r=jmaher
Keywords: checkin-needed
Comment 16•8 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox51:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in
before you can comment on or make changes to this bug.
Description
•