Skip to content

Commit

Permalink
Specify real loading principal for setAndFetchFaviconForPage()
Browse files Browse the repository at this point in the history
  • Loading branch information
Infocatcher committed Jul 7, 2016
1 parent f2b9394 commit 6eb50f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3483,7 +3483,8 @@ var privateTab = {
_log("updateBookmarkFavicon()");
var browser = tab.linkedBrowser;
var _this = this;
function onLoaded(e) {
function onLoaded(e, principal) {
principal = principal || e && e.target.nodePrincipal;
e && browser.removeEventListener(e.type, onLoaded, true);
_dbgv && _log("updateBookmarkFavicon(): " + (e ? e.type : "already loaded"));
browser.ownerDocument.defaultView.setTimeout(function() { // Wait for possible changes
Expand All @@ -3502,15 +3503,15 @@ var privateTab = {
false /*aForceReload*/,
faviconService.FAVICON_LOAD_PRIVATE,
null /*nsIFaviconDataCallback aCallback*/,
null /*nsIPrincipal aLoadingPrincipal*/
principal /*nsIPrincipal aLoadingPrincipal*/
);
}, 0);
}
if(this.isRemoteTab(tab)) {
var mm = browser.messageManager;
var receiveMessage = function(msg) {
mm.removeMessageListener("PrivateTab:ContentLoaded", receiveMessage);
onLoaded();
onLoaded(null, msg.data.principal);
};
mm.addMessageListener("PrivateTab:ContentLoaded", receiveMessage);
mm.sendAsyncMessage("PrivateTab:Action", {
Expand All @@ -3520,7 +3521,7 @@ var privateTab = {
else if(browser.webProgress.isLoadingDocument)
browser.addEventListener("load", onLoaded, true);
else
onLoaded();
onLoaded(null, browser.contentPrincipal);
},
setTabState: function(tab, isPrivate) {
if(isPrivate === undefined) {
Expand Down
4 changes: 2 additions & 2 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ var remoteFrameHandler = {
case "WaitLoading":
var webProgress = docShell.QueryInterface(Components.interfaces.nsIWebProgress);
if(!webProgress.isLoadingDocument)
sendAsyncMessage("PrivateTab:ContentLoaded");
sendAsyncMessage("PrivateTab:ContentLoaded", { principal: content.document.nodePrincipal });
else {
addEventListener("load", function onLoad(e) {
if(e.target == content.document) {
removeEventListener("load", onLoad, true);
sendAsyncMessage("PrivateTab:ContentLoaded");
sendAsyncMessage("PrivateTab:ContentLoaded", { principal: content.document.nodePrincipal });
}
}, true);
}
Expand Down

0 comments on commit 6eb50f2

Please sign in to comment.