/usr/share/xul-ext/tabmixplus/modules/Utils.jsm is in xul-ext-tabmixplus 0.5.0.0-1~deb8u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | "use strict";
this.EXPORTED_SYMBOLS = ["TabmixUtils"];
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
// Messages that will be received via the Frame Message Manager.
const FMM_MESSAGES = [
"Tabmix:restorePermissionsComplete",
"Tabmix:updateScrollPosition",
"Tabmix:reloadTab",
"Tabmix:getOpener",
"Tabmix:contentDrop",
"Tabmix:contextmenu",
];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TabmixSvc",
"resource://tabmixplus/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DocShellCapabilities",
"resource://tabmixplus/DocShellCapabilities.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AutoReload",
"resource://tabmixplus/AutoReload.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "MergeWindows",
"resource://tabmixplus/MergeWindows.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TabmixAboutNewTab",
"resource://tabmixplus/AboutNewTab.jsm");
this.TabmixUtils = {
initMessageManager: function(window) {
let mm = window.getGroupMessageManager("browsers");
FMM_MESSAGES.forEach(msg => mm.addMessageListener(msg, this));
// Load the frame script after registering listeners.
mm.loadFrameScript("chrome://tabmixplus/content/content.js", true);
// call TabmixAboutNewTab.updateBrowser for gBrowser._preloadedBrowser,
// if it already exist before we loaded our frame script
if (TabmixSvc.version(420)) {
let gBrowser = window.gBrowser;
if (TabmixSvc.prefBranch.getBoolPref("titlefrombookmark") &&
window.BROWSER_NEW_TAB_URL == TabmixSvc.aboutNewtab &&
gBrowser._preloadedBrowser && gBrowser._isPreloadingEnabled() &&
!PrivateBrowsingUtils.isWindowPrivate(window)) {
TabmixAboutNewTab.updateBrowser(gBrowser._preloadedBrowser);
}
}
},
deinit: function(window) {
let mm = window.getGroupMessageManager("browsers");
FMM_MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
},
receiveMessage: function(message) {
let browser = message.target;
let win, tab;
switch (message.name) {
case "Tabmix:restorePermissionsComplete":
DocShellCapabilities.update(browser, message.data);
break;
case "Tabmix:updateScrollPosition":
win = browser.ownerDocument.defaultView;
tab = win.gBrowser.getTabForBrowser(browser);
win.TabmixSessionManager.updateScrollPosition(tab, message.data.scroll);
break;
case "Tabmix:reloadTab": {
let postData = message.data.postData;
if (postData)
message.data.postData = this.makeInputStream(postData);
AutoReload.reloadRemoteTab(browser, message.data);
break;
}
case "Tabmix:getOpener":
win = browser.ownerDocument.defaultView;
tab = win.gBrowser.getTabForBrowser(browser);
MergeWindows.moveTabsFromPopups(null, tab, message.objects.opener);
break;
case "Tabmix:contentDrop": {
let {json, uri, name} = message.data;
win = browser.ownerDocument.defaultView;
let where = win.tablib.whereToOpenDrop(json, uri);
if (where == "tab") {
// handleDroppedLink call preventDefault
json.preventDefault = function() {};
json.tabmixContentDrop = "tab";
browser.droppedLinkHandler(json, uri, name);
// prevent default
return true;
}
return false;
}
case "Tabmix:contextmenu": {
win = browser.ownerDocument.defaultView;
let links = message.data.links;
win.Tabmix.contextMenuLinks = links && links.split("\n") || [];
break;
}
}
return null;
},
makeInputStream: function(aString) {
let stream = Cc["@mozilla.org/io/string-input-stream;1"]
.createInstance(Ci.nsISupportsCString);
stream.data = aString;
return stream;
},
// change current history title
updateHistoryTitle: function(history, title) {
var shEntry = history.getEntryAtIndex(history.index, false).QueryInterface(Ci.nsISHEntry);
shEntry.setTitle(title);
}
};
|