mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 20:07:30 +09:00
Merge remote-tracking branch 'origin/master' into custom
This commit is contained in:
commit
5184ae02a9
6 changed files with 156 additions and 70 deletions
|
|
@ -149,18 +149,18 @@ this.WinTaskbarJumpList =
|
||||||
*/
|
*/
|
||||||
|
|
||||||
startup: function() {
|
startup: function() {
|
||||||
// exit if this isn't win7 or higher.
|
// Exit if there's something wrong with getting the taskbar service.
|
||||||
if (!this._initTaskbar())
|
if (!this._initTaskbar()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Win shell shortcut maintenance. If we've gone through an update,
|
// Win shell shortcut maintenance. If we've gone through an update,
|
||||||
// this will update any pinned taskbar shortcuts. Not specific to
|
// this will update any pinned taskbar shortcuts. Not specific to
|
||||||
// jump lists, but this was a convienent place to call it.
|
// jump lists, but this was a convienent place to call it.
|
||||||
try {
|
try {
|
||||||
// dev builds may not have helper.exe, ignore failures.
|
// builds may not have helper.exe, ignore failures.
|
||||||
this._shortcutMaintenance();
|
this._shortcutMaintenance();
|
||||||
} catch (ex) {
|
} catch(ex) {}
|
||||||
}
|
|
||||||
|
|
||||||
// Store our task list config data
|
// Store our task list config data
|
||||||
this._tasks = tasksCfg;
|
this._tasks = tasksCfg;
|
||||||
|
|
@ -177,8 +177,9 @@ this.WinTaskbarJumpList =
|
||||||
|
|
||||||
update: function() {
|
update: function() {
|
||||||
// are we disabled via prefs? don't do anything!
|
// are we disabled via prefs? don't do anything!
|
||||||
if (!this._enabled)
|
if (!this._enabled) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// do what we came here to do, update the taskbar jumplist
|
// do what we came here to do, update the taskbar jumplist
|
||||||
this._buildList();
|
this._buildList();
|
||||||
|
|
@ -235,18 +236,22 @@ this.WinTaskbarJumpList =
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this._startBuild())
|
if (!this._startBuild()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this._showTasks)
|
if (this._showTasks) {
|
||||||
this._buildTasks();
|
this._buildTasks();
|
||||||
|
}
|
||||||
|
|
||||||
// Space for frequent items takes priority over recent.
|
// Space for frequent items takes priority over recent.
|
||||||
if (this._showFrequent)
|
if (this._showFrequent) {
|
||||||
this._buildFrequent();
|
this._buildFrequent();
|
||||||
|
}
|
||||||
|
|
||||||
if (this._showRecent)
|
if (this._showRecent) {
|
||||||
this._buildRecent();
|
this._buildRecent();
|
||||||
|
}
|
||||||
|
|
||||||
this._commitBuild();
|
this._commitBuild();
|
||||||
},
|
},
|
||||||
|
|
@ -256,8 +261,8 @@ this.WinTaskbarJumpList =
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_startBuild: function() {
|
_startBuild: function() {
|
||||||
var removedItems = Cc["@mozilla.org/array;1"].
|
var removedItems = Cc["@mozilla.org/array;1"]
|
||||||
createInstance(Ci.nsIMutableArray);
|
.createInstance(Ci.nsIMutableArray);
|
||||||
this._builder.abortListBuild();
|
this._builder.abortListBuild();
|
||||||
if (this._builder.initListBuild(removedItems)) {
|
if (this._builder.initListBuild(removedItems)) {
|
||||||
// Prior to building, delete removed items from history.
|
// Prior to building, delete removed items from history.
|
||||||
|
|
@ -277,20 +282,24 @@ this.WinTaskbarJumpList =
|
||||||
var items = Cc["@mozilla.org/array;1"].
|
var items = Cc["@mozilla.org/array;1"].
|
||||||
createInstance(Ci.nsIMutableArray);
|
createInstance(Ci.nsIMutableArray);
|
||||||
this._tasks.forEach(function(task) {
|
this._tasks.forEach(function(task) {
|
||||||
if ((this._shuttingDown && !task.close) || (!this._shuttingDown && !task.open))
|
if ((this._shuttingDown && !task.close) ||
|
||||||
|
(!this._shuttingDown && !task.open)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
var item = this._getHandlerAppItem(task.title, task.description,
|
var item = this._getHandlerAppItem(task.title, task.description,
|
||||||
task.args, task.iconIndex, null);
|
task.args, task.iconIndex, null);
|
||||||
items.appendElement(item, false);
|
items.appendElement(item, false);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
if (items.length > 0)
|
if (items.length > 0) {
|
||||||
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_TASKS, items);
|
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_TASKS, items);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildCustom: function(title, items) {
|
_buildCustom: function(title, items) {
|
||||||
if (items.length > 0)
|
if (items.length > 0) {
|
||||||
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_CUSTOMLIST, items, title);
|
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_CUSTOMLIST, items, title);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildFrequent: function() {
|
_buildFrequent: function() {
|
||||||
|
|
@ -329,8 +338,7 @@ this.WinTaskbarJumpList =
|
||||||
items.appendElement(shortcut, false);
|
items.appendElement(shortcut, false);
|
||||||
this._frequentHashList.push(aResult.uri);
|
this._frequentHashList.push(aResult.uri);
|
||||||
},
|
},
|
||||||
this
|
this);
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildRecent: function() {
|
_buildRecent: function() {
|
||||||
|
|
@ -374,8 +382,7 @@ this.WinTaskbarJumpList =
|
||||||
items.appendElement(shortcut, false);
|
items.appendElement(shortcut, false);
|
||||||
count++;
|
count++;
|
||||||
},
|
},
|
||||||
this
|
this);
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_deleteActiveJumpList: function() {
|
_deleteActiveJumpList: function() {
|
||||||
|
|
@ -386,8 +393,10 @@ this.WinTaskbarJumpList =
|
||||||
* Jump list item creation helpers
|
* Jump list item creation helpers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_getHandlerAppItem: function(name, description,
|
_getHandlerAppItem: function(name,
|
||||||
args, iconIndex,
|
description,
|
||||||
|
args,
|
||||||
|
iconIndex,
|
||||||
faviconPageUri) {
|
faviconPageUri) {
|
||||||
var file = Services.dirsvc.get("XREExeF", Ci.nsILocalFile);
|
var file = Services.dirsvc.get("XREExeF", Ci.nsILocalFile);
|
||||||
|
|
||||||
|
|
@ -395,13 +404,14 @@ this.WinTaskbarJumpList =
|
||||||
createInstance(Ci.nsILocalHandlerApp);
|
createInstance(Ci.nsILocalHandlerApp);
|
||||||
handlerApp.executable = file;
|
handlerApp.executable = file;
|
||||||
// handlers default to the leaf name if a name is not specified
|
// handlers default to the leaf name if a name is not specified
|
||||||
if (name && name.length != 0)
|
if (name && name.length != 0) {
|
||||||
handlerApp.name = name;
|
handlerApp.name = name;
|
||||||
|
}
|
||||||
handlerApp.detailedDescription = description;
|
handlerApp.detailedDescription = description;
|
||||||
handlerApp.appendParameter(args);
|
handlerApp.appendParameter(args);
|
||||||
|
|
||||||
var item = Cc["@mozilla.org/windows-jumplistshortcut;1"].
|
var item = Cc["@mozilla.org/windows-jumplistshortcut;1"]
|
||||||
createInstance(Ci.nsIJumpListShortcut);
|
.createInstance(Ci.nsIJumpListShortcut);
|
||||||
item.app = handlerApp;
|
item.app = handlerApp;
|
||||||
item.iconIndex = iconIndex;
|
item.iconIndex = iconIndex;
|
||||||
item.faviconPageUri = faviconPageUri;
|
item.faviconPageUri = faviconPageUri;
|
||||||
|
|
@ -409,8 +419,8 @@ this.WinTaskbarJumpList =
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSeparatorItem: function() {
|
_getSeparatorItem: function() {
|
||||||
var item = Cc["@mozilla.org/windows-jumplistseparator;1"].
|
var item = Cc["@mozilla.org/windows-jumplistseparator;1"]
|
||||||
createInstance(Ci.nsIJumpListSeparator);
|
.createInstance(Ci.nsIJumpListSeparator);
|
||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -449,8 +459,9 @@ this.WinTaskbarJumpList =
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearHistory: function(items) {
|
_clearHistory: function(items) {
|
||||||
if (!items)
|
if (!items) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
var URIsToRemove = [];
|
var URIsToRemove = [];
|
||||||
var e = items.enumerate();
|
var e = items.enumerate();
|
||||||
while (e.hasMoreElements()) {
|
while (e.hasMoreElements()) {
|
||||||
|
|
@ -512,8 +523,7 @@ this.WinTaskbarJumpList =
|
||||||
this._timer.initWithCallback(this,
|
this._timer.initWithCallback(this,
|
||||||
_prefs.getIntPref(PREF_TASKBAR_REFRESH)*1000,
|
_prefs.getIntPref(PREF_TASKBAR_REFRESH)*1000,
|
||||||
this._timer.TYPE_REPEATING_SLACK);
|
this._timer.TYPE_REPEATING_SLACK);
|
||||||
}
|
} else if ((!this._enabled || this._shuttingDown) && this._timer) {
|
||||||
else if ((!this._enabled || this._shuttingDown) && this._timer) {
|
|
||||||
this._timer.cancel();
|
this._timer.cancel();
|
||||||
delete this._timer;
|
delete this._timer;
|
||||||
}
|
}
|
||||||
|
|
@ -524,8 +534,7 @@ this.WinTaskbarJumpList =
|
||||||
if (this._enabled && !this._shuttingDown && !this._hasIdleObserver) {
|
if (this._enabled && !this._shuttingDown && !this._hasIdleObserver) {
|
||||||
_idle.addIdleObserver(this, IDLE_TIMEOUT_SECONDS);
|
_idle.addIdleObserver(this, IDLE_TIMEOUT_SECONDS);
|
||||||
this._hasIdleObserver = true;
|
this._hasIdleObserver = true;
|
||||||
}
|
} else if ((!this._enabled || this._shuttingDown) && this._hasIdleObserver) {
|
||||||
else if ((!this._enabled || this._shuttingDown) && this._hasIdleObserver) {
|
|
||||||
_idle.removeIdleObserver(this, IDLE_TIMEOUT_SECONDS);
|
_idle.removeIdleObserver(this, IDLE_TIMEOUT_SECONDS);
|
||||||
this._hasIdleObserver = false;
|
this._hasIdleObserver = false;
|
||||||
}
|
}
|
||||||
|
|
@ -551,8 +560,9 @@ this.WinTaskbarJumpList =
|
||||||
observe: function(aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
case "nsPref:changed":
|
case "nsPref:changed":
|
||||||
if (this._enabled == true && !_prefs.getBoolPref(PREF_TASKBAR_ENABLED))
|
if (this._enabled == true && !_prefs.getBoolPref(PREF_TASKBAR_ENABLED)) {
|
||||||
this._deleteActiveJumpList();
|
this._deleteActiveJumpList();
|
||||||
|
}
|
||||||
this._refreshPrefs();
|
this._refreshPrefs();
|
||||||
this._updateTimer();
|
this._updateTimer();
|
||||||
this._updateIdleObserver();
|
this._updateIdleObserver();
|
||||||
|
|
|
||||||
|
|
@ -82,8 +82,9 @@ function _imageFromURI(uri, privateMode, callback) {
|
||||||
// Ignore channels which do not support nsIPrivateBrowsingChannel
|
// Ignore channels which do not support nsIPrivateBrowsingChannel
|
||||||
}
|
}
|
||||||
NetUtil.asyncFetch(channel, function(inputStream, resultCode) {
|
NetUtil.asyncFetch(channel, function(inputStream, resultCode) {
|
||||||
if (!Components.isSuccessCode(resultCode))
|
if (!Components.isSuccessCode(resultCode)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
let out_img = { value: null };
|
let out_img = { value: null };
|
||||||
imgTools.decodeImageData(inputStream, channel.contentType, out_img);
|
imgTools.decodeImageData(inputStream, channel.contentType, out_img);
|
||||||
|
|
@ -343,10 +344,10 @@ PreviewController.prototype = {
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(PreviewController.prototype, "canvasPreviewFlags",
|
XPCOMUtils.defineLazyGetter(PreviewController.prototype, "canvasPreviewFlags",
|
||||||
function () { let canvasInterface = Ci.nsIDOMCanvasRenderingContext2D;
|
function () { let canvasInterface = Ci.nsIDOMCanvasRenderingContext2D;
|
||||||
return canvasInterface.DRAWWINDOW_DRAW_VIEW
|
return canvasInterface.DRAWWINDOW_DRAW_VIEW |
|
||||||
| canvasInterface.DRAWWINDOW_DRAW_CARET
|
canvasInterface.DRAWWINDOW_DRAW_CARET |
|
||||||
| canvasInterface.DRAWWINDOW_ASYNC_DECODE_IMAGES
|
canvasInterface.DRAWWINDOW_ASYNC_DECODE_IMAGES |
|
||||||
| canvasInterface.DRAWWINDOW_DO_NOT_FLUSH;
|
canvasInterface.DRAWWINDOW_DO_NOT_FLUSH;
|
||||||
});
|
});
|
||||||
|
|
||||||
// TabWindow
|
// TabWindow
|
||||||
|
|
@ -363,18 +364,21 @@ function TabWindow(win) {
|
||||||
|
|
||||||
this.previews = new Map();
|
this.previews = new Map();
|
||||||
|
|
||||||
for (let i = 0; i < this.tabEvents.length; i++)
|
for (let i = 0; i < this.tabEvents.length; i++) {
|
||||||
this.tabbrowser.tabContainer.addEventListener(this.tabEvents[i], this, false);
|
this.tabbrowser.tabContainer.addEventListener(this.tabEvents[i], this, false);
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < this.winEvents.length; i++)
|
for (let i = 0; i < this.winEvents.length; i++) {
|
||||||
this.win.addEventListener(this.winEvents[i], this, false);
|
this.win.addEventListener(this.winEvents[i], this, false);
|
||||||
|
}
|
||||||
|
|
||||||
this.tabbrowser.addTabsProgressListener(this);
|
this.tabbrowser.addTabsProgressListener(this);
|
||||||
|
|
||||||
AeroPeek.windows.push(this);
|
AeroPeek.windows.push(this);
|
||||||
let tabs = this.tabbrowser.tabs;
|
let tabs = this.tabbrowser.tabs;
|
||||||
for (let i = 0; i < tabs.length; i++)
|
for (let i = 0; i < tabs.length; i++) {
|
||||||
this.newTab(tabs[i]);
|
this.newTab(tabs[i]);
|
||||||
|
}
|
||||||
|
|
||||||
this.updateTabOrdering();
|
this.updateTabOrdering();
|
||||||
AeroPeek.checkPreviewCount();
|
AeroPeek.checkPreviewCount();
|
||||||
|
|
@ -394,14 +398,17 @@ TabWindow.prototype = {
|
||||||
|
|
||||||
this.tabbrowser.removeTabsProgressListener(this);
|
this.tabbrowser.removeTabsProgressListener(this);
|
||||||
|
|
||||||
for (let i = 0; i < this.winEvents.length; i++)
|
for (let i = 0; i < this.winEvents.length; i++) {
|
||||||
this.win.removeEventListener(this.winEvents[i], this, false);
|
this.win.removeEventListener(this.winEvents[i], this, false);
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < this.tabEvents.length; i++)
|
for (let i = 0; i < this.tabEvents.length; i++) {
|
||||||
this.tabbrowser.tabContainer.removeEventListener(this.tabEvents[i], this, false);
|
this.tabbrowser.tabContainer.removeEventListener(this.tabEvents[i], this, false);
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < tabs.length; i++)
|
for (let i = 0; i < tabs.length; i++) {
|
||||||
this.removeTab(tabs[i]);
|
this.removeTab(tabs[i]);
|
||||||
|
}
|
||||||
|
|
||||||
let idx = AeroPeek.windows.indexOf(this.win.gTaskbarTabGroup);
|
let idx = AeroPeek.windows.indexOf(this.win.gTaskbarTabGroup);
|
||||||
AeroPeek.windows.splice(idx, 1);
|
AeroPeek.windows.splice(idx, 1);
|
||||||
|
|
@ -411,6 +418,7 @@ TabWindow.prototype = {
|
||||||
get width () {
|
get width () {
|
||||||
return this.win.innerWidth;
|
return this.win.innerWidth;
|
||||||
},
|
},
|
||||||
|
|
||||||
get height () {
|
get height () {
|
||||||
return this.win.innerHeight;
|
return this.win.innerHeight;
|
||||||
},
|
},
|
||||||
|
|
@ -421,7 +429,8 @@ TabWindow.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
testCacheDims: function () {
|
testCacheDims: function () {
|
||||||
return this._cachedWidth == this.width && this._cachedHeight == this.height;
|
return this._cachedWidth == this.width &&
|
||||||
|
this._cachedHeight == this.height;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Invoked when the given tab is added to this window
|
// Invoked when the given tab is added to this window
|
||||||
|
|
@ -466,9 +475,8 @@ TabWindow.prototype = {
|
||||||
|
|
||||||
set enabled (enable) {
|
set enabled (enable) {
|
||||||
this._enabled = enable;
|
this._enabled = enable;
|
||||||
// Because making a tab visible requires that the tab it is next to be
|
// Because making a tab visible requires the tab it is next to be visible,
|
||||||
// visible, it is far simpler to unset the 'next' tab and recreate them all
|
// it is far simpler to unset the 'next' tab and recreate them all at once.
|
||||||
// at once.
|
|
||||||
for (let [, preview] of this.previews) {
|
for (let [, preview] of this.previews) {
|
||||||
preview.move(null);
|
preview.move(null);
|
||||||
preview.visible = enable;
|
preview.visible = enable;
|
||||||
|
|
@ -521,8 +529,9 @@ TabWindow.prototype = {
|
||||||
this.updateTabOrdering();
|
this.updateTabOrdering();
|
||||||
break;
|
break;
|
||||||
case "resize":
|
case "resize":
|
||||||
if (!AeroPeek._prefenabled)
|
if (!AeroPeek._prefenabled) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
this.onResize();
|
this.onResize();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -594,6 +603,7 @@ TabWindow.prototype = {
|
||||||
directRequestProtocols: new Set([
|
directRequestProtocols: new Set([
|
||||||
"file", "chrome", "resource", "about"
|
"file", "chrome", "resource", "about"
|
||||||
]),
|
]),
|
||||||
|
|
||||||
onLinkIconAvailable: function (aBrowser, aIconURL) {
|
onLinkIconAvailable: function (aBrowser, aIconURL) {
|
||||||
let self = this;
|
let self = this;
|
||||||
let requestURL = null;
|
let requestURL = null;
|
||||||
|
|
@ -662,12 +672,14 @@ this.AeroPeek = {
|
||||||
cacheLifespan: 20,
|
cacheLifespan: 20,
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
if (!(WINTASKBAR_CONTRACTID in Cc))
|
if (!(WINTASKBAR_CONTRACTID in Cc)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
this.taskbar = Cc[WINTASKBAR_CONTRACTID].getService(Ci.nsIWinTaskbar);
|
this.taskbar = Cc[WINTASKBAR_CONTRACTID].getService(Ci.nsIWinTaskbar);
|
||||||
this.available = this.taskbar.available;
|
this.available = this.taskbar.available;
|
||||||
if (!this.available)
|
if (!this.available) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.prefs.addObserver(TOGGLE_PREF_NAME, this, true);
|
this.prefs.addObserver(TOGGLE_PREF_NAME, this, true);
|
||||||
this.enabled = this._prefenabled = this.prefs.getBoolPref(TOGGLE_PREF_NAME);
|
this.enabled = this._prefenabled = this.prefs.getBoolPref(TOGGLE_PREF_NAME);
|
||||||
|
|
@ -677,8 +689,9 @@ this.AeroPeek = {
|
||||||
destroy: function destroy() {
|
destroy: function destroy() {
|
||||||
this._enabled = false;
|
this._enabled = false;
|
||||||
|
|
||||||
if (this.cacheTimer)
|
if (this.cacheTimer) {
|
||||||
this.cacheTimer.cancel();
|
this.cacheTimer.cancel();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
get enabled() {
|
get enabled() {
|
||||||
|
|
@ -686,8 +699,9 @@ this.AeroPeek = {
|
||||||
},
|
},
|
||||||
|
|
||||||
set enabled(enable) {
|
set enabled(enable) {
|
||||||
if (this._enabled == enable)
|
if (this._enabled == enable) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._enabled = enable;
|
this._enabled = enable;
|
||||||
|
|
||||||
|
|
@ -771,22 +785,25 @@ this.AeroPeek = {
|
||||||
|
|
||||||
onOpenWindow: function (win) {
|
onOpenWindow: function (win) {
|
||||||
// This occurs when the taskbar service is not available (xp, vista)
|
// This occurs when the taskbar service is not available (xp, vista)
|
||||||
if (!this.available || !this._prefenabled)
|
if (!this.available || !this._prefenabled) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
win.gTaskbarTabGroup = new TabWindow(win);
|
win.gTaskbarTabGroup = new TabWindow(win);
|
||||||
},
|
},
|
||||||
|
|
||||||
onCloseWindow: function (win) {
|
onCloseWindow: function (win) {
|
||||||
// This occurs when the taskbar service is not available (xp, vista)
|
// This occurs when the taskbar service is not available (xp, vista)
|
||||||
if (!this.available || !this._prefenabled)
|
if (!this.available || !this._prefenabled) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
win.gTaskbarTabGroup.destroy();
|
win.gTaskbarTabGroup.destroy();
|
||||||
delete win.gTaskbarTabGroup;
|
delete win.gTaskbarTabGroup;
|
||||||
|
|
||||||
if (this.windows.length == 0)
|
if (this.windows.length == 0) {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
resetCacheTimer: function () {
|
resetCacheTimer: function () {
|
||||||
|
|
@ -804,11 +821,13 @@ this.AeroPeek = {
|
||||||
}
|
}
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
case "nsPref:changed":
|
case "nsPref:changed":
|
||||||
if (aData == CACHE_EXPIRATION_TIME_PREF_NAME)
|
if (aData == CACHE_EXPIRATION_TIME_PREF_NAME) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (aData == DISABLE_THRESHOLD_PREF_NAME)
|
if (aData == DISABLE_THRESHOLD_PREF_NAME) {
|
||||||
this.maxpreviews = this.prefs.getIntPref(DISABLE_THRESHOLD_PREF_NAME);
|
this.maxpreviews = this.prefs.getIntPref(DISABLE_THRESHOLD_PREF_NAME);
|
||||||
|
}
|
||||||
// Might need to enable/disable ourselves
|
// Might need to enable/disable ourselves
|
||||||
this.checkPreviewCount();
|
this.checkPreviewCount();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -820,6 +820,8 @@ nsDocShell::nsDocShell()
|
||||||
, mParentCharsetSource(0)
|
, mParentCharsetSource(0)
|
||||||
, mJSRunToCompletionDepth(0)
|
, mJSRunToCompletionDepth(0)
|
||||||
, mTouchEventsOverride(nsIDocShell::TOUCHEVENTS_OVERRIDE_NONE)
|
, mTouchEventsOverride(nsIDocShell::TOUCHEVENTS_OVERRIDE_NONE)
|
||||||
|
, mStateFloodGuardCount(0)
|
||||||
|
, mStateFloodGuardReported(false)
|
||||||
{
|
{
|
||||||
AssertOriginAttributesMatchPrivateBrowsing();
|
AssertOriginAttributesMatchPrivateBrowsing();
|
||||||
mHistoryID = ++gDocshellIDCounter;
|
mHistoryID = ++gDocshellIDCounter;
|
||||||
|
|
@ -11833,6 +11835,27 @@ nsDocShell::SetReferrerPolicy(uint32_t aReferrerPolicy)
|
||||||
// nsDocShell: Session History
|
// nsDocShell: Session History
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
|
bool
|
||||||
|
nsDocShell::IsStateChangeFlooding()
|
||||||
|
{
|
||||||
|
// Issue #1688: Let's copy Firefox's strategy for state flooding here, so
|
||||||
|
// that our implementations are interoperable.
|
||||||
|
if (mStateFloodGuardCount > kStateUpdateLimit) {
|
||||||
|
TimeStamp now = TimeStamp::Now();
|
||||||
|
|
||||||
|
if (now - mStateFloodGuardUpdated > TimeDuration::FromSeconds(kRefreshTimeSecs)) {
|
||||||
|
mStateFloodGuardCount = 0;
|
||||||
|
mStateFloodGuardUpdated = now;
|
||||||
|
mStateFloodGuardReported = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
mStateFloodGuardCount++;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShell::AddState(JS::Handle<JS::Value> aData, const nsAString& aTitle,
|
nsDocShell::AddState(JS::Handle<JS::Value> aData, const nsAString& aTitle,
|
||||||
const nsAString& aURL, bool aReplace, JSContext* aCx)
|
const nsAString& aURL, bool aReplace, JSContext* aCx)
|
||||||
|
|
@ -11897,6 +11920,24 @@ nsDocShell::AddState(JS::Handle<JS::Value> aData, const nsAString& aTitle,
|
||||||
nsCOMPtr<nsIDocument> document = GetDocument();
|
nsCOMPtr<nsIDocument> document = GetDocument();
|
||||||
NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
// If we're being flooded with state change requests, we should abort early
|
||||||
|
// from the state change logic.
|
||||||
|
if (IsStateChangeFlooding()) {
|
||||||
|
// Report a warning to the console to tell developers why their navigations
|
||||||
|
// failed.
|
||||||
|
// Do this only if not yet marked reported so we only report it once per
|
||||||
|
// flood interval.
|
||||||
|
if (!mStateFloodGuardReported) {
|
||||||
|
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||||
|
NS_LITERAL_CSTRING("PushState"),
|
||||||
|
document,
|
||||||
|
nsContentUtils::eDOM_PROPERTIES,
|
||||||
|
"PushStateFloodingPrevented");
|
||||||
|
mStateFloodGuardReported = true;
|
||||||
|
}
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// Step A: Serialize aData using structured clone.
|
// Step A: Serialize aData using structured clone.
|
||||||
// https://html.spec.whatwg.org/multipage/history.html#dom-history-pushstate
|
// https://html.spec.whatwg.org/multipage/history.html#dom-history-pushstate
|
||||||
// step 5.
|
// step 5.
|
||||||
|
|
|
||||||
|
|
@ -1049,6 +1049,15 @@ private:
|
||||||
// as constants in the nsIDocShell.idl file.
|
// as constants in the nsIDocShell.idl file.
|
||||||
uint32_t mTouchEventsOverride;
|
uint32_t mTouchEventsOverride;
|
||||||
|
|
||||||
|
// Keep track how how many history state changes we're getting, to catch &
|
||||||
|
// prevent flooding.
|
||||||
|
int32_t mStateFloodGuardCount;
|
||||||
|
mozilla::TimeStamp mStateFloodGuardUpdated;
|
||||||
|
bool mStateFloodGuardReported;
|
||||||
|
// We have a limit of pushing 50 states to history every 10 seconds.
|
||||||
|
const int32_t kStateUpdateLimit = 50;
|
||||||
|
const double kRefreshTimeSecs = 10.0;
|
||||||
|
|
||||||
// Separate function to do the actual name (i.e. not _top, _self etc.)
|
// Separate function to do the actual name (i.e. not _top, _self etc.)
|
||||||
// searching for FindItemWithName.
|
// searching for FindItemWithName.
|
||||||
nsresult DoFindItemWithName(const nsAString& aName,
|
nsresult DoFindItemWithName(const nsAString& aName,
|
||||||
|
|
@ -1064,6 +1073,10 @@ private:
|
||||||
void MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
|
void MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
|
||||||
const nsString& aKeyword);
|
const nsString& aKeyword);
|
||||||
|
|
||||||
|
// Helper method for AddState which checks for excessive calls to PushState or
|
||||||
|
// ReplaceState.
|
||||||
|
bool IsStateChangeFlooding();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// We're counting the number of |nsDocShells| to help find leaks
|
// We're counting the number of |nsDocShells| to help find leaks
|
||||||
static unsigned long gNumberOfDocShells;
|
static unsigned long gNumberOfDocShells;
|
||||||
|
|
|
||||||
|
|
@ -690,6 +690,7 @@ private:
|
||||||
case CKM_AES_GCM:
|
case CKM_AES_GCM:
|
||||||
gcmParams.pIv = mIv.Elements();
|
gcmParams.pIv = mIv.Elements();
|
||||||
gcmParams.ulIvLen = mIv.Length();
|
gcmParams.ulIvLen = mIv.Length();
|
||||||
|
gcmParams.ulIvBits = gcmParams.ulIvLen * 8;
|
||||||
gcmParams.pAAD = mAad.Elements();
|
gcmParams.pAAD = mAad.Elements();
|
||||||
gcmParams.ulAADLen = mAad.Length();
|
gcmParams.ulAADLen = mAad.Length();
|
||||||
gcmParams.ulTagBits = mTagLength;
|
gcmParams.ulTagBits = mTagLength;
|
||||||
|
|
|
||||||
|
|
@ -316,3 +316,5 @@ LargeAllocationRelatedBrowsingContexts=A Large-Allocation header was ignored due
|
||||||
LargeAllocationInIFrame=A Large-Allocation header was ignored due to the load occuring within an iframe.
|
LargeAllocationInIFrame=A Large-Allocation header was ignored due to the load occuring within an iframe.
|
||||||
# LOCALIZATION NOTE: Do not translate "Large-Allocation", as it is a literal header name
|
# LOCALIZATION NOTE: Do not translate "Large-Allocation", as it is a literal header name
|
||||||
LargeAllocationNonE10S=A Large-Allocation header was ignored due to the document not being loaded out of process.
|
LargeAllocationNonE10S=A Large-Allocation header was ignored due to the document not being loaded out of process.
|
||||||
|
# LOCALIZATION NOTE: Do not translate "pushState" and "replaceState"
|
||||||
|
PushStateFloodingPrevented=Call to pushState or replaceState ignored due to excessive calls within a short timeframe.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue