Open Bug 786942 Opened 12 years ago Updated 2 years ago

Getting a DOM Window from nsIRequest using nsILoadContext.associatedWindow no longer works after updating from FF12.0 to FF14.0

Categories

(Core :: DOM: Core & HTML, defect, P5)

14 Branch
x86
Windows 8
defect

Tracking

()

UNCONFIRMED

People

(Reporter: theunis.botha1, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.8 (KHTML, like Gecko) Chrome/23.0.1247.1 Safari/537.8

Steps to reproduce:

I am writing an extension for FireFox and I originally used to get a handle on the DOM window from which an nsIRequest originated, (by using the observer notification "http-on-examine-response" and "http-on-examine-cached-response") like this:

		//gets the window for this request
		//ci = Components.interfaces, log is just a logging function
		function get_window(__request)
		{
			var loadContext = null;
			try {
				loadContext =  __request.QueryInterface(ci.nsIChannel)
							.notificationCallbacks
							.getInterface(ci.nsILoadContext);
			}
			catch (ex) {
				log("could not get load context one");
				try {
				loadContext =  __request.loadGroup
							.notificationCallbacks
							.getInterface(ci.nsILoadContext);
				}
				catch (ex) {
					log("could not get load context two");
					loadContext = null;
				}
			}
			
			if (loadContext)
				return loadContext.associatedWindow;
			else
				return null;
		}



Actual results:

I updated from FF12.0 to FF14.0 - and now I cannot get a handle on the window - loadContext in the example above is always null. the log file basically says:

"could not get load context one"
"could not get load context two"

and returns null


Expected results:

I should get a nsILoadContext interface from loadGroup or nsIChannel, and so I can get a handle on the window
I failed to mention that it does work in very few circumstances, however in my application I send out HEAD requests from a DOM window, and when those HEAD requests return header information, the observer service triggers and I always managed to get a handle on the window from which that request originated.  Also it fails in many other cases too. (Many normal GET requests (for example some images loading) I can no longer associate with its DOM window in which it is loading.
It would probably help if you find the exact regression range for example with this tool.
https://github.com/mozilla/mozregression
Component: Untriaged → DOM
Product: Firefox → Core
Indeed... nothing obvious should have changed around how this works.
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.