Closed
Bug 1231878
Opened 10 years ago
Closed 10 years ago
Getting nsIDOMWindow from nsIChannel e10s -- 2
Categories
(Firefox :: Untriaged, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 1230062
People
(Reporter: antdlmr, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; rv:11.0) like Gecko
Steps to reproduce:
The next code
var browser = objChannel.notificationCallbacks
.getInterface(Components.interfaces.nsILoadContext).topFrameElement;
var window = browser.contentWindow.QueryInterface(Components.interfaces.nsISupports); // *** CPOW ***
does not work without shim.
Without shim gBrowser.contentDocument =NULL; // https://developer.mozilla.org/en-US/Firefox/Multiprocess_Firefox/Limitations_of_chrome_scripts
Is there any way to get the window of a request from channel in e10s or all old ways are unsupported without shim?
Actual results:
CPOW
Expected results:
nsIDOMWindow
Very sorry for the duplication of the issue, but it is not closed, and VERY important to me!
Bug 1230062
My end goal is from channel get a node (IDOMNode) which sent request and to work with its sizes and position.
I have to reliaze chain channel->nsIDOMWindow->nsIDOMDocument->IDOMNode.
1.
> window.gBrowser.getTabForBrowser(browser).
Its will chrome tab but I need a content object for getting nsIDOMWindow of cannel.
I something do not understand. (:
I thought that having a window identifier windowID can I get a window object nsIDOMWindow. or not?
2.
> The content script cannot work with XPCOM objects and I will try work with windows ID.
Getting of Components.classes["@antff/event_gateway;1"].getService( Components.interfaces.IFFEvent );
in content script give error (TypeError: Components.classes['@antff/event_gateway;1'] is undefined)
*** chrome
var Gateway =
{
Init : function()
{
obj.addMessageListener( "antff@get_parent_obj", this );
},
receiveMessage: function ( mes )
{
switch ( mes.name )
{
case "antff@get_parent_obj":
............
break;
}
},
VTContentScript : function() <-- it is a content injected script
{
addMessageListener("antff@get_parent_obj", function ( message )
{
!! Here is error - TypeError: Components.classes['@antff/event_gateway;1'] is undefined
var antFFEvent = Components.classes["@antff/event_gateway;1"].getService( Components.interfaces.IFFEvent ); <-- it my component
I would want to send a window object to IFFEvent
antFFEvent.some_function( window );
},
MarkDoc : function( channel )
{
if ( channel.notificationCallbacks )
{
var loadContext = channel.notificationCallbacks.getInterface( Components.interfaces.nsILoadContext );
if ( loadContext && loadContext.topFrameElement )
{
var windowMM = loadContext.topFrameElement.messageManager;
windowMM.loadFrameScript( "data:,new " + this.VTContentScript.toString(), true ); <-- inject of content script
windowMM.sendAsyncMessage( "antff@get_parent_obj", {} );
}
}
}
...............
}
Gateway.Init();
Updated•10 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•