我的插件在 FF41 上工作。现在我想在 e10s 上迁移。使用 Firefox 开发者版 v43。
示例观察者 (c++)。
NS_IMETHODIMP CFFObserver::Observe( nsISupports* aSubject, const char* aTopic, const char16_t* aData )
{ .........
if ( lstrcmpA( aTopic, "http-on-modify-request" ) == 0 )
{
CFFObserver::onSending( aSubject );
} ..........
}
void CFFObserver::onSending( nsISupports* IHttpChannel )
{
..............
nsISupports* IDOMWindowOwner = m_gate.Channel_GetOwnerWindow( IHttpChannel );
.................
}
示例 JS 助手。
Channel_GetOwnerWindow:
function( objChannel ) // This option does not worked in v43[e10s]; <br>
{
try
{
var notificationCallbacks = objChannel.QueryInterface(Components.interfaces.nsIHttpChannel).notificationCallbacks;
if ( !notificationCallbacks )
{
var loadGroup = objChannel.QueryInterface(Components.interfaces.nsIRequest).loadGroup.notificationCallbacks;
if ( loadGroup ) notificationCallbacks = loadGroup.notificationCallbacks;
}
if ( notificationCallbacks )
{
return notificationCallbacks.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindow)
.QueryInterface(Components.interfaces.nsISupports);
}
}
catch ( err )
{
this.ErrorOut( err );
}
return null;
}
下面的代码有效,但我无法通过获取 nsIDOMWindow 获取文档。
......
objWindow.QueryInterface(Components.interfaces.nsIDOMWindow).document.QueryInterface(Components.interfaces.nsISupports)
是错误 - 没有接口....
Channel_GetOwnerWindow:
function( objChannel )
{
try
{
return objChannel.QueryInterface(Components.interfaces.nsIHttpChannel)
.notificationCallbacks
.getInterface(Components.interfaces.nsILoadContext)
.topFrameElement
.QueryInterface(Components.interfaces.nsISupports);
}
catch ( err )
{
this.ErrorOut( err );
}
return null;
}
请帮我解决这个问题。谢谢。