mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-28 04:39:07 -10:00
Merge mozilla-central to mozilla-inbound.
This commit is contained in:
commit
438ab15b79
263 files changed
+6213
-2109
No files matched your search
Generated
+13
-16
@@ -1064,20 +1064,20 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gl_generator"
|
||||
version = "0.9.0"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"khronos_api 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gleam"
|
||||
version = "0.6.3"
|
||||
version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1251,7 +1251,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "khronos_api"
|
||||
version = "2.2.0"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@@ -2948,7 +2948,7 @@ dependencies = [
|
||||
"dwrote 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -2992,7 +2992,7 @@ dependencies = [
|
||||
"euclid 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nsstring 0.1.0",
|
||||
"rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -3065,11 +3065,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "xml-rs"
|
||||
version = "0.7.0"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xpcom"
|
||||
@@ -3221,8 +3218,8 @@ dependencies = [
|
||||
"checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
|
||||
"checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb"
|
||||
"checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d"
|
||||
"checksum gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a"
|
||||
"checksum gleam 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2260952cc0393ca6f183e1a91a035c65c85ddb02505f3d53e5a775eb05946f44"
|
||||
"checksum gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0ffaf173cf76c73a73e080366bf556b4776ece104b06961766ff11449f38604"
|
||||
"checksum gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4b47f5b15742aee359c7895ab98cf2cceecc89bb4feb6f4e42f802d7899877da"
|
||||
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
|
||||
"checksum goblin 0.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "5911d7df7b8f65ab676c5327b50acea29d3c6a1a4ad05e444cf5dce321b26db2"
|
||||
"checksum h2 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "a27e7ed946e8335bdf9a191bc1b9b14a03ba822d013d2f58437f4fabcbd7fc2c"
|
||||
@@ -3237,7 +3234,7 @@ dependencies = [
|
||||
"checksum itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b07332223953b5051bceb67e8c4700aa65291535568e1f12408c43c4a42c0394"
|
||||
"checksum itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c069bbec61e1ca5a596166e55dfe4773ff745c3d16b700013bcaff9a6df2c682"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "037ab472c33f67b5fbd3e9163a2645319e5356fcd355efa6d4eb7fff4bbcb554"
|
||||
"checksum khronos_api 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "62237e6d326bd5871cd21469323bf096de81f1618cd82cbaf5d87825335aeb49"
|
||||
"checksum lalrpop 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9f7014afd5642680074fd5dcc624d544f9eabfa281cba2c3ac56c3db6d21ad1b"
|
||||
"checksum lalrpop-snap 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0b85aa455529344133d7ecaaac04c01ed87f459deeaa0fe5422885e2095d8cdc"
|
||||
"checksum lalrpop-util 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2400aeebcd11259370d038c24821b93218dd2f33a53f53e9c8fcccca70be6696"
|
||||
@@ -3407,6 +3404,6 @@ dependencies = [
|
||||
"checksum wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb06499a3a4d44302791052df005d5232b927ed1a9658146d842165c4de7767"
|
||||
"checksum winreg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a27a759395c1195c4cc5cda607ef6f8f6498f64e78f7900f5de0a127a424704a"
|
||||
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
|
||||
"checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2"
|
||||
"checksum xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "541b12c998c5b56aa2b4e6f18f03664eef9a4fd0a246a55594efae6cc2d964b5"
|
||||
"checksum yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57ab38ee1a4a266ed033496cf9af1828d8d6e6c1cfa5f643a2809effcae4d628"
|
||||
"checksum zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "36b9e08fb518a65cf7e08a1e482573eb87a2f4f8c6619316612a3c1f162fe822"
|
||||
@@ -3,9 +3,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* eslint-env mozilla/browser-window */
|
||||
/* globals StatusPanel */
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
@@ -88,6 +88,20 @@ xmlns="http://www.w3.org/1999/xhtml"
|
||||
#endif
|
||||
>
|
||||
Services.scriptloader.loadSubScript("chrome://global/content/contentAreaUtils.js", this);
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/browser-captivePortal.js", this);
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/browser-compacttheme.js", this);
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/browser-contentblocking.js", this);
|
||||
#ifdef MOZ_DATA_REPORTING
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/browser-data-submission-info-bar.js", this);
|
||||
#endif
|
||||
#ifndef MOZILLA_OFFICIAL
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/browser-development-helpers.js", this);
|
||||
#endif
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/browser-media.js", this);
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/browser-pageActions.js", this);
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/browser-plugins.js", this);
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/browser-sidebar.js", this);
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/browser-tabsintitlebar.js", this);
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser.js", this);
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/search/searchbar.js", this);
|
||||
|
||||
@@ -735,7 +749,7 @@ xmlns="http://www.w3.org/1999/xhtml"
|
||||
# shared with other top level windows in macWindow.inc.xul.
|
||||
#include browser-menubar.inc
|
||||
</toolbaritem>
|
||||
<spacer flex="1" />
|
||||
<spacer flex="1" skipintoolbarset="true"/>
|
||||
#include titlebar-items.inc.xul
|
||||
</toolbar>
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# JS files which are needed by browser.xul but no other top level windows to
|
||||
# support MacOS specific features should be loaded directly from browser.xul
|
||||
# rather than this file.
|
||||
|
||||
# If you update this list, you may need to add a mapping within the following
|
||||
# file so that ESLint works correctly:
|
||||
# tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
|
||||
@@ -16,28 +20,12 @@ Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
for (let script of [
|
||||
"chrome://browser/content/browser.js",
|
||||
|
||||
"chrome://browser/content/browser-captivePortal.js",
|
||||
"chrome://browser/content/browser-compacttheme.js",
|
||||
"chrome://browser/content/browser-contentblocking.js",
|
||||
"chrome://browser/content/browser-media.js",
|
||||
"chrome://browser/content/browser-pageActions.js",
|
||||
"chrome://browser/content/browser-places.js",
|
||||
"chrome://browser/content/browser-plugins.js",
|
||||
"chrome://browser/content/browser-sidebar.js",
|
||||
"chrome://browser/content/browser-tabsintitlebar.js",
|
||||
|
||||
"chrome://global/content/globalOverlay.js",
|
||||
"chrome://browser/content/utilityOverlay.js",
|
||||
#ifdef XP_MACOSX
|
||||
"chrome://global/content/macWindowMenu.js",
|
||||
#endif
|
||||
#ifdef MOZ_DATA_REPORTING
|
||||
"chrome://browser/content/browser-data-submission-info-bar.js",
|
||||
#endif
|
||||
#ifndef MOZILLA_OFFICIAL
|
||||
"chrome://browser/content/browser-development-helpers.js",
|
||||
#endif
|
||||
]) {
|
||||
Services.scriptloader.loadSubScript(script, this);
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* eslint-env mozilla/browser-window */
|
||||
|
||||
{ // start private scope for gBrowser
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
<hbox class="titlebar-buttonbox-container">
|
||||
<hbox class="titlebar-buttonbox-container" skipintoolbarset="true">
|
||||
<hbox class="titlebar-buttonbox titlebar-color">
|
||||
<toolbarbutton class="titlebar-button titlebar-min" oncommand="window.minimize();"/>
|
||||
<toolbarbutton class="titlebar-button titlebar-max" oncommand="onTitlebarMaxClick();"/>
|
||||
|
||||
@@ -1937,7 +1937,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
</field>
|
||||
|
||||
<field name="oneOffSearchButtons" readonly="true">
|
||||
new window.SearchOneOffs(
|
||||
new SearchOneOffs(
|
||||
document.getAnonymousElementByAttribute(this, "anonid",
|
||||
"one-off-search-buttons"));
|
||||
</field>
|
||||
|
||||
@@ -488,7 +488,7 @@ class TabTracker extends TabTrackerBase {
|
||||
// If the tab is already be destroyed, do nothing.
|
||||
return;
|
||||
}
|
||||
this.emitActivated(nativeTab);
|
||||
this.emitActivated(nativeTab, event.detail.previousTab);
|
||||
});
|
||||
break;
|
||||
|
||||
@@ -571,11 +571,14 @@ class TabTracker extends TabTrackerBase {
|
||||
*
|
||||
* @param {NativeTab} nativeTab
|
||||
* The tab element which has been activated.
|
||||
* @param {NativeTab} previousTab
|
||||
* The tab element which was previously activated.
|
||||
* @private
|
||||
*/
|
||||
emitActivated(nativeTab) {
|
||||
emitActivated(nativeTab, previousTab = undefined) {
|
||||
this.emit("tab-activated", {
|
||||
tabId: this.getId(nativeTab),
|
||||
previousTabId: previousTab && !previousTab.closing ? this.getId(previousTab) : undefined,
|
||||
windowId: windowTracker.getId(nativeTab.ownerGlobal)});
|
||||
}
|
||||
|
||||
@@ -777,6 +780,11 @@ class Tab extends TabBase {
|
||||
return this.url && this.url.startsWith(READER_MODE_PREFIX);
|
||||
}
|
||||
|
||||
get successorTabId() {
|
||||
const {successor} = this.nativeTab;
|
||||
return successor ? tabTracker.getId(successor) : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts session store data to an object compatible with the return value
|
||||
* of the convert() method, representing that data.
|
||||
|
||||
@@ -31,6 +31,8 @@ XPCOMUtils.defineLazyPreferenceGetter(this, "gMultiSelectEnabled", MULTISELECT_P
|
||||
|
||||
const TAB_HIDE_CONFIRMED_TYPE = "tabHideNotification";
|
||||
|
||||
const TAB_ID_NONE = -1;
|
||||
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "tabHidePopup", () => {
|
||||
return new ExtensionControlledPopup({
|
||||
@@ -727,6 +729,19 @@ this.tabs = class extends ExtensionAPI {
|
||||
}
|
||||
tabTracker.setOpener(nativeTab, opener);
|
||||
}
|
||||
if (updateProperties.successorTabId !== null) {
|
||||
let successor = null;
|
||||
if (updateProperties.successorTabId !== TAB_ID_NONE) {
|
||||
successor = tabTracker.getTab(updateProperties.successorTabId, null);
|
||||
if (!successor) {
|
||||
throw new ExtensionError("Invalid successorTabId");
|
||||
}
|
||||
if (successor.ownerDocument !== nativeTab.ownerDocument) {
|
||||
throw new ExtensionError("Successor tab must be in the same window as the tab being updated");
|
||||
}
|
||||
}
|
||||
tabbrowser.setSuccessor(nativeTab, successor);
|
||||
}
|
||||
|
||||
return tabManager.convert(nativeTab);
|
||||
},
|
||||
@@ -1240,6 +1255,57 @@ this.tabs = class extends ExtensionAPI {
|
||||
tab.linkedBrowser.messageManager.sendAsyncMessage("Reader:ToggleReaderMode");
|
||||
},
|
||||
|
||||
moveInSuccession(tabIds, tabId, options) {
|
||||
const {insert, append} = options || {};
|
||||
const tabIdSet = new Set(tabIds);
|
||||
if (tabIdSet.size !== tabIds.length) {
|
||||
throw new ExtensionError("IDs must not occur more than once in tabIds");
|
||||
}
|
||||
if ((append || insert) && tabIdSet.has(tabId)) {
|
||||
throw new ExtensionError("Value of tabId must not occur in tabIds if append or insert is true");
|
||||
}
|
||||
|
||||
const referenceTab = tabTracker.getTab(tabId, null);
|
||||
let referenceWindow = referenceTab && referenceTab.ownerGlobal;
|
||||
let previousTab, lastSuccessor;
|
||||
if (append) {
|
||||
previousTab = referenceTab;
|
||||
lastSuccessor = (insert && referenceTab && referenceTab.successor) || null;
|
||||
} else {
|
||||
lastSuccessor = referenceTab;
|
||||
}
|
||||
|
||||
let firstTab;
|
||||
for (const tabId of tabIds) {
|
||||
const tab = tabTracker.getTab(tabId, null);
|
||||
if (tab === null) {
|
||||
continue;
|
||||
}
|
||||
if (referenceWindow === null) {
|
||||
referenceWindow = tab.ownerGlobal;
|
||||
} else if (tab.ownerGlobal !== referenceWindow) {
|
||||
continue;
|
||||
}
|
||||
referenceWindow.gBrowser.replaceInSuccession(tab, tab.successor);
|
||||
if (append && tab === lastSuccessor) {
|
||||
lastSuccessor = tab.successor;
|
||||
}
|
||||
if (previousTab) {
|
||||
referenceWindow.gBrowser.setSuccessor(previousTab, tab);
|
||||
} else {
|
||||
firstTab = tab;
|
||||
}
|
||||
previousTab = tab;
|
||||
}
|
||||
|
||||
if (previousTab) {
|
||||
if (!append && insert && lastSuccessor !== null) {
|
||||
referenceWindow.gBrowser.replaceInSuccession(lastSuccessor, firstTab);
|
||||
}
|
||||
referenceWindow.gBrowser.setSuccessor(previousTab, lastSuccessor);
|
||||
}
|
||||
},
|
||||
|
||||
show(tabIds) {
|
||||
if (!Services.prefs.getBoolPref(TABHIDE_PREFNAME, false)) {
|
||||
throw new ExtensionError(`tabs.show is currently experimental and must be enabled with the ${TABHIDE_PREFNAME} preference.`);
|
||||
|
||||
@@ -102,7 +102,8 @@
|
||||
"isArticle": {"type": "boolean", "optional": true, "description": "Whether the document in the tab can be rendered in reader mode."},
|
||||
"isInReaderMode": {"type": "boolean", "optional": true, "description": "Whether the document in the tab is being rendered in reader mode."},
|
||||
"sharingState": {"$ref": "SharingState", "optional": true, "description": "Current tab sharing state for screen, microphone and camera."},
|
||||
"attention": {"type": "boolean", "optional": true, "description": "Whether the tab is drawing attention."}
|
||||
"attention": {"type": "boolean", "optional": true, "description": "Whether the tab is drawing attention."},
|
||||
"successorTabId": {"type": "integer", "optional": true, "minimum": -1, "description": "The ID of this tab's successor, if any; $(ref:tabs.TAB_ID_NONE) otherwise."}
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -888,6 +889,12 @@
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"description": "Whether the load should replace the current history entry for the tab."
|
||||
},
|
||||
"successorTabId": {
|
||||
"type": "integer",
|
||||
"minimum": -1,
|
||||
"optional": true,
|
||||
"description": "The ID of this tab's successor. If specified, the successor tab must be in the same window as this tab."
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1396,6 +1403,48 @@
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "moveInSuccession",
|
||||
"type": "function",
|
||||
"async": true,
|
||||
"description": "Removes an array of tabs from their lines of succession and prepends or appends them in a chain to another tab.",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "tabIds",
|
||||
"type": "array",
|
||||
"items": { "type": "integer", "minimum": 0 },
|
||||
"minItems": 1,
|
||||
"description": "An array of tab IDs to move in the line of succession. For each tab in the array, the tab's current predecessors will have their successor set to the tab's current successor, and each tab will then be set to be the successor of the previous tab in the array. Any tabs not in the same window as the tab indicated by the second argument (or the first tab in the array, if no second argument) will be skipped."
|
||||
},
|
||||
{
|
||||
"name": "tabId",
|
||||
"type": "integer",
|
||||
"optional": true,
|
||||
"default": -1,
|
||||
"minimum": -1,
|
||||
"description": "The ID of a tab to set as the successor of the last tab in the array, or $(ref:tabs.TAB_ID_NONE) to leave the last tab without a successor. If options.append is true, then this tab is made the predecessor of the first tab in the array instead."
|
||||
},
|
||||
{
|
||||
"name": "options",
|
||||
"type": "object",
|
||||
"optional": true,
|
||||
"properties": {
|
||||
"append": {
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"default": false,
|
||||
"description": "Whether to move the tabs before (false) or after (true) tabId in the succession. Defaults to false."
|
||||
},
|
||||
"insert": {
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"default": false,
|
||||
"description": "Whether to link up the current predecessors or successor (depending on options.append) of tabId to the other side of the chain after it is prepended or appended. If true, one of the following happens: if options.append is false, the first tab in the array is set as the successor of any current predecessors of tabId; if options.append is true, the current successor of tabId is set as the successor of the last tab in the array. Defaults to false."
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
@@ -1585,6 +1634,12 @@
|
||||
"minimum": 0,
|
||||
"description": "The ID of the tab that has become active."
|
||||
},
|
||||
"previousTabId": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"optional": true,
|
||||
"description": "The ID of the tab that was previously active, if that tab is still open."
|
||||
},
|
||||
"windowId": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
|
||||
@@ -222,6 +222,7 @@ skip-if = (verify && !debug && (os == 'mac'))
|
||||
skip-if = os == 'mac' # Save as PDF not supported on Mac OS X
|
||||
[browser_ext_tabs_sendMessage.js]
|
||||
[browser_ext_tabs_sharingState.js]
|
||||
[browser_ext_tabs_successors.js]
|
||||
[browser_ext_tabs_cookieStoreId.js]
|
||||
[browser_ext_tabs_update.js]
|
||||
[browser_ext_tabs_update_highlighted.js]
|
||||
|
||||
@@ -374,8 +374,9 @@ add_task(async function testTabCreateRelated() {
|
||||
});
|
||||
|
||||
add_task(async function testLastTabRemoval() {
|
||||
const CLOSE_WINDOW_PREF = "browser.tabs.closeWindowWithLastTab";
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
["browser.tabs.closeWindowWithLastTab", false],
|
||||
[CLOSE_WINDOW_PREF, false],
|
||||
]});
|
||||
|
||||
async function background() {
|
||||
@@ -409,4 +410,82 @@ add_task(async function testLastTabRemoval() {
|
||||
|
||||
await extension.unload();
|
||||
await BrowserTestUtils.closeWindow(newWin);
|
||||
SpecialPowers.clearUserPref(CLOSE_WINDOW_PREF);
|
||||
});
|
||||
|
||||
add_task(async function testTabActivationEvent() {
|
||||
async function background() {
|
||||
function makeExpectable() {
|
||||
let expectation = null, resolver = null;
|
||||
const expectable = param => {
|
||||
if (expectation === null) {
|
||||
browser.test.fail("unexpected call to expectable");
|
||||
} else {
|
||||
try {
|
||||
resolver(expectation(param));
|
||||
} catch (e) {
|
||||
resolver(Promise.reject(e));
|
||||
} finally {
|
||||
expectation = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
expectable.expect = e => {
|
||||
expectation = e;
|
||||
return new Promise(r => { resolver = r; });
|
||||
};
|
||||
return expectable;
|
||||
}
|
||||
try {
|
||||
const listener = makeExpectable();
|
||||
browser.tabs.onActivated.addListener(listener);
|
||||
|
||||
const [, {tabs: [tab1]}] = await Promise.all([
|
||||
listener.expect(info => {
|
||||
browser.test.assertEq(undefined, info.previousTabId, "previousTabId should not be defined when window is first opened");
|
||||
}),
|
||||
browser.windows.create({url: "about:blank"}),
|
||||
]);
|
||||
const [, tab2] = await Promise.all([
|
||||
listener.expect(info => {
|
||||
browser.test.assertEq(tab1.id, info.previousTabId, "Got expected previousTabId");
|
||||
}),
|
||||
browser.tabs.create({url: "about:blank"}),
|
||||
]);
|
||||
|
||||
await Promise.all([
|
||||
listener.expect(info => {
|
||||
browser.test.assertEq(tab1.id, info.tabId, "Got expected tabId");
|
||||
browser.test.assertEq(tab2.id, info.previousTabId, "Got expected previousTabId");
|
||||
}),
|
||||
browser.tabs.update(tab1.id, {active: true}),
|
||||
]);
|
||||
|
||||
await Promise.all([
|
||||
listener.expect(info => {
|
||||
browser.test.assertEq(tab2.id, info.tabId, "Got expected tabId");
|
||||
browser.test.assertEq(undefined, info.previousTabId, "previousTabId should not be defined when previous tab was closed");
|
||||
}),
|
||||
browser.tabs.remove(tab1.id),
|
||||
]);
|
||||
|
||||
await browser.tabs.remove(tab2.id);
|
||||
|
||||
browser.test.notifyPass("tabs-events");
|
||||
} catch (e) {
|
||||
browser.test.fail(`${e} :: ${e.stack}`);
|
||||
browser.test.notifyFail("tabs-events");
|
||||
}
|
||||
}
|
||||
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs"],
|
||||
},
|
||||
background,
|
||||
});
|
||||
|
||||
await extension.startup();
|
||||
await extension.awaitFinish("tabs-events");
|
||||
await extension.unload();
|
||||
});
|
||||
@@ -0,0 +1,212 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
async function background(tabCount, testFn) {
|
||||
try {
|
||||
const {TAB_ID_NONE} = browser.tabs;
|
||||
const tabIds = await Promise.all(Array.from({length: tabCount}, () => browser.tabs.create({url: "about:blank"}).then(t => t.id)));
|
||||
|
||||
const toTabIds = i => tabIds[i];
|
||||
|
||||
const setSuccessors = mapping => Promise.all(mapping.map((succ, i) =>
|
||||
browser.tabs.update(tabIds[i], {successorTabId: tabIds[succ]})));
|
||||
|
||||
const verifySuccessors = async function(mapping, name) {
|
||||
const promises = [], expected = [];
|
||||
for (let i = 0; i < mapping.length; i++) {
|
||||
if (mapping[i] !== undefined) {
|
||||
promises.push(browser.tabs.get(tabIds[i]).then(t => t.successorTabId));
|
||||
expected.push(mapping[i] === TAB_ID_NONE ? TAB_ID_NONE : tabIds[mapping[i]]);
|
||||
}
|
||||
}
|
||||
const results = await Promise.all(promises);
|
||||
for (let i = 0; i < results.length; i++) {
|
||||
browser.test.assertEq(expected[i], results[i], `${name}: successorTabId of tab ${i} in mapping should be ${expected[i]}`);
|
||||
}
|
||||
};
|
||||
|
||||
await testFn({TAB_ID_NONE, tabIds, toTabIds, setSuccessors, verifySuccessors});
|
||||
|
||||
browser.test.notifyPass("background-script");
|
||||
} catch (e) {
|
||||
browser.test.fail(`${e} :: ${e.stack}`);
|
||||
browser.test.notifyFail("background-script");
|
||||
}
|
||||
}
|
||||
|
||||
async function runTabTest(tabCount, testFn) {
|
||||
const extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs"],
|
||||
},
|
||||
background: `(${background})(${tabCount}, ${testFn});`,
|
||||
});
|
||||
|
||||
await extension.startup();
|
||||
await extension.awaitFinish("background-script");
|
||||
await extension.unload();
|
||||
}
|
||||
|
||||
add_task(function testTabSuccessors() {
|
||||
return runTabTest(3, async function({TAB_ID_NONE, tabIds}) {
|
||||
const anotherWindow = await browser.windows.create({url: "about:blank"});
|
||||
|
||||
browser.test.assertEq(TAB_ID_NONE, (await browser.tabs.get(tabIds[0])).successorTabId, "Tabs default to an undefined successor");
|
||||
|
||||
// Basic getting and setting
|
||||
|
||||
await browser.tabs.update(tabIds[0], {successorTabId: tabIds[1]});
|
||||
browser.test.assertEq(tabIds[1], (await browser.tabs.get(tabIds[0])).successorTabId, "tabs.update assigned the correct successor");
|
||||
|
||||
await browser.tabs.update(tabIds[0], {successorTabId: browser.tabs.TAB_ID_NONE});
|
||||
browser.test.assertEq(TAB_ID_NONE, (await browser.tabs.get(tabIds[0])).successorTabId, "tabs.update cleared successor");
|
||||
|
||||
await browser.tabs.update(tabIds[0], {successorTabId: tabIds[1]});
|
||||
await browser.tabs.update(tabIds[0], {successorTabId: tabIds[0]});
|
||||
browser.test.assertEq(TAB_ID_NONE, (await browser.tabs.get(tabIds[0])).successorTabId, "Setting a tab as its own successor clears the successor instead");
|
||||
|
||||
// Validation tests
|
||||
|
||||
await browser.test.assertRejects(
|
||||
browser.tabs.update(tabIds[0], {successorTabId: 1e8}),
|
||||
/Invalid successorTabId/,
|
||||
"tabs.update should throw with an invalid successor tab ID");
|
||||
|
||||
await browser.test.assertRejects(
|
||||
browser.tabs.update(tabIds[0], {successorTabId: anotherWindow.tabs[0].id}),
|
||||
/Successor tab must be in the same window as the tab being updated/,
|
||||
"tabs.update should throw with a successor tab ID from another window");
|
||||
|
||||
// Make sure the successor is truly being assigned
|
||||
|
||||
await browser.tabs.update(tabIds[0], {successorTabId: tabIds[2], active: true});
|
||||
await browser.tabs.remove(tabIds[0]);
|
||||
browser.test.assertEq(tabIds[2], (await browser.tabs.query({active: true}))[0].id);
|
||||
|
||||
|
||||
return browser.tabs.remove([tabIds[1], tabIds[2], anotherWindow.tabs[0].id]);
|
||||
});
|
||||
});
|
||||
|
||||
add_task(function testMoveInSuccession_appendFalse() {
|
||||
return runTabTest(8, async function({TAB_ID_NONE, tabIds, toTabIds, setSuccessors, verifySuccessors}) {
|
||||
await browser.tabs.moveInSuccession([1, 0].map(toTabIds), tabIds[0]);
|
||||
await verifySuccessors([TAB_ID_NONE, 0], "scenario 1");
|
||||
|
||||
await browser.tabs.moveInSuccession([0, 1, 2, 3].map(toTabIds), tabIds[0]);
|
||||
await verifySuccessors([1, 2, 3, 0], "scenario 2");
|
||||
|
||||
await browser.tabs.moveInSuccession([1, 0].map(toTabIds), tabIds[0]);
|
||||
await verifySuccessors([TAB_ID_NONE, 0], "scenario 1 after tab 0 has a successor");
|
||||
|
||||
await browser.tabs.update(tabIds[7], {successorTabId: tabIds[0]});
|
||||
await browser.tabs.moveInSuccession([4, 5, 6, 7].map(toTabIds));
|
||||
await verifySuccessors(new Array(4).concat([5, 6, 7, TAB_ID_NONE]), "scenario 4");
|
||||
|
||||
await setSuccessors([7, 2, 3, 4, 3, 6, 7, 5]);
|
||||
await browser.tabs.moveInSuccession([4, 6, 3, 2].map(toTabIds), tabIds[7]);
|
||||
await verifySuccessors([7, TAB_ID_NONE, 7, 2, 6, 7, 3, 5], "scenario 5");
|
||||
|
||||
await setSuccessors([7, 2, 3, 4, 3, 6, 7, 5]);
|
||||
await browser.tabs.moveInSuccession([4, 6, 3, 2].map(toTabIds), tabIds[7], {insert: true});
|
||||
await verifySuccessors([4, TAB_ID_NONE, 7, 2, 6, 4, 3, 5], "insert = true");
|
||||
|
||||
await setSuccessors([1, 2, 3, 4, 0]);
|
||||
await browser.tabs.moveInSuccession([3, 1, 2].map(toTabIds), tabIds[0], {insert: true});
|
||||
await verifySuccessors([4, 2, 0, 1, 3], "insert = true, part 2");
|
||||
|
||||
await browser.tabs.moveInSuccession([tabIds[0], tabIds[1], 1e8, tabIds[2]]);
|
||||
await verifySuccessors([1, 2, TAB_ID_NONE], "unknown tab ID");
|
||||
|
||||
browser.test.assertTrue(await browser.tabs.moveInSuccession([1e8]).then(() => true, () => false), "When all tab IDs are unknown, tabs.moveInSuccession should not throw");
|
||||
|
||||
// Validation tests
|
||||
|
||||
await browser.test.assertRejects(
|
||||
browser.tabs.moveInSuccession([tabIds[0], tabIds[1], tabIds[0]]),
|
||||
/IDs must not occur more than once in tabIds/,
|
||||
"tabs.moveInSuccession should throw when a tab is referenced more than once in tabIds");
|
||||
|
||||
await browser.test.assertRejects(
|
||||
browser.tabs.moveInSuccession([tabIds[0], tabIds[1]], tabIds[0], {insert: true}),
|
||||
/Value of tabId must not occur in tabIds if append or insert is true/,
|
||||
"tabs.moveInSuccession should throw when tabId occurs in tabIds and insert is true");
|
||||
|
||||
|
||||
return browser.tabs.remove(tabIds);
|
||||
});
|
||||
});
|
||||
|
||||
add_task(function testMoveInSuccession_appendTrue() {
|
||||
return runTabTest(8, async function({TAB_ID_NONE, tabIds, toTabIds, setSuccessors, verifySuccessors}) {
|
||||
await browser.tabs.moveInSuccession([1].map(toTabIds), tabIds[0], {append: true});
|
||||
await verifySuccessors([1, TAB_ID_NONE], "scenario 1");
|
||||
|
||||
await browser.tabs.update(tabIds[3], {successorTabId: tabIds[4]});
|
||||
await browser.tabs.moveInSuccession([1, 2, 3].map(toTabIds), tabIds[0], {append: true});
|
||||
await verifySuccessors([1, 2, 3, TAB_ID_NONE], "scenario 2");
|
||||
|
||||
await browser.tabs.update(tabIds[0], {successorTabId: tabIds[1]});
|
||||
await browser.tabs.moveInSuccession([1e8], tabIds[0], {append: true});
|
||||
browser.test.assertEq(TAB_ID_NONE, (await browser.tabs.get(tabIds[0])).successorTabId, "If no tabs get appended after the reference tab, it should lose its successor");
|
||||
|
||||
await setSuccessors([7, 2, 3, 4, 3, 6, 7, 5]);
|
||||
await browser.tabs.moveInSuccession([4, 6, 3, 2].map(toTabIds), tabIds[7], {append: true});
|
||||
await verifySuccessors([7, TAB_ID_NONE, TAB_ID_NONE, 2, 6, 7, 3, 4], "scenario 3");
|
||||
|
||||
await setSuccessors([7, 2, 3, 4, 3, 6, 7, 5]);
|
||||
await browser.tabs.moveInSuccession([4, 6, 3, 2].map(toTabIds), tabIds[7], {append: true, insert: true});
|
||||
await verifySuccessors([7, TAB_ID_NONE, 5, 2, 6, 7, 3, 4], "insert = true");
|
||||
|
||||
await browser.tabs.moveInSuccession([0, 4].map(toTabIds), tabIds[7], {append: true, insert: true});
|
||||
await verifySuccessors([4, undefined, undefined, undefined, 6, undefined, undefined, 0], "insert = true, part 2");
|
||||
|
||||
await setSuccessors([1, 2, 3, 4, 0]);
|
||||
await browser.tabs.moveInSuccession([3, 1, 2].map(toTabIds), tabIds[0], {append: true, insert: true});
|
||||
await verifySuccessors([3, 2, 4, 1, 0], "insert = true, part 3");
|
||||
|
||||
await browser.tabs.update(tabIds[0], {successorTabId: tabIds[1]});
|
||||
await browser.tabs.moveInSuccession([1e8], tabIds[0], {append: true, insert: true});
|
||||
browser.test.assertEq(tabIds[1], (await browser.tabs.get(tabIds[0])).successorTabId, "If no tabs get inserted after the reference tab, it should keep its successor");
|
||||
|
||||
// Validation tests
|
||||
|
||||
await browser.test.assertRejects(
|
||||
browser.tabs.moveInSuccession([tabIds[0], tabIds[1]], tabIds[0], {append: true}),
|
||||
/Value of tabId must not occur in tabIds if append or insert is true/,
|
||||
"tabs.moveInSuccession should throw when tabId occurs in tabIds and insert is true");
|
||||
|
||||
|
||||
return browser.tabs.remove(tabIds);
|
||||
});
|
||||
});
|
||||
|
||||
add_task(function testMoveInSuccession_ignoreTabsInOtherWindows() {
|
||||
return runTabTest(2, async function({TAB_ID_NONE, tabIds, toTabIds, setSuccessors, verifySuccessors}) {
|
||||
const anotherWindow = await browser.windows.create({url: Array.from({length: 3}, () => "about:blank")});
|
||||
tabIds.push(...anotherWindow.tabs.map(t => t.id));
|
||||
|
||||
await setSuccessors([1, 0, 3, 4, 2]);
|
||||
await browser.tabs.moveInSuccession([1, 3, 2].map(toTabIds), tabIds[4]);
|
||||
await verifySuccessors([1, 0, 4, 2, TAB_ID_NONE], "first tab in another window");
|
||||
|
||||
await setSuccessors([1, 0, 3, 4, 2]);
|
||||
await browser.tabs.moveInSuccession([3, 1, 2].map(toTabIds), tabIds[4]);
|
||||
await verifySuccessors([1, 0, 4, 2, TAB_ID_NONE], "middle tab in another window");
|
||||
|
||||
await setSuccessors([1, 0, 3, 4, 2]);
|
||||
await browser.tabs.moveInSuccession([3, 1, 2].map(toTabIds));
|
||||
await verifySuccessors([1, 0, TAB_ID_NONE, 2, TAB_ID_NONE], "using the first tab to determine the window");
|
||||
|
||||
await setSuccessors([1, 0, 3, 4, 2]);
|
||||
await browser.tabs.moveInSuccession([1, 3, 2].map(toTabIds), tabIds[4], {append: true});
|
||||
await verifySuccessors([1, 0, TAB_ID_NONE, 2, 3], "first tab in another window, appending");
|
||||
|
||||
await setSuccessors([1, 0, 3, 4, 2]);
|
||||
await browser.tabs.moveInSuccession([3, 1, 2].map(toTabIds), tabIds[4], {append: true});
|
||||
await verifySuccessors([1, 0, TAB_ID_NONE, 2, 3], "middle tab in another window, appending");
|
||||
|
||||
return browser.tabs.remove(tabIds);
|
||||
});
|
||||
});
|
||||
@@ -80,7 +80,7 @@ add_task(async function test_update_highlighted() {
|
||||
await expectResults(async () => {
|
||||
await browser.tabs.update(tab1, {highlighted: true});
|
||||
return {active: tab1, highlighted: [tab1, tab2], events: [
|
||||
["onActivated", {tabId: tab1, windowId}],
|
||||
["onActivated", {tabId: tab1, previousTabId: tab2, windowId}],
|
||||
["onHighlighted", {tabIds: [tab1, tab2], windowId}],
|
||||
]};
|
||||
}, "highlighting non-highlighted tab");
|
||||
@@ -93,7 +93,7 @@ add_task(async function test_update_highlighted() {
|
||||
await expectResults(async () => {
|
||||
await browser.tabs.update(tab1, {highlighted: false});
|
||||
return {active: tab2, highlighted: [tab2], events: [
|
||||
["onActivated", {tabId: tab2, windowId}],
|
||||
["onActivated", {tabId: tab2, previousTabId: tab1, windowId}],
|
||||
["onHighlighted", {tabIds: [tab2], windowId}],
|
||||
]};
|
||||
}, "unhighlighting active tab with multiselection");
|
||||
@@ -101,7 +101,7 @@ add_task(async function test_update_highlighted() {
|
||||
await expectResults(async () => {
|
||||
await browser.tabs.update(tab1, {highlighted: true});
|
||||
return {active: tab1, highlighted: [tab1, tab2], events: [
|
||||
["onActivated", {tabId: tab1, windowId}],
|
||||
["onActivated", {tabId: tab1, previousTabId: tab2, windowId}],
|
||||
["onHighlighted", {tabIds: [tab1, tab2], windowId}],
|
||||
]};
|
||||
}, "highlighting non-highlighted tab");
|
||||
@@ -123,7 +123,7 @@ add_task(async function test_update_highlighted() {
|
||||
await expectResults(async () => {
|
||||
await browser.tabs.update(tab2, {highlighted: true, active: true});
|
||||
return {active: tab2, highlighted: [tab2], events: [
|
||||
["onActivated", {tabId: tab2, windowId}],
|
||||
["onActivated", {tabId: tab2, previousTabId: tab1, windowId}],
|
||||
["onHighlighted", {tabIds: [tab2], windowId}],
|
||||
]};
|
||||
}, "highlighting and activating inactive highlighted tab");
|
||||
@@ -131,7 +131,7 @@ add_task(async function test_update_highlighted() {
|
||||
await expectResults(async () => {
|
||||
await browser.tabs.update(tab1, {active: true, highlighted: true});
|
||||
return {active: tab1, highlighted: [tab1], events: [
|
||||
["onActivated", {tabId: tab1, windowId}],
|
||||
["onActivated", {tabId: tab1, previousTabId: tab2, windowId}],
|
||||
["onHighlighted", {tabIds: [tab1], windowId}],
|
||||
]};
|
||||
}, "highlighting and activating non-highlighted tab");
|
||||
|
||||
@@ -36,6 +36,7 @@ let expectedBackgroundApisTargetSpecific = [
|
||||
"tabs.highlight",
|
||||
"tabs.insertCSS",
|
||||
"tabs.move",
|
||||
"tabs.moveInSuccession",
|
||||
"tabs.onActivated",
|
||||
"tabs.onAttached",
|
||||
"tabs.onCreated",
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
/* eslint-env mozilla/browser-window */
|
||||
/* globals XULCommandEvent */
|
||||
|
||||
{
|
||||
|
||||
class SearchOneOffs {
|
||||
constructor(container) {
|
||||
this.container = container;
|
||||
@@ -1236,5 +1234,3 @@ class SearchOneOffs {
|
||||
|
||||
window.SearchOneOffs = SearchOneOffs;
|
||||
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@
|
||||
</property>
|
||||
|
||||
<field name="oneOffButtons" readonly="true">
|
||||
new window.SearchOneOffs(
|
||||
new SearchOneOffs(
|
||||
document.getAnonymousElementByAttribute(this, "anonid",
|
||||
"search-one-off-buttons"));
|
||||
</field>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
/* eslint-env mozilla/browser-window */
|
||||
/* globals XULCommandEvent */
|
||||
|
||||
// This is loaded into chrome windows with the subscript loader. Wrap in
|
||||
|
||||
@@ -273,11 +273,10 @@ var ContentSearch = {
|
||||
let ok = SearchSuggestionController.engineOffersSuggestions(engine);
|
||||
controller.maxLocalResults = ok ? MAX_LOCAL_SUGGESTIONS : MAX_SUGGESTIONS;
|
||||
controller.maxRemoteResults = ok ? MAX_SUGGESTIONS : 0;
|
||||
let priv = PrivateBrowsingUtils.isBrowserPrivate(browser);
|
||||
// fetch() rejects its promise if there's a pending request, but since we
|
||||
// process our event queue serially, there's never a pending request.
|
||||
this._currentSuggestion = { controller, target: browser };
|
||||
let suggestions = await controller.fetch(searchString, priv, engine);
|
||||
let suggestions = await controller.fetch(searchString, engine);
|
||||
this._currentSuggestion = null;
|
||||
|
||||
// suggestions will be null if the request was cancelled
|
||||
|
||||
@@ -365,7 +365,7 @@ var ExtensionsUI = {
|
||||
let popupOptions = {
|
||||
hideClose: true,
|
||||
popupIconURL: icon || DEFAULT_EXTENSION_ICON,
|
||||
persistent: false,
|
||||
persistent: true,
|
||||
removeOnDismissal: true,
|
||||
eventCallback(topic) {
|
||||
if (topic == "removed") {
|
||||
|
||||
@@ -144,6 +144,10 @@
|
||||
margin-bottom: 2px !important;
|
||||
}
|
||||
|
||||
.identity-popup-preferences-button:-moz-locale-dir(rtl) {
|
||||
background-position: center left;
|
||||
}
|
||||
|
||||
.identity-popup-preferences-button > .toolbarbutton-text {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -152,30 +152,6 @@ function removeAddon(aAddon) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function getTargetActorForUrl(aClient, aUrl) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
aClient.listTabs().then(aResponse => {
|
||||
let targetActor = aResponse.tabs.filter(aGrip => aGrip.url == aUrl).pop();
|
||||
deferred.resolve(targetActor);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
async function attachTargetActorForUrl(aClient, aUrl) {
|
||||
let grip = await getTargetActorForUrl(aClient, aUrl);
|
||||
let [ response, front ] = await aClient.attachTarget(grip.actor);
|
||||
return [grip, response, front];
|
||||
}
|
||||
|
||||
async function attachThreadActorForUrl(aClient, aUrl) {
|
||||
let [grip, response] = await attachTargetActorForUrl(aClient, aUrl);
|
||||
let [response2, threadClient] = await aClient.attachThread(response.threadActor);
|
||||
await threadClient.resume();
|
||||
return threadClient;
|
||||
}
|
||||
|
||||
// Override once from shared-head, as some tests depend on trying native DOM listeners
|
||||
// before EventEmitter. Since this directory is deprecated, there's little value in
|
||||
// resolving the descrepency here.
|
||||
@@ -908,7 +884,7 @@ function findTab(tabs, url) {
|
||||
|
||||
function attachTarget(client, tab) {
|
||||
info("Attaching to tab with url '" + tab.url + "'.");
|
||||
return client.attachTarget(tab.actor);
|
||||
return client.attachTarget(tab);
|
||||
}
|
||||
|
||||
function listWorkers(targetFront) {
|
||||
@@ -1090,29 +1066,3 @@ function waitForDispatch(panel, type, eventRepeat = 1) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function initWorkerDebugger(TAB_URL, WORKER_URL) {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.registerAllActors();
|
||||
|
||||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
await connect(client);
|
||||
|
||||
let tab = await addTab(TAB_URL);
|
||||
let { tabs } = await listTabs(client);
|
||||
let [, targetFront] = await attachTarget(client, findTab(tabs, TAB_URL));
|
||||
|
||||
await createWorkerInTab(tab, WORKER_URL);
|
||||
|
||||
let { workers } = await listWorkers(targetFront);
|
||||
let workerTargetFront = findWorker(workers, WORKER_URL);
|
||||
|
||||
let toolbox = await gDevTools.showToolbox(TargetFactory.forWorker(workerTargetFront),
|
||||
"jsdebugger",
|
||||
Toolbox.HostType.WINDOW);
|
||||
|
||||
let debuggerPanel = toolbox.getCurrentPanel();
|
||||
let gDebugger = debuggerPanel.panelWin;
|
||||
|
||||
return {client, tab, targetFront, workerTargetFront, toolbox, gDebugger};
|
||||
}
|
||||
@@ -529,7 +529,7 @@ Target.prototype = {
|
||||
// The call to attachTarget is to be removed once all Target are having a front
|
||||
// passed as contructor's argument.
|
||||
if (!this.activeTab) {
|
||||
const [, targetFront] = await this._client.attachTarget(this.form.actor);
|
||||
const [, targetFront] = await this._client.attachTarget(this.form);
|
||||
this.activeTab = targetFront;
|
||||
} else {
|
||||
await this.activeTab.attach();
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
"use strict";
|
||||
|
||||
const { DebuggerServer } = require("devtools/server/main");
|
||||
const { DebuggerClient } = require("devtools/shared/client/debugger-client");
|
||||
|
||||
// Bug 1277805: Too slow for debug runs
|
||||
requestLongerTimeout(2);
|
||||
@@ -60,36 +59,13 @@ function runTools(target) {
|
||||
})();
|
||||
}
|
||||
|
||||
function getClient() {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.registerAllActors();
|
||||
|
||||
const transport = DebuggerServer.connectPipe();
|
||||
const client = new DebuggerClient(transport);
|
||||
|
||||
return client.connect().then(() => client);
|
||||
}
|
||||
|
||||
function getTarget(client) {
|
||||
return new Promise(resolve => {
|
||||
client.listTabs().then(tabList => {
|
||||
const target = TargetFactory.forRemoteTab({
|
||||
client: client,
|
||||
form: tabList.tabs[tabList.selected],
|
||||
chrome: false,
|
||||
});
|
||||
resolve(target);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function test() {
|
||||
(async function() {
|
||||
toggleAllTools(true);
|
||||
await addTab("about:blank");
|
||||
const tab = await addTab("about:blank");
|
||||
|
||||
const client = await getClient();
|
||||
const target = await getTarget(client);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const { client } = target;
|
||||
await runTools(target);
|
||||
|
||||
const rootFronts = [...client.mainRoot.fronts.values()];
|
||||
|
||||
@@ -26,15 +26,10 @@ function test() {
|
||||
const oldMaxTotalViewers = SpecialPowers.getIntPref(MAX_TOTAL_VIEWERS);
|
||||
SpecialPowers.setIntPref(MAX_TOTAL_VIEWERS, 10);
|
||||
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.registerAllActors();
|
||||
|
||||
const client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
yield connect(client);
|
||||
|
||||
const tab = yield addTab(TAB1_URL);
|
||||
const { tabs } = yield listTabs(client);
|
||||
const [, targetFront] = yield attachTarget(client, findTab(tabs, TAB1_URL));
|
||||
const target = yield TargetFactory.forTab(tab);
|
||||
yield target.attach();
|
||||
const targetFront = target.activeTab;
|
||||
yield listWorkers(targetFront);
|
||||
|
||||
// If a page still has pending network requests, it will not be moved into
|
||||
@@ -71,7 +66,7 @@ function test() {
|
||||
yield workerTargetFront1.attach();
|
||||
is(workerTargetFront1.isClosed, false, "worker in tab 1 should not be closed");
|
||||
|
||||
yield close(client);
|
||||
yield target.destroy();
|
||||
SpecialPowers.setIntPref(MAX_TOTAL_VIEWERS, oldMaxTotalViewers);
|
||||
finish();
|
||||
});
|
||||
|
||||
@@ -15,82 +15,53 @@ Services.scriptloader.loadSubScript(
|
||||
"chrome://mochitests/content/browser/devtools/client/shared/test/helper_workers.js",
|
||||
this);
|
||||
|
||||
var { DebuggerServer } = require("devtools/server/main");
|
||||
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
|
||||
|
||||
const TAB_URL = TEST_URI_ROOT + "doc_inline-debugger-statement.html";
|
||||
|
||||
var gClient;
|
||||
var gTab;
|
||||
add_task(async () => {
|
||||
const tab = await addTab(TAB_URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
const { client } = target;
|
||||
const targetFront = target.activeTab;
|
||||
|
||||
function test() {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.registerAllActors();
|
||||
const threadClient = await testEarlyDebuggerStatement(client, tab, targetFront);
|
||||
await testDebuggerStatement(client, tab, threadClient);
|
||||
|
||||
const transport = DebuggerServer.connectPipe();
|
||||
gClient = new DebuggerClient(transport);
|
||||
gClient.connect().then(([aType, aTraits]) => {
|
||||
is(aType, "browser",
|
||||
"Root actor should identify itself as a browser.");
|
||||
|
||||
addTab(TAB_URL)
|
||||
.then(tab => {
|
||||
gTab = tab;
|
||||
return attachTargetActorForUrl(gClient, TAB_URL);
|
||||
})
|
||||
.then(testEarlyDebuggerStatement)
|
||||
.then(testDebuggerStatement)
|
||||
.then(() => gClient.close())
|
||||
.then(finish)
|
||||
.catch(error => {
|
||||
ok(false, "Got an error: " + error.message + "\n" + error.stack);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testEarlyDebuggerStatement([aGrip, aResponse]) {
|
||||
const deferred = getDeferredPromise().defer();
|
||||
await target.destroy();
|
||||
});
|
||||
|
||||
async function testEarlyDebuggerStatement(client, tab, targetFront) {
|
||||
const onPaused = function(event, packet) {
|
||||
ok(false, "Pause shouldn't be called before we've attached!");
|
||||
deferred.reject();
|
||||
};
|
||||
|
||||
gClient.addListener("paused", onPaused);
|
||||
client.addListener("paused", onPaused);
|
||||
|
||||
// This should continue without nesting an event loop and calling
|
||||
// the onPaused hook, because we haven't attached yet.
|
||||
callInTab(gTab, "runDebuggerStatement");
|
||||
callInTab(tab, "runDebuggerStatement");
|
||||
|
||||
gClient.removeListener("paused", onPaused);
|
||||
client.removeListener("paused", onPaused);
|
||||
|
||||
// Now attach and resume...
|
||||
gClient.request({ to: aResponse.threadActor, type: "attach" }, () => {
|
||||
gClient.request({ to: aResponse.threadActor, type: "resume" }, () => {
|
||||
ok(true, "Pause wasn't called before we've attached.");
|
||||
deferred.resolve([aGrip, aResponse]);
|
||||
});
|
||||
});
|
||||
const [, threadClient] = await targetFront.attachThread();
|
||||
await threadClient.resume();
|
||||
ok(true, "Pause wasn't called before we've attached.");
|
||||
|
||||
return deferred.promise;
|
||||
return threadClient;
|
||||
}
|
||||
|
||||
function testDebuggerStatement([aGrip, aResponse]) {
|
||||
const deferred = getDeferredPromise().defer();
|
||||
|
||||
gClient.addListener("paused", (event, packet) => {
|
||||
gClient.request({ to: aResponse.threadActor, type: "resume" }, () => {
|
||||
async function testDebuggerStatement(client, tab, threadClient) {
|
||||
const onPaused = new Promise(resolve => {
|
||||
client.addListener("paused", async (event, packet) => {
|
||||
await threadClient.resume();
|
||||
ok(true, "The pause handler was triggered on a debugger statement.");
|
||||
deferred.resolve();
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
// Reach around the debugging protocol and execute the debugger statement.
|
||||
callInTab(gTab, "runDebuggerStatement");
|
||||
callInTab(tab, "runDebuggerStatement");
|
||||
|
||||
return deferred.promise;
|
||||
return onPaused;
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
gClient = null;
|
||||
});
|
||||
@@ -15,28 +15,14 @@ Services.scriptloader.loadSubScript(
|
||||
"chrome://mochitests/content/browser/devtools/client/shared/test/helper_workers.js",
|
||||
this);
|
||||
|
||||
var { DebuggerServer } = require("devtools/server/main");
|
||||
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
|
||||
|
||||
const TAB_URL = TEST_URI_ROOT + "doc_event-listeners-01.html";
|
||||
|
||||
add_task(async function() {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.registerAllActors();
|
||||
|
||||
const transport = DebuggerServer.connectPipe();
|
||||
const client = new DebuggerClient(transport);
|
||||
const [type] = await client.connect();
|
||||
|
||||
Assert.equal(type, "browser",
|
||||
"Root actor should identify itself as a browser.");
|
||||
|
||||
const tab = await addTab(TAB_URL);
|
||||
const threadClient = await attachThreadActorForUrl(client, TAB_URL);
|
||||
const { client, threadClient } = await attachThreadActorForTab(tab);
|
||||
|
||||
await pauseDebuggee(tab, client, threadClient);
|
||||
await testEventListeners(client, threadClient);
|
||||
|
||||
await client.close();
|
||||
});
|
||||
|
||||
function pauseDebuggee(tab, client, threadClient) {
|
||||
|
||||
@@ -16,27 +16,14 @@ Services.scriptloader.loadSubScript(
|
||||
"chrome://mochitests/content/browser/devtools/client/shared/test/helper_workers.js",
|
||||
this);
|
||||
|
||||
var { DebuggerServer } = require("devtools/server/main");
|
||||
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
|
||||
|
||||
const TAB_URL = TEST_URI_ROOT + "doc_event-listeners-03.html";
|
||||
|
||||
add_task(async function() {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.registerAllActors();
|
||||
|
||||
const transport = DebuggerServer.connectPipe();
|
||||
const client = new DebuggerClient(transport);
|
||||
const [type] = await client.connect();
|
||||
|
||||
Assert.equal(type, "browser",
|
||||
"Root actor should identify itself as a browser.");
|
||||
|
||||
const tab = await addTab(TAB_URL);
|
||||
const threadClient = await attachThreadActorForUrl(client, TAB_URL);
|
||||
const { client, threadClient } = await attachThreadActorForTab(tab);
|
||||
|
||||
await pauseDebuggee(tab, client, threadClient);
|
||||
await testEventListeners(client, threadClient);
|
||||
await client.close();
|
||||
});
|
||||
|
||||
function pauseDebuggee(tab, client, threadClient) {
|
||||
|
||||
@@ -16,43 +16,20 @@ Services.scriptloader.loadSubScript(
|
||||
"chrome://mochitests/content/browser/devtools/client/shared/test/helper_workers.js",
|
||||
this);
|
||||
|
||||
var { DebuggerServer } = require("devtools/server/main");
|
||||
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
|
||||
|
||||
const TAB_URL = TEST_URI_ROOT + "doc_native-event-handler.html";
|
||||
|
||||
var gClient;
|
||||
var gTab;
|
||||
add_task(async () => {
|
||||
const tab = await addTab(TAB_URL);
|
||||
const { client, threadClient } = await attachThreadActorForTab(tab);
|
||||
|
||||
function test() {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.registerAllActors();
|
||||
await pauseDebuggee(client, tab, threadClient);
|
||||
await testEventListeners(threadClient);
|
||||
});
|
||||
|
||||
const transport = DebuggerServer.connectPipe();
|
||||
gClient = new DebuggerClient(transport);
|
||||
gClient.connect().then(([aType, aTraits]) => {
|
||||
is(aType, "browser",
|
||||
"Root actor should identify itself as a browser.");
|
||||
|
||||
addTab(TAB_URL)
|
||||
.then((tab) => {
|
||||
gTab = tab;
|
||||
return attachThreadActorForUrl(gClient, TAB_URL);
|
||||
})
|
||||
.then(pauseDebuggee)
|
||||
.then(testEventListeners)
|
||||
.then(() => gClient.close())
|
||||
.then(finish)
|
||||
.catch(error => {
|
||||
ok(false, "Got an error: " + error.message + "\n" + error.stack);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function pauseDebuggee(threadClient) {
|
||||
function pauseDebuggee(client, tab, threadClient) {
|
||||
const deferred = getDeferredPromise().defer();
|
||||
|
||||
gClient.addOneTimeListener("paused", (event, packet) => {
|
||||
client.addOneTimeListener("paused", (event, packet) => {
|
||||
is(packet.type, "paused",
|
||||
"We should now be paused.");
|
||||
is(packet.why.type, "debuggerStatement",
|
||||
@@ -61,7 +38,7 @@ function pauseDebuggee(threadClient) {
|
||||
deferred.resolve(threadClient);
|
||||
});
|
||||
|
||||
generateMouseClickInTab(gTab, "content.document.querySelector('button')");
|
||||
generateMouseClickInTab(tab, "content.document.querySelector('button')");
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
@@ -86,7 +63,3 @@ function testEventListeners(threadClient) {
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
gClient = null;
|
||||
});
|
||||
@@ -44,9 +44,9 @@ function testFirstTab() {
|
||||
return addTab(TAB1_URL).then(tab => {
|
||||
gTab1 = tab;
|
||||
|
||||
return getTargetActorForUrl(gClient, TAB1_URL).then(grip => {
|
||||
ok(grip, "Should find a target actor for the first tab.");
|
||||
gTab1Actor = grip.actor;
|
||||
return getTargetActorForUrl(gClient, TAB1_URL).then(form => {
|
||||
ok(form, "Should find a target actor for the first tab.");
|
||||
gTab1Actor = form.actor;
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -67,8 +67,8 @@ function testSecondTab() {
|
||||
|
||||
function testRemoveTab() {
|
||||
return removeTab(gTab1).then(() => {
|
||||
return getTargetActorForUrl(gClient, TAB1_URL).then(grip => {
|
||||
ok(!grip, "Shouldn't find a target actor for the first tab anymore.");
|
||||
return getTargetActorForUrl(gClient, TAB1_URL).then(form => {
|
||||
ok(!form, "Shouldn't find a target actor for the first tab anymore.");
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -100,13 +100,8 @@ registerCleanupFunction(function() {
|
||||
gClient = null;
|
||||
});
|
||||
|
||||
function getTargetActorForUrl(client, url) {
|
||||
const deferred = promise.defer();
|
||||
|
||||
client.listTabs().then(response => {
|
||||
const targetActor = response.tabs.filter(grip => grip.url == url).pop();
|
||||
deferred.resolve(targetActor);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
async function getTargetActorForUrl(client, url) {
|
||||
const { tabs } = await client.listTabs();
|
||||
const targetActor = tabs.filter(form => form.url == url).pop();
|
||||
return targetActor;
|
||||
}
|
||||
@@ -29,7 +29,7 @@ add_task(async function test() {
|
||||
const tabGrip = tabs.filter(a => a.url == TAB1_URL).pop();
|
||||
ok(tabGrip, "Should have an actor for the tab");
|
||||
|
||||
let [response, targetFront] = await client.attachTarget(tabGrip.actor);
|
||||
let [response, targetFront] = await client.attachTarget(tabGrip);
|
||||
is(response.type, "tabAttached", "Should have attached");
|
||||
|
||||
response = await client.listTabs();
|
||||
@@ -41,7 +41,7 @@ add_task(async function test() {
|
||||
const newGrip = tabs.filter(a => a.url == TAB1_URL).pop();
|
||||
is(newGrip.actor, tabGrip.actor, "Should have the same actor for the same tab");
|
||||
|
||||
[response, targetFront] = await client.attachTarget(tabGrip.actor);
|
||||
[response, targetFront] = await client.attachTarget(tabGrip);
|
||||
is(response.type, "tabAttached", "Should have attached");
|
||||
response = await targetFront.detach();
|
||||
is(response.type, "detached", "Should have detached");
|
||||
|
||||
@@ -17,23 +17,15 @@ Services.scriptloader.loadSubScript(
|
||||
"chrome://mochitests/content/browser/devtools/client/shared/test/helper_workers.js",
|
||||
this);
|
||||
|
||||
var { DebuggerServer } = require("devtools/server/main");
|
||||
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
|
||||
|
||||
var TAB_URL = EXAMPLE_URL + "doc_listworkers-tab.html";
|
||||
var WORKER1_URL = "code_listworkers-worker1.js";
|
||||
var WORKER2_URL = "code_listworkers-worker2.js";
|
||||
|
||||
add_task(async function test() {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.registerAllActors();
|
||||
|
||||
const client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
await connect(client);
|
||||
|
||||
const tab = await addTab(TAB_URL);
|
||||
const { tabs } = await listTabs(client);
|
||||
const [, targetFront] = await attachTarget(client, findTab(tabs, TAB_URL));
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
const targetFront = target.activeTab;
|
||||
|
||||
let { workers } = await listWorkers(targetFront);
|
||||
is(workers.length, 0);
|
||||
@@ -74,6 +66,6 @@ add_task(async function test() {
|
||||
({ workers } = await listWorkers(targetFront));
|
||||
is(workers.length, 0);
|
||||
|
||||
await close(client);
|
||||
await target.destroy();
|
||||
finish();
|
||||
});
|
||||
@@ -9,35 +9,19 @@
|
||||
* Check tab attach/navigation.
|
||||
*/
|
||||
|
||||
var { DebuggerServer } = require("devtools/server/main");
|
||||
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
|
||||
|
||||
const TAB1_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
|
||||
const TAB2_FILE = "doc_empty-tab-02.html";
|
||||
const TAB2_URL = EXAMPLE_URL + TAB2_FILE;
|
||||
|
||||
var gClient;
|
||||
add_task(async () => {
|
||||
const tab = await addTab(TAB1_URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
const targetFront = target.activeTab;
|
||||
|
||||
function test() {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.registerAllActors();
|
||||
|
||||
const transport = DebuggerServer.connectPipe();
|
||||
gClient = new DebuggerClient(transport);
|
||||
gClient.connect().then(([aType, aTraits]) => {
|
||||
is(aType, "browser",
|
||||
"Root actor should identify itself as a browser.");
|
||||
|
||||
addTab(TAB1_URL)
|
||||
.then(() => attachTargetActorForUrl(gClient, TAB1_URL))
|
||||
.then(testNavigate)
|
||||
.then(testDetach)
|
||||
.then(finish)
|
||||
.catch(error => {
|
||||
ok(false, "Got an error: " + error.message + "\n" + error.stack);
|
||||
});
|
||||
});
|
||||
}
|
||||
await testNavigate(targetFront);
|
||||
await testDetach(target);
|
||||
});
|
||||
|
||||
function testNavigate(targetFront) {
|
||||
const outstanding = [promise.defer(), promise.defer()];
|
||||
@@ -59,40 +43,16 @@ function testNavigate(targetFront) {
|
||||
});
|
||||
|
||||
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TAB2_URL);
|
||||
return promise.all(outstanding.map(e => e.promise))
|
||||
.then(() => targetFront);
|
||||
return promise.all(outstanding.map(e => e.promise));
|
||||
}
|
||||
|
||||
async function testDetach(targetFront) {
|
||||
const onDetached = targetFront.once("tabDetached");
|
||||
async function testDetach(target) {
|
||||
// We can't listen for tabDetached at it is received by Target first
|
||||
// and target is destroyed
|
||||
const onDetached = target.once("close");
|
||||
|
||||
removeTab(gBrowser.selectedTab);
|
||||
|
||||
const packet = await onDetached;
|
||||
await onDetached;
|
||||
ok(true, "Got a tab detach notification.");
|
||||
is(packet.from, targetFront.actorID,
|
||||
"tab detach message comes from the expected actor");
|
||||
|
||||
return gClient.close();
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
gClient = null;
|
||||
});
|
||||
|
||||
async function attachTargetActorForUrl(client, url) {
|
||||
const grip = await getTargetActorForUrl(client, url);
|
||||
const [, targetFront] = await client.attachTarget(grip.actor);
|
||||
return targetFront;
|
||||
}
|
||||
|
||||
function getTargetActorForUrl(client, url) {
|
||||
const deferred = promise.defer();
|
||||
|
||||
client.listTabs().then(response => {
|
||||
const targetActor = response.tabs.filter(grip => grip.url == url).pop();
|
||||
deferred.resolve(targetActor);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
@@ -9,17 +9,11 @@
|
||||
* Check target-scoped actor lifetimes.
|
||||
*/
|
||||
|
||||
var { DebuggerServer } = require("devtools/server/main");
|
||||
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
|
||||
|
||||
const ACTORS_URL = EXAMPLE_URL + "testactors.js";
|
||||
const TAB_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
|
||||
|
||||
add_task(async function test() {
|
||||
await addTab(TAB_URL);
|
||||
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.registerAllActors();
|
||||
const tab = await addTab(TAB_URL);
|
||||
|
||||
await registerActorInContentProcess(ACTORS_URL, {
|
||||
prefix: "testOne",
|
||||
@@ -27,40 +21,23 @@ add_task(async function test() {
|
||||
type: { target: true },
|
||||
});
|
||||
|
||||
const transport = DebuggerServer.connectPipe();
|
||||
const client = new DebuggerClient(transport);
|
||||
const [ type ] = await client.connect();
|
||||
is(type, "browser", "Root actor should identify itself as a browser.");
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
const { client } = target;
|
||||
const targetFront = target.activeTab;
|
||||
const form = targetFront.targetForm;
|
||||
|
||||
const [ grip ] = await attachTargetActorForUrl(client, TAB_URL);
|
||||
await testTargetScopedActor(client, grip);
|
||||
await testTargetScopedActor(client, form);
|
||||
await removeTab(gBrowser.selectedTab);
|
||||
await client.close();
|
||||
await target.destroy();
|
||||
});
|
||||
|
||||
async function testTargetScopedActor(client, grip) {
|
||||
ok(grip.testOneActor,
|
||||
async function testTargetScopedActor(client, form) {
|
||||
ok(form.testOneActor,
|
||||
"Found the test target-scoped actor.");
|
||||
ok(grip.testOneActor.includes("testOne"),
|
||||
ok(form.testOneActor.includes("testOne"),
|
||||
"testOneActor's actorPrefix should be used.");
|
||||
|
||||
const response = await client.request({ to: grip.testOneActor, type: "ping" });
|
||||
const response = await client.request({ to: form.testOneActor, type: "ping" });
|
||||
is(response.pong, "pong", "Actor should respond to requests.");
|
||||
}
|
||||
|
||||
async function attachTargetActorForUrl(client, url) {
|
||||
const grip = await getTargetActorForUrl(client, url);
|
||||
const [ response ] = await client.attachTarget(grip.actor);
|
||||
return [grip, response];
|
||||
}
|
||||
|
||||
function getTargetActorForUrl(client, url) {
|
||||
const deferred = promise.defer();
|
||||
|
||||
client.listTabs().then(response => {
|
||||
const targetActor = response.tabs.filter(grip => grip.url == url).pop();
|
||||
deferred.resolve(targetActor);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
@@ -9,17 +9,11 @@
|
||||
* Check target-scoped actor lifetimes.
|
||||
*/
|
||||
|
||||
var { DebuggerServer } = require("devtools/server/main");
|
||||
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
|
||||
|
||||
const ACTORS_URL = EXAMPLE_URL + "testactors.js";
|
||||
const TAB_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
|
||||
|
||||
add_task(async function() {
|
||||
await addTab(TAB_URL);
|
||||
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.registerAllActors();
|
||||
const tab = await addTab(TAB_URL);
|
||||
|
||||
await registerActorInContentProcess(ACTORS_URL, {
|
||||
prefix: "testOne",
|
||||
@@ -27,51 +21,33 @@ add_task(async function() {
|
||||
type: { target: true },
|
||||
});
|
||||
|
||||
const transport = DebuggerServer.connectPipe();
|
||||
const client = new DebuggerClient(transport);
|
||||
const [type] = await client.connect();
|
||||
is(type, "browser",
|
||||
"Root actor should identify itself as a browser.");
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
const { client } = target;
|
||||
const targetFront = target.activeTab;
|
||||
const form = targetFront.targetForm;
|
||||
|
||||
const [grip] = await attachTargetActorForUrl(client, TAB_URL);
|
||||
await testTargetScopedActor(client, grip);
|
||||
await closeTab(client, grip);
|
||||
await client.close();
|
||||
await testTargetScopedActor(client, form);
|
||||
await closeTab(client, form);
|
||||
await target.destroy();
|
||||
});
|
||||
|
||||
async function testTargetScopedActor(client, grip) {
|
||||
ok(grip.testOneActor,
|
||||
async function testTargetScopedActor(client, form) {
|
||||
ok(form.testOneActor,
|
||||
"Found the test target-scoped actor.");
|
||||
ok(grip.testOneActor.includes("testOne"),
|
||||
ok(form.testOneActor.includes("testOne"),
|
||||
"testOneActor's actorPrefix should be used.");
|
||||
|
||||
const response = await client.request({ to: grip.testOneActor, type: "ping" });
|
||||
const response = await client.request({ to: form.testOneActor, type: "ping" });
|
||||
is(response.pong, "pong",
|
||||
"Actor should respond to requests.");
|
||||
}
|
||||
|
||||
async function closeTab(client, grip) {
|
||||
async function closeTab(client, form) {
|
||||
await removeTab(gBrowser.selectedTab);
|
||||
await Assert.rejects(
|
||||
client.request({ to: grip.testOneActor, type: "ping" }),
|
||||
err => err.message === `'ping' active request packet to '${grip.testOneActor}' ` +
|
||||
client.request({ to: form.testOneActor, type: "ping" }),
|
||||
err => err.message === `'ping' active request packet to '${form.testOneActor}' ` +
|
||||
`can't be sent as the connection just closed.`,
|
||||
"testOneActor went away.");
|
||||
}
|
||||
|
||||
async function attachTargetActorForUrl(client, url) {
|
||||
const grip = await getTargetActorForUrl(client, url);
|
||||
const [ response ] = await client.attachTarget(grip.actor);
|
||||
return [grip, response];
|
||||
}
|
||||
|
||||
function getTargetActorForUrl(client, url) {
|
||||
const deferred = promise.defer();
|
||||
|
||||
client.listTabs().then(response => {
|
||||
const targetActor = response.tabs.filter(grip => grip.url == url).pop();
|
||||
deferred.resolve(targetActor);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
@@ -15,15 +15,10 @@ const WORKER_URL = "code_WorkerTargetActor.attachThread-worker.js";
|
||||
add_task(async function() {
|
||||
await pushPrefs(["devtools.scratchpad.enabled", true]);
|
||||
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.registerAllActors();
|
||||
|
||||
const client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
await connect(client);
|
||||
|
||||
const tab = await addTab(TAB_URL);
|
||||
const { tabs } = await listTabs(client);
|
||||
const [, targetFront] = await attachTarget(client, findTab(tabs, TAB_URL));
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
const targetFront = target.activeTab;
|
||||
|
||||
await listWorkers(targetFront);
|
||||
await createWorkerInTab(tab, WORKER_URL);
|
||||
@@ -56,7 +51,7 @@ add_task(async function() {
|
||||
|
||||
terminateWorkerInTab(tab, WORKER_URL);
|
||||
await waitForWorkerClose(workerTargetFront);
|
||||
await close(client);
|
||||
await target.destroy();
|
||||
|
||||
await toolbox.destroy();
|
||||
});
|
||||
@@ -116,7 +116,7 @@ function findTab(tabs, url) {
|
||||
|
||||
function attachTarget(client, tab) {
|
||||
info("Attaching to tab with url '" + tab.url + "'.");
|
||||
return client.attachTarget(tab.actor);
|
||||
return client.attachTarget(tab);
|
||||
}
|
||||
|
||||
function listWorkers(targetFront) {
|
||||
@@ -172,15 +172,11 @@ function getSplitConsole(toolbox, win) {
|
||||
}
|
||||
|
||||
async function initWorkerDebugger(TAB_URL, WORKER_URL) {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.registerAllActors();
|
||||
|
||||
const client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
await connect(client);
|
||||
|
||||
const tab = await addTab(TAB_URL);
|
||||
const { tabs } = await listTabs(client);
|
||||
const [, targetFront] = await attachTarget(client, findTab(tabs, TAB_URL));
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
const { client } = target;
|
||||
const targetFront = target.activeTab;
|
||||
|
||||
await createWorkerInTab(tab, WORKER_URL);
|
||||
|
||||
@@ -242,28 +238,13 @@ this.removeTab = function removeTab(tab, win) {
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
async function attachTargetActorForUrl(client, url) {
|
||||
const grip = await getTargetActorForUrl(client, url);
|
||||
const [ response, front ] = await client.attachTarget(grip.actor);
|
||||
return [grip, response, front];
|
||||
}
|
||||
|
||||
async function attachThreadActorForUrl(client, url) {
|
||||
const [, response] = await attachTargetActorForUrl(client, url);
|
||||
const [, threadClient] = await client.attachThread(response.threadActor);
|
||||
async function attachThreadActorForTab(tab) {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
const targetFront = target.activeTab;
|
||||
const [, threadClient] = await targetFront.attachThread();
|
||||
await threadClient.resume();
|
||||
return threadClient;
|
||||
}
|
||||
|
||||
function getTargetActorForUrl(client, url) {
|
||||
const deferred = getDeferredPromise().defer();
|
||||
|
||||
client.listTabs().then(response => {
|
||||
const targetActor = response.tabs.filter(grip => grip.url == url).pop();
|
||||
deferred.resolve(targetActor);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
return { client: target.client, threadClient };
|
||||
}
|
||||
|
||||
function pushPrefs(...aPrefs) {
|
||||
|
||||
@@ -78,7 +78,7 @@ function attachToTab() {
|
||||
let tab = response.tabs[response.selected];
|
||||
|
||||
// Attach to the tab.
|
||||
client.attachTarget(tab.actor).then(([response, targetFront]) => {
|
||||
client.attachTarget(tab).then(([response, targetFront]) => {
|
||||
if (!targetFront) {
|
||||
return;
|
||||
}
|
||||
@@ -186,7 +186,7 @@ function debugTab() {
|
||||
// Find the active tab.
|
||||
let tab = response.tabs[response.selected];
|
||||
// Attach to the tab.
|
||||
client.attachTarget(tab.actor).then(([response, targetFront]) => {
|
||||
client.attachTarget(tab).then(([response, targetFront]) => {
|
||||
if (!targetFront) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -95,20 +95,15 @@ function onMessage({ data }) {
|
||||
assertEvent(data.event, data.data);
|
||||
}
|
||||
|
||||
async function connectAndAttachTab() {
|
||||
// Ensure having a minimal server
|
||||
initDebuggerServer();
|
||||
|
||||
// Connect to this tab
|
||||
const transport = DebuggerServer.connectPipe();
|
||||
const client = new DebuggerClient(transport);
|
||||
const form = await connectDebuggerClient(client);
|
||||
const actorID = form.actor;
|
||||
const [, targetFront ] = await client.attachTarget(actorID);
|
||||
async function connectAndAttachTab(tab) {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
const targetFront = target.activeTab;
|
||||
const actorID = targetFront.targetForm.actor;
|
||||
targetFront.on("tabNavigated", function(packet) {
|
||||
assertEvent("tabNavigated", packet);
|
||||
});
|
||||
return { client, actorID };
|
||||
return { target, actorID };
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
@@ -125,7 +120,8 @@ add_task(async function() {
|
||||
// Listen for messages sent by the content task
|
||||
browser.messageManager.addMessageListener("devtools-test:event", onMessage);
|
||||
|
||||
const { client, actorID } = await connectAndAttachTab();
|
||||
const tab = gBrowser.getTabForBrowser(browser);
|
||||
const { target, actorID } = await connectAndAttachTab(tab);
|
||||
await ContentTask.spawn(browser, [actorID], async function(actorId) {
|
||||
const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const { DebuggerServer } = require("devtools/server/main");
|
||||
@@ -170,7 +166,7 @@ add_task(async function() {
|
||||
|
||||
// Cleanup
|
||||
browser.messageManager.removeMessageListener("devtools-test:event", onMessage);
|
||||
await client.close();
|
||||
await target.destroy();
|
||||
Services.obs.addObserver(httpObserver, "http-on-modify-request");
|
||||
DebuggerServer.destroy();
|
||||
});
|
||||
@@ -13,7 +13,7 @@ const ACTOR_URL = "chrome://mochitests/content/browser/devtools/server/tests/bro
|
||||
const { InContentFront, InParentFront } = require(ACTOR_URL);
|
||||
|
||||
add_task(async function() {
|
||||
await addTab("data:text/html;charset=utf-8,foo");
|
||||
const browser = await addTab("data:text/html;charset=utf-8,foo");
|
||||
|
||||
info("Register target-scoped actor in the content process");
|
||||
await registerActorInContentProcess(ACTOR_URL, {
|
||||
@@ -22,9 +22,13 @@ add_task(async function() {
|
||||
type: { target: true },
|
||||
});
|
||||
|
||||
initDebuggerServer();
|
||||
const client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
const form = await connectDebuggerClient(client);
|
||||
const tab = gBrowser.getTabForBrowser(browser);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
const targetFront = target.activeTab;
|
||||
const { client } = target;
|
||||
const form = targetFront.targetForm;
|
||||
|
||||
const inContentFront = InContentFront(client, form);
|
||||
const isInContent = await inContentFront.isInContent();
|
||||
ok(isInContent, "ContentActor really runs in the content process");
|
||||
@@ -43,6 +47,6 @@ add_task(async function() {
|
||||
ok(conn, "`conn`, first contructor argument is a DebuggerServerConnection instance");
|
||||
is(mm, "ChromeMessageSender", "`mm`, last constructor argument is a message manager");
|
||||
|
||||
await client.close();
|
||||
await target.destroy();
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
@@ -26,7 +26,7 @@ async function setup(pageUrl) {
|
||||
|
||||
const { client, form } = target;
|
||||
|
||||
const [, targetFront] = await client.attachTarget(form.actor);
|
||||
const [, targetFront] = await client.attachTarget(form);
|
||||
|
||||
const [, consoleClient] = await client.attachConsole(form.consoleActor, []);
|
||||
|
||||
|
||||
@@ -116,15 +116,6 @@ async function initInspectorFront(url) {
|
||||
return {inspector, walker, target};
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the RootActor form from a DebuggerClient.
|
||||
* @param {DebuggerClient} client
|
||||
* @return {RootActor} Resolves when connected.
|
||||
*/
|
||||
function getRootForm(client) {
|
||||
return client.listTabs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait until a DebuggerClient is connected.
|
||||
* @param {DebuggerClient} client
|
||||
@@ -136,21 +127,6 @@ function waitUntilClientConnected(client) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect a debugger client.
|
||||
*
|
||||
* @param {DebuggerClient}
|
||||
* @return {Promise} Resolves to the targetActor form for the selected tab when the client
|
||||
* is connected.
|
||||
*/
|
||||
function connectDebuggerClient(client) {
|
||||
return client.connect()
|
||||
.then(() => client.listTabs())
|
||||
.then(tabs => {
|
||||
return tabs.tabs[tabs.selected];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for eventName on target.
|
||||
* @param {Object} target An observable object that either supports on/off or
|
||||
|
||||
@@ -27,53 +27,51 @@ window.onload = function() {
|
||||
|
||||
const client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
client.connect().then(function onConnect() {
|
||||
client.listTabs().then(function onListTabs(response) {
|
||||
return client.mainRoot.getFront("device");
|
||||
}).then(function(d) {
|
||||
let desc;
|
||||
const appInfo = Services.appinfo;
|
||||
const utils = window.windowUtils;
|
||||
return client.mainRoot.getFront("device");
|
||||
}).then(function(d) {
|
||||
let desc;
|
||||
const appInfo = Services.appinfo;
|
||||
const utils = window.windowUtils;
|
||||
|
||||
const localDesc = {
|
||||
appid: appInfo.ID,
|
||||
vendor: appInfo.vendor,
|
||||
name: appInfo.name,
|
||||
version: appInfo.version,
|
||||
appbuildid: appInfo.appBuildID,
|
||||
platformbuildid: appInfo.platformBuildID,
|
||||
platformversion: appInfo.platformVersion,
|
||||
geckobuildid: appInfo.platformBuildID,
|
||||
geckoversion: appInfo.platformVersion,
|
||||
useragent: window.navigator.userAgent,
|
||||
locale: Services.locale.appLocaleAsLangTag,
|
||||
os: appInfo.OS,
|
||||
processor: appInfo.XPCOMABI.split("-")[0],
|
||||
compiler: appInfo.XPCOMABI.split("-")[1],
|
||||
dpi: utils.displayDPI,
|
||||
width: window.screen.width,
|
||||
height: window.screen.height,
|
||||
};
|
||||
const localDesc = {
|
||||
appid: appInfo.ID,
|
||||
vendor: appInfo.vendor,
|
||||
name: appInfo.name,
|
||||
version: appInfo.version,
|
||||
appbuildid: appInfo.appBuildID,
|
||||
platformbuildid: appInfo.platformBuildID,
|
||||
platformversion: appInfo.platformVersion,
|
||||
geckobuildid: appInfo.platformBuildID,
|
||||
geckoversion: appInfo.platformVersion,
|
||||
useragent: window.navigator.userAgent,
|
||||
locale: Services.locale.appLocaleAsLangTag,
|
||||
os: appInfo.OS,
|
||||
processor: appInfo.XPCOMABI.split("-")[0],
|
||||
compiler: appInfo.XPCOMABI.split("-")[1],
|
||||
dpi: utils.displayDPI,
|
||||
width: window.screen.width,
|
||||
height: window.screen.height,
|
||||
};
|
||||
|
||||
function checkValues() {
|
||||
for (const key in localDesc) {
|
||||
is(desc[key], localDesc[key], "valid field (" + key + ")");
|
||||
}
|
||||
|
||||
const currProfD = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
const profileDir = currProfD.path;
|
||||
ok(profileDir.includes(desc.profile.length > 0 && desc.profile),
|
||||
"valid profile name");
|
||||
|
||||
client.close().then(() => {
|
||||
DebuggerServer.destroy();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
function checkValues() {
|
||||
for (const key in localDesc) {
|
||||
is(desc[key], localDesc[key], "valid field (" + key + ")");
|
||||
}
|
||||
|
||||
d.getDescription().then(function(v) {
|
||||
desc = v;
|
||||
}).then(checkValues);
|
||||
});
|
||||
const currProfD = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
const profileDir = currProfD.path;
|
||||
ok(profileDir.includes(desc.profile.length > 0 && desc.profile),
|
||||
"valid profile name");
|
||||
|
||||
client.close().then(() => {
|
||||
DebuggerServer.destroy();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
d.getDescription().then(function(v) {
|
||||
desc = v;
|
||||
}).then(checkValues);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -27,75 +27,73 @@ function runTests() {
|
||||
|
||||
const client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
client.connect().then(function onConnect() {
|
||||
client.listTabs().then(function onListTabs(response) {
|
||||
return client.mainRoot.getFront("preference");
|
||||
}).then(function(p) {
|
||||
const prefs = {};
|
||||
return client.mainRoot.getFront("preference");
|
||||
}).then(function(p) {
|
||||
const prefs = {};
|
||||
|
||||
const localPref = {
|
||||
boolPref: true,
|
||||
intPref: 0x1234,
|
||||
charPref: "Hello World",
|
||||
const localPref = {
|
||||
boolPref: true,
|
||||
intPref: 0x1234,
|
||||
charPref: "Hello World",
|
||||
};
|
||||
|
||||
function checkValues() {
|
||||
is(prefs.boolPref, localPref.boolPref, "read/write bool pref");
|
||||
is(prefs.intPref, localPref.intPref, "read/write int pref");
|
||||
is(prefs.charPref, localPref.charPref, "read/write string pref");
|
||||
|
||||
["test.all.bool", "test.all.int", "test.all.string"].forEach(function(key) {
|
||||
let expectedValue;
|
||||
switch (Services.prefs.getPrefType(key)) {
|
||||
case Ci.nsIPrefBranch.PREF_STRING:
|
||||
expectedValue = Services.prefs.getCharPref(key);
|
||||
break;
|
||||
case Ci.nsIPrefBranch.PREF_INT:
|
||||
expectedValue = Services.prefs.getIntPref(key);
|
||||
break;
|
||||
case Ci.nsIPrefBranch.PREF_BOOL:
|
||||
expectedValue = Services.prefs.getBoolPref(key);
|
||||
break;
|
||||
default:
|
||||
ok(false, "unexpected pref type (" + key + ")");
|
||||
break;
|
||||
}
|
||||
|
||||
is(prefs.allPrefs[key].value, expectedValue,
|
||||
"valid preference value (" + key + ")");
|
||||
is(prefs.allPrefs[key].hasUserValue, Services.prefs.prefHasUserValue(key),
|
||||
"valid hasUserValue (" + key + ")");
|
||||
});
|
||||
|
||||
["test.bool", "test.int", "test.string"].forEach(function(key) {
|
||||
ok(!prefs.allPrefs.hasOwnProperty(key), "expect no pref (" + key + ")");
|
||||
is(Services.prefs.getPrefType(key), Ci.nsIPrefBranch.PREF_INVALID,
|
||||
"pref (" + key + ") is clear");
|
||||
});
|
||||
|
||||
client.close().then(() => {
|
||||
DebuggerServer.destroy();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
function updatePrefsProperty(key) {
|
||||
return function(value) {
|
||||
prefs[key] = value;
|
||||
};
|
||||
}
|
||||
|
||||
function checkValues() {
|
||||
is(prefs.boolPref, localPref.boolPref, "read/write bool pref");
|
||||
is(prefs.intPref, localPref.intPref, "read/write int pref");
|
||||
is(prefs.charPref, localPref.charPref, "read/write string pref");
|
||||
|
||||
["test.all.bool", "test.all.int", "test.all.string"].forEach(function(key) {
|
||||
let expectedValue;
|
||||
switch (Services.prefs.getPrefType(key)) {
|
||||
case Ci.nsIPrefBranch.PREF_STRING:
|
||||
expectedValue = Services.prefs.getCharPref(key);
|
||||
break;
|
||||
case Ci.nsIPrefBranch.PREF_INT:
|
||||
expectedValue = Services.prefs.getIntPref(key);
|
||||
break;
|
||||
case Ci.nsIPrefBranch.PREF_BOOL:
|
||||
expectedValue = Services.prefs.getBoolPref(key);
|
||||
break;
|
||||
default:
|
||||
ok(false, "unexpected pref type (" + key + ")");
|
||||
break;
|
||||
}
|
||||
|
||||
is(prefs.allPrefs[key].value, expectedValue,
|
||||
"valid preference value (" + key + ")");
|
||||
is(prefs.allPrefs[key].hasUserValue, Services.prefs.prefHasUserValue(key),
|
||||
"valid hasUserValue (" + key + ")");
|
||||
});
|
||||
|
||||
["test.bool", "test.int", "test.string"].forEach(function(key) {
|
||||
ok(!prefs.allPrefs.hasOwnProperty(key), "expect no pref (" + key + ")");
|
||||
is(Services.prefs.getPrefType(key), Ci.nsIPrefBranch.PREF_INVALID,
|
||||
"pref (" + key + ") is clear");
|
||||
});
|
||||
|
||||
client.close().then(() => {
|
||||
DebuggerServer.destroy();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
function updatePrefsProperty(key) {
|
||||
return function(value) {
|
||||
prefs[key] = value;
|
||||
};
|
||||
}
|
||||
|
||||
p.getAllPrefs().then(updatePrefsProperty("allPrefs"))
|
||||
.then(() => p.setBoolPref("test.bool", localPref.boolPref))
|
||||
.then(() => p.setIntPref("test.int", localPref.intPref))
|
||||
.then(() => p.setCharPref("test.string", localPref.charPref))
|
||||
.then(() => p.getBoolPref("test.bool")).then(updatePrefsProperty("boolPref"))
|
||||
.then(() => p.getIntPref("test.int")).then(updatePrefsProperty("intPref"))
|
||||
.then(() => p.getCharPref("test.string")).then(updatePrefsProperty("charPref"))
|
||||
.then(() => p.clearUserPref("test.bool"))
|
||||
.then(() => p.clearUserPref("test.int"))
|
||||
.then(() => p.clearUserPref("test.string"))
|
||||
.then(checkValues);
|
||||
});
|
||||
p.getAllPrefs().then(updatePrefsProperty("allPrefs"))
|
||||
.then(() => p.setBoolPref("test.bool", localPref.boolPref))
|
||||
.then(() => p.setIntPref("test.int", localPref.intPref))
|
||||
.then(() => p.setCharPref("test.string", localPref.charPref))
|
||||
.then(() => p.getBoolPref("test.bool")).then(updatePrefsProperty("boolPref"))
|
||||
.then(() => p.getIntPref("test.int")).then(updatePrefsProperty("intPref"))
|
||||
.then(() => p.getCharPref("test.string")).then(updatePrefsProperty("charPref"))
|
||||
.then(() => p.clearUserPref("test.bool"))
|
||||
.then(() => p.clearUserPref("test.int"))
|
||||
.then(() => p.clearUserPref("test.string"))
|
||||
.then(checkValues);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"use strict";
|
||||
|
||||
const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const {DebuggerClient} = require("devtools/shared/client/debugger-client");
|
||||
const {DebuggerServer} = require("devtools/server/main");
|
||||
const {TargetFactory} = require("devtools/client/framework/target");
|
||||
|
||||
const Services = require("Services");
|
||||
|
||||
@@ -35,37 +35,24 @@ if (!DebuggerServer.initialized) {
|
||||
* the opened tab and disconnect its debugger client.
|
||||
*/
|
||||
async function attachURL(url) {
|
||||
let win = window.open(url, "_blank");
|
||||
let client = null;
|
||||
|
||||
const cleanup = async function() {
|
||||
if (client) {
|
||||
await client.close();
|
||||
client = null;
|
||||
}
|
||||
if (win) {
|
||||
win.close();
|
||||
win = null;
|
||||
}
|
||||
};
|
||||
SimpleTest.registerCleanupFunction(cleanup);
|
||||
|
||||
client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
await client.connect();
|
||||
const {tabs} = await client.listTabs();
|
||||
const attachedTab = tabs.find(tab => tab.url === url);
|
||||
|
||||
if (!attachedTab) {
|
||||
throw new Error(`Could not find a tab matching URL ${url}`);
|
||||
}
|
||||
|
||||
const [, targetFront] = await client.attachTarget(attachedTab.actor);
|
||||
const [, consoleClient] = await client.attachConsole(attachedTab.consoleActor, []);
|
||||
const tab = await addTab(url);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
const { client } = target;
|
||||
const { consoleActor } = target.form;
|
||||
const [, consoleClient] = await client.attachConsole(consoleActor, []);
|
||||
|
||||
return {
|
||||
tab: attachedTab,
|
||||
targetFront,
|
||||
consoleClient,
|
||||
cleanup,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Naive implementaion of addTab working from a mochitest-chrome test.
|
||||
*/
|
||||
async function addTab(url) {
|
||||
const { gBrowser } = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
const {BrowserTestUtils} = require("resource://testing-common/BrowserTestUtils.jsm");
|
||||
const tab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, url);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
return tab;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ function findTab(tabs, title) {
|
||||
|
||||
function attachTarget(client, tab) {
|
||||
dump("Attaching to tab with title '" + tab.title + "'.\n");
|
||||
return client.attachTarget(tab.actor);
|
||||
return client.attachTarget(tab);
|
||||
}
|
||||
|
||||
function waitForNewSource(threadClient, url) {
|
||||
@@ -327,7 +327,7 @@ function getTestTab(client, title, callback) {
|
||||
// response packet and a TargetFront instance referring to that tab.
|
||||
function attachTestTab(client, title, callback) {
|
||||
getTestTab(client, title, function(tab) {
|
||||
client.attachTarget(tab.actor).then(([response, targetFront]) => {
|
||||
client.attachTarget(tab).then(([response, targetFront]) => {
|
||||
callback(response, targetFront);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -357,13 +357,14 @@ DebuggerClient.prototype = {
|
||||
* Instantiates a new ThreadActor that can be later attached to in order to
|
||||
* debug JS sources in the document.
|
||||
*
|
||||
* @param string targetActor
|
||||
* The target actor ID for the tab to attach.
|
||||
* @param string targetActorForm
|
||||
* The target actor form for the tab to attach.
|
||||
*/
|
||||
attachTarget: async function(targetActor) {
|
||||
let front = this._frontPool.actor(targetActor);
|
||||
attachTarget: async function(targetActorForm) {
|
||||
const actorID = targetActorForm.actor;
|
||||
let front = this._frontPool.actor(actorID);
|
||||
if (!front) {
|
||||
front = new BrowsingContextTargetFront(this, { actor: targetActor });
|
||||
front = new BrowsingContextTargetFront(this, targetActorForm);
|
||||
this._frontPool.manage(front);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,100 +26,91 @@ function initDebuggerServer() {
|
||||
DebuggerServer.allowChromeProcess = true;
|
||||
}
|
||||
|
||||
function connectToDebugger() {
|
||||
async function connectToDebugger() {
|
||||
initCommon();
|
||||
initDebuggerServer();
|
||||
|
||||
const transport = DebuggerServer.connectPipe();
|
||||
const client = new DebuggerClient(transport);
|
||||
|
||||
const dbgState = { dbgClient: client };
|
||||
return new Promise(resolve => {
|
||||
client.connect().then(response => resolve([dbgState, response]));
|
||||
});
|
||||
await client.connect();
|
||||
return client;
|
||||
}
|
||||
|
||||
function attachConsole(listeners, callback) {
|
||||
_attachConsole(listeners, callback);
|
||||
async function attachConsole(listeners, callback) {
|
||||
const { state, response } = await _attachConsole(listeners);
|
||||
callback(state, response);
|
||||
}
|
||||
function attachConsoleToTab(listeners, callback) {
|
||||
_attachConsole(listeners, callback, true);
|
||||
async function attachConsoleToTab(listeners, callback) {
|
||||
const { state, response } = await _attachConsole(listeners, true);
|
||||
callback(state, response);
|
||||
}
|
||||
function attachConsoleToWorker(listeners, callback) {
|
||||
_attachConsole(listeners, callback, true, true);
|
||||
async function attachConsoleToWorker(listeners, callback) {
|
||||
const { state, response } = await _attachConsole(listeners, true, true);
|
||||
callback(state, response);
|
||||
}
|
||||
|
||||
var _attachConsole = async function(
|
||||
listeners, callback, attachToTab, attachToWorker
|
||||
listeners, attachToTab, attachToWorker
|
||||
) {
|
||||
function _onAttachConsole(state, [response, webConsoleClient]) {
|
||||
state.client = webConsoleClient;
|
||||
try {
|
||||
const client = await connectToDebugger();
|
||||
|
||||
callback(state, response);
|
||||
}
|
||||
function _onAttachError(state, response) {
|
||||
console.error("attachConsole failed: " + response.error + " " +
|
||||
response.message);
|
||||
callback(state, response);
|
||||
}
|
||||
|
||||
function waitForMessage(target) {
|
||||
return new Promise(resolve => {
|
||||
target.addEventListener("message", resolve, { once: true });
|
||||
});
|
||||
}
|
||||
|
||||
let [state, response] = await connectToDebugger();
|
||||
if (response.error) {
|
||||
console.error("client.connect() failed: " + response.error + " " +
|
||||
response.message);
|
||||
callback(state, response);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!attachToTab) {
|
||||
const front = await state.dbgClient.mainRoot.getMainProcess();
|
||||
await front.attach();
|
||||
const consoleActor = front.targetForm.consoleActor;
|
||||
state.actor = consoleActor;
|
||||
state.dbgClient.attachConsole(consoleActor, listeners)
|
||||
.then(_onAttachConsole.bind(null, state), _onAttachError.bind(null, state));
|
||||
return;
|
||||
}
|
||||
response = await state.dbgClient.listTabs();
|
||||
if (response.error) {
|
||||
console.error("listTabs failed: " + response.error + " " +
|
||||
response.message);
|
||||
callback(state, response);
|
||||
return;
|
||||
}
|
||||
const tab = response.tabs[response.selected];
|
||||
const [, targetFront] = await state.dbgClient.attachTarget(tab.actor);
|
||||
if (attachToWorker) {
|
||||
const workerName = "console-test-worker.js#" + new Date().getTime();
|
||||
const worker = new Worker(workerName);
|
||||
// Keep a strong reference to the Worker to avoid it being
|
||||
// GCd during the test (bug 1237492).
|
||||
// eslint-disable-next-line camelcase
|
||||
state._worker_ref = worker;
|
||||
await waitForMessage(worker);
|
||||
|
||||
const { workers } = await targetFront.listWorkers();
|
||||
const workerTargetFront = workers.filter(w => w.url == workerName)[0];
|
||||
if (!workerTargetFront) {
|
||||
console.error("listWorkers failed. Unable to find the worker actor\n");
|
||||
return;
|
||||
function waitForMessage(target) {
|
||||
return new Promise(resolve => {
|
||||
target.addEventListener("message", resolve, { once: true });
|
||||
});
|
||||
}
|
||||
await workerTargetFront.attach();
|
||||
await workerTargetFront.attachThread({});
|
||||
state.actor = workerTargetFront.targetForm.consoleActor;
|
||||
state.dbgClient.attachConsole(workerTargetFront.targetForm.consoleActor, listeners)
|
||||
.then(_onAttachConsole.bind(null, state), _onAttachError.bind(null, state));
|
||||
} else {
|
||||
state.actor = tab.consoleActor;
|
||||
state.dbgClient.attachConsole(tab.consoleActor, listeners)
|
||||
.then(_onAttachConsole.bind(null, state), _onAttachError.bind(null, state));
|
||||
|
||||
// Fetch the console actor out of the expected target
|
||||
// ParentProcessTarget / WorkerTarget / FrameTarget
|
||||
let consoleActor, worker;
|
||||
if (!attachToTab) {
|
||||
const front = await client.mainRoot.getMainProcess();
|
||||
await front.attach();
|
||||
consoleActor = front.targetForm.consoleActor;
|
||||
} else {
|
||||
const form = await client.getTab();
|
||||
const [, targetFront] = await client.attachTarget(form.tab);
|
||||
if (attachToWorker) {
|
||||
const workerName = "console-test-worker.js#" + new Date().getTime();
|
||||
worker = new Worker(workerName);
|
||||
await waitForMessage(worker);
|
||||
|
||||
const { workers } = await targetFront.listWorkers();
|
||||
const workerTargetFront = workers.filter(w => w.url == workerName)[0];
|
||||
if (!workerTargetFront) {
|
||||
console.error("listWorkers failed. Unable to find the worker actor\n");
|
||||
return null;
|
||||
}
|
||||
await workerTargetFront.attach();
|
||||
await workerTargetFront.attachThread({});
|
||||
consoleActor = workerTargetFront.targetForm.consoleActor;
|
||||
} else {
|
||||
consoleActor = targetFront.targetForm.consoleActor;
|
||||
}
|
||||
}
|
||||
|
||||
// Instantiate the WebConsoleClient
|
||||
const [ response, webConsoleClient ] = await client.attachConsole(consoleActor,
|
||||
listeners);
|
||||
return {
|
||||
state: {
|
||||
dbgClient: client,
|
||||
client: webConsoleClient,
|
||||
actor: consoleActor,
|
||||
// Keep a strong reference to the Worker to avoid it being
|
||||
// GCd during the test (bug 1237492).
|
||||
// eslint-disable-next-line camelcase
|
||||
_worker_ref: worker,
|
||||
},
|
||||
response,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error(`attachConsole failed: ${error.error} ${error.message} - ` +
|
||||
error.stack);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
function closeDebugger(state, callback) {
|
||||
|
||||
@@ -286,6 +286,19 @@ nsDOMWindowUtils::GetWebRenderBridge()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SyncFlushCompositor()
|
||||
{
|
||||
if (nsIWidget* widget = GetWidget()) {
|
||||
if (LayerManager* lm = widget->GetLayerManager()) {
|
||||
if (KnowsCompositor* kc = lm->AsKnowsCompositor()) {
|
||||
kc->SyncWithCompositor();
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetImageAnimationMode(uint16_t *aMode)
|
||||
{
|
||||
|
||||
@@ -239,10 +239,6 @@ WebGLContext::ValidateInvalidateFramebuffer(GLenum target,
|
||||
|
||||
////
|
||||
|
||||
if (!fb) {
|
||||
mDefaultFB_IsInvalid = true;
|
||||
mResolvedDefaultFB = nullptr;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,9 +52,12 @@ public:
|
||||
* every form submission.
|
||||
*
|
||||
* @param aElement element which the attribute/value pair is submitted for
|
||||
* @param aName value of the form element name attribute about to be submitted
|
||||
* @param aValue On entry it contains the value about to be submitted for aName.
|
||||
* On exit it contains the value which will actually be submitted for aName.
|
||||
* @param aName value of the form element name attribute about to be
|
||||
* submitted
|
||||
* @param aValue On entry it contains the value about to be submitted
|
||||
* for aName.
|
||||
* On exit it contains the value which will actually be
|
||||
* submitted for aName.
|
||||
*
|
||||
*/
|
||||
virtual nsresult ProcessValue(mozilla::dom::Element* aElement,
|
||||
@@ -75,8 +78,10 @@ public:
|
||||
* content which comes from a source other than the document (i.e. a local database)
|
||||
*
|
||||
* @param aFormType Type of form to get content for.
|
||||
* @param aOptions List of nsStrings which define the contents for the form element
|
||||
* @param aAttr Attribute to be attached to the form element. It is used to identify
|
||||
* @param aOptions List of nsStrings which define the contents for the
|
||||
* form element
|
||||
* @param aAttr Attribute to be attached to the form element. It is
|
||||
* used to identify
|
||||
* the form element contains non-standard content.
|
||||
*/
|
||||
|
||||
|
||||
@@ -54,7 +54,8 @@ namespace indexedDB {
|
||||
When encoding strings, we use variable-size encoding per the following table
|
||||
|
||||
Chars 0 - 7E are encoded as 0xxxxxxx with 1 added
|
||||
Chars 7F - (3FFF+7F) are encoded as 10xxxxxx xxxxxxxx with 7F subtracted
|
||||
Chars 7F - (3FFF+7F) are encoded as 10xxxxxx xxxxxxxx with 7F
|
||||
subtracted
|
||||
Chars (3FFF+80) - FFFF are encoded as 11xxxxxx xxxxxxxx xx000000
|
||||
|
||||
This ensures that the first byte is never encoded as 0, which means that the
|
||||
|
||||
@@ -1994,6 +1994,8 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
const long DIRECTION_LTR = 0;
|
||||
const long DIRECTION_RTL = 1;
|
||||
const long DIRECTION_NOT_SET = 2;
|
||||
|
||||
void syncFlushCompositor();
|
||||
};
|
||||
|
||||
[scriptable, uuid(c694e359-7227-4392-a138-33c0cc1f15a6)]
|
||||
|
||||
@@ -152,7 +152,8 @@ class Pledge;
|
||||
*
|
||||
* DOMStream A
|
||||
* Input Owned Playback
|
||||
* t1 ---------> t1 <- MediaStreamTrack X (removed)
|
||||
* t1 ---------> t1 <- MediaStreamTrack X
|
||||
* (removed)
|
||||
* (pointing to t1 in A)
|
||||
* t2 ---------> t2 ------------> t2 <- MediaStreamTrack Y
|
||||
* \ (pointing to t2 in A)
|
||||
@@ -160,7 +161,8 @@ class Pledge;
|
||||
* \ / (pointing to t1 in B)
|
||||
* DOMStream B \ /
|
||||
* Input \ Owned / Playback
|
||||
* t1 ---^-----> t1 --- <- MediaStreamTrack Z (removed)
|
||||
* t1 ---^-----> t1 --- <- MediaStreamTrack Z
|
||||
* (removed)
|
||||
* \ \ (pointing to t1 in B)
|
||||
* \ \
|
||||
* DOMStream A' \ \
|
||||
|
||||
@@ -276,7 +276,8 @@ void DynamicsCompressorKernel::process(float* sourceChannels[],
|
||||
float y4 = releaseFrames * releaseZone4;
|
||||
|
||||
// All of these coefficients were derived for 4th order polynomial curve fitting where the y values
|
||||
// match the evenly spaced x values as follows: (y1 : x == 0, y2 : x == 1, y3 : x == 2, y4 : x == 3)
|
||||
// match the evenly spaced x values as follows:
|
||||
// (y1 : x == 0, y2 : x == 1, y3 : x == 2, y4 : x == 3)
|
||||
float kA = 0.9999999999999998f*y1 + 1.8432219684323923e-16f*y2 - 1.9373394351676423e-16f*y3 + 8.824516011816245e-18f*y4;
|
||||
float kB = -1.5788320352845888f*y1 + 2.3305837032074286f*y2 - 0.9141194204840429f*y3 + 0.1623677525612032f*y4;
|
||||
float kC = 0.5334142869106424f*y1 - 1.272736789213631f*y2 + 0.9258856042207512f*y3 - 0.18656310191776226f*y4;
|
||||
|
||||
@@ -42,10 +42,12 @@ class HRTFDatabase {
|
||||
public:
|
||||
static nsReturnRef<HRTFDatabase> create(float sampleRate);
|
||||
|
||||
// clang-format off
|
||||
// getKernelsFromAzimuthElevation() returns a left and right ear kernel, and an interpolated left and right frame delay for the given azimuth and elevation.
|
||||
// azimuthBlend must be in the range 0 -> 1.
|
||||
// Valid values for azimuthIndex are 0 -> HRTFElevation::NumberOfTotalAzimuths - 1 (corresponding to angles of 0 -> 360).
|
||||
// Valid values for elevationAngle are MinElevation -> MaxElevation.
|
||||
// clang-format on
|
||||
void getKernelsFromAzimuthElevation(double azimuthBlend, unsigned azimuthIndex, double elevationAngle, HRTFKernel* &kernelL, HRTFKernel* &kernelR, double& frameDelayL, double& frameDelayR);
|
||||
|
||||
// Returns the number of different azimuth angles.
|
||||
|
||||
@@ -43,7 +43,8 @@ using mozilla::FFTBlock;
|
||||
// HRTFKernel is a frequency-domain representation of an impulse-response used as part of the spatialized panning system.
|
||||
// For a given azimuth / elevation angle there will be one HRTFKernel for the left ear transfer function, and one for the right ear.
|
||||
// The leading delay (average group delay) for each impulse response is extracted:
|
||||
// m_fftFrame is the frequency-domain representation of the impulse response with the delay removed
|
||||
// m_fftFrame is the frequency-domain representation of the impulse
|
||||
// response with the delay removed
|
||||
// m_frameDelay is the leading delay of the original impulse response.
|
||||
class HRTFKernel {
|
||||
public:
|
||||
|
||||
@@ -117,7 +117,8 @@ void IIRFilter::getFrequencyResponse(int nFrequencies, const float* frequency, f
|
||||
//
|
||||
// H(z) = sum(b[k]*z^(-k), k, 0, M) / sum(a[k]*z^(-k), k, 0, N);
|
||||
//
|
||||
// The desired frequency response is H(exp(j*omega)), where omega is in [0, 1).
|
||||
// The desired frequency response is H(exp(j*omega)), where omega is in
|
||||
// [0, 1).
|
||||
//
|
||||
// Let P(x) = sum(c[k]*x^k, k, 0, P) be a polynomial of order P. Then each of the sums in H(z)
|
||||
// is equivalent to evaluating a polynomial at the point 1/z.
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
#define NP_VERSION_MINOR 29
|
||||
|
||||
|
||||
/* clang-format off */
|
||||
/* The OS/2 version of Netscape uses RC_DATA to define the
|
||||
mime types, file extensions, etc that are required.
|
||||
Use a vertical bar to separate types, end types with \0.
|
||||
@@ -88,6 +89,7 @@ RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\
|
||||
RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" }
|
||||
RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" }
|
||||
*/
|
||||
/* clang-format on */
|
||||
/* RC_DATA types for version info - required */
|
||||
#define NP_INFO_ProductVersion 1
|
||||
#define NP_INFO_MIMEType 2
|
||||
|
||||
@@ -31,8 +31,9 @@
|
||||
// 2. You can combine logs and levels by separating them with a comma:
|
||||
// My favorite Win32 Example: SET MOZ_LOG=Plugin:5,PluginNPP:5,PluginNPN:5
|
||||
|
||||
// 3. Instead of output going to the console, you can log to a file. Additionally, set the
|
||||
// MOZ_LOG_FILE environment variable to point to the full path of a file.
|
||||
// 3. Instead of output going to the console, you can log to a file.
|
||||
// Additionally, set the MOZ_LOG_FILE environment variable to point to the
|
||||
// full path of a file.
|
||||
// My favorite Win32 Example: SET MOZ_LOG_FILE=c:\temp\pluginLog.txt
|
||||
|
||||
// 4. For complete information see the Gecko Developer guide:
|
||||
|
||||
@@ -54,7 +54,8 @@
|
||||
* Use a subclass instead of a typedef if you need to maintain data or state.
|
||||
*
|
||||
* Step 2: Add an instance of that object to the FunctionHookList in
|
||||
* AddFunctionHook(FunctionHookList&) or AddBrokeredFunctionHook(FunctionHookList&).
|
||||
* AddFunctionHook(FunctionHookList&) or
|
||||
* AddBrokeredFunctionHook(FunctionHookList&).
|
||||
* This typically just means calling the constructor with the correct info.
|
||||
* At a minimum, this means supplying the names of the DLL and method to
|
||||
* broker, and a pointer to the original version of the method.
|
||||
@@ -81,7 +82,9 @@
|
||||
* parameters are sent/returned. This example tells InternetWriteFileFB to
|
||||
* return its third parameter:
|
||||
* template<> template<>
|
||||
* struct InternetWriteFileFB::Response::Info::ShouldMarshal<3> { static const bool value = true; };
|
||||
* struct InternetWriteFileFB::Response::Info::ShouldMarshal<3> {
|
||||
* static const bool value = true;
|
||||
* };
|
||||
* By default, all parameters have ShouldMarshal set in the request phase
|
||||
* and only the return value (parameter -1) has it set in the response phase.
|
||||
*
|
||||
@@ -113,13 +116,16 @@
|
||||
* length. Something like:
|
||||
*
|
||||
* typedef RequestHandler<ID_HookedFunc,
|
||||
* int HOOK_CALL (nsDependentCSubstring)> HookedFuncDelegateReq;
|
||||
* int HOOK_CALL (nsDependentCSubstring)>
|
||||
* HookedFuncDelegateReq;
|
||||
*
|
||||
* template<>
|
||||
* void HookedFuncFB::Request::Marshal(IpdlTuple& aTuple, const void*& aBuf, const int& aBufLen)
|
||||
* void HookedFuncFB::Request::Marshal(IpdlTuple& aTuple, const void*& aBuf,
|
||||
* const int& aBufLen)
|
||||
* {
|
||||
* MOZ_ASSERT(nWritten);
|
||||
* HookedFuncDelegateReq::Marshal(aTuple, nsDependentCSubstring(aBuf, aBufLen));
|
||||
* HookedFuncDelegateReq::Marshal(aTuple,
|
||||
* nsDependentCSubstring(aBuf, aBufLen));
|
||||
* }
|
||||
*
|
||||
* template<>
|
||||
|
||||
@@ -2456,7 +2456,8 @@ convertPointY(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVaria
|
||||
static bool
|
||||
streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
|
||||
{
|
||||
// .streamTest(url, doPost, postData, writeCallback, notifyCallback, redirectCallback, allowRedirects, postFile = false)
|
||||
// .streamTest(url, doPost, postData, writeCallback, notifyCallback,
|
||||
// redirectCallback, allowRedirects, postFile = false)
|
||||
if (!(7 <= argCount && argCount <= 8))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -1144,7 +1144,8 @@ PresentationControllingInfo::NotifyData(const nsACString& aData, bool aIsBinary)
|
||||
* During presentation session establishment, the receiver expects the following
|
||||
* after trying to launch the app by notifying "presentation-launch-receiver":
|
||||
* (The order between step 2 and 3 is not guaranteed.)
|
||||
* 1. |Observe| of |nsIObserver| is called with "presentation-receiver-launched".
|
||||
* 1. |Observe| of |nsIObserver| is called with
|
||||
* "presentation-receiver-launched".
|
||||
* Then start listen to document |STATE_TRANSFERRING| event.
|
||||
* 2. |NotifyResponderReady| is called to indicate the receiver page is ready
|
||||
* for presentation use.
|
||||
|
||||
@@ -29,7 +29,8 @@ class WorkerPrivate;
|
||||
// 1. Create a Promise on the worker thread and return it to the content
|
||||
// script:
|
||||
//
|
||||
// RefPtr<Promise> promise = Promise::Create(workerPrivate->GlobalScope(), aRv);
|
||||
// RefPtr<Promise> promise =
|
||||
// Promise::Create(workerPrivate->GlobalScope(), aRv);
|
||||
// if (aRv.Failed()) {
|
||||
// return nullptr;
|
||||
// }
|
||||
@@ -79,7 +80,8 @@ class WorkerPrivate;
|
||||
// worker.
|
||||
//
|
||||
// RefPtr<FinishTaskWorkerRunnable> runnable =
|
||||
// new FinishTaskWorkerRunnable(proxy->GetWorkerPrivate(), proxy, result);
|
||||
// new FinishTaskWorkerRunnable(proxy->GetWorkerPrivate(), proxy,
|
||||
// result);
|
||||
// if (!r->Dispatch()) {
|
||||
// // Worker is alive but not Running any more, so the Promise can't
|
||||
// // be resolved, give up. The proxy will get Release()d at some
|
||||
|
||||
@@ -549,10 +549,12 @@ nsCSPContext::GetAllowsInline(nsContentPolicyType aContentType,
|
||||
*
|
||||
* @param violationType: the VIOLATION_TYPE_* constant (partial symbol)
|
||||
* such as INLINE_SCRIPT
|
||||
* @param contentPolicyType: a constant from nsIContentPolicy such as TYPE_STYLESHEET
|
||||
* @param contentPolicyType: a constant from nsIContentPolicy such as
|
||||
* TYPE_STYLESHEET
|
||||
* @param nonceOrHash: for NONCE and HASH violations, it's the nonce or content
|
||||
* string. For other violations, it is an empty string.
|
||||
* @param keyword: the keyword corresponding to violation (UNSAFE_INLINE for most)
|
||||
* @param keyword: the keyword corresponding to violation (UNSAFE_INLINE for
|
||||
* most)
|
||||
* @param observerTopic: the observer topic string to send with the CSP
|
||||
* observer notifications.
|
||||
*
|
||||
|
||||
@@ -123,7 +123,8 @@ class nsCSPParser {
|
||||
* are stored in mTokens, for example:
|
||||
* mTokens = [ [ script-src, http://www.example.com, 'self' ], ... ]
|
||||
*
|
||||
* When parsing starts, mCurdir always holds the currently processed array of strings.
|
||||
* When parsing starts, mCurdir always holds the currently processed array of
|
||||
* strings.
|
||||
* In our example:
|
||||
* mCurDir = [ script-src, http://www.example.com, 'self' ]
|
||||
*
|
||||
@@ -133,20 +134,22 @@ class nsCSPParser {
|
||||
* mCurToken = script-src
|
||||
* which allows to do simple string comparisons to see if mCurToken is a valid directive.
|
||||
*
|
||||
* Continuing parsing, the parser consumes the next string of that array, resetting:
|
||||
* Continuing parsing, the parser consumes the next string of that array,
|
||||
* resetting:
|
||||
* mCurToken = "http://www.example.com"
|
||||
* ^ ^
|
||||
* mCurChar mEndChar (points *after* the 'm')
|
||||
* mCurValue = ""
|
||||
*
|
||||
* After calling advance() the first time, helpers would hold the following values:
|
||||
* After calling advance() the first time, helpers would hold the following
|
||||
* values:
|
||||
* mCurToken = "http://www.example.com"
|
||||
* ^ ^
|
||||
* mCurChar mEndChar (points *after* the 'm')
|
||||
* mCurValue = "h"
|
||||
*
|
||||
* We continue parsing till all strings of one directive are consumed, then we reset
|
||||
* mCurDir to hold the next array of strings and start the process all over.
|
||||
* We continue parsing till all strings of one directive are consumed, then we
|
||||
* reset mCurDir to hold the next array of strings and start the process all over.
|
||||
*/
|
||||
|
||||
const char16_t* mCurChar;
|
||||
|
||||
@@ -642,9 +642,10 @@ nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect,
|
||||
// In this case we use aRequestingLocation to set requestingLocation.
|
||||
// b) TYPE_CSP_REPORT which does not provide a context. In this case we
|
||||
// use aRequestingLocation to set requestingLocation.
|
||||
// c) content scripts from addon code that do not provide aRequestingContext
|
||||
// or aRequestingLocation, but do provide aRequestPrincipal.
|
||||
// If aRequestPrincipal is an expanded principal, we allow the load.
|
||||
// c) content scripts from addon code that do not provide
|
||||
// aRequestingContext or aRequestingLocation, but do provide
|
||||
// aRequestPrincipal. If aRequestPrincipal is an expanded principal,
|
||||
// we allow the load.
|
||||
// 4) If we still end up not having a requestingLocation, we reject the load.
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
|
||||
@@ -179,6 +179,7 @@ TEST(CSPParser, Directives)
|
||||
{
|
||||
static const PolicyTest policies[] =
|
||||
{
|
||||
// clang-format off
|
||||
{ "connect-src xn--mnchen-3ya.de",
|
||||
"connect-src http://xn--mnchen-3ya.de"},
|
||||
{ "default-src http://www.example.com",
|
||||
@@ -221,6 +222,7 @@ TEST(CSPParser, Directives)
|
||||
"worker-src https://example.com" },
|
||||
{ "worker-src http://worker.com; frame-src http://frame.com; child-src http://child.com",
|
||||
"worker-src http://worker.com; frame-src http://frame.com; child-src http://child.com" },
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest);
|
||||
@@ -233,6 +235,7 @@ TEST(CSPParser, Keywords)
|
||||
{
|
||||
static const PolicyTest policies[] =
|
||||
{
|
||||
// clang-format off
|
||||
{ "script-src 'self'",
|
||||
"script-src 'self'" },
|
||||
{ "script-src 'unsafe-inline'",
|
||||
@@ -245,18 +248,20 @@ TEST(CSPParser, Keywords)
|
||||
"script-src 'none'" },
|
||||
{ "img-src 'none'; script-src 'unsafe-eval' 'unsafe-inline'; default-src 'self'",
|
||||
"img-src 'none'; script-src 'unsafe-eval' 'unsafe-inline'; default-src 'self'" },
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest);
|
||||
ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1)));
|
||||
}
|
||||
|
||||
// ============================= TestIgnoreUpperLowerCasePolicies ========================
|
||||
// =================== TestIgnoreUpperLowerCasePolicies ==============
|
||||
|
||||
TEST(CSPParser, IgnoreUpperLowerCasePolicies)
|
||||
{
|
||||
static const PolicyTest policies[] =
|
||||
{
|
||||
// clang-format off
|
||||
{ "script-src 'SELF'",
|
||||
"script-src 'self'" },
|
||||
{ "sCriPt-src 'Unsafe-Inline'",
|
||||
@@ -289,18 +294,20 @@ TEST(CSPParser, IgnoreUpperLowerCasePolicies)
|
||||
"sandbox allow-forms"},
|
||||
{ "require-SRI-for sCript stYle",
|
||||
"require-sri-for script style"},
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest);
|
||||
ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1)));
|
||||
}
|
||||
|
||||
// ============================= TestPaths ========================
|
||||
// ========================= TestPaths ===============================
|
||||
|
||||
TEST(CSPParser, Paths)
|
||||
{
|
||||
static const PolicyTest policies[] =
|
||||
{
|
||||
// clang-format off
|
||||
{ "script-src http://www.example.com",
|
||||
"script-src http://www.example.com" },
|
||||
{ "script-src http://www.example.com/",
|
||||
@@ -387,18 +394,20 @@ TEST(CSPParser, Paths)
|
||||
"script-src http://www.example.com:88/.js" },
|
||||
{ "script-src https://foo.com/_abc/abc_/_/_a_b_c_",
|
||||
"script-src https://foo.com/_abc/abc_/_/_a_b_c_" }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest);
|
||||
ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1)));
|
||||
}
|
||||
|
||||
// ============================= TestSimplePolicies ========================
|
||||
// ======================== TestSimplePolicies =======================
|
||||
|
||||
TEST(CSPParser, SimplePolicies)
|
||||
{
|
||||
static const PolicyTest policies[] =
|
||||
{
|
||||
// clang-format off
|
||||
{ "default-src *",
|
||||
"default-src *" },
|
||||
{ "default-src https:",
|
||||
@@ -463,18 +472,20 @@ TEST(CSPParser, SimplePolicies)
|
||||
"upgrade-insecure-requests" },
|
||||
{ "sandbox allow-scripts allow-forms ",
|
||||
"sandbox allow-scripts allow-forms" },
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest);
|
||||
ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1)));
|
||||
}
|
||||
|
||||
// ============================= TestPoliciesWithInvalidSrc ========================
|
||||
// =================== TestPoliciesWithInvalidSrc ====================
|
||||
|
||||
TEST(CSPParser, PoliciesWithInvalidSrc)
|
||||
{
|
||||
static const PolicyTest policies[] =
|
||||
{
|
||||
// clang-format off
|
||||
{ "script-src 'self'; SCRIPT-SRC http://www.example.com",
|
||||
"script-src 'self'" },
|
||||
{ "script-src 'none' test.com; script-src example.com",
|
||||
@@ -557,6 +568,7 @@ TEST(CSPParser, PoliciesWithInvalidSrc)
|
||||
"require-sri-for script"},
|
||||
{ "sandbox foo",
|
||||
"sandbox"},
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
// amount of tests - 1, because the latest should be ignored.
|
||||
@@ -564,12 +576,13 @@ TEST(CSPParser, PoliciesWithInvalidSrc)
|
||||
ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1)));
|
||||
}
|
||||
|
||||
// ============================= TestBadPolicies ========================
|
||||
// ============================= TestBadPolicies =======================
|
||||
|
||||
TEST(CSPParser, BadPolicies)
|
||||
{
|
||||
static const PolicyTest policies[] =
|
||||
{
|
||||
// clang-format off
|
||||
{ "script-sr 'self", "" },
|
||||
{ "", "" },
|
||||
{ "; ; ; ; ; ; ;", "" },
|
||||
@@ -580,18 +593,20 @@ TEST(CSPParser, BadPolicies)
|
||||
{ "require-sri-for foo", ""},
|
||||
{ "report-uri", ""},
|
||||
{ "report-uri http://:foo", ""},
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest);
|
||||
ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 0)));
|
||||
}
|
||||
|
||||
// ============================= TestGoodGeneratedPolicies ========================
|
||||
// ======================= TestGoodGeneratedPolicies =================
|
||||
|
||||
TEST(CSPParser, GoodGeneratedPolicies)
|
||||
{
|
||||
static const PolicyTest policies[] =
|
||||
{
|
||||
// clang-format off
|
||||
{ "default-src 'self'; img-src *",
|
||||
"default-src 'self'; img-src *" },
|
||||
{ "report-uri /policy",
|
||||
@@ -808,18 +823,20 @@ TEST(CSPParser, GoodGeneratedPolicies)
|
||||
"default-src 'self'; frame-ancestors 'self'" },
|
||||
{ "frame-ancestors http://bar.com/foo.png",
|
||||
"frame-ancestors http://bar.com/foo.png" },
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest);
|
||||
ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1)));
|
||||
}
|
||||
|
||||
// ============================= TestBadGeneratedPolicies ========================
|
||||
// ==================== TestBadGeneratedPolicies ====================
|
||||
|
||||
TEST(CSPParser, BadGeneratedPolicies)
|
||||
{
|
||||
static const PolicyTest policies[] =
|
||||
{
|
||||
// clang-format off
|
||||
{ "foo.*.bar", ""},
|
||||
{ "foo!bar.com", ""},
|
||||
{ "x.*.a.com", ""},
|
||||
@@ -834,13 +851,14 @@ TEST(CSPParser, BadGeneratedPolicies)
|
||||
{ "http://other:[email protected]/foo", ""},
|
||||
{ "http://user1:[email protected]/foo", ""},
|
||||
{ "http://username:[email protected]/bar", ""},
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest);
|
||||
ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 0)));
|
||||
}
|
||||
|
||||
// ============ TestGoodGeneratedPoliciesForPathHandling ============
|
||||
// ============ TestGoodGeneratedPoliciesForPathHandling =============
|
||||
|
||||
TEST(CSPParser, GoodGeneratedPoliciesForPathHandling)
|
||||
{
|
||||
@@ -849,6 +867,7 @@ TEST(CSPParser, GoodGeneratedPoliciesForPathHandling)
|
||||
|
||||
static const PolicyTest policies[] =
|
||||
{
|
||||
// clang-format off
|
||||
{ "img-src http://test1.example.com",
|
||||
"img-src http://test1.example.com" },
|
||||
{ "img-src http://test1.example.com/",
|
||||
@@ -957,18 +976,20 @@ TEST(CSPParser, GoodGeneratedPoliciesForPathHandling)
|
||||
"img-src https://test1.example.com/abc////////////def/" },
|
||||
{ "img-src https://test1.example.com/abc////////////",
|
||||
"img-src https://test1.example.com/abc////////////" },
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest);
|
||||
ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1)));
|
||||
}
|
||||
|
||||
// ============ TestBadGeneratedPoliciesForPathHandling ============
|
||||
// ============== TestBadGeneratedPoliciesForPathHandling ============
|
||||
|
||||
TEST(CSPParser, BadGeneratedPoliciesForPathHandling)
|
||||
{
|
||||
static const PolicyTest policies[] =
|
||||
{
|
||||
// clang-format off
|
||||
{ "img-src test1.example.com:88path-1/",
|
||||
"img-src 'none'" },
|
||||
{ "img-src test1.example.com:80.js",
|
||||
@@ -983,13 +1004,14 @@ TEST(CSPParser, BadGeneratedPoliciesForPathHandling)
|
||||
"img-src 'none'" },
|
||||
{ "img-src http://test1.example.com:80abc",
|
||||
"img-src 'none'" },
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest);
|
||||
ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1)));
|
||||
}
|
||||
|
||||
// ============================= TestFuzzyPolicies ========================
|
||||
// ======================== TestFuzzyPolicies ========================
|
||||
|
||||
// Use a policy, eliminate one character at a time,
|
||||
// and feed it as input to the parser.
|
||||
@@ -1010,7 +1032,7 @@ TEST(CSPParser, ShorteningPolicies)
|
||||
}
|
||||
}
|
||||
|
||||
// ============================= TestFuzzyPolicies ========================
|
||||
// ============================= TestFuzzyPolicies ===================
|
||||
|
||||
// We generate kFuzzyRuns inputs by (pseudo) randomly picking from the 128
|
||||
// ASCII characters; feed them to the parser and verfy that the parser
|
||||
@@ -1045,7 +1067,7 @@ TEST(CSPParser, FuzzyPolicies)
|
||||
|
||||
#endif
|
||||
|
||||
// ============================= TestFuzzyPoliciesIncDir ========================
|
||||
// ======================= TestFuzzyPoliciesIncDir ===================
|
||||
|
||||
// In a similar fashion as in TestFuzzyPolicies, we again (pseudo) randomly
|
||||
// generate input for the parser, but this time also include a valid directive
|
||||
@@ -1085,7 +1107,7 @@ TEST(CSPParser, FuzzyPoliciesIncDir)
|
||||
|
||||
#endif
|
||||
|
||||
// ============================= TestFuzzyPoliciesIncDirLimASCII ==============
|
||||
// ====================== TestFuzzyPoliciesIncDirLimASCII ============
|
||||
|
||||
// Same as TestFuzzyPoliciesIncDir() but using limited ASCII,
|
||||
// which represents more likely input.
|
||||
|
||||
@@ -2757,12 +2757,12 @@ ServiceWorkerManager::RemoveRegistration(ServiceWorkerRegistrationInfo* aRegistr
|
||||
{
|
||||
// Note, we do not need to call mActor->SendUnregister() here. There are a few
|
||||
// ways we can get here:
|
||||
// 1) Through a normal unregister which calls SendUnregister() in the unregister
|
||||
// job Start() method.
|
||||
// 1) Through a normal unregister which calls SendUnregister() in the
|
||||
// unregister job Start() method.
|
||||
// 2) Through origin storage being purged. These result in ForceUnregister()
|
||||
// starting unregister jobs which in turn call SendUnregister().
|
||||
// 3) Through the failure to install a new service worker. Since we don't store
|
||||
// the registration until install succeeds, we do not need to call
|
||||
// 3) Through the failure to install a new service worker. Since we don't
|
||||
// store the registration until install succeeds, we do not need to call
|
||||
// SendUnregister here.
|
||||
// Assert these conditions by testing for pending uninstall (cases 1 and 2) or
|
||||
// null workers (case 3).
|
||||
|
||||
@@ -128,7 +128,8 @@ public: // WebIDL interface:
|
||||
// webIDL: readonly attribute DOMString protocol;
|
||||
void GetProtocol(nsAString& aResult);
|
||||
|
||||
// webIDL: void close(optional unsigned short code, optional DOMString reason):
|
||||
// webIDL: void close(optional unsigned short code,
|
||||
// optional DOMString reason):
|
||||
void Close(const Optional<uint16_t>& aCode,
|
||||
const Optional<nsAString>& aReason,
|
||||
ErrorResult& aRv);
|
||||
|
||||
@@ -97,7 +97,7 @@ static const JSClass gPrototypeJSClass = {
|
||||
&gPrototypeJSClassOps
|
||||
};
|
||||
|
||||
// Implementation /////////////////////////////////////////////////////////////////
|
||||
// Implementation //////////////////////////////////////////////////////////////
|
||||
|
||||
// Constructors/Destructors
|
||||
nsXBLBinding::nsXBLBinding(nsXBLPrototypeBinding* aBinding)
|
||||
@@ -808,7 +808,7 @@ nsXBLBinding::GetServoStyles() const
|
||||
return mPrototypeBinding->GetServoStyles();
|
||||
}
|
||||
|
||||
// Internal helper methods ////////////////////////////////////////////////////////////////
|
||||
// Internal helper methods /////////////////////////////////////////////////////
|
||||
|
||||
// Get or create a WeakMap object on a given XBL-hosting global.
|
||||
//
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
// Helper Classes =====================================================================
|
||||
// Helper Classes ==============================================================
|
||||
|
||||
// nsXBLAttributeEntry and helpers. This class is used to efficiently handle
|
||||
// attribute changes in anonymous content.
|
||||
@@ -105,7 +105,7 @@ nsXBLAttributeEntry::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
|
||||
// =============================================================================
|
||||
|
||||
// Implementation /////////////////////////////////////////////////////////////////
|
||||
// Implementation //////////////////////////////////////////////////////////////
|
||||
|
||||
// Constructors/Destructors
|
||||
nsXBLPrototypeBinding::nsXBLPrototypeBinding()
|
||||
@@ -456,7 +456,7 @@ nsXBLPrototypeBinding::ImplementsInterface(REFNSIID aIID) const
|
||||
return !!mInterfaceTable.GetWeak(aIID);
|
||||
}
|
||||
|
||||
// Internal helpers ///////////////////////////////////////////////////////////////////////
|
||||
// Internal helpers ////////////////////////////////////////////////////////////
|
||||
|
||||
Element*
|
||||
nsXBLPrototypeBinding::GetImmediateChild(nsAtom* aTag)
|
||||
|
||||
@@ -346,7 +346,7 @@ nsXBLStreamListener::HandleEvent(Event* aEvent)
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Implementation /////////////////////////////////////////////////////////////////
|
||||
// Implementation //////////////////////////////////////////////////////////////
|
||||
|
||||
// Implement our nsISupports methods
|
||||
NS_IMPL_ISUPPORTS(nsXBLService, nsISupportsWeakReference)
|
||||
@@ -717,7 +717,7 @@ nsXBLService::DetachGlobalKeyHandler(EventTarget* aTarget)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Internal helper methods ////////////////////////////////////////////////////////////////
|
||||
// Internal helper methods /////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
nsXBLService::BindingReady(nsIContent* aBoundElement,
|
||||
|
||||
@@ -135,7 +135,8 @@ public:
|
||||
void* remove();
|
||||
|
||||
/**
|
||||
* Resets the current location within the txList to the beginning of the txList
|
||||
* Resets the current location within the txList to the beginning of the
|
||||
* txList
|
||||
**/
|
||||
void reset();
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
|
||||
/**
|
||||
* Creates a new BooleanResult with the value of the given bool parameter
|
||||
* @param boolean the bool to use for initialization of this BooleanResult's value
|
||||
* @param boolean the bool to use for initialization of this BooleanResult's
|
||||
* value
|
||||
**/
|
||||
BooleanResult::BooleanResult(bool boolean)
|
||||
: txAExprResult(nullptr)
|
||||
|
||||
@@ -567,7 +567,8 @@ SetDocumentStateCommand::GetCommandStateParams(const char* aCommandName,
|
||||
* 2. Implement an nsIObserve object, e.g:
|
||||
*
|
||||
* void Observe(
|
||||
* in nsISupports aSubject, // The nsICommandManager calling this Observer
|
||||
* in nsISupports aSubject, // The nsICommandManager calling this
|
||||
* // Observer
|
||||
* in string aTopic, // command name, e.g.:"obs_documentCreated"
|
||||
* // or "obs_documentWillBeDestroyed"
|
||||
in wstring aData ); // ignored (set to "command_status_changed")
|
||||
@@ -578,7 +579,8 @@ SetDocumentStateCommand::GetCommandStateParams(const char* aCommandName,
|
||||
* trigger the notification of this observer by something like:
|
||||
*
|
||||
* nsCOMPtr<nsICommandManager> commandManager = mDocShell->GetCommandManager();
|
||||
* nsCOMPtr<nsPICommandUpdater> commandUpdater = do_QueryInterface(commandManager);
|
||||
* nsCOMPtr<nsPICommandUpdater> commandUpdater =
|
||||
* do_QueryInterface(commandManager);
|
||||
* NS_ENSURE_TRUE(commandUpdater, NS_ERROR_FAILURE);
|
||||
* commandUpdater->CommandStatusChanged(obs_documentCreated);
|
||||
*
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
}
|
||||
|
||||
// This is needed to abort the caret reset in the destructor
|
||||
// when one method yields control to another
|
||||
// when one method yields control to another
|
||||
void CancelSetCaret()
|
||||
{
|
||||
mHTMLEditor = nullptr;
|
||||
@@ -1835,7 +1835,7 @@ HTMLEditor::SelectBlockOfCells(Element* aStartCell,
|
||||
}
|
||||
|
||||
// We can only select a block if within the same table,
|
||||
// so do nothing if not within one table
|
||||
// so do nothing if not within one table
|
||||
if (table != endTable) {
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1851,11 +1851,11 @@ HTMLEditor::SelectBlockOfCells(Element* aStartCell,
|
||||
}
|
||||
|
||||
// Suppress nsISelectionListener notification
|
||||
// until all selection changes are finished
|
||||
// until all selection changes are finished
|
||||
SelectionBatcher selectionBatcher(SelectionRefPtr());
|
||||
|
||||
// Examine all cell nodes in current selection and
|
||||
// remove those outside the new block cell region
|
||||
// remove those outside the new block cell region
|
||||
int32_t minColumn =
|
||||
std::min(startCellIndexes.mColumn, endCellIndexes.mColumn);
|
||||
int32_t minRow =
|
||||
@@ -1958,7 +1958,7 @@ HTMLEditor::SelectAllTableCells()
|
||||
}
|
||||
|
||||
// Suppress nsISelectionListener notification
|
||||
// until all selection changes are finished
|
||||
// until all selection changes are finished
|
||||
SelectionBatcher selectionBatcher(SelectionRefPtr());
|
||||
|
||||
// It is now safe to clear the selection
|
||||
@@ -2040,12 +2040,12 @@ HTMLEditor::SelectTableRow()
|
||||
return error.StealNSResult();
|
||||
}
|
||||
|
||||
//Note: At this point, we could get first and last cells in row,
|
||||
// then call SelectBlockOfCells, but that would take just
|
||||
// a little less code, so the following is more efficient
|
||||
// Note: At this point, we could get first and last cells in row,
|
||||
// then call SelectBlockOfCells, but that would take just
|
||||
// a little less code, so the following is more efficient
|
||||
|
||||
// Suppress nsISelectionListener notification
|
||||
// until all selection changes are finished
|
||||
// until all selection changes are finished
|
||||
SelectionBatcher selectionBatcher(SelectionRefPtr());
|
||||
|
||||
// It is now safe to clear the selection
|
||||
@@ -2125,7 +2125,7 @@ HTMLEditor::SelectTableColumn()
|
||||
}
|
||||
|
||||
// Suppress nsISelectionListener notification
|
||||
// until all selection changes are finished
|
||||
// until all selection changes are finished
|
||||
SelectionBatcher selectionBatcher(SelectionRefPtr());
|
||||
|
||||
// It is now safe to clear the selection
|
||||
@@ -2217,7 +2217,7 @@ HTMLEditor::SplitTableCell()
|
||||
int32_t rowSpanBelow, colSpanAfter;
|
||||
|
||||
// Split up cell row-wise first into rowspan=1 above, and the rest below,
|
||||
// whittling away at the cell below until no more extra span
|
||||
// whittling away at the cell below until no more extra span
|
||||
for (rowSpanBelow = actualRowSpan-1; rowSpanBelow >= 0; rowSpanBelow--) {
|
||||
// We really split row-wise only if we had rowspan > 1
|
||||
if (rowSpanBelow > 0) {
|
||||
@@ -2298,7 +2298,7 @@ HTMLEditor::SplitCellIntoColumns(Element* aTable,
|
||||
}
|
||||
|
||||
// Insert new cell after using the remaining span
|
||||
// and always get the new cell so we can copy the background color;
|
||||
// and always get the new cell so we can copy the background color;
|
||||
RefPtr<Element> newCellElement;
|
||||
rv = InsertCell(cellData.mElement,
|
||||
cellData.mEffectiveRowSpan, aColSpanRight, true, false,
|
||||
@@ -2394,8 +2394,8 @@ HTMLEditor::SplitCellIntoRows(Element* aTable,
|
||||
break;
|
||||
}
|
||||
// If cell found is AFTER desired new cell colum,
|
||||
// we have multiple cells with rowspan > 1 that
|
||||
// prevented us from finding a cell to insert after...
|
||||
// we have multiple cells with rowspan > 1 that
|
||||
// prevented us from finding a cell to insert after...
|
||||
if (cellDataAtInsertionPoint.mFirst.mColumn > cellData.mFirst.mColumn) {
|
||||
// ... so instead insert before the cell we found
|
||||
insertAfter = false;
|
||||
@@ -2410,9 +2410,9 @@ HTMLEditor::SplitCellIntoRows(Element* aTable,
|
||||
|
||||
if (!cellElementAtInsertionPoint && lastCellFound) {
|
||||
// Edge case where we didn't find a cell to insert after
|
||||
// or before because column(s) before desired column
|
||||
// and all columns after it are spanned from above.
|
||||
// We can insert after the last cell we found
|
||||
// or before because column(s) before desired column
|
||||
// and all columns after it are spanned from above.
|
||||
// We can insert after the last cell we found
|
||||
cellElementAtInsertionPoint = std::move(lastCellFound);
|
||||
insertAfter = true; // Should always be true, but let's be sure
|
||||
}
|
||||
@@ -2424,7 +2424,7 @@ HTMLEditor::SplitCellIntoRows(Element* aTable,
|
||||
}
|
||||
|
||||
// Insert new cell after using the remaining span
|
||||
// and always get the new cell so we can copy the background color;
|
||||
// and always get the new cell so we can copy the background color;
|
||||
RefPtr<Element> newCell;
|
||||
rv = InsertCell(cellElementAtInsertionPoint,
|
||||
aRowSpanBelow, cellData.mEffectiveColSpan,
|
||||
@@ -2522,8 +2522,8 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents)
|
||||
AutoTransactionsConserveSelection dontChangeSelection(*this);
|
||||
|
||||
// Note: We dont' use AutoSelectionSetterAfterTableEdit here so the selection
|
||||
// is retained after joining. This leaves the target cell selected
|
||||
// as well as the "non-contiguous" cells, so user can see what happened.
|
||||
// is retained after joining. This leaves the target cell selected
|
||||
// as well as the "non-contiguous" cells, so user can see what happened.
|
||||
|
||||
ErrorResult error;
|
||||
CellAndIndexes firstSelectedCell(*this, *SelectionRefPtr(), error);
|
||||
@@ -2544,7 +2544,7 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents)
|
||||
|
||||
if (joinSelectedCells) {
|
||||
// We have selected cells: Join just contiguous cells
|
||||
// and just merge contents if not contiguous
|
||||
// and just merge contents if not contiguous
|
||||
TableSize tableSize(*this, *table, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.StealNSResult();
|
||||
@@ -2561,10 +2561,10 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents)
|
||||
}
|
||||
|
||||
// This defines the last indexes along the "edges"
|
||||
// of the contiguous block of cells, telling us
|
||||
// that we can join adjacent cells to the block
|
||||
// of the contiguous block of cells, telling us
|
||||
// that we can join adjacent cells to the block
|
||||
// Start with same as the first values,
|
||||
// then expand as we find adjacent selected cells
|
||||
// then expand as we find adjacent selected cells
|
||||
int32_t lastRowIndex = firstSelectedCell.mIndexes.mRow;
|
||||
int32_t lastColIndex = firstSelectedCell.mIndexes.mColumn;
|
||||
|
||||
@@ -2621,7 +2621,7 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents)
|
||||
if (cellData.mCurrent.mRow > firstSelectedCell.mIndexes.mRow + 1 &&
|
||||
cellData.mCurrent.mColumn <= lastColIndex) {
|
||||
// Cell is in a column less than current right border in
|
||||
// the third or higher selected row, so stop block at the previous row
|
||||
// the third or higher selected row, so stop block at the previous row
|
||||
lastRowIndex = std::max(0, cellData.mCurrent.mRow - 1);
|
||||
lastRowIsSet = true;
|
||||
}
|
||||
@@ -2643,7 +2643,7 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents)
|
||||
if (colIndex < lastColIndex) {
|
||||
// (don't think we ever get here?)
|
||||
// Cell is in a column less than current right boundary,
|
||||
// so stop block at the previous row
|
||||
// so stop block at the previous row
|
||||
lastRowIndex = std::max(0, rowIndex - 1);
|
||||
} else {
|
||||
// Go on to examine next row
|
||||
@@ -2654,7 +2654,7 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents)
|
||||
lastColIndex = std::min(lastColIndex, lastColInRow);
|
||||
} else {
|
||||
// No selected cells in this row -- stop at row above
|
||||
// and leave last column at its previous value
|
||||
// and leave last column at its previous value
|
||||
lastRowIndex = std::max(0, rowIndex - 1);
|
||||
}
|
||||
}
|
||||
@@ -2687,14 +2687,14 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents)
|
||||
cellData.mCurrent.mColumn <= lastColIndex) {
|
||||
// We are within the join region
|
||||
// Problem: It is very tricky to delete cells as we merge,
|
||||
// since that will upset the cellmap
|
||||
// Instead, build a list of cells to delete and do it later
|
||||
// since that will upset the cellmap
|
||||
// Instead, build a list of cells to delete and do it later
|
||||
NS_ASSERTION(!cellData.IsSpannedFromOtherRow(),
|
||||
"JoinTableCells: StartRowIndex is in row above");
|
||||
|
||||
if (cellData.mEffectiveColSpan > 1) {
|
||||
//Check if cell "hangs" off the boundary because of colspan > 1
|
||||
// Use split methods to chop off excess
|
||||
// Check if cell "hangs" off the boundary because of colspan > 1
|
||||
// Use split methods to chop off excess
|
||||
int32_t extraColSpan =
|
||||
cellData.mFirst.mColumn + cellData.mEffectiveColSpan -
|
||||
(lastColIndex + 1);
|
||||
@@ -2844,7 +2844,7 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents)
|
||||
// Merged cell is "shorter"
|
||||
// (there are cells(s) below it that are row-spanned by target cell)
|
||||
// We could try splitting those cells, but that's REAL messy,
|
||||
// so the safest thing to do is NOT really join the cells
|
||||
// so the safest thing to do is NOT really join the cells
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -2884,7 +2884,7 @@ HTMLEditor::MergeCells(RefPtr<Element> aTargetCell,
|
||||
if (!IsEmptyCell(aCellToMerge)) {
|
||||
// Get index of last child in target cell
|
||||
// If we fail or don't have children,
|
||||
// we insert at index 0
|
||||
// we insert at index 0
|
||||
int32_t insertIndex = 0;
|
||||
|
||||
// Start inserting just after last child
|
||||
@@ -3984,7 +3984,7 @@ HTMLEditor::SetSelectionAfterTableEdit(Element* aTable,
|
||||
// Set the caret to deepest first child
|
||||
// but don't go into nested tables
|
||||
// TODO: Should we really be placing the caret at the END
|
||||
// of the cell content?
|
||||
// of the cell content?
|
||||
CollapseSelectionToDeepestNonTableFirstChild(cell);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -845,7 +845,8 @@ TextServicesDocument::SetSelection(int32_t aOffset,
|
||||
nsresult rv = SetSelectionInternal(aOffset, aLength, true);
|
||||
|
||||
//**** KDEBUG ****
|
||||
// printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
|
||||
// printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex,
|
||||
// mSelStartOffset, mSelEndIndex, mSelEndOffset);
|
||||
//**** KDEBUG ****
|
||||
|
||||
return rv;
|
||||
@@ -1110,7 +1111,8 @@ TextServicesDocument::DeleteSelection()
|
||||
|
||||
//**** KDEBUG ****
|
||||
// printf("\n---- After Delete\n");
|
||||
// printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
|
||||
// printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex,
|
||||
// mSelStartOffset, mSelEndIndex, mSelEndOffset);
|
||||
// PrintOffsetTable();
|
||||
//**** KDEBUG ****
|
||||
|
||||
@@ -1274,7 +1276,8 @@ TextServicesDocument::InsertText(const nsString* aText)
|
||||
|
||||
//**** KDEBUG ****
|
||||
// printf("\n---- After Insert\n");
|
||||
// printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
|
||||
// printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex,
|
||||
// mSelStartOffset, mSelEndIndex, mSelEndOffset);
|
||||
// PrintOffsetTable();
|
||||
//**** KDEBUG ****
|
||||
|
||||
@@ -1690,6 +1693,7 @@ TextServicesDocument::IsBlockNode(nsIContent* aContent)
|
||||
|
||||
nsAtom *atom = aContent->NodeInfo()->NameAtom();
|
||||
|
||||
// clang-format off
|
||||
return (nsGkAtoms::a != atom &&
|
||||
nsGkAtoms::address != atom &&
|
||||
nsGkAtoms::big != atom &&
|
||||
@@ -1716,6 +1720,7 @@ TextServicesDocument::IsBlockNode(nsIContent* aContent)
|
||||
nsGkAtoms::u != atom &&
|
||||
nsGkAtoms::var != atom &&
|
||||
nsGkAtoms::wbr != atom);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -1836,7 +1841,8 @@ TextServicesDocument::SetSelectionInternal(int32_t aOffset,
|
||||
mSelEndOffset = mSelStartOffset;
|
||||
|
||||
//**** KDEBUG ****
|
||||
// printf("\n* Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
|
||||
// printf("\n* Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex,
|
||||
// mSelStartOffset, mSelEndIndex, mSelEndOffset);
|
||||
//**** KDEBUG ****
|
||||
|
||||
return NS_OK;
|
||||
@@ -1878,7 +1884,8 @@ TextServicesDocument::SetSelectionInternal(int32_t aOffset,
|
||||
}
|
||||
|
||||
//**** KDEBUG ****
|
||||
// printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset);
|
||||
// printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex,
|
||||
// mSelStartOffset, mSelEndIndex, mSelEndOffset);
|
||||
//**** KDEBUG ****
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@@ -103,10 +103,10 @@ static int32_t sPreloadPermissionCount = 0;
|
||||
// Permissions which are in this list are considered to have a "" permission
|
||||
// key, even if their principal would not normally have that key.
|
||||
static const char* kPreloadPermissions[] = {
|
||||
// NOTE: These permissions are the different nsContentBlocker permissions for
|
||||
// allowing or denying certain content types from being loaded. Every
|
||||
// permission listed in the `kTypeString` array in nsContentBlocker.cpp should
|
||||
// appear in this list.
|
||||
// NOTE: These permissions are the different nsContentBlocker permissions
|
||||
// for allowing or denying certain content types from being loaded. Every
|
||||
// permission listed in the `kTypeString` array in nsContentBlocker.cpp
|
||||
// should appear in this list.
|
||||
"other",
|
||||
"script",
|
||||
"image",
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
/**
|
||||
* This is the most braindead implementation of a personal dictionary possible.
|
||||
* There is not much complexity needed, though. It could be made much faster,
|
||||
* and probably should, but I don't see much need for more in terms of interface.
|
||||
* and probably should, but I don't see much need for more in terms of interface.
|
||||
*
|
||||
* Allowing personal words to be associated with only certain dictionaries maybe.
|
||||
*
|
||||
|
||||
+14
-7
@@ -349,7 +349,8 @@ public:
|
||||
Matrix mMatrix; //!< Transforms the pattern into user space
|
||||
|
||||
IntRect mSamplingRect; /**< Rect that must not be sampled outside of,
|
||||
or an empty rect if none has been specified. */
|
||||
or an empty rect if none has been
|
||||
specified. */
|
||||
};
|
||||
|
||||
class StoredPattern;
|
||||
@@ -956,7 +957,8 @@ public:
|
||||
* Creates a UnscaledFont using the font corresponding to the index.
|
||||
*
|
||||
* @param aIndex index for the font within the resource.
|
||||
* @param aInstanceData pointer to read-only buffer of any available instance data.
|
||||
* @param aInstanceData pointer to read-only buffer of any available instance
|
||||
* data.
|
||||
* @param aInstanceDataLength the size of the instance data.
|
||||
* @return an already_addrefed UnscaledFont, containing nullptr if failed.
|
||||
*/
|
||||
@@ -1040,8 +1042,10 @@ public:
|
||||
* applying scaling. No sampling happens outside the source.
|
||||
*
|
||||
* @param aSurface Source surface to draw
|
||||
* @param aDest Destination rectangle that this drawing operation should draw to
|
||||
* @param aSource Source rectangle in aSurface coordinates, this area of aSurface
|
||||
* @param aDest Destination rectangle that this drawing operation should draw
|
||||
* to
|
||||
* @param aSource Source rectangle in aSurface coordinates, this area of
|
||||
* aSurface
|
||||
* will be stretched to the size of aDest.
|
||||
* @param aOptions General draw options that are applied to the operation
|
||||
* @param aSurfOptions DrawSurface options that are applied
|
||||
@@ -1466,7 +1470,8 @@ public:
|
||||
* filters.
|
||||
*
|
||||
* aScaledFont The scaled font used when drawing.
|
||||
* aGlyphIndices An array of indices for the glyphs whose the metrics are wanted
|
||||
* aGlyphIndices An array of indices for the glyphs whose the metrics are
|
||||
* wanted
|
||||
* aNumGlyphs The amount of elements in aGlyphIndices
|
||||
* aGlyphMetrics The glyph metrics
|
||||
*/
|
||||
@@ -1724,9 +1729,11 @@ public:
|
||||
*
|
||||
* @param aData Pointer to the data
|
||||
* @param aSize Size of the TrueType data
|
||||
* @param aBackendType Type of the reference DrawTarget the font should be created for.
|
||||
* @param aBackendType Type of the reference DrawTarget the font should be
|
||||
* created for.
|
||||
* @param aFontType Type of NativeFontResource that should be created.
|
||||
* @param aFontContext Optional native font context to be used to create the NativeFontResource.
|
||||
* @param aFontContext Optional native font context to be used to create the
|
||||
* NativeFontResource.
|
||||
* @return a NativeFontResource of nullptr if failed.
|
||||
*/
|
||||
static already_AddRefed<NativeFontResource>
|
||||
|
||||
+4
-2
@@ -214,9 +214,11 @@ BoxBlurRow(const uint8_t* aInput,
|
||||
* Box blur involves looking at one pixel, and setting its value to the average
|
||||
* of its neighbouring pixels. This is meant to provide a 3-pass approximation of a
|
||||
* Gaussian blur.
|
||||
* @param aTranspose Whether to transpose the buffer when reading and writing to it.
|
||||
* @param aTranspose Whether to transpose the buffer when reading and writing
|
||||
* to it.
|
||||
* @param aData The buffer to be blurred.
|
||||
* @param aLobes The number of pixels to blend on the left and right for each of 3 passes.
|
||||
* @param aLobes The number of pixels to blend on the left and right for each of
|
||||
* 3 passes.
|
||||
* @param aWidth The number of columns in the buffers.
|
||||
* @param aRows The number of rows in the buffers.
|
||||
* @param aStride The stride of the buffer.
|
||||
|
||||
@@ -1055,7 +1055,8 @@ GfxMatrixToCGAffineTransform(const Matrix &m)
|
||||
* We cannot cancel out (2) and (3) as we have to apply the clips and transforms
|
||||
* of DrawTargetSkia between (2) and (3).
|
||||
*
|
||||
* Consider the example letter P, drawn at (0, 20) in CG coordinates in a (100, 100) rect.
|
||||
* Consider the example letter P, drawn at (0, 20) in CG coordinates in a
|
||||
* (100, 100) rect.
|
||||
* Again, going right to left of the transforms. We'd get:
|
||||
*
|
||||
* 1) The letter P drawn at (0, -20) due to the inversion of the Y axis
|
||||
|
||||
@@ -320,7 +320,8 @@ private:
|
||||
* We have to call CreateSimilarDrawTarget on mFinalDT up front and pass it in
|
||||
* as it can fail.
|
||||
*
|
||||
* @param aDT DrawTargetWrapAndRecord on which CreateSimilarDrawTarget was called
|
||||
* @param aDT DrawTargetWrapAndRecord on which CreateSimilarDrawTarget was
|
||||
* called
|
||||
* @param aSimilarDT Similar DrawTarget created from aDT.mFinalDT.
|
||||
*/
|
||||
DrawTargetWrapAndRecord(const DrawTargetWrapAndRecord *aDT,
|
||||
|
||||
@@ -247,12 +247,14 @@ template<typename i16x8_t, typename i32x4_t>
|
||||
inline i32x4_t
|
||||
BlendAlphaOfFourPixels(i16x8_t s_rrrraaaa1234, i16x8_t d_rrrraaaa1234)
|
||||
{
|
||||
// clang-format off
|
||||
// We're using MulAdd16x8x2To32x4, so we need to interleave our factors
|
||||
// appropriately. The calculation is rewritten as follows:
|
||||
// resultAlpha[0] * 255 = 255 * 255 - (255 - sourceAlpha[0]) * (255 - destAlpha[0])
|
||||
// = 255 * 255 + (255 - sourceAlpha[0]) * (destAlpha[0] - 255)
|
||||
// = (255 - 0) * (510 - 255) + (255 - sourceAlpha[0]) * (destAlpha[0] - 255)
|
||||
// = MulAdd(255 - IntLv(0, sourceAlpha), IntLv(510, destAlpha) - 255)[0]
|
||||
// clang-format on
|
||||
i16x8_t zeroInterleavedWithSourceAlpha = simd::InterleaveHi16(simd::FromI16<i16x8_t>(0), s_rrrraaaa1234);
|
||||
i16x8_t fiveTenInterleavedWithDestAlpha = simd::InterleaveHi16(simd::FromI16<i16x8_t>(510), d_rrrraaaa1234);
|
||||
i16x8_t f1 = simd::Sub16(simd::FromI16<i16x8_t>(255), zeroInterleavedWithSourceAlpha);
|
||||
@@ -517,13 +519,15 @@ ColorMatrixMultiply(i16x8_t p, i16x8_t rows_bg, i16x8_t rows_ra, const i32x4_t&
|
||||
|
||||
// int16_t bg[8] = { b, g, b, g, b, g, b, g };
|
||||
i16x8_t bg = simd::ShuffleHi16<1,0,1,0>(simd::ShuffleLo16<1,0,1,0>(p));
|
||||
// int32_t prodsum_bg[4] = { b * bB + g * gB, b * bG + g * gG, b * bR + g * gR, b * bA + g * gA }
|
||||
// int32_t prodsum_bg[4] =
|
||||
// { b * bB + g * gB, b * bG + g * gG, b * bR + g * gR, b * bA + g * gA }
|
||||
i32x4_t prodsum_bg = simd::MulAdd16x8x2To32x4(bg, rows_bg);
|
||||
sum = simd::Add32(sum, prodsum_bg);
|
||||
|
||||
// uint16_t ra[8] = { r, a, r, a, r, a, r, a };
|
||||
i16x8_t ra = simd::ShuffleHi16<3,2,3,2>(simd::ShuffleLo16<3,2,3,2>(p));
|
||||
// int32_t prodsum_ra[4] = { r * rB + a * aB, r * rG + a * aG, r * rR + a * aR, r * rA + a * aA }
|
||||
// int32_t prodsum_ra[4] =
|
||||
// { r * rB + a * aB, r * rG + a * aG, r * rR + a * aR, r * rA + a * aA }
|
||||
i32x4_t prodsum_ra = simd::MulAdd16x8x2To32x4(ra, rows_ra);
|
||||
sum = simd::Add32(sum, prodsum_ra);
|
||||
|
||||
|
||||
@@ -583,6 +583,7 @@ CreatePartialBitmapForSurface(DataSourceSurface *aSurface, const Matrix &aDestin
|
||||
|
||||
// Limit the uploadRect as much as possible without supporting discontiguous uploads
|
||||
//
|
||||
// clang-format off
|
||||
// region we will paint from
|
||||
// uploadRect
|
||||
// .---------------. .---------------. resulting uploadRect
|
||||
@@ -591,6 +592,7 @@ CreatePartialBitmapForSurface(DataSourceSurface *aSurface, const Matrix &aDestin
|
||||
// | | | ----> | | | | ----> | |
|
||||
// | '---------' '----' '----' '---------------'
|
||||
// '---------------' '---------------'
|
||||
// clang-format on
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -32,15 +32,18 @@ public:
|
||||
// XXX - temporarily disabled, see bug 1209039
|
||||
//
|
||||
// // Call this from the thread itself because of Mac.
|
||||
//#ifdef XP_MACOSX
|
||||
// pthread_setname_np(aName);
|
||||
//#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
// pthread_set_name_np(mThread, aName);
|
||||
//#elif defined(__NetBSD__)
|
||||
// pthread_setname_np(mThread, "%s", (void*)aName);
|
||||
//#else
|
||||
// pthread_setname_np(mThread, aName);
|
||||
//#endif
|
||||
/*
|
||||
#ifdef XP_MACOSX
|
||||
pthread_setname_np(aName);
|
||||
#elif defined(__DragonFly__) || defined(__FreeBSD__) || \
|
||||
defined(__OpenBSD__)
|
||||
pthread_set_name_np(mThread, aName);
|
||||
#elif defined(__NetBSD__)
|
||||
pthread_setname_np(mThread, "%s", (void*)aName);
|
||||
#else
|
||||
pthread_setname_np(mThread, aName);
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
+2
-1
@@ -758,7 +758,8 @@ typedef Log<LOG_CRITICAL, CriticalLogger> CriticalLog;
|
||||
|
||||
// This is a shortcut for errors we want logged in crash reports/about support
|
||||
// but we do not want asserting. These are available in all builds, so it is
|
||||
// not worth trying to do magic to avoid matching the syntax of gfxCriticalError.
|
||||
// not worth trying to do magic to avoid matching the syntax of
|
||||
// gfxCriticalError.
|
||||
// So, this one is used as
|
||||
// gfxCriticalNote << "Something to report and not assert";
|
||||
// while the critical error is
|
||||
|
||||
+10
-5
@@ -340,14 +340,17 @@ FindInflectionApproximationRange(BezierControlPoints aControlPoints,
|
||||
* curve is degenerate in such a way that it is best approximated by a straight
|
||||
* line.
|
||||
*
|
||||
* The below algorithm was written by Jeff Muizelaar <jmuizelaar@mozilla.com>, explanation follows:
|
||||
* The below algorithm was written by Jeff Muizelaar <jmuizelaar@mozilla.com>,
|
||||
* explanation follows:
|
||||
*
|
||||
* The lower inflection point is returned in aT1, the higher one in aT2. In the
|
||||
* case of a single inflection point this will be in aT1.
|
||||
*
|
||||
* The method is inspired by the algorithm in "analysis of in?ection points for planar cubic bezier curve"
|
||||
* The method is inspired by the algorithm in "analysis of in?ection points for
|
||||
* planar cubic bezier curve"
|
||||
*
|
||||
* Here are some differences between this algorithm and versions discussed elsewhere in the literature:
|
||||
* Here are some differences between this algorithm and versions discussed
|
||||
* elsewhere in the literature:
|
||||
*
|
||||
* zhang et. al compute a0, d0 and e0 incrementally using the follow formula:
|
||||
*
|
||||
@@ -360,9 +363,11 @@ FindInflectionApproximationRange(BezierControlPoints aControlPoints,
|
||||
|
||||
* Point e0 = d1 - d0
|
||||
*
|
||||
* this avoids any multiplications and may or may not be faster than the approach take below.
|
||||
* this avoids any multiplications and may or may not be faster than the
|
||||
* approach take below.
|
||||
*
|
||||
* "fast, precise flattening of cubic bezier path and ofset curves" by hain et. al
|
||||
* "fast, precise flattening of cubic bezier path and ofset curves" by hain et.
|
||||
* al
|
||||
* Point a = CP1 + 3 * CP2 - 3 * CP3 + CP4
|
||||
* Point b = 3 * CP1 - 6 * CP2 + 3 * CP3
|
||||
* Point c = -3 * CP1 + 3 * CP2
|
||||
|
||||
+4
-3
@@ -209,10 +209,11 @@ PremultiplyFallback(const uint8_t* aSrc, int32_t aSrcGap,
|
||||
if (aSwapRB) {
|
||||
rb = (rb >> 16) | (rb << 16);
|
||||
}
|
||||
// Approximate the multiply by alpha and divide by 255 which is essentially:
|
||||
// Approximate the multiply by alpha and divide by 255 which is
|
||||
// essentially:
|
||||
// c = c*a + 255; c = (c + (c >> 8)) >> 8;
|
||||
// However, we omit the final >> 8 to fold it with the final shift into place
|
||||
// depending on desired output format.
|
||||
// However, we omit the final >> 8 to fold it with the final shift into
|
||||
// place depending on desired output format.
|
||||
rb = rb*a + 0x00FF00FF;
|
||||
rb = (rb + ((rb >> 8) & 0x00FF00FF)) & 0xFF00FF00;
|
||||
|
||||
|
||||
@@ -184,14 +184,15 @@ UnpremultiplyVector_NEON(const uint16x8_t& aSrc)
|
||||
// lo1 lo1 lo2 lo2 lo3 lo3 lo4 lo4 and hi1 hi1 hi2 hi2 hi3 hi3 hi4 hi4
|
||||
uint16x8x2_t q1234lohi = vtrnq_u16(q1234, q1234);
|
||||
|
||||
// VQDMULH is a signed multiply that doubles (*2) the result, then takes the high word.
|
||||
// To work around the signedness and the doubling, the low portion of the reciprocal only
|
||||
// stores the lower 15 bits, which fits in a signed 16 bit integer. The high 9 bit portion
|
||||
// is effectively also doubled by 2 as a side-effect of being shifted for storage. Thus the
|
||||
// output scale of doing a normal multiply by the high portion and the VQDMULH by the low
|
||||
// portion are both doubled and can be safely added together. The resulting sum just needs
|
||||
// to be halved (via VHADD) to thus cancel out the doubling. All this combines to produce
|
||||
// a reciprocal multiply of the form:
|
||||
// VQDMULH is a signed multiply that doubles (*2) the result, then takes the
|
||||
// high word. To work around the signedness and the doubling, the low
|
||||
// portion of the reciprocal only stores the lower 15 bits, which fits in a
|
||||
// signed 16 bit integer. The high 9 bit portion is effectively also doubled
|
||||
// by 2 as a side-effect of being shifted for storage. Thus the output scale
|
||||
// of doing a normal multiply by the high portion and the VQDMULH by the low
|
||||
// portion are both doubled and can be safely added together. The resulting
|
||||
// sum just needs to be halved (via VHADD) to thus cancel out the doubling.
|
||||
// All this combines to produce a reciprocal multiply of the form:
|
||||
// rb = ((rb * hi) + ((rb * lo * 2) >> 16)) / 2
|
||||
rb =
|
||||
vhaddq_u16(
|
||||
|
||||
@@ -20,7 +20,8 @@ public:
|
||||
ForceDiscreteGPUHelperCGL()
|
||||
: mPixelFormatObj(nullptr)
|
||||
{
|
||||
// the code in this function is taken from Chromium, src/ui/gfx/gl/gl_context_cgl.cc, r122013
|
||||
// the code in this function is taken from Chromium,
|
||||
// src/ui/gfx/gl/gl_context_cgl.cc, r122013
|
||||
// BSD-style license, (c) The Chromium Authors
|
||||
CGLPixelFormatAttribute attribs[1];
|
||||
attribs[0] = static_cast<CGLPixelFormatAttribute>(0);
|
||||
|
||||
@@ -176,6 +176,7 @@ WGLLibrary::EnsureInitialized()
|
||||
|
||||
// Now we can grab all the other symbols that we couldn't without having
|
||||
// a context current.
|
||||
// clang-format off
|
||||
const GLLibraryLoader::SymLoadStruct reqExtSymbols[] = {
|
||||
{ (PRFuncPtr*)&mSymbols.fCreatePbuffer, { "wglCreatePbufferARB", "wglCreatePbufferEXT", nullptr } },
|
||||
{ (PRFuncPtr*)&mSymbols.fDestroyPbuffer, { "wglDestroyPbufferARB", "wglDestroyPbufferEXT", nullptr } },
|
||||
@@ -188,6 +189,7 @@ WGLLibrary::EnsureInitialized()
|
||||
SYMBOL(GetExtensionsStringARB),
|
||||
END_OF_SYMBOLS
|
||||
};
|
||||
// clang-format on
|
||||
if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, reqExtSymbols, lookupFunc)) {
|
||||
NS_WARNING("reqExtSymbols missing");
|
||||
return false;
|
||||
|
||||
@@ -9,7 +9,7 @@ rayon = "1"
|
||||
thread_profiler = "0.1.1"
|
||||
euclid = { version = "0.19.3", features = ["serde"] }
|
||||
app_units = "0.7"
|
||||
gleam = "0.6.3"
|
||||
gleam = "0.6.8"
|
||||
log = "0.4"
|
||||
nsstring = { path = "../../servo/support/gecko/nsstring" }
|
||||
bincode = "1.0"
|
||||
|
||||
@@ -1 +1 @@
|
||||
195582a8dc5b9c6d26d54ce8d70060ccc8f423d8
|
||||
586af96c22c8b05722534e98703bfb47f1d270a1
|
||||
Generated
+32
-9
@@ -118,7 +118,7 @@ name = "cgl"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gleam 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -308,7 +308,7 @@ name = "direct-composition"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"euclid 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozangle 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender 0.57.2",
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -472,11 +472,21 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gleam"
|
||||
version = "0.6.3"
|
||||
name = "gl_generator"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"khronos_api 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gleam"
|
||||
version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -608,6 +618,11 @@ name = "khronos_api"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "khronos_api"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "0.2.11"
|
||||
@@ -1473,7 +1488,7 @@ dependencies = [
|
||||
"dwrote 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1503,7 +1518,7 @@ dependencies = [
|
||||
"app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glutin 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender 0.57.2",
|
||||
@@ -1603,7 +1618,7 @@ dependencies = [
|
||||
"env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"font-loader 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glutin 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1664,6 +1679,11 @@ dependencies = [
|
||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xml-rs"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "yaml-rust"
|
||||
version = "0.3.5"
|
||||
@@ -1733,8 +1753,9 @@ dependencies = [
|
||||
"checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
|
||||
"checksum gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518"
|
||||
"checksum gif 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff3414b424657317e708489d2857d9575f4403698428b040b609b9d1c1a84a2c"
|
||||
"checksum gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0ffaf173cf76c73a73e080366bf556b4776ece104b06961766ff11449f38604"
|
||||
"checksum gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a"
|
||||
"checksum gleam 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2260952cc0393ca6f183e1a91a035c65c85ddb02505f3d53e5a775eb05946f44"
|
||||
"checksum gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4b47f5b15742aee359c7895ab98cf2cceecc89bb4feb6f4e42f802d7899877da"
|
||||
"checksum glutin 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a70c5fe78efbd5a3b243a804ea1032053c584510f8822819f94cfb29b2100317"
|
||||
"checksum half 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d5c5f71a723d10dfc58927cbed37c3071a50afc7f073d86fd7d3e5727db890f"
|
||||
"checksum httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2f407128745b78abc95c0ffbe4e5d37427fdc0d45470710cfef8c44522a2e37"
|
||||
@@ -1748,6 +1769,7 @@ dependencies = [
|
||||
"checksum jpeg-decoder 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0dfe27a6c0dabd772d0f9b9f8701c4ca12c4d1eebcadf2be1f6f70396f6a1434"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "037ab472c33f67b5fbd3e9163a2645319e5356fcd355efa6d4eb7fff4bbcb554"
|
||||
"checksum khronos_api 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "62237e6d326bd5871cd21469323bf096de81f1618cd82cbaf5d87825335aeb49"
|
||||
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
|
||||
"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d"
|
||||
"checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef"
|
||||
@@ -1860,5 +1882,6 @@ dependencies = [
|
||||
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
|
||||
"checksum x11-dl 2.17.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3235540540fde1ae074c8df49054166c0e070407f1c6e1ee17b8c87c2c7bcc7d"
|
||||
"checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2"
|
||||
"checksum xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "541b12c998c5b56aa2b4e6f18f03664eef9a4fd0a246a55594efae6cc2d964b5"
|
||||
"checksum yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992"
|
||||
"checksum yaml-rust 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "95acf0db5515d07da9965ec0e0ba6cc2d825e2caeb7303b66ca441729801254e"
|
||||
@@ -8,12 +8,15 @@ check-alphabetical-order = false
|
||||
packages = [
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
"gl_generator",
|
||||
"khronos_api",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"rand",
|
||||
"winapi",
|
||||
"core-graphics",
|
||||
"core-text",
|
||||
"xml-rs",
|
||||
"yaml-rust",
|
||||
]
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ bitflags = "1.0"
|
||||
byteorder = "1.0"
|
||||
cfg-if = "0.1.2"
|
||||
fxhash = "0.2.1"
|
||||
gleam = "0.6.3"
|
||||
gleam = "0.6.8"
|
||||
image = { optional = true, version = "0.20" }
|
||||
lazy_static = "1"
|
||||
log = "0.4"
|
||||
|
||||
@@ -857,6 +857,9 @@ pub struct Device {
|
||||
/// format, we fall back to glTexImage*.
|
||||
texture_storage_usage: TexStorageUsage,
|
||||
|
||||
/// Whether the function glCopyImageSubData is available.
|
||||
supports_copy_image_sub_data: bool,
|
||||
|
||||
// GL extensions
|
||||
extensions: Vec<String>,
|
||||
}
|
||||
@@ -1024,6 +1027,9 @@ impl Device {
|
||||
)
|
||||
};
|
||||
|
||||
let supports_copy_image_sub_data = supports_extension(&extensions, "GL_EXT_copy_image") ||
|
||||
supports_extension(&extensions, "GL_ARB_copy_image");
|
||||
|
||||
// Explicitly set some global states to the values we expect.
|
||||
gl.disable(gl::FRAMEBUFFER_SRGB);
|
||||
gl.disable(gl::MULTISAMPLE);
|
||||
@@ -1066,6 +1072,7 @@ impl Device {
|
||||
frame_id: GpuFrameId(0),
|
||||
extensions,
|
||||
texture_storage_usage,
|
||||
supports_copy_image_sub_data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1621,15 +1628,27 @@ impl Device {
|
||||
debug_assert!(dst.size.height >= src.size.height);
|
||||
debug_assert!(dst.layer_count >= src.layer_count);
|
||||
|
||||
// Note that zip() truncates to the shorter of the two iterators.
|
||||
let rect = DeviceIntRect::new(DeviceIntPoint::zero(), src.get_dimensions().to_i32());
|
||||
for (read_fbo, draw_fbo) in src.fbos.iter().zip(&dst.fbos) {
|
||||
self.bind_read_target_impl(*read_fbo);
|
||||
self.bind_draw_target_impl(*draw_fbo);
|
||||
self.blit_render_target(rect, rect);
|
||||
if self.supports_copy_image_sub_data {
|
||||
assert_ne!(src.id, dst.id,
|
||||
"glCopyImageSubData's behaviour is undefined if src and dst images are identical and the rectangles overlap.");
|
||||
unsafe {
|
||||
self.gl.copy_image_sub_data(src.id, src.target, 0,
|
||||
0, 0, 0,
|
||||
dst.id, dst.target, 0,
|
||||
0, 0, 0,
|
||||
src.size.width as _, src.size.height as _, src.layer_count);
|
||||
}
|
||||
} else {
|
||||
// Note that zip() truncates to the shorter of the two iterators.
|
||||
let rect = DeviceIntRect::new(DeviceIntPoint::zero(), src.get_dimensions().to_i32());
|
||||
for (read_fbo, draw_fbo) in src.fbos.iter().zip(&dst.fbos) {
|
||||
self.bind_read_target_impl(*read_fbo);
|
||||
self.bind_draw_target_impl(*draw_fbo);
|
||||
self.blit_render_target(rect, rect);
|
||||
}
|
||||
self.reset_draw_target();
|
||||
self.reset_read_target();
|
||||
}
|
||||
self.reset_draw_target();
|
||||
self.reset_read_target();
|
||||
}
|
||||
|
||||
/// Notifies the device that the contents of a render target are no longer
|
||||
|
||||
@@ -693,9 +693,7 @@ function WaitForTestEnd(contentRootElement, inPrintMode, spellCheckedElements) {
|
||||
};
|
||||
os.addObserver(flushWaiter, "apz-repaints-flushed");
|
||||
|
||||
var willSnapshot = (gCurrentTestType != TYPE_SCRIPT) &&
|
||||
(gCurrentTestType != TYPE_LOAD) &&
|
||||
(gCurrentTestType != TYPE_PRINT);
|
||||
var willSnapshot = IsSnapshottableTestType();
|
||||
var noFlush =
|
||||
!(contentRootElement &&
|
||||
contentRootElement.classList.contains("reftest-no-flush"));
|
||||
@@ -754,6 +752,17 @@ function WaitForTestEnd(contentRootElement, inPrintMode, spellCheckedElements) {
|
||||
}
|
||||
CheckLayerAssertions(contentRootElement);
|
||||
}
|
||||
|
||||
if (!IsSnapshottableTestType()) {
|
||||
// If we're not snapshotting the test, at least do a sync round-trip
|
||||
// to the compositor to ensure that all the rendering messages
|
||||
// related to this test get processed. Otherwise problems triggered
|
||||
// by this test may only manifest as failures in a later test.
|
||||
LogInfo("MakeProgress: Doing sync flush to compositor");
|
||||
gFailureReason = "timed out while waiting for sync compositor flush"
|
||||
windowUtils().syncFlushCompositor();
|
||||
}
|
||||
|
||||
LogInfo("MakeProgress: Completed");
|
||||
state = STATE_COMPLETED;
|
||||
gFailureReason = "timed out while taking snapshot (bug in harness?)";
|
||||
@@ -1094,14 +1103,19 @@ function LogInfo(str)
|
||||
}
|
||||
}
|
||||
|
||||
function IsSnapshottableTestType()
|
||||
{
|
||||
// Script, load-only, and PDF-print tests do not need any snapshotting.
|
||||
return !(gCurrentTestType == TYPE_SCRIPT ||
|
||||
gCurrentTestType == TYPE_LOAD ||
|
||||
gCurrentTestType == TYPE_PRINT);
|
||||
}
|
||||
|
||||
const SYNC_DEFAULT = 0x0;
|
||||
const SYNC_ALLOW_DISABLE = 0x1;
|
||||
function SynchronizeForSnapshot(flags)
|
||||
{
|
||||
if (gCurrentTestType == TYPE_SCRIPT ||
|
||||
gCurrentTestType == TYPE_LOAD ||
|
||||
gCurrentTestType == TYPE_PRINT) {
|
||||
// Script, load-only, and PDF-print tests do not need any snapshotting.
|
||||
if (!IsSnapshottableTestType()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 263 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user