mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 23:37:33 +09:00
waiter waiter more webextensions please
This commit is contained in:
parent
3837792171
commit
bb0adb61ae
10 changed files with 198 additions and 8 deletions
|
|
@ -5466,6 +5466,9 @@ function handleLinkClick(event, href, linkNode) {
|
|||
urlSecurityCheck(href, doc.nodePrincipal);
|
||||
let params = {
|
||||
charset: doc.characterSet,
|
||||
currentBrowser: gBrowser.getBrowserForDocument(doc),
|
||||
frameOuterWindowID: doc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils).outerWindowID,
|
||||
allowMixedContent: persistAllowMixedContentInChildTab,
|
||||
referrerURI: referrerURI,
|
||||
referrerPolicy: referrerPolicy,
|
||||
|
|
|
|||
|
|
@ -442,7 +442,9 @@ var ClickEventHandler = {
|
|||
}
|
||||
}
|
||||
|
||||
let json = { button: event.button, shiftKey: event.shiftKey,
|
||||
let json = { frameOuterWindowID: ownerDoc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils).outerWindowID,
|
||||
button: event.button, shiftKey: event.shiftKey,
|
||||
ctrlKey: event.ctrlKey, metaKey: event.metaKey,
|
||||
altKey: event.altKey, href: null, title: null,
|
||||
bookmark: false, referrerPolicy: referrerPolicy,
|
||||
|
|
|
|||
|
|
@ -938,6 +938,8 @@ nsContextMenu.prototype = {
|
|||
|
||||
_openLinkInParameters : function (extra) {
|
||||
let params = { charset: gContextMenuContentData.charSet,
|
||||
currentBrowser: this.browser,
|
||||
frameOuterWindowID: this.frameOuterWindowID,
|
||||
originPrincipal: this.principal,
|
||||
triggeringPrincipal: this.principal,
|
||||
referrerURI: gContextMenuContentData.documentURIObject,
|
||||
|
|
|
|||
|
|
@ -273,6 +273,18 @@ function openLinkIn(url, where, params) {
|
|||
// Note that if |w| is null we might have no current browser (we'll open a new window).
|
||||
var aCurrentBrowser = params.currentBrowser || (w && w.gBrowser.selectedBrowser);
|
||||
|
||||
// Capture the source before opening a foreground tab changes the selection.
|
||||
function notifyNavigationTarget(createdTabBrowser) {
|
||||
if (params.frameOuterWindowID && aCurrentBrowser) {
|
||||
Services.obs.notifyObservers({wrappedJSObject: {
|
||||
url,
|
||||
createdTabBrowser,
|
||||
sourceTabBrowser: aCurrentBrowser,
|
||||
sourceFrameOuterWindowID: params.frameOuterWindowID,
|
||||
}}, "webNavigation-createdNavigationTarget", null);
|
||||
}
|
||||
}
|
||||
|
||||
if (where == "save") {
|
||||
// TODO(1073187): propagate referrerPolicy.
|
||||
|
||||
|
|
@ -365,7 +377,21 @@ function openLinkIn(url, where, params) {
|
|||
features += ",private";
|
||||
}
|
||||
|
||||
Services.ww.openWindow(w || window, getBrowserURL(), null, features, sa);
|
||||
let newWindow = Services.ww.openWindow(w || window, getBrowserURL(), null, features, sa);
|
||||
if (params.frameOuterWindowID && aCurrentBrowser) {
|
||||
let cleanup = () => {
|
||||
Services.obs.removeObserver(observer, "browser-delayed-startup-finished");
|
||||
newWindow.removeEventListener("unload", cleanup);
|
||||
};
|
||||
let observer = subject => {
|
||||
if (subject == newWindow) {
|
||||
cleanup();
|
||||
notifyNavigationTarget(newWindow.gBrowser.selectedBrowser);
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(observer, "browser-delayed-startup-finished", false);
|
||||
newWindow.addEventListener("unload", cleanup);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -474,6 +500,7 @@ function openLinkIn(url, where, params) {
|
|||
triggeringPrincipal: aTriggeringPrincipal,
|
||||
});
|
||||
browserUsedForLoad = tabUsedForLoad.linkedBrowser;
|
||||
notifyNavigationTarget(browserUsedForLoad);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue