File tree Expand file tree Collapse file tree 1 file changed +11
-13
lines changed
Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -409,26 +409,24 @@ HTTPSEverywhere.prototype = {
409409
410410 getWindowForChannel : function ( channel ) {
411411 // Obtain an nsIDOMWindow from a channel
412+ let loadContext ;
412413 try {
413- var nc = channel . notificationCallbacks ? channel . notificationCallbacks : channel . loadGroup . notificationCallbacks ;
414+ loadContext = channel . notificationCallbacks . getInterface ( CI . nsILoadContext ) ;
414415 } catch ( e ) {
415- this . log ( INFO , "no loadgroup notificationCallbacks for " + channel . URI . spec ) ;
416- return null ;
417- }
418- if ( ! nc ) {
419- this . log ( DBUG , "no window for " + channel . URI . spec ) ;
420- return null ;
421- }
422- try {
423- var domWin = nc . getInterface ( CI . nsIDOMWindow ) ;
424- } catch ( e ) {
425- this . log ( INFO , "No window associated with request: " + channel . URI . spec ) ;
426- return null ;
416+ try {
417+ loadContext = channel . loadGroup . notificationCallbacks . getInterface ( CI . nsILoadContext ) ;
418+ } catch ( e ) {
419+ console . log ( NOTE , "No loadContext for " + channel . URI . spec ) ;
420+ return null ;
421+ }
427422 }
423+
424+ let domWin = loadContext . associatedWindow ;
428425 if ( ! domWin ) {
429426 this . log ( NOTE , "failed to get DOMWin for " + channel . URI . spec ) ;
430427 return null ;
431428 }
429+
432430 domWin = domWin . top ;
433431 return domWin ;
434432 } ,
You can’t perform that action at this time.
0 commit comments