Last Comment Bug 596292 - Sending an XMLHttpRequest to a "view-source:" URL from a Firefox extension results in weird message in JavaScript console.
: Sending an XMLHttpRequest to a "view-source:" URL from a Firefox extension re...
Product: Core
Classification: Components
Component: Networking: HTTP (show other bugs)
: unspecified
: x86 Windows 7
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
Depends on:
  Show dependency treegraph
Reported: 2010-09-14 10:55 PDT by Tyler Breisacher
Modified: 2016-02-05 11:53 PST (History)
5 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description Tyler Breisacher 2010-09-14 10:55:13 PDT
User-Agent:       Mozilla/5.0 (Windows NT 6.1; rv:2.0b5) Gecko/20100101 Firefox/4.0b5
Build Identifier: Mozilla/5.0 (Windows NT 6.1; rv:2.0b5) Gecko/20100101 Firefox/4.0b5

I'm writing a Firefox extension that uses lots of XMLHttpRequests. I'm not doing anything different from what is described on but when I send some of these requests, I get a weird message in the JavaScript console.

Reproducible: Sometimes

Steps to Reproduce:
1. Open the JavaScript console.
2. Send an asynchronous XMLHttpRequest from a Firefox extension, as described at
3. Message appears. See "Actual Results" below.
Actual Results:  
Message in the JavaScript Console: "Http channel implementation doesn't support nsIUploadChannel2. An extension has supplied a non-functional http protocol handler. This will break behavior and in future releases not work at all." This is designated as a message, not an error, and it does not have a file or line number associated with it.

Expected Results:  
No message in JavaScript console.

I have observed this on Firefox 3.6.9 as well as the most recent 4.0 beta as of this writing (Firefox 4.0 beta 5). I'm happy to just ignore the message because the XMLHttpRequests are all working fine. But I want to make sure that I'm not doing something that will cause my extension to break in a future Firefox release.
Comment 1 Josh Matthews [:jdm] 2010-09-14 17:16:20 PDT
You're going to need to be more specific about step 2.  An exact code sample or a link to existing code that demonstrates this problem would be very useful.
Comment 2 Tyler Breisacher 2010-09-15 18:37:40 PDT
I'll put together a specific code sample when I get a chance, probably this weekend if not sooner, but in the meantime, I've done a little more investigation and it looks like it's actually the code at that's causing the problem. Perhaps that is not the best (or most future-proof) way to get the source code of a page.
Comment 3 Boris Zbarsky [:bz] 2010-09-15 21:43:09 PDT
Ah, a view-source channel.  Yeah, we could probably implement nsIUploadChannel2 on those, if the http impl is going to insist on one....
Comment 4 Boris Zbarsky [:bz] 2010-09-15 21:43:50 PDT
Tyler: for what it's worth, the "view-source:" part of that snippet is totally pointless. You can just take it out, with no loss of functionality.
Comment 5 Tyler Breisacher 2010-09-16 11:26:28 PDT
(In reply to comment #4)
> Tyler: for what it's worth, the "view-source:" part of that snippet is totally
> pointless. You can just take it out, with no loss of functionality.

Except that this is a page that has already loaded in the browser, so (if I'm not mistaken) if I leave out the 'view-source:' part, it will make another HTTP request to the web server that the page came from, whereas if I leave it in, I will just get the source of the already-loaded page without making another HTTP request. Am I totally wrong about this?
Comment 6 Boris Zbarsky [:bz] 2010-09-16 11:31:45 PDT
You're totally wrong about that.  Just loading a view-source:something URI is exactly the same as loading "something" directly and then just parsing it with a slightly different parser than usual.  The view source menu item in browser does something more like a back/forward navigation load, not a direct load of a view-source URI.
Comment 7 Josh Matthews [:jdm] 2016-02-05 11:14:18 PST
Patrick, did you mean to mark this both FIXED and [necko-would-take]?

Note You need to log in before you can comment on or make changes to this bug.