зеркало из https://github.com/mozilla/gecko-dev.git
Merge autoland to mozilla-central. a=merge
This commit is contained in:
Коммит
04b812b386
|
@ -80,7 +80,7 @@ rev = "477d8fc53a64705a9d3fbcce9de92f4988558525"
|
|||
[source."https://github.com/ChunMinChang/cubeb-coreaudio-rs"]
|
||||
git = "https://github.com/ChunMinChang/cubeb-coreaudio-rs"
|
||||
replace-with = "vendored-sources"
|
||||
rev = "91a7bb50198a9b7578d98d56e9fd32f257abb41f"
|
||||
rev = "08a2b75285732a2e1a389bc4ab02518c74a8a9c5"
|
||||
|
||||
[source.crates-io]
|
||||
replace-with = "vendored-sources"
|
||||
|
|
|
@ -735,7 +735,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "coreaudio-sys-utils"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=91a7bb50198a9b7578d98d56e9fd32f257abb41f#91a7bb50198a9b7578d98d56e9fd32f257abb41f"
|
||||
source = "git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=08a2b75285732a2e1a389bc4ab02518c74a8a9c5#08a2b75285732a2e1a389bc4ab02518c74a8a9c5"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"coreaudio-sys",
|
||||
|
@ -984,7 +984,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cubeb-coreaudio"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=91a7bb50198a9b7578d98d56e9fd32f257abb41f#91a7bb50198a9b7578d98d56e9fd32f257abb41f"
|
||||
source = "git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=08a2b75285732a2e1a389bc4ab02518c74a8a9c5#08a2b75285732a2e1a389bc4ab02518c74a8a9c5"
|
||||
dependencies = [
|
||||
"atomic",
|
||||
"audio-mixer",
|
||||
|
@ -5567,18 +5567,18 @@ checksum = "57da5d7300428d75d8b3cdfb736e41ee6af8926d69c1de2f201a1a22f234b7b5"
|
|||
|
||||
[[package]]
|
||||
name = "wast"
|
||||
version = "23.0.0"
|
||||
version = "25.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26b080a48623c1b15193eac2e28c7b8d0e6b2e1c6c67ed46ddcd86063e78e504"
|
||||
checksum = "94c7c4b9eeb5c233b89385147dd3ea5bb89988a3a8d256f116cf1db40e5ff43e"
|
||||
dependencies = [
|
||||
"leb128",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wat"
|
||||
version = "1.0.24"
|
||||
version = "1.0.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c350d7431aa486488d28cdf75b57d59c02fab9cde20d93c52424510afe18ecc"
|
||||
checksum = "4766d466249e23279e92c52033429eb91141c5efea1c4478138fa6f6ef4efe3e"
|
||||
dependencies = [
|
||||
"wast",
|
||||
]
|
||||
|
|
|
@ -128,9 +128,6 @@ if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['CC_TYPE'] not in ('clang', 'gcc'):
|
|||
|
||||
DisableStlWrapping()
|
||||
|
||||
if CONFIG['MOZ_LINKER']:
|
||||
OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']
|
||||
|
||||
if CONFIG['HAVE_CLOCK_MONOTONIC']:
|
||||
OS_LIBS += CONFIG['REALTIME_LIBS']
|
||||
|
||||
|
|
|
@ -337,6 +337,9 @@
|
|||
#endif
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuitem id="context-print-selection"
|
||||
data-l10n-id="main-context-menu-print-selection"
|
||||
oncommand="gContextMenu.printSelection();"/>
|
||||
<menuitem id="context-viewpartialsource-selection"
|
||||
data-l10n-id="main-context-menu-view-selection-source"
|
||||
oncommand="gContextMenu.viewPartialSource();"/>
|
||||
|
|
|
@ -5083,6 +5083,7 @@ var XULBrowserWindow = {
|
|||
return (this._elementsForTextBasedTypes = [
|
||||
document.getElementById("pageStyleMenu"),
|
||||
document.getElementById("context-viewpartialsource-selection"),
|
||||
document.getElementById("context-print-selection"),
|
||||
]);
|
||||
},
|
||||
get _elementsForFind() {
|
||||
|
|
|
@ -487,6 +487,11 @@ class nsContextMenu {
|
|||
!this.inAboutDevtoolsToolbox && this.isContentSelected
|
||||
);
|
||||
|
||||
this.showItem(
|
||||
"context-print-selection",
|
||||
!this.inAboutDevtoolsToolbox && this.isContentSelected
|
||||
);
|
||||
|
||||
var shouldShow = !(
|
||||
this.isContentSelected ||
|
||||
this.onImage ||
|
||||
|
@ -1888,6 +1893,14 @@ class nsContextMenu {
|
|||
PrintUtils.startPrintWindow(this.actor.browsingContext);
|
||||
}
|
||||
|
||||
printSelection() {
|
||||
PrintUtils.startPrintWindow(
|
||||
this.actor.browsingContext,
|
||||
/* aOpenWindowInfo = */ null,
|
||||
/* aPrintSelectionOnly = */ true
|
||||
);
|
||||
}
|
||||
|
||||
switchPageDirection() {
|
||||
gBrowser.selectedBrowser.sendMessageToActor(
|
||||
"SwitchDocumentDirection",
|
||||
|
|
|
@ -1498,6 +1498,8 @@ add_task(async function test_select_text() {
|
|||
true,
|
||||
"context-searchselect-private",
|
||||
true,
|
||||
"context-print-selection",
|
||||
true,
|
||||
"context-viewpartialsource-selection",
|
||||
true,
|
||||
],
|
||||
|
@ -1523,6 +1525,8 @@ add_task(async function test_select_text_search_service_not_initialized() {
|
|||
true,
|
||||
"---",
|
||||
null,
|
||||
"context-print-selection",
|
||||
true,
|
||||
"context-viewpartialsource-selection",
|
||||
true,
|
||||
],
|
||||
|
@ -1576,6 +1580,8 @@ add_task(async function test_select_text_link() {
|
|||
true,
|
||||
[],
|
||||
null,
|
||||
"context-print-selection",
|
||||
true,
|
||||
"context-viewpartialsource-selection",
|
||||
true,
|
||||
],
|
||||
|
|
|
@ -1 +1 @@
|
|||
10.21.0
|
||||
10.22.1
|
||||
|
|
|
@ -65,8 +65,8 @@
|
|||
"engines": {
|
||||
"firefox": ">=45.0 <=*",
|
||||
"//": "when changing node versions, also edit .nvmrc",
|
||||
"node": "10.21.*",
|
||||
"npm": "6.14.4"
|
||||
"node": "10.22.*",
|
||||
"npm": "6.14.6"
|
||||
},
|
||||
"homepage": "https://github.com/mozilla/activity-stream",
|
||||
"keywords": [
|
||||
|
|
|
@ -92,11 +92,11 @@ The Payment Request UI uses `Custom Elements <https://developer.mozilla.org/en-U
|
|||
|
||||
Some guidelines:
|
||||
|
||||
* There are some `mixins <https://dxr.mozilla.org/mozilla-central/source/browser/components/payments/res/mixins/>`_
|
||||
* There are some `mixins <https://searchfox.org/mozilla-central/source/browser/components/payments/res/mixins/>`_
|
||||
to provide commonly needed functionality to a custom element.
|
||||
* `res/containers/ <https://dxr.mozilla.org/mozilla-central/source/browser/components/payments/res/containers/>`_
|
||||
* `res/containers/ <https://searchfox.org/mozilla-central/source/browser/components/payments/res/containers/>`_
|
||||
contains elements that react to application state changes,
|
||||
`res/components/ <https://dxr.mozilla.org/mozilla-central/source/browser/components/payments/res/components>`_
|
||||
`res/components/ <https://searchfox.org/mozilla-central/source/browser/components/payments/res/components>`_
|
||||
contains elements that aren't connected to the state directly.
|
||||
* Elements should avoid having their own internal/private state and should react to state changes.
|
||||
Containers primarily use the application state (``requestStore``) while components primarily use attributes.
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
/* import-globals-from ../main.js */
|
||||
|
||||
var gAddEngineDialog = {
|
||||
_addButton: null,
|
||||
let gAddEngineDialog = {
|
||||
_form: null,
|
||||
_name: null,
|
||||
_alias: null,
|
||||
|
@ -15,15 +14,16 @@ var gAddEngineDialog = {
|
|||
},
|
||||
|
||||
async init() {
|
||||
this._addButton = document.getElementById("addButton");
|
||||
this._dialog = document.querySelector("dialog");
|
||||
this._form = document.getElementById("addEngineForm");
|
||||
this._name = document.getElementById("engineName");
|
||||
this._alias = document.getElementById("engineAlias");
|
||||
|
||||
this._addButton.addEventListener("command", this.onAddEngine.bind(this));
|
||||
this._name.addEventListener("input", this.onNameInput.bind(this));
|
||||
this._alias.addEventListener("input", this.onAliasInput.bind(this));
|
||||
this._form.addEventListener("input", this.onFormInput.bind(this));
|
||||
|
||||
document.addEventListener("dialogaccept", this.onAddEngine.bind(this));
|
||||
},
|
||||
|
||||
async onAddEngine(event) {
|
||||
|
@ -35,7 +35,6 @@ var gAddEngineDialog = {
|
|||
url,
|
||||
this._alias.value
|
||||
);
|
||||
window.close();
|
||||
},
|
||||
|
||||
async onNameInput() {
|
||||
|
@ -59,8 +58,11 @@ var gAddEngineDialog = {
|
|||
this._alias.setCustomValidity(validity);
|
||||
},
|
||||
|
||||
async onFormInput(event) {
|
||||
this._addButton.setAttribute("disabled", !this._form.checkValidity());
|
||||
async onFormInput() {
|
||||
this._dialog.setAttribute(
|
||||
"buttondisabledaccept",
|
||||
!this._form.checkValidity()
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -13,6 +13,12 @@
|
|||
data-l10n-attrs="title, style"
|
||||
persist="screenX screenY width height" screenX="24" screenY="24">
|
||||
|
||||
<dialog
|
||||
buttons="accept,cancel"
|
||||
buttondisabledaccept="true"
|
||||
data-l10n-id="add-engine-dialog"
|
||||
data-l10n-attrs="buttonlabelaccept, buttonaccesskeyaccept">
|
||||
|
||||
<linkset>
|
||||
<html:link rel="localization" href="browser/preferences/addEngine.ftl"/>
|
||||
</linkset>
|
||||
|
@ -41,15 +47,5 @@
|
|||
<html:input id="engineAlias" type="text" />
|
||||
</hbox>
|
||||
</html:form>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
||||
<hbox pack="end">
|
||||
<button oncommand="window.close();"
|
||||
data-l10n-id="add-engine-cancel" />
|
||||
<button id="addButton"
|
||||
disabled="true"
|
||||
data-l10n-id="add-engine-ok" />
|
||||
</hbox>
|
||||
|
||||
</dialog>
|
||||
</window>
|
||||
|
|
|
@ -60,16 +60,9 @@ var gBlocklistManager = {
|
|||
},
|
||||
},
|
||||
|
||||
onWindowKeyPress(event) {
|
||||
if (event.keyCode == KeyEvent.DOM_VK_ESCAPE) {
|
||||
window.close();
|
||||
} else if (event.keyCode == KeyEvent.DOM_VK_RETURN) {
|
||||
gBlocklistManager.onApplyChanges();
|
||||
}
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.init();
|
||||
document.addEventListener("dialogaccept", () => this.onApplyChanges());
|
||||
},
|
||||
|
||||
init() {
|
||||
|
@ -124,8 +117,6 @@ var gBlocklistManager = {
|
|||
listmanager.forceUpdates(trackingTable);
|
||||
}
|
||||
}
|
||||
|
||||
window.close();
|
||||
},
|
||||
|
||||
async _loadBlockLists() {
|
||||
|
|
|
@ -15,8 +15,12 @@
|
|||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload="gBlocklistManager.onLoad();"
|
||||
onunload="gBlocklistManager.uninit();"
|
||||
persist="screenX screenY width height"
|
||||
onkeypress="gBlocklistManager.onWindowKeyPress(event);">
|
||||
persist="screenX screenY width height">
|
||||
|
||||
<dialog
|
||||
buttons="accept,cancel"
|
||||
data-l10n-id="blocklist-dialog"
|
||||
data-l10n-attrs="buttonlabelaccept, buttonaccesskeyaccept">
|
||||
|
||||
<linkset>
|
||||
<html:link rel="localization" href="branding/brand.ftl"/>
|
||||
|
@ -46,11 +50,5 @@
|
|||
<treechildren/>
|
||||
</tree>
|
||||
</vbox>
|
||||
|
||||
<hbox class="actionButtons" pack="end">
|
||||
<button oncommand="window.close();"
|
||||
data-l10n-id="blocklist-button-cancel"/>
|
||||
<button id="btnApplyChanges" oncommand="gBlocklistManager.onApplyChanges();"
|
||||
data-l10n-id="blocklist-button-ok"/>
|
||||
</hbox>
|
||||
</dialog>
|
||||
</window>
|
||||
|
|
|
@ -15,15 +15,13 @@ ChromeUtils.defineModuleGetter(
|
|||
var gClearSiteDataDialog = {
|
||||
_clearSiteDataCheckbox: null,
|
||||
_clearCacheCheckbox: null,
|
||||
_clearButton: null,
|
||||
|
||||
onLoad() {
|
||||
document.mozSubdialogReady = this.init();
|
||||
},
|
||||
|
||||
async init() {
|
||||
this._clearButton = document.getElementById("clearButton");
|
||||
this._cancelButton = document.getElementById("cancelButton");
|
||||
this._dialog = document.querySelector("dialog");
|
||||
this._clearSiteDataCheckbox = document.getElementById("clearSiteData");
|
||||
this._clearCacheCheckbox = document.getElementById("clearCache");
|
||||
|
||||
|
@ -52,10 +50,7 @@ var gClearSiteDataDialog = {
|
|||
this._clearSiteDataCheckbox,
|
||||
]);
|
||||
|
||||
window.addEventListener("keypress", this.onWindowKeyPress);
|
||||
|
||||
this._cancelButton.addEventListener("command", window.close);
|
||||
this._clearButton.addEventListener("command", () => this.onClear());
|
||||
document.addEventListener("dialogaccept", event => this.onClear(event));
|
||||
|
||||
this._clearSiteDataCheckbox.addEventListener("command", e =>
|
||||
this.onCheckboxCommand(e)
|
||||
|
@ -65,39 +60,37 @@ var gClearSiteDataDialog = {
|
|||
);
|
||||
},
|
||||
|
||||
onWindowKeyPress(event) {
|
||||
if (event.keyCode == KeyEvent.DOM_VK_ESCAPE) {
|
||||
window.close();
|
||||
}
|
||||
},
|
||||
|
||||
onCheckboxCommand(event) {
|
||||
this._clearButton.disabled = !(
|
||||
this._clearSiteDataCheckbox.checked || this._clearCacheCheckbox.checked
|
||||
this._dialog.setAttribute(
|
||||
"buttondisabledaccept",
|
||||
!(this._clearSiteDataCheckbox.checked || this._clearCacheCheckbox.checked)
|
||||
);
|
||||
},
|
||||
|
||||
onClear() {
|
||||
let allowed = true;
|
||||
onClear(event) {
|
||||
let clearSiteData = this._clearSiteDataCheckbox.checked;
|
||||
let clearCache = this._clearCacheCheckbox.checked;
|
||||
|
||||
if (this._clearCacheCheckbox.checked && allowed) {
|
||||
SiteDataManager.removeCache();
|
||||
// If we're not clearing site data, we need to tell the
|
||||
// SiteDataManager to signal that it's updating.
|
||||
if (!this._clearSiteDataCheckbox.checked) {
|
||||
SiteDataManager.updateSites();
|
||||
if (clearSiteData) {
|
||||
// Ask for confirmation before clearing site data
|
||||
if (!SiteDataManager.promptSiteDataRemoval(window)) {
|
||||
clearSiteData = false;
|
||||
// Prevent closing the dialog when the data removal wasn't allowed.
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
if (this._clearSiteDataCheckbox.checked) {
|
||||
allowed = SiteDataManager.promptSiteDataRemoval(window);
|
||||
if (allowed) {
|
||||
if (clearSiteData) {
|
||||
SiteDataManager.removeSiteData();
|
||||
}
|
||||
}
|
||||
if (clearCache) {
|
||||
SiteDataManager.removeCache();
|
||||
|
||||
if (allowed) {
|
||||
window.close();
|
||||
// If we're not clearing site data, we need to tell the
|
||||
// SiteDataManager to signal that it's updating.
|
||||
if (!clearSiteData) {
|
||||
SiteDataManager.updateSites();
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -16,6 +16,12 @@
|
|||
data-l10n-attrs="title, style"
|
||||
persist="screenX screenY width height">
|
||||
|
||||
<dialog
|
||||
buttons="accept,cancel"
|
||||
data-l10n-id="clear-site-data-dialog"
|
||||
data-l10n-attrs="buttonlabelaccept, buttonaccesskeyaccept"
|
||||
>
|
||||
|
||||
<linkset>
|
||||
<html:link rel="localization" href="branding/brand.ftl"/>
|
||||
<html:link rel="localization" href="browser/preferences/clearSiteData.ftl"/>
|
||||
|
@ -40,11 +46,5 @@
|
|||
</vbox>
|
||||
</vbox>
|
||||
</vbox>
|
||||
|
||||
<hbox class="actionButtons" pack="end">
|
||||
<button id="cancelButton"
|
||||
data-l10n-id="clear-site-data-cancel"/>
|
||||
<button id="clearButton"
|
||||
data-l10n-id="clear-site-data-clear"/>
|
||||
</hbox>
|
||||
</dialog>
|
||||
</window>
|
||||
|
|
|
@ -58,6 +58,7 @@ let gContainersManager = {
|
|||
},
|
||||
|
||||
init(aParams) {
|
||||
this._dialog = document.querySelector("dialog");
|
||||
this.userContextId = aParams.userContextId || null;
|
||||
this.identity = aParams.identity;
|
||||
|
||||
|
@ -73,6 +74,8 @@ let gContainersManager = {
|
|||
this.checkForm();
|
||||
}
|
||||
|
||||
document.addEventListener("dialogaccept", () => this.onApplyChanges());
|
||||
|
||||
// This is to prevent layout jank caused by the svgs and outlines rendering at different times
|
||||
document.getElementById("containers-content").removeAttribute("hidden");
|
||||
},
|
||||
|
@ -82,12 +85,7 @@ let gContainersManager = {
|
|||
// Check if name is provided to determine if the form can be submitted
|
||||
checkForm() {
|
||||
const name = document.getElementById("name");
|
||||
let btnApplyChanges = document.getElementById("btnApplyChanges");
|
||||
if (!name.value) {
|
||||
btnApplyChanges.setAttribute("disabled", true);
|
||||
} else {
|
||||
btnApplyChanges.removeAttribute("disabled");
|
||||
}
|
||||
this._dialog.setAttribute("buttondisabledaccept", !name.value);
|
||||
},
|
||||
|
||||
createIconButtons(defaultIcon) {
|
||||
|
@ -166,10 +164,4 @@ let gContainersManager = {
|
|||
}
|
||||
window.parent.location.reload();
|
||||
},
|
||||
|
||||
onWindowKeyPress(aEvent) {
|
||||
if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE) {
|
||||
window.close();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -13,8 +13,13 @@
|
|||
data-l10n-attrs="title, style"
|
||||
onload="gContainersManager.onLoad();"
|
||||
onunload="gContainersManager.uninit();"
|
||||
persist="screenX screenY width height"
|
||||
onkeypress="gContainersManager.onWindowKeyPress(event);">
|
||||
persist="screenX screenY width height">
|
||||
|
||||
<dialog
|
||||
buttons="accept"
|
||||
buttondisabledaccept="true"
|
||||
data-l10n-id="containers-dialog"
|
||||
data-l10n-attrs="buttonlabelaccept, buttonaccesskeyaccept">
|
||||
|
||||
<linkset>
|
||||
<html:link rel="localization" href="browser/preferences/containers.ftl"/>
|
||||
|
@ -44,9 +49,5 @@
|
|||
data-l10n-attrs="style"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
||||
<hbox class="actionButtons" pack="end">
|
||||
<button id="btnApplyChanges" disabled="true" oncommand="gContainersManager.onApplyChanges();"
|
||||
data-l10n-id="containers-button-done"/>
|
||||
</hbox>
|
||||
</dialog>
|
||||
</window>
|
||||
|
|
|
@ -59,17 +59,30 @@ var gPermissionManager = {
|
|||
this._isObserving = true;
|
||||
}
|
||||
|
||||
document.addEventListener("dialogaccept", () => this.onApplyChanges());
|
||||
|
||||
this._type = params.permissionType;
|
||||
this._list = document.getElementById("permissionsBox");
|
||||
this._removeButton = document.getElementById("removePermission");
|
||||
this._removeAllButton = document.getElementById("removeAllPermissions");
|
||||
|
||||
this._btnSession = document.getElementById("btnSession");
|
||||
this._btnBlock = document.getElementById("btnBlock");
|
||||
this._btnAllow = document.getElementById("btnAllow");
|
||||
|
||||
let permissionsText = document.getElementById("permissionsText");
|
||||
|
||||
let l10n = permissionExceptionsL10n[this._type];
|
||||
document.l10n.setAttributes(permissionsText, l10n.description);
|
||||
document.l10n.setAttributes(document.documentElement, l10n.window);
|
||||
|
||||
let urlFieldVisible =
|
||||
params.blockVisible || params.sessionVisible || params.allowVisible;
|
||||
|
||||
this._urlField = document.getElementById("url");
|
||||
this._urlField.value = params.prefilledHost;
|
||||
this._urlField.hidden = !urlFieldVisible;
|
||||
|
||||
await document.l10n.translateElements([
|
||||
permissionsText,
|
||||
document.documentElement,
|
||||
|
@ -79,14 +92,7 @@ var gPermissionManager = {
|
|||
document.getElementById("btnSession").hidden = !params.sessionVisible;
|
||||
document.getElementById("btnAllow").hidden = !params.allowVisible;
|
||||
|
||||
let urlFieldVisible =
|
||||
params.blockVisible || params.sessionVisible || params.allowVisible;
|
||||
|
||||
let urlField = document.getElementById("url");
|
||||
urlField.value = params.prefilledHost;
|
||||
urlField.hidden = !urlFieldVisible;
|
||||
|
||||
this.onHostInput(urlField);
|
||||
this.onHostInput(this._urlField);
|
||||
|
||||
let urlLabel = document.getElementById("urlLabel");
|
||||
urlLabel.hidden = !urlFieldVisible;
|
||||
|
@ -106,7 +112,7 @@ var gPermissionManager = {
|
|||
this._loadPermissions();
|
||||
this.buildPermissionsList();
|
||||
|
||||
urlField.focus();
|
||||
this._urlField.focus();
|
||||
},
|
||||
|
||||
uninit() {
|
||||
|
@ -339,8 +345,13 @@ var gPermissionManager = {
|
|||
},
|
||||
|
||||
onWindowKeyPress(event) {
|
||||
if (event.keyCode == KeyEvent.DOM_VK_ESCAPE) {
|
||||
window.close();
|
||||
// Prevent dialog.js from closing the dialog when the user submits the input
|
||||
// field via the return key.
|
||||
if (
|
||||
event.keyCode == KeyEvent.DOM_VK_RETURN &&
|
||||
document.activeElement == this._urlField
|
||||
) {
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -370,13 +381,9 @@ var gPermissionManager = {
|
|||
},
|
||||
|
||||
onHostInput(siteField) {
|
||||
let btnSession = document.getElementById("btnSession");
|
||||
let btnBlock = document.getElementById("btnBlock");
|
||||
let btnAllow = document.getElementById("btnAllow");
|
||||
|
||||
btnSession.disabled = btnSession.hidden || !siteField.value;
|
||||
btnBlock.disabled = btnBlock.hidden || !siteField.value;
|
||||
btnAllow.disabled = btnAllow.hidden || !siteField.value;
|
||||
this._btnSession.disabled = this._btnSession.hidden || !siteField.value;
|
||||
this._btnBlock.disabled = this._btnBlock.hidden || !siteField.value;
|
||||
this._btnAllow.disabled = this._btnAllow.hidden || !siteField.value;
|
||||
},
|
||||
|
||||
_setRemoveButtonState() {
|
||||
|
@ -425,8 +432,6 @@ var gPermissionManager = {
|
|||
for (let p of this._permissionsToAdd.values()) {
|
||||
Services.perms.addFromPrincipal(p.principal, p.type, p.capability);
|
||||
}
|
||||
|
||||
window.close();
|
||||
},
|
||||
|
||||
buildPermissionsList(sortCol) {
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
persist="screenX screenY width height"
|
||||
onkeypress="gPermissionManager.onWindowKeyPress(event);">
|
||||
|
||||
<dialog
|
||||
buttons="accept,cancel"
|
||||
data-l10n-id="permission-dialog"
|
||||
data-l10n-attrs="buttonlabelaccept, buttonaccesskeyaccept">
|
||||
|
||||
<linkset>
|
||||
<html:link rel="localization" href="browser/preferences/permissions.ftl"/>
|
||||
</linkset>
|
||||
|
@ -43,7 +48,7 @@
|
|||
oncommand="gPermissionManager.addPermission(Ci.nsIPermissionManager.DENY_ACTION);"/>
|
||||
<button id="btnSession" disabled="true" data-l10n-id="permissions-session"
|
||||
oncommand="gPermissionManager.addPermission(Ci.nsICookiePermission.ACCESS_SESSION);"/>
|
||||
<button id="btnAllow" disabled="true" data-l10n-id="permissions-allow" default="true"
|
||||
<button id="btnAllow" disabled="true" data-l10n-id="permissions-allow"
|
||||
oncommand="gPermissionManager.addPermission(Ci.nsIPermissionManager.ALLOW_ACTION);"/>
|
||||
</hbox>
|
||||
<separator class="thin"/>
|
||||
|
@ -67,11 +72,5 @@
|
|||
data-l10n-id="permissions-remove-all"
|
||||
oncommand="gPermissionManager.onAllPermissionsDelete();"/>
|
||||
</hbox>
|
||||
<spacer flex="1"/>
|
||||
<hbox class="actionButtons" pack="end">
|
||||
<button oncommand="window.close();"
|
||||
data-l10n-id="permissions-button-cancel" />
|
||||
<button id="btnApplyChanges" oncommand="gPermissionManager.onApplyChanges();"
|
||||
data-l10n-id="permissions-button-ok" />
|
||||
</hbox>
|
||||
</dialog>
|
||||
</window>
|
||||
|
|
|
@ -140,11 +140,11 @@ let gSiteDataSettings = {
|
|||
setEventListener("usageCol", "click", this.onClickTreeCol);
|
||||
setEventListener("lastAccessedCol", "click", this.onClickTreeCol);
|
||||
setEventListener("cookiesCol", "click", this.onClickTreeCol);
|
||||
setEventListener("cancel", "command", this.close);
|
||||
setEventListener("save", "command", this.saveChanges);
|
||||
setEventListener("searchBox", "command", this.onCommandSearch);
|
||||
setEventListener("removeAll", "command", this.onClickRemoveAll);
|
||||
setEventListener("removeSelected", "command", this.removeSelected);
|
||||
|
||||
document.addEventListener("dialogaccept", e => this.saveChanges(e));
|
||||
},
|
||||
|
||||
_updateButtonsState() {
|
||||
|
@ -254,47 +254,30 @@ let gSiteDataSettings = {
|
|||
this._updateButtonsState();
|
||||
},
|
||||
|
||||
async saveChanges() {
|
||||
// Tracks whether the user confirmed their decision.
|
||||
let allowed = false;
|
||||
|
||||
async saveChanges(event) {
|
||||
let removals = this._sites
|
||||
.filter(site => site.userAction == "remove")
|
||||
.map(site => site.host);
|
||||
|
||||
if (removals.length) {
|
||||
if (this._sites.length == removals.length) {
|
||||
allowed = SiteDataManager.promptSiteDataRemoval(window);
|
||||
if (allowed) {
|
||||
try {
|
||||
await SiteDataManager.removeAll();
|
||||
} catch (e) {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
allowed = SiteDataManager.promptSiteDataRemoval(window, removals);
|
||||
if (allowed) {
|
||||
try {
|
||||
await SiteDataManager.remove(removals);
|
||||
} catch (e) {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
allowed = true;
|
||||
}
|
||||
|
||||
let removeAll = removals.length == this._sites.length;
|
||||
let promptArg = removeAll ? undefined : removals;
|
||||
if (!SiteDataManager.promptSiteDataRemoval(window, promptArg)) {
|
||||
// If the user cancelled the confirm dialog keep the site data window open,
|
||||
// they can still press cancel again to exit.
|
||||
if (allowed) {
|
||||
this.close();
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (removeAll) {
|
||||
await SiteDataManager.removeAll();
|
||||
} else {
|
||||
await SiteDataManager.remove(removals);
|
||||
}
|
||||
} catch (e) {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
close() {
|
||||
window.close();
|
||||
},
|
||||
|
||||
removeSelected() {
|
||||
|
@ -334,9 +317,7 @@ let gSiteDataSettings = {
|
|||
},
|
||||
|
||||
onKeyPress(e) {
|
||||
if (e.keyCode == KeyEvent.DOM_VK_ESCAPE) {
|
||||
this.close();
|
||||
} else if (
|
||||
if (
|
||||
e.keyCode == KeyEvent.DOM_VK_DELETE ||
|
||||
(AppConstants.platform == "macosx" &&
|
||||
e.keyCode == KeyEvent.DOM_VK_BACK_SPACE)
|
||||
|
|
|
@ -19,6 +19,11 @@
|
|||
onkeypress="gSiteDataSettings.onKeyPress(event);"
|
||||
persist="screenX screenY width height">
|
||||
|
||||
<dialog
|
||||
buttons="accept,cancel"
|
||||
data-l10n-id="site-data-settings-dialog"
|
||||
data-l10n-attrs="buttonlabelaccept, buttonaccesskeyaccept">
|
||||
|
||||
<linkset>
|
||||
<html:link rel="localization" href="branding/brand.ftl"/>
|
||||
<html:link rel="localization" href="browser/preferences/siteDataSettings.ftl"/>
|
||||
|
@ -51,12 +56,5 @@
|
|||
<button id="removeSelected" data-l10n-id="site-data-remove-selected"/>
|
||||
<button id="removeAll"/>
|
||||
</hbox>
|
||||
|
||||
<vbox align="end">
|
||||
<hbox>
|
||||
<button id="cancel" data-l10n-id="site-data-button-cancel"/>
|
||||
<button id="save" data-l10n-id="site-data-button-save"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
||||
</dialog>
|
||||
</window>
|
||||
|
|
|
@ -111,6 +111,8 @@ var gSitePermissionsManager = {
|
|||
this._isObserving = true;
|
||||
}
|
||||
|
||||
document.addEventListener("dialogaccept", () => this.onApplyChanges());
|
||||
|
||||
this._type = params.permissionType;
|
||||
this._list = document.getElementById("permissionsBox");
|
||||
this._removeButton = document.getElementById("removePermission");
|
||||
|
@ -395,12 +397,6 @@ var gSitePermissionsManager = {
|
|||
return richlistitem;
|
||||
},
|
||||
|
||||
onWindowKeyPress(event) {
|
||||
if (event.keyCode == KeyEvent.DOM_VK_ESCAPE) {
|
||||
window.close();
|
||||
}
|
||||
},
|
||||
|
||||
onPermissionKeyPress(event) {
|
||||
if (!this._list.selectedItem) {
|
||||
return;
|
||||
|
@ -500,8 +496,6 @@ var gSitePermissionsManager = {
|
|||
SitePermissions.UNKNOWN
|
||||
);
|
||||
}
|
||||
|
||||
window.close();
|
||||
},
|
||||
|
||||
buildPermissionsList(sortCol) {
|
||||
|
|
|
@ -16,8 +16,12 @@
|
|||
data-l10n-attrs="title, style"
|
||||
onload="gSitePermissionsManager.onLoad();"
|
||||
onunload="gSitePermissionsManager.uninit();"
|
||||
persist="screenX screenY width height"
|
||||
onkeypress="gSitePermissionsManager.onWindowKeyPress(event);">
|
||||
persist="screenX screenY width height">
|
||||
|
||||
<dialog
|
||||
buttons="accept,cancel"
|
||||
data-l10n-id="permission-dialog"
|
||||
data-l10n-attrs="buttonlabelaccept, buttonaccesskeyaccept">
|
||||
|
||||
<linkset>
|
||||
<html:link rel="localization" href="browser/preferences/preferences.ftl"/>
|
||||
|
@ -77,10 +81,5 @@
|
|||
class="extension-controlled-button accessory-button"
|
||||
data-l10n-id="disable-extension"/>
|
||||
</hbox>
|
||||
<hbox class="actionButtons" pack="end">
|
||||
<button oncommand="window.close();" id="cancel"
|
||||
data-l10n-id="permissions-button-cancel" />
|
||||
<button id="btnApplyChanges" oncommand="gSitePermissionsManager.onApplyChanges();"
|
||||
data-l10n-id="permissions-button-ok" />
|
||||
</hbox>
|
||||
</dialog>
|
||||
</window>
|
||||
|
|
|
@ -251,12 +251,6 @@ var gTranslationExceptions = {
|
|||
}
|
||||
},
|
||||
|
||||
onWindowKeyPress(aEvent) {
|
||||
if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE) {
|
||||
window.close();
|
||||
}
|
||||
},
|
||||
|
||||
uninit() {
|
||||
Services.obs.removeObserver(this, "perm-changed");
|
||||
Services.prefs.removeObserver(kLanguagesPref, this);
|
||||
|
|
|
@ -15,8 +15,12 @@
|
|||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload="gTranslationExceptions.onLoad();"
|
||||
onunload="gTranslationExceptions.uninit();"
|
||||
persist="screenX screenY width height"
|
||||
onkeypress="gTranslationExceptions.onWindowKeyPress(event);">
|
||||
persist="screenX screenY width height">
|
||||
|
||||
<dialog
|
||||
buttons="accept"
|
||||
data-l10n-id="translation-dialog"
|
||||
data-l10n-attrs="buttonlabelaccept, buttonaccesskeyaccept">
|
||||
|
||||
<linkset>
|
||||
<html:link rel="localization" href="browser/preferences/translation.ftl"/>
|
||||
|
@ -79,7 +83,6 @@
|
|||
data-l10n-id="translation-sites-button-remove-all"
|
||||
oncommand="gTranslationExceptions.onAllSitesDeleted();"/>
|
||||
<spacer flex="1"/>
|
||||
<button oncommand="window.close();"
|
||||
data-l10n-id="translation-button-close"/>
|
||||
</hbox>
|
||||
</dialog>
|
||||
</window>
|
||||
|
|
|
@ -38,8 +38,6 @@
|
|||
search-l10n-ids="
|
||||
permissions-remove.label,
|
||||
permissions-remove-all.label,
|
||||
permissions-button-cancel.label,
|
||||
permissions-button-ok.label,
|
||||
permissions-exceptions-etp-window.title,
|
||||
permissions-exceptions-etp-desc,
|
||||
"/>
|
||||
|
@ -269,7 +267,7 @@
|
|||
<label id="changeBlockListLink"
|
||||
data-l10n-id="content-blocking-tracking-protection-change-block-list"
|
||||
is="text-link"
|
||||
search-l10n-ids="blocklist-window.title, blocklist-description, blocklist-button-cancel.label, blocklist-button-ok.label"/>
|
||||
search-l10n-ids="blocklist-window.title, blocklist-description, blocklist-dialog.buttonlabelaccept"/>
|
||||
|
||||
<hbox class="custom-option" id="contentBlockingCryptominersOption">
|
||||
<checkbox id="contentBlockingCryptominersCheckbox"
|
||||
|
@ -381,8 +379,6 @@
|
|||
permissions-allow.label,
|
||||
permissions-remove.label,
|
||||
permissions-remove-all.label,
|
||||
permissions-button-cancel.label,
|
||||
permissions-button-ok.label,
|
||||
permissions-exceptions-cookie-desc,
|
||||
" />
|
||||
</hbox>
|
||||
|
@ -650,8 +646,6 @@
|
|||
search-l10n-ids="
|
||||
permissions-remove.label,
|
||||
permissions-remove-all.label,
|
||||
permissions-button-cancel.label,
|
||||
permissions-button-ok.label,
|
||||
permissions-site-location-window.title,
|
||||
permissions-site-location-desc,
|
||||
permissions-site-location-disable-label,
|
||||
|
@ -673,8 +667,6 @@
|
|||
search-l10n-ids="
|
||||
permissions-remove.label,
|
||||
permissions-remove-all.label,
|
||||
permissions-button-cancel.label,
|
||||
permissions-button-ok.label,
|
||||
permissions-site-camera-window.title,
|
||||
permissions-site-camera-desc,
|
||||
permissions-site-camera-disable-label,
|
||||
|
@ -696,8 +688,6 @@
|
|||
search-l10n-ids="
|
||||
permissions-remove.label,
|
||||
permissions-remove-all.label,
|
||||
permissions-button-cancel.label,
|
||||
permissions-button-ok.label,
|
||||
permissions-site-microphone-window.title,
|
||||
permissions-site-microphone-desc,
|
||||
permissions-site-microphone-disable-label,
|
||||
|
@ -725,8 +715,6 @@
|
|||
search-l10n-ids="
|
||||
permissions-remove.label,
|
||||
permissions-remove-all.label,
|
||||
permissions-button-cancel.label,
|
||||
permissions-button-ok.label,
|
||||
permissions-site-notification-window.title,
|
||||
permissions-site-notification-desc,
|
||||
permissions-site-notification-disable-label,
|
||||
|
@ -753,8 +741,6 @@
|
|||
search-l10n-ids="
|
||||
permissions-remove.label,
|
||||
permissions-remove-all.label,
|
||||
permissions-button-cancel.label,
|
||||
permissions-button-ok.label,
|
||||
permissions-site-autoplay-window.title,
|
||||
permissions-site-autoplay-desc,
|
||||
" />
|
||||
|
@ -774,8 +760,6 @@
|
|||
search-l10n-ids="
|
||||
permissions-remove.label,
|
||||
permissions-remove-all.label,
|
||||
permissions-button-cancel.label,
|
||||
permissions-button-ok.label,
|
||||
permissions-site-xr-window.title,
|
||||
permissions-site-xr-desc,
|
||||
permissions-site-xr-disable-label,
|
||||
|
@ -799,8 +783,6 @@
|
|||
data-l10n-id="permissions-block-popups-exceptions"
|
||||
search-l10n-ids="
|
||||
permissions-address,
|
||||
permissions-button-cancel.label,
|
||||
permissions-button-ok.label,
|
||||
permissions-exceptions-popup-window.title,
|
||||
permissions-exceptions-popup-desc,
|
||||
" />
|
||||
|
@ -823,8 +805,6 @@
|
|||
permissions-allow.label,
|
||||
permissions-remove.label,
|
||||
permissions-remove-all.label,
|
||||
permissions-button-cancel.label,
|
||||
permissions-button-ok.label,
|
||||
permissions-exceptions-addons-window.title,
|
||||
permissions-exceptions-addons-desc,
|
||||
" />
|
||||
|
|
|
@ -115,8 +115,7 @@
|
|||
add-engine-name,
|
||||
add-engine-alias,
|
||||
add-engine-url,
|
||||
add-engine-cancel.label,
|
||||
add-engine-ok.label,
|
||||
add-engine-dialog.buttonlabelaccept,
|
||||
"
|
||||
/>
|
||||
</hbox>
|
||||
|
|
|
@ -34,7 +34,7 @@ add_task(async function() {
|
|||
let doc = await openDialog();
|
||||
|
||||
let name = doc.getElementById("name");
|
||||
let btnApplyChanges = doc.getElementById("btnApplyChanges");
|
||||
let btnApplyChanges = doc.querySelector("dialog").getButton("accept");
|
||||
|
||||
Assert.equal(name.value, "", "The name textbox should initlally be empty");
|
||||
Assert.ok(
|
||||
|
|
|
@ -17,21 +17,19 @@ async function openCookiesDialog(doc) {
|
|||
|
||||
function checkCookiesDialog(dialog) {
|
||||
ok(dialog, "dialog loaded");
|
||||
let buttonIds = [
|
||||
"removePermission",
|
||||
"removeAllPermissions",
|
||||
"btnApplyChanges",
|
||||
];
|
||||
let buttonIds = ["removePermission", "removeAllPermissions"];
|
||||
|
||||
for (let buttonId of buttonIds) {
|
||||
let button = dialog.document.getElementById(buttonId);
|
||||
ok(button, `${buttonId} found`);
|
||||
}
|
||||
|
||||
let cancelButton = dialog.document.getElementsByClassName("actionButtons")[1]
|
||||
.children[0];
|
||||
let dialogEl = dialog.document.querySelector("dialog");
|
||||
let acceptBtn = dialogEl.getButton("accept");
|
||||
let cancelBtn = dialogEl.getButton("cancel");
|
||||
|
||||
is(cancelButton.getAttribute("label"), "Cancel", "cancelButton found");
|
||||
ok(!acceptBtn.hidden, "acceptButton found");
|
||||
ok(!cancelBtn.hidden, "cancelButton found");
|
||||
}
|
||||
|
||||
function addNewPermission(websiteAddress, dialog) {
|
||||
|
@ -86,14 +84,15 @@ function deletePermission(permission, dialog) {
|
|||
}
|
||||
|
||||
function save(dialog) {
|
||||
let saveButton = dialog.document.getElementById("btnApplyChanges");
|
||||
let saveButton = dialog.document.querySelector("dialog").getButton("accept");
|
||||
saveButton.click();
|
||||
}
|
||||
|
||||
function cancel(dialog) {
|
||||
let cancelButton = dialog.document.getElementsByClassName("actionButtons")[1]
|
||||
.children[0];
|
||||
is(cancelButton.getAttribute("label"), "Cancel", "cancelButton found");
|
||||
let cancelButton = dialog.document
|
||||
.querySelector("dialog")
|
||||
.getButton("cancel");
|
||||
ok(!cancelButton.hidden, "cancelButton found");
|
||||
cancelButton.click();
|
||||
}
|
||||
|
||||
|
|
|
@ -529,7 +529,7 @@ async function runTest(test, getObservances) {
|
|||
allow: Ci.nsIPermissionManager.ALLOW_ACTION,
|
||||
deny: Ci.nsIPermissionManager.DENY_ACTION,
|
||||
};
|
||||
let btnApplyChanges = doc.getElementById("btnApplyChanges");
|
||||
let btnApplyChanges = doc.querySelector("dialog").getButton("accept");
|
||||
let observances = getObservances(params);
|
||||
let observeAllPromise = createObserveAllPromise(observances);
|
||||
|
||||
|
|
|
@ -168,7 +168,10 @@ add_task(async function onPermissionChange() {
|
|||
"Permission state does not change before saving changes"
|
||||
);
|
||||
|
||||
doc.getElementById("btnApplyChanges").click();
|
||||
doc
|
||||
.querySelector("dialog")
|
||||
.getButton("accept")
|
||||
.click();
|
||||
|
||||
await TestUtils.waitForCondition(
|
||||
() =>
|
||||
|
@ -203,7 +206,10 @@ add_task(async function onPermissionDelete() {
|
|||
"Permission is not deleted before saving changes"
|
||||
);
|
||||
|
||||
doc.getElementById("btnApplyChanges").click();
|
||||
doc
|
||||
.querySelector("dialog")
|
||||
.getButton("accept")
|
||||
.click();
|
||||
|
||||
await TestUtils.waitForCondition(
|
||||
() =>
|
||||
|
@ -245,7 +251,10 @@ add_task(async function onAllPermissionsDelete() {
|
|||
"Permissions are not deleted before saving changes"
|
||||
);
|
||||
|
||||
doc.getElementById("btnApplyChanges").click();
|
||||
doc
|
||||
.querySelector("dialog")
|
||||
.getButton("accept")
|
||||
.click();
|
||||
|
||||
await TestUtils.waitForCondition(
|
||||
() =>
|
||||
|
@ -276,7 +285,10 @@ add_task(async function onPermissionChangeAndDelete() {
|
|||
|
||||
await TestUtils.waitForCondition(() => richlistbox.itemCount == 0);
|
||||
|
||||
doc.getElementById("btnApplyChanges").click();
|
||||
doc
|
||||
.querySelector("dialog")
|
||||
.getButton("accept")
|
||||
.click();
|
||||
|
||||
await TestUtils.waitForCondition(
|
||||
() =>
|
||||
|
@ -298,7 +310,10 @@ add_task(async function onPermissionChangeCancel() {
|
|||
// Change the permission state in the UI.
|
||||
doc.getElementsByAttribute("value", SitePermissions.BLOCK)[0].click();
|
||||
|
||||
doc.getElementById("cancel").click();
|
||||
doc
|
||||
.querySelector("dialog")
|
||||
.getButton("cancel")
|
||||
.click();
|
||||
|
||||
Assert.equal(
|
||||
PermissionTestUtils.getPermissionObject(URI, "desktop-notification")
|
||||
|
@ -327,7 +342,10 @@ add_task(async function onPermissionDeleteCancel() {
|
|||
|
||||
await TestUtils.waitForCondition(() => richlistbox.itemCount == 0);
|
||||
|
||||
doc.getElementById("cancel").click();
|
||||
doc
|
||||
.querySelector("dialog")
|
||||
.getButton("cancel")
|
||||
.click();
|
||||
|
||||
Assert.equal(
|
||||
PermissionTestUtils.getPermissionObject(URI, "desktop-notification")
|
||||
|
@ -371,7 +389,10 @@ add_task(async function onSearch() {
|
|||
PermissionTestUtils.remove(URI, "desktop-notification");
|
||||
PermissionTestUtils.remove(u, "desktop-notification");
|
||||
|
||||
doc.getElementById("cancel").click();
|
||||
doc
|
||||
.querySelector("dialog")
|
||||
.getButton("cancel")
|
||||
.click();
|
||||
});
|
||||
|
||||
add_task(async function onPermissionsSort() {
|
||||
|
@ -440,7 +461,10 @@ add_task(async function onPermissionsSort() {
|
|||
PermissionTestUtils.remove(URI, "desktop-notification");
|
||||
PermissionTestUtils.remove(u, "desktop-notification");
|
||||
|
||||
doc.getElementById("cancel").click();
|
||||
doc
|
||||
.querySelector("dialog")
|
||||
.getButton("cancel")
|
||||
.click();
|
||||
});
|
||||
|
||||
add_task(async function onPermissionDisable() {
|
||||
|
@ -459,7 +483,10 @@ add_task(async function onPermissionDisable() {
|
|||
|
||||
// Disable permission and click on "Cancel".
|
||||
checkbox.checked = true;
|
||||
doc.getElementById("cancel").click();
|
||||
doc
|
||||
.querySelector("dialog")
|
||||
.getButton("cancel")
|
||||
.click();
|
||||
|
||||
// Check that the permission is not disabled yet.
|
||||
let perm = Services.prefs.getIntPref(
|
||||
|
@ -474,7 +501,10 @@ add_task(async function onPermissionDisable() {
|
|||
// Disable permission and save changes.
|
||||
checkbox = doc.getElementById("permissionsDisableCheckbox");
|
||||
checkbox.checked = true;
|
||||
doc.getElementById("btnApplyChanges").click();
|
||||
doc
|
||||
.querySelector("dialog")
|
||||
.getButton("accept")
|
||||
.click();
|
||||
|
||||
// Check if the permission is now disabled.
|
||||
perm = Services.prefs.getIntPref("permissions.default.desktop-notification");
|
||||
|
@ -487,7 +517,10 @@ add_task(async function onPermissionDisable() {
|
|||
Assert.equal(checkbox.checked, true);
|
||||
|
||||
// Close the dialog and clean up.
|
||||
doc.getElementById("cancel").click();
|
||||
doc
|
||||
.querySelector("dialog")
|
||||
.getButton("cancel")
|
||||
.click();
|
||||
Services.prefs.setIntPref(
|
||||
"permissions.default.desktop-notification",
|
||||
SitePermissions.UNKNOWN
|
||||
|
@ -513,7 +546,10 @@ add_task(async function checkDefaultPermissionState() {
|
|||
checkbox.checked = false;
|
||||
|
||||
// Save changes.
|
||||
doc.getElementById("btnApplyChanges").click();
|
||||
doc
|
||||
.querySelector("dialog")
|
||||
.getButton("accept")
|
||||
.click();
|
||||
|
||||
// Check if the default permission state is retained (and not automatically set to SitePermissions.UNKNOWN).
|
||||
let state = Services.prefs.getIntPref(
|
||||
|
@ -580,7 +616,10 @@ add_task(async function testTabBehaviour() {
|
|||
PermissionTestUtils.remove(URI, "desktop-notification");
|
||||
PermissionTestUtils.remove(u, "desktop-notification");
|
||||
|
||||
doc.getElementById("cancel").click();
|
||||
doc
|
||||
.querySelector("dialog")
|
||||
.getButton("cancel")
|
||||
.click();
|
||||
});
|
||||
|
||||
add_task(async function removeTab() {
|
||||
|
|
|
@ -114,7 +114,9 @@ async function testClearData(clearSiteData, clearCache) {
|
|||
|
||||
let dialogClosed = BrowserTestUtils.waitForEvent(dialogWin, "unload");
|
||||
|
||||
let clearButton = dialogWin.document.getElementById("clearButton");
|
||||
let clearButton = dialogWin.document
|
||||
.querySelector("dialog")
|
||||
.getButton("accept");
|
||||
if (!clearSiteData && !clearCache) {
|
||||
// Simulate user input on one of the checkboxes to trigger the event listener for
|
||||
// disabling the clearButton.
|
||||
|
@ -124,7 +126,9 @@ async function testClearData(clearSiteData, clearCache) {
|
|||
() => clearButton.disabled,
|
||||
"Clear button should be disabled"
|
||||
);
|
||||
let cancelButton = dialogWin.document.getElementById("cancelButton");
|
||||
let cancelButton = dialogWin.document
|
||||
.querySelector("dialog")
|
||||
.getButton("cancel");
|
||||
// Cancel, since we can't delete anything.
|
||||
cancelButton.click();
|
||||
} else {
|
||||
|
|
|
@ -174,7 +174,7 @@ add_task(async function() {
|
|||
let site = sitesList.querySelector(`richlistitem[host="${host}"]`);
|
||||
if (site) {
|
||||
let removeBtn = frameDoc.getElementById("removeSelected");
|
||||
let saveBtn = frameDoc.getElementById("save");
|
||||
let saveBtn = frameDoc.querySelector("dialog").getButton("accept");
|
||||
site.click();
|
||||
removeBtn.doCommand();
|
||||
saveBtn.doCommand();
|
||||
|
@ -325,7 +325,7 @@ add_task(async function() {
|
|||
);
|
||||
|
||||
let removeBtn = frameDoc.getElementById("removeSelected");
|
||||
let saveBtn = frameDoc.getElementById("save");
|
||||
let saveBtn = frameDoc.querySelector("dialog").getButton("accept");
|
||||
site2.click();
|
||||
removeBtn.doCommand();
|
||||
saveBtn.doCommand();
|
||||
|
@ -374,7 +374,7 @@ add_task(async function() {
|
|||
);
|
||||
|
||||
let removeBtn = frameDoc.getElementById("removeSelected");
|
||||
let saveBtn = frameDoc.getElementById("save");
|
||||
let saveBtn = frameDoc.querySelector("dialog").getButton("accept");
|
||||
site1.click();
|
||||
removeBtn.doCommand();
|
||||
saveBtn.doCommand();
|
||||
|
|
|
@ -53,7 +53,7 @@ add_task(async function test_selectRemove() {
|
|||
// Test the "Cancel" button
|
||||
settingsDialogClosePromise = promiseSettingsDialogClose();
|
||||
frameDoc = win.gSubDialog._topDialog._frame.contentDocument;
|
||||
cancelBtn = frameDoc.getElementById("cancel");
|
||||
cancelBtn = frameDoc.querySelector("dialog").getButton("cancel");
|
||||
removeAllSitesOneByOne();
|
||||
assertAllSitesNotListed(win);
|
||||
cancelBtn.doCommand();
|
||||
|
@ -65,8 +65,8 @@ add_task(async function test_selectRemove() {
|
|||
let cancelPromise = BrowserTestUtils.promiseAlertDialogOpen("cancel");
|
||||
settingsDialogClosePromise = promiseSettingsDialogClose();
|
||||
frameDoc = win.gSubDialog._topDialog._frame.contentDocument;
|
||||
saveBtn = frameDoc.getElementById("save");
|
||||
cancelBtn = frameDoc.getElementById("cancel");
|
||||
saveBtn = frameDoc.querySelector("dialog").getButton("accept");
|
||||
cancelBtn = frameDoc.querySelector("dialog").getButton("cancel");
|
||||
removeAllSitesOneByOne();
|
||||
assertAllSitesNotListed(win);
|
||||
saveBtn.doCommand();
|
||||
|
@ -81,7 +81,7 @@ add_task(async function test_selectRemove() {
|
|||
settingsDialogClosePromise = promiseSettingsDialogClose();
|
||||
updatePromise = promiseSiteDataManagerSitesUpdated();
|
||||
frameDoc = win.gSubDialog._topDialog._frame.contentDocument;
|
||||
saveBtn = frameDoc.getElementById("save");
|
||||
saveBtn = frameDoc.querySelector("dialog").getButton("accept");
|
||||
removeAllSitesOneByOne();
|
||||
assertAllSitesNotListed(win);
|
||||
saveBtn.doCommand();
|
||||
|
@ -161,7 +161,7 @@ add_task(async function test_removePartialSites() {
|
|||
// Test the "Cancel" button
|
||||
settingsDialogClosePromise = promiseSettingsDialogClose();
|
||||
frameDoc = win.gSubDialog._topDialog._frame.contentDocument;
|
||||
cancelBtn = frameDoc.getElementById("cancel");
|
||||
cancelBtn = frameDoc.querySelector("dialog").getButton("cancel");
|
||||
await removeSelectedSite(hosts.slice(0, 2));
|
||||
assertSitesListed(doc, hosts.slice(2));
|
||||
cancelBtn.doCommand();
|
||||
|
@ -176,8 +176,8 @@ add_task(async function test_removePartialSites() {
|
|||
);
|
||||
settingsDialogClosePromise = promiseSettingsDialogClose();
|
||||
frameDoc = win.gSubDialog._topDialog._frame.contentDocument;
|
||||
saveBtn = frameDoc.getElementById("save");
|
||||
cancelBtn = frameDoc.getElementById("cancel");
|
||||
saveBtn = frameDoc.querySelector("dialog").getButton("accept");
|
||||
cancelBtn = frameDoc.querySelector("dialog").getButton("cancel");
|
||||
await removeSelectedSite(hosts.slice(0, 2));
|
||||
assertSitesListed(doc, hosts.slice(2));
|
||||
saveBtn.doCommand();
|
||||
|
@ -194,7 +194,7 @@ add_task(async function test_removePartialSites() {
|
|||
);
|
||||
settingsDialogClosePromise = promiseSettingsDialogClose();
|
||||
frameDoc = win.gSubDialog._topDialog._frame.contentDocument;
|
||||
saveBtn = frameDoc.getElementById("save");
|
||||
saveBtn = frameDoc.querySelector("dialog").getButton("accept");
|
||||
await removeSelectedSite(hosts.slice(0, 2));
|
||||
assertSitesListed(doc, hosts.slice(2));
|
||||
saveBtn.doCommand();
|
||||
|
@ -290,7 +290,7 @@ add_task(async function() {
|
|||
);
|
||||
let settingsDialogClosePromise = promiseSettingsDialogClose();
|
||||
let removeAllBtn = frameDoc.getElementById("removeAll");
|
||||
let saveBtn = frameDoc.getElementById("save");
|
||||
let saveBtn = frameDoc.querySelector("dialog").getButton("accept");
|
||||
removeAllBtn.doCommand();
|
||||
saveBtn.doCommand();
|
||||
await acceptRemovePromise;
|
||||
|
@ -350,7 +350,7 @@ add_task(async function() {
|
|||
let acceptRemovePromise = BrowserTestUtils.promiseAlertDialogOpen("accept");
|
||||
let settingsDialogClosePromise = promiseSettingsDialogClose();
|
||||
let removeAllBtn = frameDoc.getElementById("removeAll");
|
||||
let saveBtn = frameDoc.getElementById("save");
|
||||
let saveBtn = frameDoc.querySelector("dialog").getButton("accept");
|
||||
removeAllBtn.doCommand();
|
||||
saveBtn.doCommand();
|
||||
await acceptRemovePromise;
|
||||
|
|
|
@ -88,7 +88,7 @@ add_task(async function() {
|
|||
assertSitesListed(doc, hosts.slice(4));
|
||||
|
||||
updatePromise = promiseSiteDataManagerSitesUpdated();
|
||||
let saveBtn = frameDoc.getElementById("save");
|
||||
let saveBtn = frameDoc.querySelector("dialog").getButton("accept");
|
||||
saveBtn.doCommand();
|
||||
|
||||
await removeDialogOpenPromise;
|
||||
|
|
|
@ -13,8 +13,8 @@ several different sources, including:
|
|||
* WebExtensions
|
||||
* Open tabs
|
||||
|
||||
Most of the address bar code lives in `browser/components/urlbar <https://dxr.mozilla.org/mozilla-central/source/browser/components/urlbar/>`_.
|
||||
A separate and important back-end piece currently is `toolkit/components/places/UnifiedComplete.jsm <https://dxr.mozilla.org/mozilla-central/source/toolkit/components/places/UnifiedComplete.jsm>`_, which was carried over from awesomebar and has not yet been rewritten for quantumbar.
|
||||
Most of the address bar code lives in `browser/components/urlbar <https://searchfox.org/mozilla-central/source/browser/components/urlbar/>`_.
|
||||
A separate and important back-end piece currently is `toolkit/components/places/UnifiedComplete.jsm <https://searchfox.org/mozilla-central/source/toolkit/components/places/UnifiedComplete.jsm>`_, which was carried over from awesomebar and has not yet been rewritten for quantumbar.
|
||||
|
||||
.. toctree::
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ The Model
|
|||
|
||||
The *Model* is the component responsible for retrieving search results based on
|
||||
the user's input, and sorting them accordingly to their importance.
|
||||
At the core is the `UrlbarProvidersManager <https://dxr.mozilla.org/mozilla-central/source/browser/components/urlbar/UrlbarProvidersManager.jsm>`_,
|
||||
At the core is the `UrlbarProvidersManager <https://searchfox.org/mozilla-central/source/browser/components/urlbar/UrlbarProvidersManager.jsm>`_,
|
||||
a component tracking all the available search providers, and managing searches
|
||||
across them.
|
||||
|
||||
|
@ -91,7 +91,7 @@ Queries can be canceled.
|
|||
terminating any running and future SQL query, unless a query is running inside
|
||||
a *runInCriticalSection* task.
|
||||
|
||||
The *searchString* gets tokenized by the `UrlbarTokenizer <https://dxr.mozilla.org/mozilla-central/source/browser/components/urlbar/UrlbarTokenizer.jsm>`_
|
||||
The *searchString* gets tokenized by the `UrlbarTokenizer <https://searchfox.org/mozilla-central/source/browser/components/urlbar/UrlbarTokenizer.jsm>`_
|
||||
component into tokens, some of these tokens have a special meaning and can be
|
||||
used by the user to restrict the search to specific result type (See the
|
||||
*UrlbarTokenizer::TYPE* enum).
|
||||
|
@ -239,7 +239,7 @@ indicated by the UrlbarQueryContext.muxer property.
|
|||
The Controller
|
||||
--------------
|
||||
|
||||
`UrlbarController <https://dxr.mozilla.org/mozilla-central/source/browser/components/urlbar/UrlbarController.jsm>`_
|
||||
`UrlbarController <https://searchfox.org/mozilla-central/source/browser/components/urlbar/UrlbarController.jsm>`_
|
||||
is the component responsible for reacting to user's input, by communicating
|
||||
proper course of action to the Model (e.g. starting/stopping a query) and the
|
||||
View (e.g. showing/hiding a panel). It is also responsible for reporting Telemetry.
|
||||
|
@ -273,7 +273,7 @@ user and handling their input.
|
|||
The View is a replaceable component, as such what is described here is a
|
||||
reference for the default View, but may not be valid for other implementations.
|
||||
|
||||
`UrlbarInput.jsm <https://dxr.mozilla.org/mozilla-central/source/browser/components/urlbar/UrlbarInput.jsm>`_
|
||||
`UrlbarInput.jsm <https://searchfox.org/mozilla-central/source/browser/components/urlbar/UrlbarInput.jsm>`_
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Implements an input box *View*, owns an *UrlbarView*.
|
||||
|
@ -318,7 +318,7 @@ Implements an input box *View*, owns an *UrlbarView*.
|
|||
value;
|
||||
}
|
||||
|
||||
`UrlbarView.jsm <https://dxr.mozilla.org/mozilla-central/source/browser/components/urlbar/UrlbarView.jsm>`_
|
||||
`UrlbarView.jsm <https://searchfox.org/mozilla-central/source/browser/components/urlbar/UrlbarView.jsm>`_
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Represents the base *View* implementation, communicates with the *Controller*.
|
||||
|
@ -349,7 +349,7 @@ Represents the base *View* implementation, communicates with the *Controller*.
|
|||
UrlbarResult
|
||||
------------
|
||||
|
||||
An `UrlbarResult <https://dxr.mozilla.org/mozilla-central/source/browser/components/urlbar/UrlbarResult.jsm>`_
|
||||
An `UrlbarResult <https://searchfox.org/mozilla-central/source/browser/components/urlbar/UrlbarResult.jsm>`_
|
||||
instance represents a single search result with a result type, that
|
||||
identifies specific kind of results.
|
||||
Each kind has its own properties, that the *View* may support, and a few common
|
||||
|
|
|
@ -3,7 +3,7 @@ Utilities
|
|||
|
||||
Various modules provide shared utilities to the other components:
|
||||
|
||||
`UrlbarPrefs.jsm <https://dxr.mozilla.org/mozilla-central/source/browser/components/urlbar/UrlbarPrefs.jsm>`_
|
||||
`UrlbarPrefs.jsm <https://searchfox.org/mozilla-central/source/browser/components/urlbar/UrlbarPrefs.jsm>`_
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Implements a Map-like storage or urlbar related preferences. The values are kept
|
||||
|
@ -20,7 +20,7 @@ up-to-date.
|
|||
|
||||
Newly added preferences should always be properly documented in UrlbarPrefs.
|
||||
|
||||
`UrlbarUtils.jsm <https://dxr.mozilla.org/mozilla-central/source/browser/components/urlbar/UrlbarUtils.jsm>`_
|
||||
`UrlbarUtils.jsm <https://searchfox.org/mozilla-central/source/browser/components/urlbar/UrlbarUtils.jsm>`_
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Includes shared utils and constants shared across all the components.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Browser Usage Telemetry
|
||||
=======================
|
||||
|
||||
The `BrowserUsageTelemetry.jsm <https://dxr.mozilla.org/mozilla-central/source/browser/modules/BrowserUsageTelemetry.jsm>`_ module is the main module for measurements regarding the browser usage (e.g. tab and window counts, search counts, ...).
|
||||
The `BrowserUsageTelemetry.jsm <https://searchfox.org/mozilla-central/source/browser/modules/BrowserUsageTelemetry.jsm>`_ module is the main module for measurements regarding the browser usage (e.g. tab and window counts, search counts, ...).
|
||||
|
||||
The measurements recording begins right after the ``SessionStore`` has finished restoring the session (i.e. restoring tabs/windows after Firefox starts).
|
||||
|
||||
|
@ -12,9 +12,9 @@ Search telemetry
|
|||
================
|
||||
This module exposes the ``recordSearch`` method, which serves as the main entry point for recording search related Telemetry. It records only the search *counts* per engine and the origin of the search, but nothing pertaining the search contents themselves.
|
||||
|
||||
As the transition to the ``BrowserUsageTelemetry`` happens, the ``recordSearch`` calls are dispatched through `BrowserSearch.recordSearchInTelemetry <https://dxr.mozilla.org/mozilla-central/rev/3e73fd638e687a4d7f46613586e5156b8e2af846/browser/base/content/browser.js#3752>`_, that is called by all the search related UI components (urlbar, searchbar, context menu and about\:\* pages).
|
||||
As the transition to the ``BrowserUsageTelemetry`` happens, the ``recordSearch`` calls are dispatched through `BrowserSearch.recordSearchInTelemetry <https://searchfox.org/mozilla-central/rev/1a973762afcbc5066f73f1508b0c846872fe3952/browser/base/content/browser.js#4498>`_, that is called by all the search related UI components (urlbar, searchbar, context menu and about\:\* pages).
|
||||
|
||||
A list of the components recording search Telemetry can be found using the following `DXR search <https://dxr.mozilla.org/mozilla-central/search?q=recordSearchInTelemetry>`_.
|
||||
A list of the components recording search Telemetry can be found using the following `Searchfox search <https://searchfox.org/mozilla-central/search?q=recordSearchInTelemetry>`_.
|
||||
|
||||
Tab and window interactions
|
||||
===========================
|
||||
|
@ -25,7 +25,7 @@ The usage telemetry module currently measures these interactions with the browse
|
|||
- *navigation events*: at this time, this only counts the number of time a page load is triggered by a particular UI interaction (e.g. by searching through the URL bar, see ``browser.engagement.navigation.urlbar``).
|
||||
|
||||
|
||||
Please see `Scalars.yaml <https://dxr.mozilla.org/mozilla-central/source/toolkit/components/telemetry/Scalars.yaml>`_ for the full list of tracked interactions.
|
||||
Please see `Scalars.yaml <https://searchfox.org/mozilla-central/source/toolkit/components/telemetry/Scalars.yaml>`_ for the full list of tracked interactions.
|
||||
|
||||
Customizable UI
|
||||
===============
|
||||
|
|
|
@ -357,6 +357,10 @@ main-context-menu-frame-view-info =
|
|||
.label = View Frame Info
|
||||
.accesskey = I
|
||||
|
||||
main-context-menu-print-selection =
|
||||
.label = Print Selection
|
||||
.accesskey = r
|
||||
|
||||
main-context-menu-view-selection-source =
|
||||
.label = View Selection Source
|
||||
.accesskey = e
|
||||
|
|
|
@ -14,13 +14,9 @@ add-engine-alias = Alias
|
|||
|
||||
add-engine-url = Engine URL, use %s in place of the search term
|
||||
|
||||
add-engine-cancel =
|
||||
.label = Cancel
|
||||
.accesskey = C
|
||||
|
||||
add-engine-ok =
|
||||
.label = Add Engine
|
||||
.accesskey = A
|
||||
add-engine-dialog=
|
||||
.buttonlabelaccept = Add Engine
|
||||
.buttonaccesskeyaccept = A
|
||||
|
||||
engine-name-exists = An engine with that name already exists
|
||||
engine-alias-exists = An engine with that alias already exists
|
||||
|
|
|
@ -13,13 +13,10 @@ blocklist-close-key =
|
|||
blocklist-treehead-list =
|
||||
.label = List
|
||||
|
||||
blocklist-button-cancel =
|
||||
.label = Cancel
|
||||
.accesskey = C
|
||||
blocklist-dialog=
|
||||
.buttonlabelaccept = Save Changes
|
||||
.buttonaccesskeyaccept = S
|
||||
|
||||
blocklist-button-ok =
|
||||
.label = Save Changes
|
||||
.accesskey = S
|
||||
|
||||
# This template constructs the name of the block list in the block lists dialog.
|
||||
# It combines the list name and description.
|
||||
|
|
|
@ -51,10 +51,6 @@ clear-site-data-cache-empty =
|
|||
|
||||
clear-site-data-cache-info = Will require websites to reload images and data
|
||||
|
||||
clear-site-data-cancel =
|
||||
.label = Cancel
|
||||
.accesskey = C
|
||||
|
||||
clear-site-data-clear =
|
||||
.label = Clear
|
||||
.accesskey = l
|
||||
clear-site-data-dialog =
|
||||
.buttonlabelaccept = Clear
|
||||
.buttonaccesskeyaccept = l
|
||||
|
|
|
@ -40,9 +40,9 @@ containers-color-label = Color
|
|||
.accesskey = o
|
||||
.style = { -containers-labels-style }
|
||||
|
||||
containers-button-done =
|
||||
.label = Done
|
||||
.accesskey = D
|
||||
containers-dialog =
|
||||
.buttonlabelaccept = Done
|
||||
.buttonaccesskeyaccept = D
|
||||
|
||||
containers-color-blue =
|
||||
.label = Blue
|
||||
|
|
|
@ -38,13 +38,9 @@ permissions-remove-all =
|
|||
.label = Remove All Websites
|
||||
.accesskey = e
|
||||
|
||||
permissions-button-cancel =
|
||||
.label = Cancel
|
||||
.accesskey = C
|
||||
|
||||
permissions-button-ok =
|
||||
.label = Save Changes
|
||||
.accesskey = S
|
||||
permission-dialog =
|
||||
.buttonlabelaccept = Save Changes
|
||||
.buttonaccesskeyaccept = S
|
||||
|
||||
permissions-autoplay-menu = Default for all websites:
|
||||
|
||||
|
|
|
@ -30,13 +30,9 @@ site-data-remove-selected =
|
|||
.label = Remove Selected
|
||||
.accesskey = R
|
||||
|
||||
site-data-button-cancel =
|
||||
.label = Cancel
|
||||
.accesskey = C
|
||||
|
||||
site-data-button-save =
|
||||
.label = Save Changes
|
||||
.accesskey = a
|
||||
site-data-settings-dialog =
|
||||
.buttonlabelaccept = Save Changes
|
||||
.buttonaccesskeyaccept = a
|
||||
|
||||
# Variables:
|
||||
# $value (Number) - Value of the unit (for example: 4.6, 500)
|
||||
|
|
|
@ -35,6 +35,6 @@ translation-sites-button-remove-all =
|
|||
.label = Remove All Sites
|
||||
.accesskey = i
|
||||
|
||||
translation-button-close =
|
||||
.label = Close
|
||||
.accesskey = C
|
||||
translation-dialog =
|
||||
.buttonlabelaccept = Close
|
||||
.buttonaccesskeyaccept = C
|
||||
|
|
|
@ -73,5 +73,5 @@ define(MOZ_ARG_HEADER, [# $1])
|
|||
dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file
|
||||
AC_DEFUN([MOZ_READ_MOZCONFIG],
|
||||
[AC_REQUIRE([AC_INIT_BINSH])dnl
|
||||
. ./old-configure.vars
|
||||
. $OLD_CONFIGURE_VARS
|
||||
])
|
||||
|
|
|
@ -85,16 +85,12 @@ if test -n "$ENABLE_MOZSEARCH_PLUGIN"; then
|
|||
AC_MSG_ERROR([Can't use mozsearch plugin without --enable-clang-plugin.])
|
||||
fi
|
||||
|
||||
dnl We use this construct rather than $_objdir to avoid getting /js/src in the
|
||||
dnl path when compiling JS code.
|
||||
OBJDIR="$(dirname $(dirname $(dirname $CLANG_PLUGIN)))"
|
||||
|
||||
CLANG_PLUGIN_FLAGS="$CLANG_PLUGIN_FLAGS -Xclang -add-plugin -Xclang mozsearch-index"
|
||||
|
||||
dnl Parameters are: srcdir, outdir (path where output JSON is stored), objdir.
|
||||
CLANG_PLUGIN_FLAGS="$CLANG_PLUGIN_FLAGS -Xclang -plugin-arg-mozsearch-index -Xclang $_topsrcdir"
|
||||
CLANG_PLUGIN_FLAGS="$CLANG_PLUGIN_FLAGS -Xclang -plugin-arg-mozsearch-index -Xclang $OBJDIR/mozsearch_index"
|
||||
CLANG_PLUGIN_FLAGS="$CLANG_PLUGIN_FLAGS -Xclang -plugin-arg-mozsearch-index -Xclang $OBJDIR"
|
||||
CLANG_PLUGIN_FLAGS="$CLANG_PLUGIN_FLAGS -Xclang -plugin-arg-mozsearch-index -Xclang $_objdir/mozsearch_index"
|
||||
CLANG_PLUGIN_FLAGS="$CLANG_PLUGIN_FLAGS -Xclang -plugin-arg-mozsearch-index -Xclang $_objdir"
|
||||
|
||||
AC_DEFINE(MOZ_MOZSEARCH_PLUGIN)
|
||||
fi
|
||||
|
|
|
@ -165,7 +165,7 @@ The first thing to note is that only files beneath :file:`locales/en-US` are
|
|||
exposed to localizers. The second thing to note is that only a few directories
|
||||
are exposed. Which directories are exposed is defined in files called
|
||||
``l10n.ini``, which are at a
|
||||
`few places <https://dxr.mozilla.org/mozilla-central/search?q=path%3Al10n.ini&redirect=true>`_
|
||||
`few places <https://searchfox.org/mozilla-central/search?q=path%3Al10n.ini&redirect=true>`_
|
||||
in the source code.
|
||||
|
||||
An example looks like this
|
||||
|
@ -328,5 +328,4 @@ We host a mercurial repository per locale. All of our
|
|||
localizations can be found on https://hg.mozilla.org/l10n-central/.
|
||||
|
||||
You can search inside our localized files on
|
||||
`Transvision <https://transvision.mozfr.org/>`_ and
|
||||
https://dxr.mozilla.org/l10n-central/source/.
|
||||
`Transvision <https://transvision.mozfr.org/>`_.
|
||||
|
|
|
@ -14,11 +14,11 @@ def default_android_ndk_root(mozbuild_state_path, _):
|
|||
return path
|
||||
|
||||
|
||||
js_option('--with-android-ndk', nargs=1,
|
||||
option('--with-android-ndk', nargs=1,
|
||||
default=default_android_ndk_root,
|
||||
help='location where the Android NDK can be found{|}')
|
||||
|
||||
js_option('--with-android-toolchain', nargs=1,
|
||||
option('--with-android-toolchain', nargs=1,
|
||||
help='location of the Android toolchain')
|
||||
|
||||
option('--with-android-googlevr-sdk', nargs=1,
|
||||
|
@ -33,7 +33,7 @@ def min_android_version(target):
|
|||
return '16'
|
||||
|
||||
|
||||
js_option('--with-android-version',
|
||||
option('--with-android-version',
|
||||
nargs=1,
|
||||
help='android platform version{|}',
|
||||
default=min_android_version)
|
||||
|
@ -244,7 +244,7 @@ def android_toolchain_prefix_base(target):
|
|||
return target.toolchain
|
||||
|
||||
|
||||
js_option(env='STLPORT_CPPFLAGS',
|
||||
option(env='STLPORT_CPPFLAGS',
|
||||
nargs=1,
|
||||
help='Options compiler should pass for standard C++ library')
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ def arm_option_defaults(os, _):
|
|||
# default is always returned. The lint is fooled by this file being
|
||||
# conditional. If it weren't conditional, the lint wouldn't ask for '{|}' to
|
||||
# be there.
|
||||
js_option('--with-arch', nargs=1,
|
||||
option('--with-arch', nargs=1,
|
||||
default=arm_option_defaults.arch,
|
||||
help='{Use specific CPU features (-march=type). Resets thumb, fpu, '
|
||||
'float-abi, etc. defaults when set|}')
|
||||
|
@ -40,7 +40,7 @@ def arch_option(value):
|
|||
return []
|
||||
|
||||
|
||||
js_option('--with-thumb', choices=('yes', 'no', 'toolchain-default'),
|
||||
option('--with-thumb', choices=('yes', 'no', 'toolchain-default'),
|
||||
default=arm_option_defaults.thumb,
|
||||
nargs='?', help='{Use Thumb instruction set (-mthumb)|}')
|
||||
|
||||
|
@ -67,7 +67,7 @@ def thumb_option(value):
|
|||
return []
|
||||
|
||||
|
||||
js_option('--with-thumb-interwork', choices=('yes', 'no', 'toolchain-default'),
|
||||
option('--with-thumb-interwork', choices=('yes', 'no', 'toolchain-default'),
|
||||
default='toolchain-default',
|
||||
nargs='?', help='Use Thumb/ARM instuctions interwork (-mthumb-interwork)')
|
||||
|
||||
|
@ -82,7 +82,7 @@ def thumb_interwork_option(value):
|
|||
return []
|
||||
|
||||
|
||||
js_option('--with-fpu', nargs=1,
|
||||
option('--with-fpu', nargs=1,
|
||||
default=arm_option_defaults.fpu,
|
||||
help='{Use specific FPU type (-mfpu=type)|}')
|
||||
|
||||
|
@ -95,7 +95,7 @@ def fpu_option(value):
|
|||
return []
|
||||
|
||||
|
||||
js_option('--with-float-abi', nargs=1,
|
||||
option('--with-float-abi', nargs=1,
|
||||
default=arm_option_defaults.float_abi,
|
||||
help='{Use specific arm float ABI (-mfloat-abi=type)|}')
|
||||
|
||||
|
@ -108,7 +108,7 @@ def float_abi_option(value):
|
|||
return []
|
||||
|
||||
|
||||
js_option('--with-soft-float', choices=('yes', 'no', 'toolchain-default'),
|
||||
option('--with-soft-float', choices=('yes', 'no', 'toolchain-default'),
|
||||
default='toolchain-default',
|
||||
nargs='?', help='Use soft float library (-msoft-float)')
|
||||
|
||||
|
|
|
@ -68,15 +68,15 @@ def cbindgen(cbindgen_override, toolchain_search_path):
|
|||
set_config('CBINDGEN', cbindgen)
|
||||
|
||||
# Bindgen can use rustfmt to format Rust file, but it's not required.
|
||||
js_option(env='RUSTFMT', nargs=1, help='Path to the rustfmt program')
|
||||
option(env='RUSTFMT', nargs=1, help='Path to the rustfmt program')
|
||||
|
||||
rustfmt = check_prog('RUSTFMT', ['rustfmt'], paths=toolchain_search_path,
|
||||
input='RUSTFMT', allow_missing=True)
|
||||
|
||||
|
||||
js_option('--with-libclang-path', nargs=1,
|
||||
option('--with-libclang-path', nargs=1,
|
||||
help='Absolute path to a directory containing Clang/LLVM libraries for bindgen (version 3.9.x or above)')
|
||||
js_option('--with-clang-path', nargs=1,
|
||||
option('--with-clang-path', nargs=1,
|
||||
help='Absolute path to a Clang binary for bindgen (version 3.9.x or above)')
|
||||
|
||||
|
||||
|
@ -289,7 +289,7 @@ def basic_bindgen_cflags(target, is_unix, compiler_info, android_cflags,
|
|||
return args + (clang_flags or [])
|
||||
|
||||
|
||||
js_option(env='BINDGEN_CFLAGS',
|
||||
option(env='BINDGEN_CFLAGS',
|
||||
nargs=1,
|
||||
help='Options bindgen should pass to the C/C++ parser')
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ def rust_flags(compile_flags, warning_flags):
|
|||
set_config('MOZ_RUST_DEFAULT_FLAGS', rust_flags)
|
||||
|
||||
|
||||
js_option('--disable-new-pass-manager',
|
||||
option('--disable-new-pass-manager',
|
||||
help='Use the legacy LLVM pass manager in clang builds')
|
||||
|
||||
@depends('--enable-new-pass-manager', c_compiler, host, target, 'MOZ_PGO',
|
||||
|
|
|
@ -69,7 +69,7 @@ check_headers(
|
|||
have_perf_event_h = check_header('linux/perf_event.h',
|
||||
when=building_linux)
|
||||
|
||||
js_option('--with-linux-headers',
|
||||
option('--with-linux-headers',
|
||||
help='location where the Linux kernel headers can be found',
|
||||
nargs=1)
|
||||
|
||||
|
|
|
@ -115,15 +115,12 @@ def check_build_environment(help, dist):
|
|||
|
||||
set_config('TOPSRCDIR', check_build_environment.topsrcdir)
|
||||
set_config('TOPOBJDIR', check_build_environment.topobjdir)
|
||||
set_config('MOZ_BUILD_ROOT', check_build_environment.topobjdir)
|
||||
set_config('DIST', check_build_environment.dist)
|
||||
|
||||
add_old_configure_assignment(
|
||||
'_topsrcdir', check_build_environment.topsrcdir)
|
||||
add_old_configure_assignment(
|
||||
'_objdir', check_build_environment.topobjdir)
|
||||
add_old_configure_assignment(
|
||||
'MOZ_BUILD_ROOT', check_build_environment.topobjdir)
|
||||
add_old_configure_assignment(
|
||||
'DIST', check_build_environment.dist)
|
||||
|
||||
|
@ -1109,25 +1106,7 @@ set_define('MOZ_BUILD_APP', build_project)
|
|||
add_old_configure_assignment('MOZ_BUILD_APP', build_project)
|
||||
|
||||
|
||||
# This is temporary until js/src/configure and configure are merged.
|
||||
# Use instead of option() in js/moz.configure and more generally, for
|
||||
# options that are shared between configure and js/src/configure.
|
||||
@dependable
|
||||
def js_configure_args():
|
||||
return []
|
||||
|
||||
@template
|
||||
def js_option(*args, **kwargs):
|
||||
opt = option(*args, **kwargs)
|
||||
|
||||
@depends(js_configure_args, opt.option, build_project, when=kwargs.get('when'))
|
||||
def js_option(js_configure_args, value, build_project):
|
||||
if build_project != 'js':
|
||||
arg = value.format(opt.option)
|
||||
js_configure_args.append(arg)
|
||||
|
||||
|
||||
js_option(env='MOZILLA_OFFICIAL',
|
||||
option(env='MOZILLA_OFFICIAL',
|
||||
help='Build an official release')
|
||||
|
||||
|
||||
|
@ -1291,7 +1270,7 @@ set_define('MOZ_UPDATE_CHANNEL', update_channel)
|
|||
add_old_configure_assignment('MOZ_UPDATE_CHANNEL', update_channel)
|
||||
|
||||
|
||||
js_option(env='MOZBUILD_STATE_PATH', nargs=1,
|
||||
option(env='MOZBUILD_STATE_PATH', nargs=1,
|
||||
help='Path to a persistent state directory for the build system '
|
||||
'and related tools')
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ llvm_profdata = check_prog('LLVM_PROFDATA', ['llvm-profdata'],
|
|||
allow_missing=True,
|
||||
paths=toolchain_search_path)
|
||||
|
||||
js_option('--enable-profile-generate',
|
||||
option('--enable-profile-generate',
|
||||
env='MOZ_PROFILE_GENERATE',
|
||||
nargs='?',
|
||||
choices=('cross',),
|
||||
|
@ -28,13 +28,13 @@ set_define('MOZ_PROFILE_GENERATE',
|
|||
add_old_configure_assignment('MOZ_PROFILE_GENERATE', 1,
|
||||
when='--enable-profile-generate')
|
||||
|
||||
js_option('--enable-profile-use',
|
||||
option('--enable-profile-use',
|
||||
env='MOZ_PROFILE_USE',
|
||||
nargs='?',
|
||||
choices=('cross',),
|
||||
help='Use a generated profile during the build')
|
||||
|
||||
js_option('--with-pgo-profile-path',
|
||||
option('--with-pgo-profile-path',
|
||||
help='Path to the directory with unmerged profile data to use during the build',
|
||||
nargs=1)
|
||||
|
||||
|
@ -148,13 +148,13 @@ set_config('MOZ_PGO_RUST', moz_pgo_rust)
|
|||
# LTO
|
||||
# ==============================================================
|
||||
|
||||
js_option('--enable-lto',
|
||||
option('--enable-lto',
|
||||
env='MOZ_LTO',
|
||||
nargs='?',
|
||||
choices=('full', 'thin', 'cross'),
|
||||
help='Enable LTO')
|
||||
|
||||
js_option(env='MOZ_LD64_KNOWN_GOOD',
|
||||
option(env='MOZ_LD64_KNOWN_GOOD',
|
||||
nargs=1,
|
||||
help='Indicate that ld64 is free of symbol aliasing bugs.')
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ def jemalloc_default(target):
|
|||
return target.kernel in ('Darwin', 'Linux', 'WINNT')
|
||||
|
||||
|
||||
js_option('--enable-jemalloc', env='MOZ_MEMORY', default=jemalloc_default,
|
||||
option('--enable-jemalloc', env='MOZ_MEMORY', default=jemalloc_default,
|
||||
help='{Replace|Do not replace} memory allocator with jemalloc')
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@ def replace_malloc_default(milestone, build_project):
|
|||
return True
|
||||
|
||||
|
||||
js_option('--enable-replace-malloc', default=replace_malloc_default,
|
||||
option('--enable-replace-malloc', default=replace_malloc_default,
|
||||
when='--enable-jemalloc',
|
||||
help='{Enable|Disable} ability to dynamically replace the malloc implementation')
|
||||
|
||||
|
|
|
@ -6,17 +6,17 @@
|
|||
|
||||
# Top-level configure defaults to building NSPR from source. Standalone JS
|
||||
# doesn't.
|
||||
js_option('--enable-nspr-build', when=building_js,
|
||||
option('--enable-nspr-build', when=js_standalone,
|
||||
help='{Build|Do not build} NSPR from source tree')
|
||||
|
||||
@depends('--enable-nspr-build', when=building_js)
|
||||
@depends('--enable-nspr-build', when=js_standalone)
|
||||
def enable_nspr_build(enable):
|
||||
if enable:
|
||||
return enable
|
||||
|
||||
js_option('--with-system-nspr', help='Use system NSPR')
|
||||
option('--with-system-nspr', help='Use system NSPR')
|
||||
|
||||
@depends(enable_nspr_build, '--with-system-nspr', 'JS_STANDALONE')
|
||||
@depends(enable_nspr_build, '--with-system-nspr', js_standalone)
|
||||
def build_nspr(nspr_build, system_nspr, js_standalone):
|
||||
if nspr_build is not None and nspr_build.origin != 'default':
|
||||
if nspr_build and system_nspr:
|
||||
|
@ -28,17 +28,17 @@ def build_nspr(nspr_build, system_nspr, js_standalone):
|
|||
set_config('MOZ_BUILD_NSPR', True, when=build_nspr)
|
||||
set_config('MOZ_SYSTEM_NSPR', True, when='--with-system-nspr')
|
||||
|
||||
@depends(build_nspr, '--with-system-nspr', building_js)
|
||||
def js_without_nspr(build_nspr, system_nspr, building_js):
|
||||
if building_js:
|
||||
@depends(build_nspr, '--with-system-nspr', js_standalone)
|
||||
def js_without_nspr(build_nspr, system_nspr, js_standalone):
|
||||
if js_standalone:
|
||||
return not build_nspr and not system_nspr
|
||||
|
||||
set_config('JS_WITHOUT_NSPR', True, when=js_without_nspr)
|
||||
set_define('JS_WITHOUT_NSPR', True, when=js_without_nspr)
|
||||
|
||||
@depends(building_js)
|
||||
def nspr_minver(building_js):
|
||||
if building_js:
|
||||
@depends(js_standalone)
|
||||
def nspr_minver(js_standalone):
|
||||
if js_standalone:
|
||||
return 'nspr >= 4.10'
|
||||
return 'nspr >= 4.26'
|
||||
|
||||
|
|
|
@ -22,26 +22,8 @@ def prepare_mozconfig(mozconfig):
|
|||
return items
|
||||
|
||||
|
||||
@depends('OLD_CONFIGURE', 'MOZILLABUILD', prepare_mozconfig, awk, m4, check_build_environment,
|
||||
shell, old_configure_assignments, build_project)
|
||||
@imports(_from='__builtin__', _import='open')
|
||||
@imports(_from='__builtin__', _import='print')
|
||||
@imports(_from='__builtin__', _import='sorted')
|
||||
@imports('glob')
|
||||
@imports('itertools')
|
||||
@imports('subprocess')
|
||||
# Import getmtime without overwriting the sandbox os.path.
|
||||
@imports(_from='os.path', _import='getmtime')
|
||||
@imports(_from='os.path', _import='exists')
|
||||
@imports(_from='mozbuild.shellutil', _import='quote')
|
||||
@imports(_from='tempfile', _import='NamedTemporaryFile')
|
||||
@imports(_from='os', _import='environ')
|
||||
@imports(_from='os', _import='remove')
|
||||
@imports(_from='os', _import='rename')
|
||||
@imports(_from='subprocess', _import='CalledProcessError')
|
||||
@imports(_from='__builtin__', _import='OSError')
|
||||
def prepare_configure(old_configure, mozillabuild, mozconfig, awk, m4, build_env, shell,
|
||||
old_configure_assignments, build_project):
|
||||
@depends('OLD_CONFIGURE', build_project)
|
||||
def old_configure(old_configure, build_project):
|
||||
# os.path.abspath in the sandbox will ensure forward slashes on Windows,
|
||||
# which is actually necessary because this path actually ends up literally
|
||||
# as $0, and backslashes there breaks autoconf's detection of the source
|
||||
|
@ -52,70 +34,15 @@ def prepare_configure(old_configure, mozillabuild, mozconfig, awk, m4, build_env
|
|||
if not old_configure_dir.endswith('/js/src'):
|
||||
old_configure = os.path.join(old_configure_dir, 'js', 'src',
|
||||
os.path.basename(old_configure))
|
||||
return old_configure
|
||||
|
||||
refresh = True
|
||||
if exists(old_configure):
|
||||
mtime = getmtime(old_configure)
|
||||
aclocal = os.path.join(build_env.topsrcdir, 'build', 'autoconf',
|
||||
'*.m4')
|
||||
for input in itertools.chain(
|
||||
(old_configure + '.in',
|
||||
os.path.join(os.path.dirname(old_configure), 'aclocal.m4')),
|
||||
glob.iglob(aclocal),
|
||||
):
|
||||
if getmtime(input) > mtime:
|
||||
break
|
||||
else:
|
||||
refresh = False
|
||||
|
||||
if refresh:
|
||||
autoconf = os.path.join(build_env.topsrcdir, 'build', 'autoconf', 'autoconf.sh')
|
||||
log.info('Refreshing %s with %s', old_configure, autoconf)
|
||||
env = dict(environ)
|
||||
env['M4'] = m4
|
||||
env['AWK'] = awk
|
||||
env['AC_MACRODIR'] = os.path.join(build_env.topsrcdir, 'build', 'autoconf')
|
||||
|
||||
try:
|
||||
script = subprocess.check_output([
|
||||
shell, autoconf,
|
||||
'--localdir=%s' % os.path.dirname(old_configure),
|
||||
old_configure + '.in'], env=env)
|
||||
except CalledProcessError as exc:
|
||||
# Autoconf on win32 may break due to a bad $PATH. Let the user know
|
||||
# their $PATH is suspect.
|
||||
if mozillabuild:
|
||||
mozillabuild_path = normsep(mozillabuild[0])
|
||||
sh_path = normsep(find_program('sh'))
|
||||
if mozillabuild_path not in sh_path:
|
||||
log.warning("The '{}msys/bin' directory is not first in $PATH. "
|
||||
"This may cause autoconf to fail. ($PATH is currently "
|
||||
"set to: {})".format(mozillabuild_path, environ[
|
||||
'PATH']))
|
||||
die('autoconf exited with return code {}'.format(exc.returncode))
|
||||
|
||||
if not script:
|
||||
die('Generated old-configure is empty! Check that your autoconf 2.13 program works!')
|
||||
|
||||
# Make old-configure append to config.log, where we put our own log.
|
||||
# This could be done with a m4 macro, but it's way easier this way
|
||||
script = script.replace(b'>./config.log', b'>>${CONFIG_LOG=./config.log}')
|
||||
|
||||
with NamedTemporaryFile(mode='wb', prefix=os.path.basename(old_configure),
|
||||
dir=os.path.dirname(old_configure), delete=False) as fh:
|
||||
fh.write(script)
|
||||
|
||||
try:
|
||||
rename(fh.name, old_configure)
|
||||
except OSError:
|
||||
try:
|
||||
# Likely the file already existed (on Windows). Retry after removing it.
|
||||
remove(old_configure)
|
||||
rename(fh.name, old_configure)
|
||||
except OSError as e:
|
||||
die('Failed re-creating old-configure: %s' % e.message)
|
||||
|
||||
cmd = [shell, old_configure]
|
||||
@depends(prepare_mozconfig, old_configure_assignments)
|
||||
@imports(_from='__builtin__', _import='open')
|
||||
@imports(_from='__builtin__', _import='print')
|
||||
@imports(_from='__builtin__', _import='sorted')
|
||||
@imports(_from='mozbuild.shellutil', _import='quote')
|
||||
def prepare_configure(mozconfig, old_configure_assignments):
|
||||
with open('old-configure.vars', 'w') as out:
|
||||
log.debug('Injecting the following to old-configure:')
|
||||
|
||||
|
@ -137,8 +64,6 @@ def prepare_configure(old_configure, mozillabuild, mozconfig, awk, m4, build_env
|
|||
for k, v in old_configure_assignments:
|
||||
inject('%s=%s' % (k, quote(v)))
|
||||
|
||||
return cmd
|
||||
|
||||
|
||||
@template
|
||||
def old_configure_options(*options):
|
||||
|
@ -201,20 +126,96 @@ def prepare_configure_options(host, target, all_options, *options):
|
|||
return namespace(options=options, all_options=all_options)
|
||||
|
||||
|
||||
@depends(prepare_configure, prepare_configure_options, altered_path)
|
||||
@imports(_from='__builtin__', _import='compile')
|
||||
@imports(_from='__builtin__', _import='open')
|
||||
@imports('logging')
|
||||
@imports('os')
|
||||
@imports('subprocess')
|
||||
@imports('sys')
|
||||
@imports(_from='mozbuild.shellutil', _import='quote')
|
||||
@imports(_from='mozbuild.shellutil', _import='split')
|
||||
@imports(_from='six', _import='exec_')
|
||||
@imports(_from='six', _import='iteritems')
|
||||
@imports(_from='six', _import='string_types')
|
||||
def old_configure(prepare_configure, prepare_configure_options, altered_path):
|
||||
cmd = prepare_configure + prepare_configure_options.options
|
||||
@template
|
||||
def old_configure_for(old_configure_path, extra_env=None):
|
||||
if extra_env is None:
|
||||
extra_env = dependable(None)
|
||||
|
||||
@depends(prepare_configure, prepare_configure_options, altered_path, extra_env,
|
||||
check_build_environment, old_configure_path, 'MOZILLABUILD', awk, m4, shell)
|
||||
@imports(_from='__builtin__', _import='compile')
|
||||
@imports(_from='__builtin__', _import='open')
|
||||
@imports(_from='__builtin__', _import='OSError')
|
||||
@imports('glob')
|
||||
@imports('itertools')
|
||||
@imports('logging')
|
||||
@imports('os')
|
||||
@imports('subprocess')
|
||||
@imports('sys')
|
||||
@imports(_from='mozbuild.shellutil', _import='quote')
|
||||
@imports(_from='mozbuild.shellutil', _import='split')
|
||||
@imports(_from='tempfile', _import='NamedTemporaryFile')
|
||||
@imports(_from='subprocess', _import='CalledProcessError')
|
||||
@imports(_from='six', _import='exec_')
|
||||
@imports(_from='six', _import='iteritems')
|
||||
@imports(_from='six', _import='string_types')
|
||||
def old_configure(prepare_configure, prepare_configure_options, altered_path, extra_env,
|
||||
build_env, old_configure, mozillabuild, awk, m4, shell):
|
||||
# Use prepare_configure to make lint happy
|
||||
prepare_configure
|
||||
refresh = True
|
||||
if os.path.exists(old_configure):
|
||||
mtime = os.path.getmtime(old_configure)
|
||||
aclocal = os.path.join(build_env.topsrcdir, 'build', 'autoconf',
|
||||
'*.m4')
|
||||
for input in itertools.chain(
|
||||
(old_configure + '.in',
|
||||
os.path.join(os.path.dirname(old_configure), 'aclocal.m4')),
|
||||
glob.iglob(aclocal),
|
||||
):
|
||||
if os.path.getmtime(input) > mtime:
|
||||
break
|
||||
else:
|
||||
refresh = False
|
||||
|
||||
if refresh:
|
||||
autoconf = os.path.join(build_env.topsrcdir, 'build', 'autoconf', 'autoconf.sh')
|
||||
log.info('Refreshing %s with %s', old_configure, autoconf)
|
||||
env = dict(os.environ)
|
||||
env['M4'] = m4
|
||||
env['AWK'] = awk
|
||||
env['AC_MACRODIR'] = os.path.join(build_env.topsrcdir, 'build', 'autoconf')
|
||||
|
||||
try:
|
||||
script = subprocess.check_output([
|
||||
shell, autoconf,
|
||||
'--localdir=%s' % os.path.dirname(old_configure),
|
||||
old_configure + '.in'], env=env)
|
||||
except CalledProcessError as exc:
|
||||
# Autoconf on win32 may break due to a bad $PATH. Let the user know
|
||||
# their $PATH is suspect.
|
||||
if mozillabuild:
|
||||
mozillabuild_path = normsep(mozillabuild[0])
|
||||
sh_path = normsep(find_program('sh'))
|
||||
if mozillabuild_path not in sh_path:
|
||||
log.warning("The '{}msys/bin' directory is not first in $PATH. "
|
||||
"This may cause autoconf to fail. ($PATH is currently "
|
||||
"set to: {})".format(mozillabuild_path, os.environ[
|
||||
'PATH']))
|
||||
die('autoconf exited with return code {}'.format(exc.returncode))
|
||||
|
||||
if not script:
|
||||
die('Generated old-configure is empty! Check that your autoconf 2.13 program works!')
|
||||
|
||||
# Make old-configure append to config.log, where we put our own log.
|
||||
# This could be done with a m4 macro, but it's way easier this way
|
||||
script = script.replace(b'>./config.log', b'>>${CONFIG_LOG=./config.log}')
|
||||
|
||||
with NamedTemporaryFile(mode='wb', prefix=os.path.basename(old_configure),
|
||||
dir=os.path.dirname(old_configure), delete=False) as fh:
|
||||
fh.write(script)
|
||||
|
||||
try:
|
||||
os.rename(fh.name, old_configure)
|
||||
except OSError:
|
||||
try:
|
||||
# Likely the file already existed (on Windows). Retry after removing it.
|
||||
os.remove(old_configure)
|
||||
os.rename(fh.name, old_configure)
|
||||
except OSError as e:
|
||||
die('Failed re-creating old-configure: %s' % e.message)
|
||||
|
||||
cmd = [shell, old_configure] + prepare_configure_options.options
|
||||
|
||||
env = dict(os.environ)
|
||||
|
||||
|
@ -237,6 +238,10 @@ def old_configure(prepare_configure, prepare_configure_options, altered_path):
|
|||
if altered_path:
|
||||
env['PATH'] = altered_path
|
||||
|
||||
if extra_env:
|
||||
env.update(extra_env)
|
||||
|
||||
env['OLD_CONFIGURE_VARS'] = os.path.join(build_env.topobjdir, 'old-configure.vars')
|
||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
||||
env=env)
|
||||
while True:
|
||||
|
@ -282,38 +287,20 @@ def old_configure(prepare_configure, prepare_configure_options, altered_path):
|
|||
# debugging.
|
||||
os.remove('config.data')
|
||||
|
||||
for c in ('substs', 'defines'):
|
||||
raw_config[c] = [
|
||||
return namespace(**{
|
||||
c: [
|
||||
(k[1:-1], v[1:-1] if isinstance(v, string_types) else v)
|
||||
for k, v in raw_config[c]
|
||||
]
|
||||
for c in ('substs', 'defines')
|
||||
})
|
||||
|
||||
return raw_config
|
||||
return old_configure
|
||||
|
||||
|
||||
# set_config is only available in the global namespace, not directly in
|
||||
# @depends functions, but we do need to enumerate the result of
|
||||
# old_configure, so we cheat.
|
||||
@imports('__sandbox__')
|
||||
def set_old_configure_config(name, value):
|
||||
__sandbox__.set_config_impl(name, value)
|
||||
|
||||
# Same as set_old_configure_config, but for set_define.
|
||||
|
||||
|
||||
@imports('__sandbox__')
|
||||
def set_old_configure_define(name, value):
|
||||
__sandbox__.set_define_impl(name, value)
|
||||
|
||||
|
||||
@depends(old_configure)
|
||||
@imports(_from='six', _import='iteritems')
|
||||
def post_old_configure(raw_config):
|
||||
for k, v in raw_config['substs']:
|
||||
set_old_configure_config(k, v)
|
||||
|
||||
for k, v in iteritems(dict(raw_config['defines'])):
|
||||
set_old_configure_define(k, v)
|
||||
old_configure = old_configure_for(old_configure)
|
||||
set_config('OLD_CONFIGURE_SUBSTS', old_configure.substs)
|
||||
set_config('OLD_CONFIGURE_DEFINES', old_configure.defines)
|
||||
|
||||
|
||||
# Assuming no other option is declared after this function, handle the
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
# Rust is required by `rust_compiler` below. We allow_missing here
|
||||
# to propagate failures to the better error message there.
|
||||
js_option(env='RUSTC', nargs=1, help='Path to the rust compiler')
|
||||
js_option(env='CARGO', nargs=1, help='Path to the Cargo package manager')
|
||||
option(env='RUSTC', nargs=1, help='Path to the rust compiler')
|
||||
option(env='CARGO', nargs=1, help='Path to the Cargo package manager')
|
||||
|
||||
rustc = check_prog('_RUSTC', ['rustc'], what='rustc',
|
||||
paths=toolchain_search_path, input='RUSTC',
|
||||
|
@ -435,7 +435,7 @@ set_config('RUST_HOST_TARGET', rust_host_triple)
|
|||
set_config('RUSTC_COMMIT', depends(rustc_info)(lambda i: i.commit))
|
||||
|
||||
# Rustdoc is required by Rust tests below.
|
||||
js_option(env='RUSTDOC', nargs=1, help='Path to the rustdoc program')
|
||||
option(env='RUSTDOC', nargs=1, help='Path to the rustdoc program')
|
||||
|
||||
rustdoc = check_prog('RUSTDOC', ['rustdoc'], paths=toolchain_search_path,
|
||||
input='RUSTDOC', allow_missing=True)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
imply_option('--enable-release', mozilla_official)
|
||||
imply_option('--enable-release', depends_if('MOZ_AUTOMATION')(lambda x: True))
|
||||
|
||||
js_option('--enable-release',
|
||||
option('--enable-release',
|
||||
default=milestone.is_release_or_beta,
|
||||
help='{Build|Do not build} with more conservative, release '
|
||||
'engineering-oriented options.{ This may slow down builds.|}')
|
||||
|
@ -25,7 +25,7 @@ set_config('DEVELOPER_OPTIONS', developer_options)
|
|||
# Code optimization
|
||||
# ==============================================================
|
||||
|
||||
js_option('--disable-optimize',
|
||||
option('--disable-optimize',
|
||||
nargs='?',
|
||||
help='Disable optimizations via compiler flags')
|
||||
|
||||
|
@ -133,7 +133,7 @@ def host_is_osx(host):
|
|||
with only_when(host_is_osx | target_is_osx):
|
||||
# MacOS SDK
|
||||
# =========
|
||||
js_option('--with-macos-sdk', env='MACOS_SDK_DIR', nargs=1,
|
||||
option('--with-macos-sdk', env='MACOS_SDK_DIR', nargs=1,
|
||||
help='Location of platform SDK to use')
|
||||
|
||||
@depends('--with-macos-sdk', host)
|
||||
|
@ -204,14 +204,10 @@ with only_when(target_is_osx):
|
|||
|
||||
# Compiler wrappers
|
||||
# ==============================================================
|
||||
# Normally, we'd use js_option and automatically have those variables
|
||||
# propagated to js/src, but things are complicated by possible additional
|
||||
# wrappers in CC/CXX, and by other subconfigures that do not handle those
|
||||
# options and do need CC/CXX altered.
|
||||
option('--with-compiler-wrapper', env='COMPILER_WRAPPER', nargs=1,
|
||||
help='Enable compiling with wrappers such as distcc and ccache')
|
||||
|
||||
js_option('--with-ccache', env='CCACHE', nargs='?',
|
||||
option('--with-ccache', env='CCACHE', nargs='?',
|
||||
help='Enable compiling with ccache')
|
||||
|
||||
|
||||
|
@ -226,7 +222,7 @@ def ccache(value):
|
|||
|
||||
ccache = check_prog('CCACHE', progs=(), input=ccache)
|
||||
|
||||
js_option(env='CCACHE_PREFIX',
|
||||
option(env='CCACHE_PREFIX',
|
||||
nargs=1,
|
||||
help='Compiler prefix to use when using ccache')
|
||||
|
||||
|
@ -250,7 +246,7 @@ def using_ccache(ccache, ccache_is_sccache):
|
|||
def using_sccache(ccache, ccache_is_sccache):
|
||||
return ccache and ccache_is_sccache
|
||||
|
||||
js_option(env='RUSTC_WRAPPER', nargs=1,
|
||||
option(env='RUSTC_WRAPPER', nargs=1,
|
||||
help='Wrap rust compilation with given tool')
|
||||
|
||||
@depends(ccache, ccache_is_sccache, 'RUSTC_WRAPPER')
|
||||
|
@ -338,7 +334,7 @@ set_config('MOZ_HAZARD', hazard_analysis)
|
|||
|
||||
# Cross-compilation related things.
|
||||
# ==============================================================
|
||||
js_option('--with-toolchain-prefix', env='TOOLCHAIN_PREFIX', nargs=1,
|
||||
option('--with-toolchain-prefix', env='TOOLCHAIN_PREFIX', nargs=1,
|
||||
help='Prefix for the target toolchain')
|
||||
|
||||
|
||||
|
@ -615,7 +611,7 @@ def host_is_windows(host):
|
|||
return True
|
||||
|
||||
|
||||
js_option('--with-visual-studio-version', nargs=1,
|
||||
option('--with-visual-studio-version', nargs=1,
|
||||
choices=('2017',), when=host_is_windows,
|
||||
help='Select a specific Visual Studio version to use')
|
||||
|
||||
|
@ -626,7 +622,7 @@ def vs_major_version(value):
|
|||
return {'2017': 15}[value[0]]
|
||||
|
||||
|
||||
js_option(env='VC_PATH', nargs=1, when=host_is_windows,
|
||||
option(env='VC_PATH', nargs=1, when=host_is_windows,
|
||||
help='Path to the Microsoft Visual C/C++ compiler')
|
||||
|
||||
|
||||
|
@ -1298,7 +1294,7 @@ option(env='MOZ_DEBUG_FLAGS',
|
|||
imply_option('--enable-debug-symbols',
|
||||
depends_if('--enable-debug')(lambda v: v))
|
||||
|
||||
js_option('--disable-debug-symbols',
|
||||
option('--disable-debug-symbols',
|
||||
nargs='?',
|
||||
help='Disable debug symbols using the given compiler flags')
|
||||
|
||||
|
@ -1498,7 +1494,7 @@ set_config('PPC_VSX3_FLAGS',
|
|||
# ASAN
|
||||
# ==============================================================
|
||||
|
||||
js_option('--enable-address-sanitizer', help='Enable Address Sanitizer')
|
||||
option('--enable-address-sanitizer', help='Enable Address Sanitizer')
|
||||
|
||||
|
||||
@depends(when='--enable-address-sanitizer')
|
||||
|
@ -1511,7 +1507,7 @@ add_old_configure_assignment('MOZ_ASAN', asan)
|
|||
# MSAN
|
||||
# ==============================================================
|
||||
|
||||
js_option('--enable-memory-sanitizer', help='Enable Memory Sanitizer')
|
||||
option('--enable-memory-sanitizer', help='Enable Memory Sanitizer')
|
||||
|
||||
|
||||
@depends(when='--enable-memory-sanitizer')
|
||||
|
@ -1524,7 +1520,7 @@ add_old_configure_assignment('MOZ_MSAN', msan)
|
|||
# TSAN
|
||||
# ==============================================================
|
||||
|
||||
js_option('--enable-thread-sanitizer', help='Enable Thread Sanitizer')
|
||||
option('--enable-thread-sanitizer', help='Enable Thread Sanitizer')
|
||||
|
||||
|
||||
@depends(when='--enable-thread-sanitizer')
|
||||
|
@ -1537,7 +1533,7 @@ add_old_configure_assignment('MOZ_TSAN', tsan)
|
|||
# UBSAN
|
||||
# ==============================================================
|
||||
|
||||
js_option('--enable-undefined-sanitizer',
|
||||
option('--enable-undefined-sanitizer',
|
||||
nargs='*',
|
||||
help='Enable UndefinedBehavior Sanitizer')
|
||||
|
||||
|
@ -1561,7 +1557,7 @@ def ubsan(options):
|
|||
add_old_configure_assignment('MOZ_UBSAN_CHECKS', ubsan)
|
||||
|
||||
|
||||
js_option('--enable-signed-overflow-sanitizer',
|
||||
option('--enable-signed-overflow-sanitizer',
|
||||
help='Enable UndefinedBehavior Sanitizer (Signed Integer Overflow Parts)')
|
||||
|
||||
|
||||
|
@ -1573,7 +1569,7 @@ def ub_signed_overflow_san():
|
|||
add_old_configure_assignment('MOZ_SIGNED_OVERFLOW_SANITIZE', ub_signed_overflow_san)
|
||||
|
||||
|
||||
js_option('--enable-unsigned-overflow-sanitizer',
|
||||
option('--enable-unsigned-overflow-sanitizer',
|
||||
help='Enable UndefinedBehavior Sanitizer (Unsigned Integer Overflow Parts)')
|
||||
|
||||
|
||||
|
@ -1724,7 +1720,7 @@ def frame_pointer_default(optimize, debug, target, msan, asan, ubsan):
|
|||
(target.os == 'WINNT' and target.cpu in ('x86', 'aarch64')))
|
||||
|
||||
|
||||
js_option('--enable-frame-pointers', default=frame_pointer_default,
|
||||
option('--enable-frame-pointers', default=frame_pointer_default,
|
||||
help='{Enable|Disable} frame pointers')
|
||||
|
||||
|
||||
|
@ -1811,7 +1807,7 @@ add_old_configure_assignment('YASM', have_yasm)
|
|||
# Code Coverage
|
||||
# ==============================================================
|
||||
|
||||
js_option('--enable-coverage', env='MOZ_CODE_COVERAGE',
|
||||
option('--enable-coverage', env='MOZ_CODE_COVERAGE',
|
||||
help='Enable code coverage')
|
||||
|
||||
|
||||
|
@ -1869,7 +1865,7 @@ set_config('RUSTFLAGS', depends('RUSTFLAGS')(lambda flags: flags))
|
|||
# Rust compiler flags
|
||||
# ==============================================================
|
||||
|
||||
js_option(env='RUSTC_OPT_LEVEL',
|
||||
option(env='RUSTC_OPT_LEVEL',
|
||||
nargs=1,
|
||||
help='Rust compiler optimization level (-C opt-level=%s)')
|
||||
|
||||
|
@ -1933,7 +1929,7 @@ def rust_compile_flags(opt_level, debug_rust, debug_symbols, frame_pointers):
|
|||
# ==============================================================
|
||||
|
||||
|
||||
js_option('--disable-cargo-incremental',
|
||||
option('--disable-cargo-incremental',
|
||||
help='Disable incremental rust compilation.')
|
||||
|
||||
@depends(rustc_opt_level, debug_rust, 'MOZ_AUTOMATION', code_coverage,
|
||||
|
@ -2025,7 +2021,7 @@ def enable_linker_default(target, developer_options):
|
|||
return 'lld' if developer_options else 'bfd'
|
||||
|
||||
|
||||
js_option('--enable-linker', nargs=1,
|
||||
option('--enable-linker', nargs=1,
|
||||
help='Select the linker {bfd, gold, ld64, lld, lld-*}{|}',
|
||||
default=enable_linker_default,
|
||||
when=is_linker_option_enabled)
|
||||
|
@ -2178,7 +2174,7 @@ add_old_configure_assignment('GCC_USE_GNU_LD', gcc_use_gnu_ld)
|
|||
# Assembler detection
|
||||
# ==============================================================
|
||||
|
||||
js_option(env='AS', nargs=1, help='Path to the assembler')
|
||||
option(env='AS', nargs=1, help='Path to the assembler')
|
||||
|
||||
@depends(target, c_compiler)
|
||||
def as_info(target, c_compiler):
|
||||
|
@ -2280,7 +2276,7 @@ set_config('ASOUTOPTION', as_outoption)
|
|||
# clang plugin handling
|
||||
# ==============================================================
|
||||
|
||||
js_option('--enable-clang-plugin', env='ENABLE_CLANG_PLUGIN',
|
||||
option('--enable-clang-plugin', env='ENABLE_CLANG_PLUGIN',
|
||||
help="Enable building with the Clang plugin (gecko specific static analyzers)")
|
||||
|
||||
add_old_configure_assignment('ENABLE_CLANG_PLUGIN',
|
||||
|
@ -2314,7 +2310,7 @@ llvm_config = check_prog('LLVM_CONFIG', llvm_config, what='llvm-config',
|
|||
add_old_configure_assignment('LLVM_CONFIG', llvm_config)
|
||||
|
||||
|
||||
js_option('--enable-clang-plugin-alpha', env='ENABLE_CLANG_PLUGIN_ALPHA',
|
||||
option('--enable-clang-plugin-alpha', env='ENABLE_CLANG_PLUGIN_ALPHA',
|
||||
help='Enable static analysis with clang-plugin alpha checks.')
|
||||
|
||||
@depends('--enable-clang-plugin', '--enable-clang-plugin-alpha')
|
||||
|
@ -2327,7 +2323,7 @@ def check_clang_plugin_alpha(enable_clang_plugin, enable_clang_plugin_alpha):
|
|||
add_old_configure_assignment('ENABLE_CLANG_PLUGIN_ALPHA', check_clang_plugin_alpha)
|
||||
set_define('MOZ_CLANG_PLUGIN_ALPHA', check_clang_plugin_alpha)
|
||||
|
||||
js_option('--enable-mozsearch-plugin', env='ENABLE_MOZSEARCH_PLUGIN',
|
||||
option('--enable-mozsearch-plugin', env='ENABLE_MOZSEARCH_PLUGIN',
|
||||
help="Enable building with the mozsearch indexer plugin")
|
||||
|
||||
add_old_configure_assignment('ENABLE_MOZSEARCH_PLUGIN',
|
||||
|
@ -2336,7 +2332,7 @@ add_old_configure_assignment('ENABLE_MOZSEARCH_PLUGIN',
|
|||
# Libstdc++ compatibility hacks
|
||||
# ==============================================================
|
||||
#
|
||||
js_option('--enable-stdcxx-compat', env='MOZ_STDCXX_COMPAT',
|
||||
option('--enable-stdcxx-compat', env='MOZ_STDCXX_COMPAT',
|
||||
help='Enable compatibility with older libstdc++')
|
||||
|
||||
|
||||
|
@ -2374,7 +2370,7 @@ add_gcc_flag(
|
|||
|
||||
# Support various fuzzing options
|
||||
# ==============================================================
|
||||
js_option('--enable-fuzzing', help='Enable fuzzing support')
|
||||
option('--enable-fuzzing', help='Enable fuzzing support')
|
||||
|
||||
@depends('--enable-fuzzing')
|
||||
def enable_fuzzing(value):
|
||||
|
@ -2538,6 +2534,6 @@ add_old_configure_assignment('AR', ar)
|
|||
set_config('AR_FLAGS', ar_config.flags)
|
||||
|
||||
|
||||
js_option('--enable-cpp-rtti', help='Enable C++ RTTI')
|
||||
option('--enable-cpp-rtti', help='Enable C++ RTTI')
|
||||
|
||||
add_old_configure_assignment('_MOZ_USE_RTTI', '1', when='--enable-cpp-rtti')
|
||||
|
|
|
@ -4,7 +4,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/.
|
||||
|
||||
js_option('--enable-warnings-as-errors', env='MOZ_ENABLE_WARNINGS_AS_ERRORS',
|
||||
option('--enable-warnings-as-errors', env='MOZ_ENABLE_WARNINGS_AS_ERRORS',
|
||||
default=depends('MOZ_AUTOMATION')(lambda x: bool(x)),
|
||||
help='{Enable|Disable} treating warnings as errors')
|
||||
|
||||
|
|
|
@ -457,12 +457,12 @@ def sdk_bin_path(valid_windows_sdk_dir, valid_ucrt_sdk_dir, host):
|
|||
return result
|
||||
|
||||
|
||||
js_option(env='LINKER', nargs=1, when=target_is_windows, help='Path to the linker')
|
||||
option(env='LINKER', nargs=1, when=target_is_windows, help='Path to the linker')
|
||||
|
||||
link = check_prog('LINKER', ('lld-link',), input='LINKER',
|
||||
when=target_is_windows, paths=toolchain_search_path)
|
||||
|
||||
js_option(env='HOST_LINKER', nargs=1, when=host_is_windows, help='Path to the host linker')
|
||||
option(env='HOST_LINKER', nargs=1, when=host_is_windows, help='Path to the host linker')
|
||||
|
||||
host_link = check_prog('HOST_LINKER', ('lld-link',), input='HOST_LINKER',
|
||||
when=host_is_windows, paths=host_toolchain_search_path)
|
||||
|
|
|
@ -61,7 +61,6 @@ showbuild showhost: _DEPEND_CFLAGS=
|
|||
showbuild showhost: COMPILE_PDB_FLAG=
|
||||
showbuild:
|
||||
$(call print_vars,\
|
||||
MOZ_BUILD_ROOT \
|
||||
MOZ_WIDGET_TOOLKIT \
|
||||
CC \
|
||||
CXX \
|
||||
|
|
80
configure.py
80
configure.py
|
@ -5,6 +5,7 @@
|
|||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import codecs
|
||||
import errno
|
||||
import io
|
||||
import itertools
|
||||
import logging
|
||||
|
@ -55,6 +56,31 @@ def main(argv):
|
|||
if sandbox._help:
|
||||
return 0
|
||||
|
||||
logging.getLogger('moz.configure').info('Creating config.status')
|
||||
|
||||
old_js_configure_substs = config.pop('OLD_JS_CONFIGURE_SUBSTS', None)
|
||||
old_js_configure_defines = config.pop('OLD_JS_CONFIGURE_DEFINES', None)
|
||||
if old_js_configure_substs or old_js_configure_defines:
|
||||
js_config = config.copy()
|
||||
pwd = os.getcwd()
|
||||
try:
|
||||
try:
|
||||
os.makedirs('js/src')
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
os.chdir('js/src')
|
||||
js_config['OLD_CONFIGURE_SUBSTS'] = old_js_configure_substs
|
||||
js_config['OLD_CONFIGURE_DEFINES'] = old_js_configure_defines
|
||||
# The build system frontend expects $objdir/js/src/config.status
|
||||
# to have $objdir/js/src as topobjdir.
|
||||
# We want forward slashes on all platforms.
|
||||
js_config['TOPOBJDIR'] += '/js/src'
|
||||
config_status(js_config, execute=False)
|
||||
finally:
|
||||
os.chdir(pwd)
|
||||
|
||||
return config_status(config)
|
||||
|
||||
|
||||
|
@ -79,7 +105,7 @@ def check_unicode(obj):
|
|||
return True
|
||||
|
||||
|
||||
def config_status(config):
|
||||
def config_status(config, execute=True):
|
||||
# Sanitize config data to feed config.status
|
||||
# Ideally, all the backend and frontend code would handle the booleans, but
|
||||
# there are so many things involved, that it's easier to keep config.status
|
||||
|
@ -97,11 +123,16 @@ def config_status(config):
|
|||
sanitized_config = {}
|
||||
sanitized_config['substs'] = {
|
||||
k: sanitize_config(v) for k, v in six.iteritems(config)
|
||||
if k not in ('DEFINES', 'TOPSRCDIR', 'TOPOBJDIR', 'CONFIG_STATUS_DEPS')
|
||||
if k not in ('DEFINES', 'TOPSRCDIR', 'TOPOBJDIR', 'CONFIG_STATUS_DEPS',
|
||||
'OLD_CONFIGURE_SUBSTS', 'OLD_CONFIGURE_DEFINES')
|
||||
}
|
||||
for k, v in config['OLD_CONFIGURE_SUBSTS']:
|
||||
sanitized_config['substs'][k] = sanitize_config(v)
|
||||
sanitized_config['defines'] = {
|
||||
k: sanitize_config(v) for k, v in six.iteritems(config['DEFINES'])
|
||||
}
|
||||
for k, v in config['OLD_CONFIGURE_DEFINES']:
|
||||
sanitized_config['defines'][k] = sanitize_config(v)
|
||||
sanitized_config['topsrcdir'] = config['TOPSRCDIR']
|
||||
sanitized_config['topobjdir'] = config['TOPOBJDIR']
|
||||
sanitized_config['mozconfig'] = config.get('MOZCONFIG')
|
||||
|
@ -111,10 +142,29 @@ def config_status(config):
|
|||
print("Please file a bug for the above.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
# Some values in sanitized_config also have more complex types, such as
|
||||
# EnumString, which using when calling config_status would currently
|
||||
# break the build, as well as making it inconsistent with re-running
|
||||
# config.status, for which they are normalized to plain strings via
|
||||
# indented_repr. Likewise for non-dict non-string iterables being
|
||||
# converted to lists.
|
||||
def normalize(obj):
|
||||
if isinstance(obj, dict):
|
||||
return {
|
||||
k: normalize(v)
|
||||
for k, v in six.iteritems(obj)
|
||||
}
|
||||
if isinstance(obj, six.text_type):
|
||||
return six.text_type(obj)
|
||||
if isinstance(obj, Iterable):
|
||||
return [normalize(o) for o in obj]
|
||||
return obj
|
||||
|
||||
sanitized_config = normalize(sanitized_config)
|
||||
|
||||
# Create config.status. Eventually, we'll want to just do the work it does
|
||||
# here, when we're able to skip configure tests/use cached results/not rely
|
||||
# on autoconf.
|
||||
logging.getLogger('moz.configure').info('Creating config.status')
|
||||
with codecs.open('config.status', 'w', 'utf-8') as fh:
|
||||
fh.write(textwrap.dedent('''\
|
||||
#!%(python)s
|
||||
|
@ -127,7 +177,7 @@ def config_status(config):
|
|||
fh.write("__all__ = ['topobjdir', 'topsrcdir', 'defines', "
|
||||
"'substs', 'mozconfig']")
|
||||
|
||||
if config.get('MOZ_BUILD_APP') != 'js' or config.get('JS_STANDALONE'):
|
||||
if execute:
|
||||
fh.write(textwrap.dedent('''
|
||||
if __name__ == '__main__':
|
||||
from mozbuild.util import patch_main
|
||||
|
@ -153,27 +203,9 @@ def config_status(config):
|
|||
# Other things than us are going to run this file, so we need to give it
|
||||
# executable permissions.
|
||||
os.chmod('config.status', 0o755)
|
||||
if config.get('MOZ_BUILD_APP') != 'js' or config.get('JS_STANDALONE'):
|
||||
if execute:
|
||||
from mozbuild.config_status import config_status
|
||||
|
||||
# Some values in sanitized_config also have more complex types, such as
|
||||
# EnumString, which using when calling config_status would currently
|
||||
# break the build, as well as making it inconsistent with re-running
|
||||
# config.status, for which they are normalized to plain strings via
|
||||
# indented_repr. Likewise for non-dict non-string iterables being
|
||||
# converted to lists.
|
||||
def normalize(obj):
|
||||
if isinstance(obj, dict):
|
||||
return {
|
||||
k: normalize(v)
|
||||
for k, v in six.iteritems(obj)
|
||||
}
|
||||
if isinstance(obj, six.text_type):
|
||||
return six.text_type(obj)
|
||||
if isinstance(obj, Iterable):
|
||||
return [normalize(o) for o in obj]
|
||||
return obj
|
||||
return config_status(args=[], **normalize(sanitized_config))
|
||||
return config_status(args=[], **sanitized_config)
|
||||
return 0
|
||||
|
||||
|
||||
|
|
|
@ -28,6 +28,9 @@ const TOGGLE_MESSAGES_TRUNCATION_TITLE = L10N.getStr(
|
|||
"toggleMessagesTruncation.title"
|
||||
);
|
||||
const CONNECTION_CLOSED_TEXT = L10N.getStr("netmonitor.ws.connection.closed");
|
||||
const {
|
||||
MESSAGE_HEADERS,
|
||||
} = require("devtools/client/netmonitor/src/constants.js");
|
||||
const Actions = require("devtools/client/netmonitor/src/actions/index");
|
||||
|
||||
const {
|
||||
|
@ -258,9 +261,9 @@ class MessageListContent extends Component {
|
|||
);
|
||||
}
|
||||
|
||||
const visibleColumns = Object.entries(columns)
|
||||
.filter(([name, isVisible]) => isVisible)
|
||||
.map(([name]) => name);
|
||||
const visibleColumns = MESSAGE_HEADERS.filter(
|
||||
header => columns[header.name]
|
||||
).map(col => col.name);
|
||||
|
||||
let displayedMessages;
|
||||
let MESSAGES_TRUNCATED;
|
||||
|
|
|
@ -7,7 +7,22 @@
|
|||
* Test columns' state for WS and SSE connection.
|
||||
*/
|
||||
|
||||
function shallowEqual(obj1, obj2) {
|
||||
function shallowArrayEqual(arr1, arr2) {
|
||||
if (arr1.length !== arr2.length) {
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < arr1.length; i++) {
|
||||
if (
|
||||
(arr2[i] instanceof RegExp && !arr2[i].test(arr1[i])) ||
|
||||
(typeof arr2[i] === "string" && arr2[i] !== arr1[i])
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function shallowObjectEqual(obj1, obj2) {
|
||||
const k1 = Object.keys(obj1);
|
||||
const k2 = Object.keys(obj2);
|
||||
|
||||
|
@ -24,6 +39,13 @@ function shallowEqual(obj1, obj2) {
|
|||
return true;
|
||||
}
|
||||
|
||||
function shallowEqual(obj1, obj2) {
|
||||
if (Array.isArray(obj1) && Array.isArray(obj2)) {
|
||||
return shallowArrayEqual(obj1, obj2);
|
||||
}
|
||||
return shallowObjectEqual(obj1, obj2);
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
|
@ -65,6 +87,60 @@ add_task(async function() {
|
|||
store.dispatch(Actions.toggleMessageColumn("opCode"));
|
||||
store.dispatch(Actions.toggleMessageColumn("maskBit"));
|
||||
store.dispatch(Actions.toggleMessageColumn("finBit"));
|
||||
EventUtils.sendMouseEvent(
|
||||
{ type: "click" },
|
||||
document.querySelector("#response-tab")
|
||||
);
|
||||
|
||||
// Get all messages present in the "Response" panel
|
||||
const frames = document.querySelectorAll(
|
||||
"#messages-view .message-list-table .message-list-item"
|
||||
);
|
||||
|
||||
// Check expected results
|
||||
is(frames.length, 2, "There should be two frames");
|
||||
|
||||
let columnHeaders = Array.prototype.map.call(
|
||||
document.querySelectorAll(
|
||||
"#messages-view .message-list-headers .button-text"
|
||||
),
|
||||
node => node.textContent
|
||||
);
|
||||
|
||||
is(
|
||||
shallowEqual(columnHeaders, [
|
||||
"Data",
|
||||
"Size",
|
||||
"OpCode",
|
||||
"MaskBit",
|
||||
"FinBit",
|
||||
"Time",
|
||||
]),
|
||||
true,
|
||||
"WS Column headers are in correct order"
|
||||
);
|
||||
|
||||
// Get column values of first row for WS.
|
||||
let columnValues = Array.prototype.map.call(frames, frame =>
|
||||
Array.prototype.map.call(
|
||||
frame.querySelectorAll(".message-list-column"),
|
||||
column => column.textContent.trim()
|
||||
)
|
||||
)[0];
|
||||
|
||||
is(
|
||||
shallowEqual(columnValues, [
|
||||
"Payload 0",
|
||||
"9 B",
|
||||
"1",
|
||||
"true",
|
||||
"true",
|
||||
// Time format is "hh:mm:ss.mmm".
|
||||
/\d+:\d+:\d+\.\d+/,
|
||||
]),
|
||||
true,
|
||||
"WS Column values are in correct order"
|
||||
);
|
||||
|
||||
// Select the SSE request.
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, requests[1]);
|
||||
|
@ -73,6 +149,45 @@ add_task(async function() {
|
|||
store.dispatch(Actions.toggleMessageColumn("eventName"));
|
||||
store.dispatch(Actions.toggleMessageColumn("retry"));
|
||||
|
||||
columnHeaders = Array.prototype.map.call(
|
||||
document.querySelectorAll(
|
||||
"#messages-view .message-list-headers .button-text"
|
||||
),
|
||||
node => node.textContent
|
||||
);
|
||||
|
||||
is(
|
||||
shallowEqual(columnHeaders, [
|
||||
"Data",
|
||||
"Time",
|
||||
"Event Name",
|
||||
"Last Event ID",
|
||||
"Retry",
|
||||
]),
|
||||
true,
|
||||
"SSE Column headers are in correct order"
|
||||
);
|
||||
|
||||
// Get column values of first row for SSE.
|
||||
columnValues = Array.prototype.map.call(frames, frame =>
|
||||
Array.prototype.map.call(
|
||||
frame.querySelectorAll(".message-list-column"),
|
||||
column => column.textContent.trim()
|
||||
)
|
||||
)[0];
|
||||
|
||||
is(
|
||||
shallowEqual(columnValues, [
|
||||
"Why so serious?",
|
||||
/\d+:\d+:\d+\.\d+/,
|
||||
"message",
|
||||
"",
|
||||
"5000",
|
||||
]),
|
||||
true,
|
||||
"SSE Column values are in correct order"
|
||||
);
|
||||
|
||||
// Select the WS request again.
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]);
|
||||
is(
|
||||
|
|
|
@ -12,8 +12,7 @@ If you're not yet familiar with the codebase, the [files and directories overvie
|
|||
|
||||
If you know what you're looking for (e.g. a string that has a typo and needs correcting, or a function name that needs modifying), you can use a source code search engine:
|
||||
|
||||
* [Searchfox](http://searchfox.org/mozilla-central/source) (updated most frequently)
|
||||
* [DXR](http://dxr.mozilla.org/mozilla-central/source/) (less often)
|
||||
* [Searchfox](http://searchfox.org/mozilla-central/source)
|
||||
|
||||
It is a good idea to [add smart keyword searches](https://support.mozilla.org/en-US/kb/how-search-from-address-bar) for Searchfox or DXR to search faster.
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Where is the code? (or: `mozilla-central` vs `devtools-html`)
|
||||
|
||||
Most of the code is hosted in the Firefox repository (we call it `mozilla-central`, often abbreviated as `m-c`), in the [devtools](https://dxr.mozilla.org/mozilla-central/source/devtools) folder. Development of some pieces of the tools is happening in GitHub, on the [firefox-devtools](https://github.com/firefox-devtools/) organisation.
|
||||
Most of the code is hosted in the Firefox repository (we call it `mozilla-central`, often abbreviated as `m-c`), in the [devtools](https://searchfox.org/mozilla-central/source/devtools) folder. Development of some pieces of the tools is happening in GitHub, on the [firefox-devtools](https://github.com/firefox-devtools/) organisation.
|
||||
|
||||
<!--TODO: table listing components and locations (m-c vs github)-->
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ It will only display regressions and improvements with a medium or high confiden
|
|||
|
||||
DAMP is based on top of a more generic test suite called [Talos](https://wiki.mozilla.org/Buildbot/Talos).
|
||||
Talos is a Mozilla test suite to follow all Firefox components performance.
|
||||
It is written in Python and here are [the sources](https://dxr.mozilla.org/mozilla-central/source/testing/talos/) in mozilla-central.
|
||||
It is written in Python and here are [the sources](https://searchfox.org/mozilla-central/source/testing/talos/) in mozilla-central.
|
||||
Compared to the other test suites, it isn't run on the cloud, but on dedicated hardware.
|
||||
This is to ensure performance numbers are stable over time and between two runs.
|
||||
Talos runs various types of tests. More specifically, DAMP is a [Page loader test](https://wiki.mozilla.org/Buildbot/Talos/Tests#Page_Load_Tests).
|
||||
|
|
|
@ -106,7 +106,7 @@ For example, the head.js files in the `markupview` and `styleinspector` test fol
|
|||
|
||||
## Shared head.js file
|
||||
|
||||
A [shared-head.js](https://dxr.mozilla.org/mozilla-central/source/devtools/client/shared/test/shared-head.js) file has been introduced to avoid duplicating code in various `head.js` files.
|
||||
A [shared-head.js](https://searchfox.org/mozilla-central/source/devtools/client/shared/test/shared-head.js) file has been introduced to avoid duplicating code in various `head.js` files.
|
||||
|
||||
It's important to know whether or not the `shared.js` in your test directory already imports `shared-head.js` (look for a <code>Services.scriptloader.loadSubScript</code> call), as common helpers in `shared-head.js` might be useful for your test.
|
||||
|
||||
|
@ -122,7 +122,7 @@ One of the direct consequences of E10S on tests is that you cannot retrieve and
|
|||
|
||||
So when creating a new test, if this test needs to access the content page in any way, you can use [the message manager](https://developer.mozilla.org/en-US/docs/The_message_manager) to communicate with a script loaded in the content process to do things for you instead of accessing objects in the page directly.
|
||||
|
||||
You can use the helper `ContentTask.spawn()` for this. See [this list of DevTools tests that use that helper for examples](https://dxr.mozilla.org/mozilla-central/search?q=ContentTask.spawn%28+path%3Adevtools%2Fclient&redirect=false&case=false).
|
||||
You can use the helper `ContentTask.spawn()` for this. See [this list of DevTools tests that use that helper for examples](https://searchfox.org/mozilla-central/search?q=ContentTask.spawn%28&path=devtools%2Fclient).
|
||||
|
||||
Note that a lot of tests only need to access the DevTools UI anyway, and don't need to interact with the content process at all. Since the UI lives in the same process as the test, you won't need to use the message manager to access it.
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ In this example, the test DIV will be inserted in the page, and will be displaye
|
|||
|
||||
### The AnonymousContent API
|
||||
|
||||
In the previous example, the returned `insertedEl` object isn't a DOM node, and it certainly is not `el`. It is a new object, whose type is `AnonymousContent` ([see the WebIDL here](https://dxr.mozilla.org/mozilla-central/source/dom/webidl/AnonymousContent.webidl)).
|
||||
In the previous example, the returned `insertedEl` object isn't a DOM node, and it certainly is not `el`. It is a new object, whose type is `AnonymousContent` ([see the WebIDL here](https://searchfox.org/mozilla-central/source/dom/webidl/AnonymousContent.webidl)).
|
||||
|
||||
Because of the way content is inserted into the page, it isn't wanted to give consumers a direct reference to the inserted DOM node. This is why `document.insertAnonymousContent(el)` actually **clones** `el` and returns a new object whose API lets consumers make changes to the inserted element in a way that never gives back a reference to the inserted DOM node.
|
||||
|
||||
|
@ -143,7 +143,7 @@ The returned object provides the following API:
|
|||
|
||||
### Creating a new highlighter class
|
||||
|
||||
A good way to get started is by taking a look at [existing highlighters here](https://dxr.mozilla.org/mozilla-central/source/devtools/server/actors/highlighters.js#697-727).
|
||||
A good way to get started is by taking a look at [existing highlighters here](https://searchfox.org/mozilla-central/rev/1a973762afcbc5066f73f1508b0c846872fe3952/devtools/server/actors/highlighters.js#519-530).
|
||||
|
||||
Here is some boilerplate code for a new highlighter class:
|
||||
|
||||
|
|
|
@ -534,7 +534,7 @@ const NetworkEventActor = protocol.ActorClassWithSpec(networkEventSpec, {
|
|||
* @param object serverTimings
|
||||
* Timing details extracted from the Server-Timing header.
|
||||
*/
|
||||
addSeverTimings(serverTimings) {
|
||||
addServerTimings(serverTimings) {
|
||||
if (serverTimings) {
|
||||
this._serverTimings = serverTimings;
|
||||
}
|
||||
|
|
|
@ -567,7 +567,7 @@ const NetworkEventActor = protocol.ActorClassWithSpec(networkEventSpec, {
|
|||
* @param object serverTimings
|
||||
* Timing details extracted from the Server-Timing header.
|
||||
*/
|
||||
addSeverTimings(serverTimings) {
|
||||
addServerTimings(serverTimings) {
|
||||
if (serverTimings) {
|
||||
this._serverTimings = serverTimings;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,14 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* NetworkObserver is the main class in DevTools to observe network requests
|
||||
* out of many events fired by the platform code.
|
||||
*/
|
||||
|
||||
// Enable logging all platform events this module listen to
|
||||
const DEBUG_PLATFORM_EVENTS = false;
|
||||
|
||||
const { Cc, Ci, Cr, Cu } = require("chrome");
|
||||
const Services = require("Services");
|
||||
const {
|
||||
|
@ -50,7 +58,12 @@ loader.lazyGetter(
|
|||
() => Cu.getGlobalForObject(Cu).WebExtensionPolicy
|
||||
);
|
||||
|
||||
// Network logging
|
||||
function logPlatformEvent(eventName, channel, message = "") {
|
||||
if (!DEBUG_PLATFORM_EVENTS) {
|
||||
return;
|
||||
}
|
||||
dump(`[netmonitor] ${channel.channelId} - ${eventName} ${message}\n`);
|
||||
}
|
||||
|
||||
// The maximum uint32 value.
|
||||
const PR_UINT32_MAX = 4294967295;
|
||||
|
@ -292,6 +305,8 @@ NetworkObserver.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
logPlatformEvent(topic, channel);
|
||||
|
||||
this.interceptedChannels.add(subject);
|
||||
|
||||
// Service workers never fire http-on-examine-cached-response, so fake one.
|
||||
|
@ -317,6 +332,8 @@ NetworkObserver.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
logPlatformEvent(topic, channel);
|
||||
|
||||
// Ignore preload requests to avoid duplicity request entries in
|
||||
// the Network panel. If a preload fails (for whatever reason)
|
||||
// then the platform kicks off another 'real' request.
|
||||
|
@ -349,6 +366,8 @@ NetworkObserver.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
logPlatformEvent(topic, channel);
|
||||
|
||||
let id;
|
||||
let reason;
|
||||
|
||||
|
@ -371,7 +390,7 @@ NetworkObserver.prototype = {
|
|||
if (httpActivity.owner) {
|
||||
// Try extracting server timings. Note that they will be sent to the client
|
||||
// in the `_onTransactionClose` method together with network event timings.
|
||||
httpActivity.owner.addSeverTimings(serverTimings);
|
||||
httpActivity.owner.addServerTimings(serverTimings);
|
||||
} else {
|
||||
// If the owner isn't set we need to create the network event and send
|
||||
// it to the client. This happens in case where the request has been
|
||||
|
@ -417,6 +436,14 @@ NetworkObserver.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
logPlatformEvent(
|
||||
topic,
|
||||
subject,
|
||||
blockedOrFailed
|
||||
? "blockedOrFailed:" + blockedReason
|
||||
: channel.responseStatus
|
||||
);
|
||||
|
||||
const response = {
|
||||
id: gSequenceId(),
|
||||
channel: channel,
|
||||
|
@ -535,6 +562,8 @@ NetworkObserver.prototype = {
|
|||
if (throttler) {
|
||||
const channel = subject.QueryInterface(Ci.nsIHttpChannel);
|
||||
if (matchRequest(channel, this.filters)) {
|
||||
logPlatformEvent("http-on-modify-request", channel);
|
||||
|
||||
// Read any request body here, before it is throttled.
|
||||
const httpActivity = this.createOrGetActivityObject(channel);
|
||||
this._onRequestBodySent(httpActivity);
|
||||
|
@ -588,6 +617,27 @@ NetworkObserver.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
getActivityTypeString(activityType, activitySubtype) {
|
||||
if (
|
||||
activityType === Ci.nsIHttpActivityObserver.ACTIVITY_TYPE_SOCKET_TRANSPORT
|
||||
) {
|
||||
for (const name in Ci.nsISocketTransport) {
|
||||
if (Ci.nsISocketTransport[name] === activitySubtype) {
|
||||
return "SOCKET_TRANSPORT:" + name;
|
||||
}
|
||||
}
|
||||
} else if (
|
||||
activityType === Ci.nsIHttpActivityObserver.ACTIVITY_TYPE_HTTP_TRANSACTION
|
||||
) {
|
||||
for (const name in Ci.nsIHttpActivityObserver) {
|
||||
if (Ci.nsIHttpActivityObserver[name] === activitySubtype) {
|
||||
return "HTTP_TRANSACTION:" + name.replace("ACTIVITY_SUBTYPE_", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
return "unexpected-activity-types:" + activityType + ":" + activitySubtype;
|
||||
},
|
||||
|
||||
/**
|
||||
* Begin observing HTTP traffic that originates inside the current tab.
|
||||
*
|
||||
|
@ -626,6 +676,13 @@ NetworkObserver.prototype = {
|
|||
channel = channel.QueryInterface(Ci.nsIHttpChannel);
|
||||
channel = channel.QueryInterface(Ci.nsIClassifiedChannel);
|
||||
|
||||
if (DEBUG_PLATFORM_EVENTS) {
|
||||
logPlatformEvent(
|
||||
this.getActivityTypeString(activityType, activitySubtype),
|
||||
channel
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
activitySubtype == gActivityDistributor.ACTIVITY_SUBTYPE_REQUEST_HEADER
|
||||
) {
|
||||
|
|
|
@ -14,10 +14,15 @@ loader.lazyRequireGetter(
|
|||
);
|
||||
|
||||
/**
|
||||
* Start a DevTools server in a worker and add it as a child server for an active
|
||||
* connection.
|
||||
* Start a DevTools server in a worker and add it as a child server for a given active connection.
|
||||
*
|
||||
* @params {DevToolsConnection} connection
|
||||
* @params {WorkerDebugger} dbg: The WorkerDebugger we want to create a target actor for.
|
||||
* @params {String} forwardingPrefix: The prefix that will be used to forward messages
|
||||
* to the DevToolsServer on the worker thread.
|
||||
* @params {Object} options: An option object that will be passed with the "connect" packet.
|
||||
*/
|
||||
function connectToWorker(connection, dbg, id, options) {
|
||||
function connectToWorker(connection, dbg, forwardingPrefix, options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (dbg.isClosed) {
|
||||
reject("closed");
|
||||
|
@ -93,7 +98,7 @@ function connectToWorker(connection, dbg, id, options) {
|
|||
dbg.postMessage(
|
||||
JSON.stringify({
|
||||
type: "connect",
|
||||
id,
|
||||
forwardingPrefix,
|
||||
options,
|
||||
})
|
||||
);
|
||||
|
@ -110,7 +115,10 @@ function connectToWorker(connection, dbg, id, options) {
|
|||
|
||||
onMessage: message => {
|
||||
message = JSON.parse(message);
|
||||
if (message.type !== "connected" || message.id !== id) {
|
||||
if (
|
||||
message.type !== "connected" ||
|
||||
message.forwardingPrefix !== forwardingPrefix
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -119,7 +127,10 @@ function connectToWorker(connection, dbg, id, options) {
|
|||
dbg.removeListener(listener);
|
||||
|
||||
// Step 7: Create a transport for the connection to the worker.
|
||||
const transport = new MainThreadWorkerDebuggerTransport(dbg, id);
|
||||
const transport = new MainThreadWorkerDebuggerTransport(
|
||||
dbg,
|
||||
forwardingPrefix
|
||||
);
|
||||
transport.ready();
|
||||
transport.hooks = {
|
||||
onClosed: () => {
|
||||
|
@ -135,7 +146,7 @@ function connectToWorker(connection, dbg, id, options) {
|
|||
dbg.postMessage(
|
||||
JSON.stringify({
|
||||
type: "disconnect",
|
||||
id,
|
||||
forwardingPrefix,
|
||||
})
|
||||
);
|
||||
} catch (e) {
|
||||
|
@ -147,7 +158,7 @@ function connectToWorker(connection, dbg, id, options) {
|
|||
}
|
||||
}
|
||||
|
||||
connection.cancelForwarding(id);
|
||||
connection.cancelForwarding(forwardingPrefix);
|
||||
},
|
||||
|
||||
onPacket: packet => {
|
||||
|
@ -161,7 +172,7 @@ function connectToWorker(connection, dbg, id, options) {
|
|||
// Ensure that any packets received from the client on the main thread
|
||||
// to actors on the worker thread are forwarded to the server on the
|
||||
// worker thread.
|
||||
connection.setForwarding(id, transport);
|
||||
connection.setForwarding(forwardingPrefix, transport);
|
||||
|
||||
resolve({
|
||||
workerTargetForm: message.workerTargetForm,
|
||||
|
|
|
@ -17,15 +17,17 @@
|
|||
// main thread. It is exposed as a built-in global to every module by the
|
||||
// worker loader. To make sure the worker loader can access it, it needs to be
|
||||
// defined before loading the worker loader script below.
|
||||
let nextId = 0;
|
||||
const rpcDeferreds = {};
|
||||
this.rpc = function(method, ...params) {
|
||||
const id = nextId++;
|
||||
|
||||
postMessage(
|
||||
JSON.stringify({
|
||||
type: "rpc",
|
||||
method: method,
|
||||
params: params,
|
||||
id: id,
|
||||
method,
|
||||
params,
|
||||
id,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -36,30 +38,35 @@ this.rpc = function(method, ...params) {
|
|||
|
||||
loadSubScript("resource://devtools/shared/worker/loader.js");
|
||||
|
||||
var defer = worker.require("devtools/shared/defer");
|
||||
const defer = worker.require("devtools/shared/defer");
|
||||
const { WorkerTargetActor } = worker.require(
|
||||
"devtools/server/actors/targets/worker"
|
||||
);
|
||||
var { DevToolsServer } = worker.require("devtools/server/devtools-server");
|
||||
const { DevToolsServer } = worker.require("devtools/server/devtools-server");
|
||||
|
||||
DevToolsServer.init();
|
||||
DevToolsServer.createRootActor = function() {
|
||||
throw new Error("Should never get here!");
|
||||
};
|
||||
|
||||
var connections = Object.create(null);
|
||||
var nextId = 0;
|
||||
var rpcDeferreds = [];
|
||||
// This file is only instanciated once for a given WorkerDebugger, which means that
|
||||
// multiple toolbox could end up using the same instance of this script. In order to handle
|
||||
// that, we handle a Map of the different connections, keyed by forwarding prefix.
|
||||
const connections = new Map();
|
||||
|
||||
this.addEventListener("message", function(event) {
|
||||
const packet = JSON.parse(event.data);
|
||||
switch (packet.type) {
|
||||
case "connect":
|
||||
const { forwardingPrefix } = packet;
|
||||
|
||||
// Step 3: Create a connection to the parent.
|
||||
const connection = DevToolsServer.connectToParent(packet.id, this);
|
||||
const connection = DevToolsServer.connectToParent(forwardingPrefix, this);
|
||||
|
||||
// Step 4: Create a WorkerTarget actor.
|
||||
const workerTargetActor = new WorkerTargetActor(connection, global);
|
||||
// Make the worker manage itself so it is put in a Pool and assigned an actorID.
|
||||
workerTargetActor.manage(workerTargetActor);
|
||||
|
||||
workerTargetActor.on(
|
||||
"worker-thread-attached",
|
||||
|
@ -71,15 +78,14 @@ this.addEventListener("message", function(event) {
|
|||
|
||||
// Step 5: Send a response packet to the parent to notify
|
||||
// it that a connection has been established.
|
||||
connections[packet.id] = {
|
||||
connections.set(forwardingPrefix, {
|
||||
connection,
|
||||
rpcs: [],
|
||||
};
|
||||
});
|
||||
|
||||
postMessage(
|
||||
JSON.stringify({
|
||||
type: "connected",
|
||||
id: packet.id,
|
||||
forwardingPrefix,
|
||||
workerTargetForm: workerTargetActor.form(),
|
||||
})
|
||||
);
|
||||
|
@ -87,7 +93,9 @@ this.addEventListener("message", function(event) {
|
|||
break;
|
||||
|
||||
case "disconnect":
|
||||
connections[packet.id].connection.close();
|
||||
// This will destroy the associate WorkerTargetActor (and the actors it manages).
|
||||
connections.get(packet.forwardingPrefix).connection.close();
|
||||
connections.delete(packet.forwardingPrefix);
|
||||
break;
|
||||
|
||||
case "rpc":
|
||||
|
|
|
@ -189,10 +189,10 @@ Setting up lldb
|
|||
lldb <Debugging Firefox with LLDB>`.
|
||||
|
||||
The
|
||||
`.lldbinit <http://dxr.mozilla.org/mozilla-central/source/.lldbinit>`__
|
||||
`.lldbinit <http://searchfox.org/mozilla-central/source/.lldbinit>`__
|
||||
file in the source tree imports many useful `Mozilla specific lldb
|
||||
settings, commands and
|
||||
formatters <https://dxr.mozilla.org/mozilla-central/source/python/lldbutils/README.txt>`__
|
||||
formatters <https://searchfox.org/mozilla-central/source/python/lldbutils/README.txt>`__
|
||||
into ``lldb``, but you may need to take one of the following steps to
|
||||
make sure this file is used.
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ Debugging JavaScript
|
|||
Use `Venkman <https://developer.mozilla.org/en-US/docs/Archive/Mozilla/Venkman>`__, the JavaScript Debugger for Mozilla.
|
||||
|
||||
You can use helper functions from
|
||||
`nsXPConnect.cpp <https://dxr.mozilla.org/mozilla-central/source/js/src/xpconnect/src/nsXPConnect.cpp#1395>`__
|
||||
`nsXPConnect.cpp <https://searchfox.org/mozilla-central/source/js/xpconnect/src/nsXPConnect.cpp>`__
|
||||
to inspect and modify the state of JavaScript code from the MSVS
|
||||
debugger.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Building Firefox On Windows
|
||||
Building Firefox On Windows
|
||||
===========================
|
||||
|
||||
Thank you for helping us build the world's best browser on the world's
|
||||
|
@ -158,7 +158,7 @@ source directory as before and type
|
|||
|
||||
The ``./mach bootstrap`` step is a catch-all for any dependencies not
|
||||
covered in this documentation. Note that, bootstrap works **only with
|
||||
the Mercuial repo of the source**, not with source tar balls, nor the
|
||||
the Mercurial repo of the source**, not with source tar balls, nor the
|
||||
github mirror. If you are working on Firefox or Firefox for Android
|
||||
frontends or building Firefox without any changes, select :ref:`Artifact Builds
|
||||
<Understanding Artifact Builds>` in
|
||||
|
|
|
@ -1260,7 +1260,13 @@ void IMEStateManager::SetIMEState(const IMEState& aState,
|
|||
}
|
||||
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::input)) {
|
||||
HTMLInputElement::FromNode(aContent)->GetType(context.mHTMLInputType);
|
||||
HTMLInputElement* inputElement = HTMLInputElement::FromNode(aContent);
|
||||
if (inputElement->HasBeenTypePassword() && aState.IsEditable()) {
|
||||
context.mHTMLInputType.AssignLiteral("password");
|
||||
} else {
|
||||
inputElement->GetType(context.mHTMLInputType);
|
||||
}
|
||||
|
||||
GetActionHint(*aContent, context.mActionHint);
|
||||
} else if (aContent->IsHTMLElement(nsGkAtoms::textarea)) {
|
||||
context.mHTMLInputType.Assign(nsGkAtoms::textarea->GetUTF16String());
|
||||
|
|
|
@ -1349,12 +1349,14 @@ bool BackgroundFactoryRequestChild::HandleResponse(
|
|||
static_cast<BackgroundDatabaseChild*>(aResponse.databaseChild());
|
||||
MOZ_ASSERT(databaseActor);
|
||||
|
||||
NotNull<IDBDatabase*> database = [this, databaseActor] {
|
||||
IDBDatabase* const database = [this, databaseActor]() -> IDBDatabase* {
|
||||
IDBDatabase* database = databaseActor->GetDOMObject();
|
||||
if (!database) {
|
||||
Unused << this;
|
||||
|
||||
databaseActor->EnsureDOMObject();
|
||||
if (NS_WARN_IF(!databaseActor->EnsureDOMObject())) {
|
||||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(mDatabaseActor);
|
||||
|
||||
database = databaseActor->GetDOMObject();
|
||||
|
@ -1363,12 +1365,10 @@ bool BackgroundFactoryRequestChild::HandleResponse(
|
|||
MOZ_ASSERT(!database->IsClosed());
|
||||
}
|
||||
|
||||
return WrapNotNullUnchecked(database);
|
||||
return database;
|
||||
}();
|
||||
|
||||
MOZ_ASSERT(mDatabaseActor == databaseActor);
|
||||
|
||||
if (database->IsClosed()) {
|
||||
if (!database || database->IsClosed()) {
|
||||
// If the database was closed already, which is only possible if we fired an
|
||||
// "upgradeneeded" event, then we shouldn't fire a "success" event here.
|
||||
// Instead we fire an error event with AbortErr.
|
||||
|
@ -1377,7 +1377,13 @@ bool BackgroundFactoryRequestChild::HandleResponse(
|
|||
SetResultAndDispatchSuccessEvent(mRequest, nullptr, *database);
|
||||
}
|
||||
|
||||
if (database) {
|
||||
MOZ_ASSERT(mDatabaseActor == databaseActor);
|
||||
|
||||
databaseActor->ReleaseDOMObject();
|
||||
} else {
|
||||
databaseActor->SendDeleteMeInternal();
|
||||
}
|
||||
MOZ_ASSERT(!mDatabaseActor);
|
||||
|
||||
return true;
|
||||
|
@ -1590,14 +1596,14 @@ void BackgroundDatabaseChild::SendDeleteMeInternal() {
|
|||
}
|
||||
}
|
||||
|
||||
void BackgroundDatabaseChild::EnsureDOMObject() {
|
||||
bool BackgroundDatabaseChild::EnsureDOMObject() {
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mOpenRequestActor);
|
||||
|
||||
if (mTemporaryStrongDatabase) {
|
||||
MOZ_ASSERT(!mSpec);
|
||||
MOZ_ASSERT(mDatabase == mTemporaryStrongDatabase);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mSpec);
|
||||
|
@ -1607,6 +1613,17 @@ void BackgroundDatabaseChild::EnsureDOMObject() {
|
|||
auto& factory =
|
||||
static_cast<BackgroundFactoryChild*>(Manager())->GetDOMObject();
|
||||
|
||||
if (!factory.GetParentObject()) {
|
||||
// Already disconnected from global.
|
||||
|
||||
// We need to clear mOpenRequestActor here, since that would otherwise be
|
||||
// done by ReleaseDOMObject, which cannot be called if EnsureDOMObject
|
||||
// failed.
|
||||
mOpenRequestActor = nullptr;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: This AcquireStrongRefFromRawPtr looks suspicious. This should be
|
||||
// changed or at least well explained, see also comment on
|
||||
// BackgroundFactoryChild.
|
||||
|
@ -1620,6 +1637,8 @@ void BackgroundDatabaseChild::EnsureDOMObject() {
|
|||
mDatabase = mTemporaryStrongDatabase;
|
||||
|
||||
mOpenRequestActor->SetDatabaseActor(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BackgroundDatabaseChild::ReleaseDOMObject() {
|
||||
|
@ -1709,9 +1728,28 @@ BackgroundDatabaseChild::RecvPBackgroundIDBVersionChangeTransactionConstructor(
|
|||
|
||||
MaybeCollectGarbageOnIPCMessage();
|
||||
|
||||
EnsureDOMObject();
|
||||
auto* const actor =
|
||||
static_cast<BackgroundVersionChangeTransactionChild*>(aActor);
|
||||
|
||||
auto* actor = static_cast<BackgroundVersionChangeTransactionChild*>(aActor);
|
||||
if (!EnsureDOMObject()) {
|
||||
NS_WARNING("Factory is already disconnected from global");
|
||||
|
||||
actor->SendDeleteMeInternal(true);
|
||||
|
||||
// XXX This is a hack to ensure that transaction/request serial numbers stay
|
||||
// in sync between parent and child. Actually, it might be better to create
|
||||
// an IDBTransaction in the child and abort that.
|
||||
Unused
|
||||
<< mozilla::ipc::BackgroundChildImpl::GetThreadLocalForCurrentThread()
|
||||
->mIndexedDBThreadLocal->NextTransactionSN(
|
||||
IDBTransaction::Mode::VersionChange);
|
||||
Unused << IDBRequest::NextSerialNumber();
|
||||
|
||||
// If we return IPC_FAIL_NO_REASON(this) here, we crash...
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!mDatabase->IsInvalidated());
|
||||
|
||||
// XXX NotNull might encapsulate this
|
||||
const auto request =
|
||||
|
|
|
@ -249,7 +249,7 @@ class BackgroundDatabaseChild final : public PBackgroundIDBDatabaseChild {
|
|||
|
||||
void SendDeleteMeInternal();
|
||||
|
||||
void EnsureDOMObject();
|
||||
[[nodiscard]] bool EnsureDOMObject();
|
||||
|
||||
void ReleaseDOMObject();
|
||||
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
function createDb() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const openRequest = indexedDB.open("test-abort-on-reload", 1);
|
||||
openRequest.onsuccess = () => {
|
||||
const db = openRequest.result;
|
||||
// This would throw when db is corrupted.
|
||||
db.transaction("databases", "readwrite");
|
||||
db.onversionchange = () => {
|
||||
db.close();
|
||||
};
|
||||
resolve();
|
||||
};
|
||||
openRequest.onupgradeneeded = (evt) => {
|
||||
// Interrupt upgrade
|
||||
window.location.reload();
|
||||
opener.info('reload requested\n');
|
||||
openRequest.result.createObjectStore("databases");
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function reset() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const request = indexedDB.deleteDatabase("test-abort-on-reload");
|
||||
request.onsuccess = resolve;
|
||||
});
|
||||
}
|
||||
|
||||
async function test() {
|
||||
opener.postMessage("message", "*");
|
||||
|
||||
for (let i = 0; i < 10; ++i) {
|
||||
opener.info(`iteration ${i}`);
|
||||
await createDb();
|
||||
await reset();
|
||||
}
|
||||
}
|
||||
|
||||
test();
|
||||
</script>
|
||||
</body>
|
|
@ -119,6 +119,9 @@ support-files =
|
|||
|
||||
[test_abort_deleted_index.html]
|
||||
[test_abort_deleted_objectStore.html]
|
||||
[test_abort_on_reload.html]
|
||||
support-files =
|
||||
abort_on_reload.html
|
||||
[test_add_put.html]
|
||||
[test_add_twice_failure.html]
|
||||
[test_advance.html]
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Indexed Database Test</title>
|
||||
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
<script type="text/javascript">
|
||||
let openedWindow
|
||||
let reloads = 0
|
||||
|
||||
function openWindow() {
|
||||
openedWindow = window.open("abort_on_reload.html");
|
||||
}
|
||||
|
||||
function messageListener(event) {
|
||||
ok(true, "reload recorded");
|
||||
|
||||
if (++reloads == 20) {
|
||||
openedWindow.close();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
window.addEventListener("message", messageListener);
|
||||
|
||||
openWindow();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="runTest();">
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -29,21 +29,21 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
|
||||
bool MediaControlKeyManager::IsOpened() const {
|
||||
// As MediaControlKeyManager represents a platform-indenpendent event source,
|
||||
// which we can use to add other listeners to moniter media key events, we
|
||||
// would always return true even if we fail to open the real media key event
|
||||
// source, because we still have chances to open the source again when there
|
||||
// are other new controllers being added.
|
||||
return true;
|
||||
return mEventSource && mEventSource->IsOpened();
|
||||
}
|
||||
|
||||
bool MediaControlKeyManager::Open() {
|
||||
mControllerAmountChangedListener =
|
||||
MediaControlService::GetService()
|
||||
->MediaControllerAmountChangedEvent()
|
||||
.Connect(AbstractThread::MainThread(), this,
|
||||
&MediaControlKeyManager::ControllerAmountChanged);
|
||||
if (IsOpened()) {
|
||||
return true;
|
||||
}
|
||||
return StartMonitoringControlKeys();
|
||||
}
|
||||
|
||||
void MediaControlKeyManager::Close() {
|
||||
// We don't call parent's `Close()` because we want to keep the listener
|
||||
// (MediaControlKeyHandler) all the time. It would be manually removed by
|
||||
// `MediaControlService` when shutdown.
|
||||
StopMonitoringControlKeys();
|
||||
}
|
||||
|
||||
MediaControlKeyManager::MediaControlKeyManager()
|
||||
|
@ -57,7 +57,6 @@ MediaControlKeyManager::~MediaControlKeyManager() { Shutdown(); }
|
|||
void MediaControlKeyManager::Shutdown() {
|
||||
StopMonitoringControlKeys();
|
||||
mEventSource = nullptr;
|
||||
mControllerAmountChangedListener.DisconnectIfExists();
|
||||
if (mObserver) {
|
||||
nsContentUtils::UnregisterShutdownObserver(mObserver);
|
||||
Preferences::RemoveObserver(mObserver, MEDIA_CONTROL_PREF);
|
||||
|
@ -65,44 +64,42 @@ void MediaControlKeyManager::Shutdown() {
|
|||
}
|
||||
}
|
||||
|
||||
void MediaControlKeyManager::StartMonitoringControlKeys() {
|
||||
bool MediaControlKeyManager::StartMonitoringControlKeys() {
|
||||
if (!StaticPrefs::media_hardwaremediakeys_enabled()) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mEventSource) {
|
||||
mEventSource = widget::CreateMediaControlKeySource();
|
||||
}
|
||||
|
||||
// When cross-compiling with MinGW, we cannot use the related WinAPI, thus
|
||||
// mEventSource might be null there.
|
||||
if (!mEventSource) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mEventSource->IsOpened() && mEventSource->Open()) {
|
||||
if (mEventSource && mEventSource->Open()) {
|
||||
LOG_INFO("StartMonitoringControlKeys");
|
||||
mEventSource->SetPlaybackState(mPlaybackState);
|
||||
mEventSource->SetMediaMetadata(mMetadata);
|
||||
mEventSource->SetSupportedMediaKeys(mSupportedKeys);
|
||||
mEventSource->AddListener(this);
|
||||
return true;
|
||||
}
|
||||
// Fail to open or create event source (eg. when cross-compiling with MinGW,
|
||||
// we cannot use the related WinAPI)
|
||||
return false;
|
||||
}
|
||||
|
||||
void MediaControlKeyManager::StopMonitoringControlKeys() {
|
||||
if (mEventSource && mEventSource->IsOpened()) {
|
||||
if (!mEventSource || !mEventSource->IsOpened()) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_INFO("StopMonitoringControlKeys");
|
||||
mEventSource->Close();
|
||||
if (StaticPrefs::media_mediacontrol_testingevents_enabled()) {
|
||||
// Close the source would reset the displayed playback state and metadata.
|
||||
if (nsCOMPtr<nsIObserverService> obs = services::GetObserverService()) {
|
||||
obs->NotifyObservers(nullptr, "media-displayed-playback-changed",
|
||||
nullptr);
|
||||
obs->NotifyObservers(nullptr, "media-displayed-metadata-changed",
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void MediaControlKeyManager::ControllerAmountChanged(
|
||||
uint64_t aControllerAmount) {
|
||||
LOG("Controller amount changed=%" PRId64, aControllerAmount);
|
||||
if (aControllerAmount > 0) {
|
||||
StartMonitoringControlKeys();
|
||||
} else if (aControllerAmount == 0) {
|
||||
StopMonitoringControlKeys();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,18 +161,6 @@ void MediaControlKeyManager::SetSupportedMediaKeys(
|
|||
}
|
||||
}
|
||||
|
||||
void MediaControlKeyManager::SetControlledTabBrowsingContextId(
|
||||
Maybe<uint64_t> aTopLevelBrowsingContextId) {
|
||||
if (aTopLevelBrowsingContextId) {
|
||||
LOG_INFO("Controlled tab Id=%" PRId64, *aTopLevelBrowsingContextId);
|
||||
} else {
|
||||
LOG_INFO("No controlled tab exists");
|
||||
}
|
||||
if (mEventSource && mEventSource->IsOpened()) {
|
||||
mEventSource->SetControlledTabBrowsingContextId(aTopLevelBrowsingContextId);
|
||||
}
|
||||
}
|
||||
|
||||
void MediaControlKeyManager::SetEnableFullScreen(bool aIsEnabled) {
|
||||
LOG_INFO("Set fullscreen %s", aIsEnabled ? "enabled" : "disabled");
|
||||
if (mEventSource && mEventSource->IsOpened()) {
|
||||
|
@ -209,7 +194,7 @@ void MediaControlKeyManager::OnPreferenceChange() {
|
|||
LOG_INFO("Preference change : %s media control",
|
||||
isPrefEnabled ? "enable" : "disable");
|
||||
if (shouldMonitorKeys) {
|
||||
StartMonitoringControlKeys();
|
||||
Unused << StartMonitoringControlKeys();
|
||||
} else {
|
||||
StopMonitoringControlKeys();
|
||||
}
|
||||
|
|
|
@ -29,21 +29,15 @@ class MediaControlKeyManager final : public MediaControlKeySource,
|
|||
|
||||
// MediaControlKeySource methods
|
||||
bool Open() override;
|
||||
void Close() override;
|
||||
bool IsOpened() const override;
|
||||
|
||||
void SetControlledTabBrowsingContextId(
|
||||
Maybe<uint64_t> aTopLevelBrowsingContextId) override;
|
||||
|
||||
void SetPlaybackState(MediaSessionPlaybackState aState) override;
|
||||
MediaSessionPlaybackState GetPlaybackState() const override;
|
||||
|
||||
// MediaControlKeyListener methods
|
||||
void OnActionPerformed(const MediaControlAction& aAction) override;
|
||||
|
||||
// The callback function for monitoring the media controller amount changed
|
||||
// event.
|
||||
void ControllerAmountChanged(uint64_t aControllerAmount);
|
||||
|
||||
void SetMediaMetadata(const MediaMetadataBase& aMetadata) override;
|
||||
void SetSupportedMediaKeys(const MediaKeysArray& aSupportedKeys) override;
|
||||
void SetEnableFullScreen(bool aIsEnabled) override;
|
||||
|
@ -68,10 +62,9 @@ class MediaControlKeyManager final : public MediaControlKeySource,
|
|||
RefPtr<Observer> mObserver;
|
||||
void OnPreferenceChange();
|
||||
|
||||
void StartMonitoringControlKeys();
|
||||
bool StartMonitoringControlKeys();
|
||||
void StopMonitoringControlKeys();
|
||||
RefPtr<MediaControlKeySource> mEventSource;
|
||||
MediaEventListener mControllerAmountChangedListener;
|
||||
MediaMetadataBase mMetadata;
|
||||
nsTArray<MediaControlKey> mSupportedKeys;
|
||||
};
|
||||
|
|
|
@ -95,17 +95,6 @@ class MediaControlKeySource {
|
|||
* the same time, we would only update information from one of that tabs that
|
||||
* would be done by `MediaControlService`.
|
||||
*/
|
||||
|
||||
// Currently, this method is only useful for GeckoView. It would be called
|
||||
// before all the other `SetXXX()` functions after the key source is open.
|
||||
// It's used to indicate where the property change occurs. We would send the
|
||||
// top level browsing context Id in order to allow the key source know which
|
||||
// tab that the following coming information belong to. This function would be
|
||||
// called whenever we change the controlled tab. If no controlled tab exists,
|
||||
// the `aTopLevelBrowsingContextId` would be `Nothing()`.
|
||||
virtual void SetControlledTabBrowsingContextId(
|
||||
Maybe<uint64_t> aTopLevelBrowsingContextId){};
|
||||
|
||||
virtual void SetPlaybackState(MediaSessionPlaybackState aState);
|
||||
virtual MediaSessionPlaybackState GetPlaybackState() const;
|
||||
|
||||
|
|
|
@ -109,8 +109,6 @@ MediaControlService::MediaControlService() {
|
|||
void MediaControlService::Init() {
|
||||
mMediaKeysHandler = new MediaControlKeyHandler();
|
||||
mMediaControlKeyManager = new MediaControlKeyManager();
|
||||
mMediaControlKeyManager->Open();
|
||||
MOZ_ASSERT(mMediaControlKeyManager->IsOpened());
|
||||
mMediaControlKeyManager->AddListener(mMediaKeysHandler.get());
|
||||
mControllerManager = MakeUnique<ControllerManager>(this);
|
||||
|
||||
|
@ -170,7 +168,6 @@ bool MediaControlService::RegisterActiveMediaController(
|
|||
}
|
||||
LOG("Register media controller %" PRId64 ", currentNum=%" PRId64,
|
||||
aController->Id(), GetActiveControllersNum());
|
||||
mMediaControllerAmountChangedEvent.Notify(GetActiveControllersNum());
|
||||
if (StaticPrefs::media_mediacontrol_testingevents_enabled()) {
|
||||
if (nsCOMPtr<nsIObserverService> obs = services::GetObserverService()) {
|
||||
obs->NotifyObservers(nullptr, "media-controller-amount-changed", nullptr);
|
||||
|
@ -189,7 +186,6 @@ bool MediaControlService::UnregisterActiveMediaController(
|
|||
}
|
||||
LOG("Unregister media controller %" PRId64 ", currentNum=%" PRId64,
|
||||
aController->Id(), GetActiveControllersNum());
|
||||
mMediaControllerAmountChangedEvent.Notify(GetActiveControllersNum());
|
||||
if (StaticPrefs::media_mediacontrol_testingevents_enabled()) {
|
||||
if (nsCOMPtr<nsIObserverService> obs = services::GetObserverService()) {
|
||||
obs->NotifyObservers(nullptr, "media-controller-amount-changed", nullptr);
|
||||
|
@ -407,15 +403,20 @@ void MediaControlService::ControllerManager::UpdateMainControllerInternal(
|
|||
|
||||
if (!mMainController) {
|
||||
LOG_MAINCONTROLLER_INFO("Clear main controller");
|
||||
mSource->SetControlledTabBrowsingContextId(Nothing());
|
||||
mSource->SetPlaybackState(MediaSessionPlaybackState::None);
|
||||
mSource->SetMediaMetadata(MediaMetadataBase::EmptyData());
|
||||
mSource->SetSupportedMediaKeys(MediaKeysArray());
|
||||
mSource->Close();
|
||||
DisconnectMainControllerEvents();
|
||||
} else {
|
||||
LOG_MAINCONTROLLER_INFO("Set controller %" PRId64 " as main controller",
|
||||
mMainController->Id());
|
||||
mSource->SetControlledTabBrowsingContextId(Some(mMainController->Id()));
|
||||
if (!mSource->Open()) {
|
||||
LOG("Failed to open source for monitoring media keys");
|
||||
}
|
||||
// We would still update those status to the event source even if it failed
|
||||
// to open, because it would save the result and set them to the real
|
||||
// source when it opens. In addition, another benefit to do that is to
|
||||
// prevent testing from affecting by platform specific issues, because our
|
||||
// testing events rely on those status changes and they are all platform
|
||||
// independent.
|
||||
mSource->SetPlaybackState(mMainController->PlaybackState());
|
||||
mSource->SetMediaMetadata(mMainController->GetCurrentMediaMetadata());
|
||||
mSource->SetSupportedMediaKeys(mMainController->GetSupportedMediaKeys());
|
||||
|
|
|
@ -67,12 +67,6 @@ class MediaControlService final : public nsIObserver {
|
|||
// key events and would show its metadata to virtual controller interface.
|
||||
MediaController* GetMainController() const;
|
||||
|
||||
// This event is used to generate a media event indicating media controller
|
||||
// amount changed.
|
||||
MediaEventSource<uint64_t>& MediaControllerAmountChangedEvent() {
|
||||
return mMediaControllerAmountChangedEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* These following functions are used for testing only. We use them to
|
||||
* generate fake media control key events, get the media metadata and playback
|
||||
|
|
|
@ -1612,7 +1612,7 @@ pub extern "C" fn wr_window_new(
|
|||
|
||||
let window_size = DeviceIntSize::new(window_width, window_height);
|
||||
let notifier = Box::new(CppNotifier { window_id: window_id });
|
||||
let (renderer, sender) = match Renderer::new(gl, notifier, opts, shaders, window_size) {
|
||||
let (renderer, sender) = match Renderer::new(gl, notifier, opts, shaders) {
|
||||
Ok((renderer, sender)) => (renderer, sender),
|
||||
Err(e) => {
|
||||
warn!(" Failed to create a Renderer: {:?}", e);
|
||||
|
|
|
@ -116,7 +116,6 @@ impl Rectangle {
|
|||
..webrender::RendererOptions::default()
|
||||
},
|
||||
None,
|
||||
size,
|
||||
).unwrap();
|
||||
let api = sender.create_api();
|
||||
|
||||
|
|
|
@ -383,7 +383,6 @@ fn main() {
|
|||
notifier,
|
||||
opts,
|
||||
None,
|
||||
device_size,
|
||||
).unwrap();
|
||||
let api = sender.create_api();
|
||||
let document_id = api.add_document(device_size, 0);
|
||||
|
|
|
@ -183,7 +183,6 @@ pub fn main_wrapper<E: Example>(
|
|||
notifier,
|
||||
opts,
|
||||
None,
|
||||
device_size,
|
||||
).unwrap();
|
||||
let mut api = sender.create_api();
|
||||
let document_id = api.add_document(device_size, 0);
|
||||
|
|
|
@ -105,7 +105,7 @@ impl Window {
|
|||
DeviceIntSize::new(size.width as i32, size.height as i32)
|
||||
};
|
||||
let notifier = Box::new(Notifier::new(events_loop.create_proxy()));
|
||||
let (renderer, sender) = webrender::Renderer::new(gl.clone(), notifier, opts, None, device_size).unwrap();
|
||||
let (renderer, sender) = webrender::Renderer::new(gl.clone(), notifier, opts, None).unwrap();
|
||||
let mut api = sender.create_api();
|
||||
let document_id = api.add_document(device_size, 0);
|
||||
|
||||
|
|
|
@ -299,27 +299,6 @@ pub const TILE_SIZE_SCROLLBAR_VERTICAL: DeviceIntSize = DeviceIntSize {
|
|||
_unit: marker::PhantomData,
|
||||
};
|
||||
|
||||
pub const TILE_SIZE_FOR_TESTS: [DeviceIntSize; 6] = [
|
||||
DeviceIntSize {
|
||||
width: 128,
|
||||
height: 128,
|
||||
_unit: marker::PhantomData,
|
||||
},
|
||||
DeviceIntSize {
|
||||
width: 256,
|
||||
height: 256,
|
||||
_unit: marker::PhantomData,
|
||||
},
|
||||
DeviceIntSize {
|
||||
width: 512,
|
||||
height: 512,
|
||||
_unit: marker::PhantomData,
|
||||
},
|
||||
TILE_SIZE_DEFAULT,
|
||||
TILE_SIZE_SCROLLBAR_VERTICAL,
|
||||
TILE_SIZE_SCROLLBAR_HORIZONTAL,
|
||||
];
|
||||
|
||||
/// The maximum size per axis of a surface,
|
||||
/// in WorldPixel coordinates.
|
||||
const MAX_SURFACE_SIZE: f32 = 4096.0;
|
||||
|
|
|
@ -2410,7 +2410,6 @@ impl Renderer {
|
|||
notifier: Box<dyn RenderNotifier>,
|
||||
mut options: RendererOptions,
|
||||
shaders: Option<&mut WrShaders>,
|
||||
start_size: DeviceIntSize,
|
||||
) -> Result<(Self, RenderApiSender), RendererError> {
|
||||
if !wr_has_been_initialized() {
|
||||
// If the profiler feature is enabled, try to load the profiler shared library
|
||||
|
@ -2796,22 +2795,10 @@ impl Renderer {
|
|||
thread_listener.thread_started(&rb_thread_name);
|
||||
}
|
||||
|
||||
let prealloc_sizes = [
|
||||
picture_tile_size,
|
||||
picture::TILE_SIZE_SCROLLBAR_HORIZONTAL,
|
||||
picture::TILE_SIZE_SCROLLBAR_VERTICAL,
|
||||
];
|
||||
|
||||
let texture_cache = TextureCache::new(
|
||||
max_texture_size,
|
||||
max_texture_layers,
|
||||
match (config.global_enable_picture_caching, config.testing) {
|
||||
(true, false) => &prealloc_sizes,
|
||||
(true, true) => &picture::TILE_SIZE_FOR_TESTS,
|
||||
_ => &[],
|
||||
},
|
||||
picture_tile_size,
|
||||
start_size,
|
||||
color_cache_formats,
|
||||
swizzle_settings,
|
||||
);
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче