0
我的插件工作在FF41上。現在我想在e10s上遷移。使用Firefox開發者版v43。
示例觀察者(C++)。
e10s - 我想從nsIObserver-nsIHttpChannel-nsIDOMWindow-nsIDOMDocument獲取。我該怎麼做?
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;
}
請幫助我解決這個問題。謝謝。
請格式化您的代碼。每行需要四個空格來表示它是代碼。 –
格式化的代碼作爲代碼,刪除
werent需要,固定非關閉粗體 – mikek3332002