Closed
Bug 1299408
Opened 8 years ago
Closed 8 years ago
can't get TabID from loadContext
Categories
(Developer Documentation Graveyard :: Add-ons, defect)
Tracking
(e10s+)
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
e10s | + | --- |
People
(Reporter: phanthai12, Unassigned)
References
()
Details
(Keywords: dev-doc-complete, Whiteboard: triaged)
Attachments
(1 file)
3.53 KB,
application/javascript
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
Steps to reproduce:
Here is My code:
Cu.import('resource://gre/modules/Services.jsm');
var httpObs = {
observe: function (aSubject, aTopic, aData) {
if (aTopic == 'http-on-modify-request') {
/*start - do not edit here*/
var oHttp = aSubject.QueryInterface(Ci.nsIHttpChannel); //i used nsIHttpChannel but i guess you can use nsIChannel, im not sure why though
var interfaceRequestor = oHttp.notificationCallbacks.QueryInterface(Ci.nsIInterfaceRequestor);
//var DOMWindow = interfaceRequestor.getInterface(Ci.nsIDOMWindow); //not to be done anymore because: https://developer.mozilla.org/en-US/docs/Updating_extensions_for_Firefox_3.5#Getting_a_load_context_from_a_request //instead do the loadContext stuff below
var loadContext;
try {
loadContext = aSubject.QueryInterface(Ci.nsIChannel) // aSubject is equivalent to aSubject from observe
.notificationCallbacks
.getInterface(Ci.nsILoadContext);
} catch (ex) {
try {
loadContext = aSubject.loadGroup.notificationCallbacks
.getInterface(Ci.nsILoadContext);
} catch (ex) {
loadContext = null;
}
}
/*end do not edit here*/
/*start - do all your edits below here*/
var url = oHttp.URI.spec; //can get url without needing loadContext
if(loadContext){
var window = loadContext.associatedWindow;
var utab = utabs.getTabForContentWindow(window);
console.log(utabs.getTabId(utab));
}
}
}
};
Services.obs.addObserver(httpObs, 'http-on-modify-request', false);
Actual results:
console.log: test: -5-2
console.log: test: -5-2
console.log: test: -5-2
console.log: test: -5-2
console.log: test: -5-2
console.log: test: -5-2
console.log: test: -5-2
console.log: test: -5-2
console.log: test: -5-2
console.log: test: -5-2
console.log: test: -5-2
console.log: test: -5-2
console.log: test: -5-2
Expected results:
console.log: test: -5-1
console.log: ....
console.log: test: -5-1
console.log: test: -5-2
console.log: ....
console.log: test: -5-2
console.log: test: -5-3
console.log: ....
console.log: test: -5-3
Reporter | ||
Updated•8 years ago
|
Reporter | ||
Updated•8 years ago
|
Updated•8 years ago
|
Blocks: e10s-addons
Updated•8 years ago
|
Component: Untriaged → Extension Compatibility
Reporter | ||
Comment 1•8 years ago
|
||
I think there should be a way to help us get tabID without nsIDOMWindow. Can we create a different channel (eg nsITab) used to connect via methods QueryInterface.
Comment 3•8 years ago
|
||
That page should probably just be archived.
Component: Extension Compatibility → Add-ons
Product: Firefox → Developer Documentation
Version: 51 Branch → unspecified
Updated•8 years ago
|
Whiteboard: triaged
Reporter | ||
Comment 4•8 years ago
|
||
Has not been corrected in version 52
Comment 5•8 years ago
|
||
Will, can you please archive this page? https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Tabbed_browser
Flags: needinfo?(wbamberg)
Comment 6•8 years ago
|
||
Flags: needinfo?(wbamberg)
Keywords: dev-doc-needed → dev-doc-complete
Updated•8 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 7•8 years ago
|
||
(In reply to Will Bamberg [:wbamberg] from comment #6)
> -> https://developer.mozilla.org/en-US/docs/Archive/Add-ons/Tabbed_browser
No way to get tabID from HTTPChannel?
You need to log in
before you can comment on or make changes to this bug.
Description
•