зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to inbound. a=merge CLOSED TREE
This commit is contained in:
Коммит
bd30279387
|
@ -2,6 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Get text between offsets tests</title>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
|
@ -64,6 +65,22 @@
|
|||
testText(IDs, 0, 19, "oneword\n\ntwo words\n");
|
||||
testText(IDs, 0, -1, "oneword\n\ntwo words\n");
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CSS text-transform
|
||||
//
|
||||
// Content with `text-transform:uppercase | lowercase | capitalize` returns
|
||||
// the transformed content.
|
||||
//
|
||||
testText(["d4a"], 0, -1, "HELLO MY FRIEND");
|
||||
testText(["d4b"], 0, -1, "hello my friend");
|
||||
testText(["d4c"], 0, -1, "Hello My Friend");
|
||||
|
||||
// `text-transform: full-width | full-size-kana` should not be reflected in
|
||||
// a11y.
|
||||
testText(["d5a"], 0, -1, "hello my friend");
|
||||
testText(["d5b"], 0, -1, "ゕゖヵヶ");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -107,5 +124,12 @@ two words
|
|||
</textarea>
|
||||
</pre>
|
||||
|
||||
<div id="d4a" style="text-transform:uppercase">Hello My Friend</div>
|
||||
<div id="d4b" style="text-transform:lowercase">Hello My Friend</div>
|
||||
<div id="d4c" style="text-transform:capitalize">hello my friend</div>
|
||||
|
||||
<div id="d5a" style="text-transform:full-width">hello my friend</div>
|
||||
<div id="d5b" style="text-transform:full-size-kana">ゕゖヵヶ</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1167,6 +1167,8 @@ pref("services.sync.prefs.sync.addons.ignoreUserEnabledChanges", true);
|
|||
// source, and this would propagate automatically to other,
|
||||
// uncompromised Sync-connected devices.
|
||||
pref("services.sync.prefs.sync.browser.contentblocking.category", true);
|
||||
pref("services.sync.prefs.sync.browser.contentblocking.features.standard", true);
|
||||
pref("services.sync.prefs.sync.browser.contentblocking.features.strict", true);
|
||||
pref("services.sync.prefs.sync.browser.contentblocking.introCount", true);
|
||||
pref("services.sync.prefs.sync.browser.crashReports.unsubmittedCheck.autoSubmit2", true);
|
||||
pref("services.sync.prefs.sync.browser.ctrlTab.recentlyUsedOrder", true);
|
||||
|
@ -1568,6 +1570,36 @@ pref("browser.contentblocking.control-center.ui.showAllowedLabels", false);
|
|||
pref("browser.contentblocking.cryptomining.preferences.ui.enabled", true);
|
||||
pref("browser.contentblocking.fingerprinting.preferences.ui.enabled", true);
|
||||
|
||||
// Possible values for browser.contentblocking.features.* prefs:
|
||||
// Tracking Protection:
|
||||
// "tp": tracking protection enabled
|
||||
// "-tp": tracking protection disabled
|
||||
// Tracking Protection in private windows:
|
||||
// "tpPrivate": tracking protection in private windows enabled
|
||||
// "-tpPrivate": tracking protection in private windows disabled
|
||||
// Fingerprinting:
|
||||
// "fp": fingerprinting blocking enabled
|
||||
// "-fp": fingerprinting blocking disabled
|
||||
// Cryptomining:
|
||||
// "cm": cryptomining blocking enabled
|
||||
// "-cm": cryptomining blocking disabled
|
||||
// Cookie behavior:
|
||||
// "cookieBehavior0": cookie behaviour BEHAVIOR_ACCEPT
|
||||
// "cookieBehavior1": cookie behaviour BEHAVIOR_REJECT_FOREIGN
|
||||
// "cookieBehavior2": cookie behaviour BEHAVIOR_REJECT
|
||||
// "cookieBehavior3": cookie behaviour BEHAVIOR_LIMIT_FOREIGN
|
||||
// "cookieBehavior4": cookie behaviour BEHAVIOR_REJECT_TRACKER
|
||||
// One value from each section must be included in each browser.contentblocking.features.* pref.
|
||||
pref("browser.contentblocking.features.strict", "tp,tpPrivate,cookieBehavior4,-cm,-fp");
|
||||
|
||||
// Enable blocking access to storage from tracking resources only in nightly
|
||||
// and early beta. By default the value is "cookieBehavior0": BEHAVIOR_ACCEPT
|
||||
#ifdef EARLY_BETA_OR_EARLIER
|
||||
pref("browser.contentblocking.features.standard", "-tp,tpPrivate,cookieBehavior4,-cm,-fp");
|
||||
#else
|
||||
pref("browser.contentblocking.features.standard", "-tp,tpPrivate,cookieBehavior0,-cm,-fp");
|
||||
#endif
|
||||
|
||||
// Enable the Report Breakage UI on Nightly and Beta but not on Release yet.
|
||||
#ifdef EARLY_BETA_OR_EARLIER
|
||||
pref("browser.contentblocking.reportBreakage.enabled", true);
|
||||
|
|
|
@ -164,7 +164,7 @@
|
|||
<!-- Media information -->
|
||||
<vbox id="mediaPanel">
|
||||
<tree id="imagetree" onselect="onImageSelect();" contextmenu="picontext"
|
||||
ondragstart="onBeginLinkDrag(event,'image-address','image-alt')">
|
||||
ondragstart="onBeginLinkDrag(event, 'image-address', 'image-alt')">
|
||||
<treecols>
|
||||
<treecol primary="true" persist="width" flex="10"
|
||||
width="10" id="image-address" data-l10n-id="media-address"
|
||||
|
|
|
@ -65,6 +65,9 @@ let whitelist = [
|
|||
intermittent: true,
|
||||
errorMessage: /Property contained reference to invalid variable.*background/i,
|
||||
isFromDevTools: true},
|
||||
{sourceName: /pictureinpicture\/toggle.css$/i,
|
||||
errorMessage: /Unknown pseudo-class.*moz-native-anonymous/i,
|
||||
isFromDevTools: false},
|
||||
];
|
||||
|
||||
if (!Services.prefs.getBoolPref("layout.css.xul-box-display-values.content.enabled")) {
|
||||
|
|
|
@ -2,7 +2,6 @@ const CAT_PREF = "browser.contentblocking.category";
|
|||
const TP_PREF = "privacy.trackingprotection.enabled";
|
||||
const TP_PB_PREF = "privacy.trackingprotection.pbmode.enabled";
|
||||
const TPC_PREF = "network.cookie.cookieBehavior";
|
||||
const TT_PREF = "urlclassifier.trackingTable";
|
||||
const CM_PREF = "privacy.trackingprotection.cryptomining.enabled";
|
||||
const FP_PREF = "privacy.trackingprotection.fingerprinting.enabled";
|
||||
|
||||
|
@ -12,7 +11,6 @@ registerCleanupFunction(function() {
|
|||
Services.prefs.clearUserPref(TP_PREF);
|
||||
Services.prefs.clearUserPref(TP_PB_PREF);
|
||||
Services.prefs.clearUserPref(TPC_PREF);
|
||||
Services.prefs.clearUserPref(TT_PREF);
|
||||
Services.prefs.clearUserPref(CAT_PREF);
|
||||
Services.prefs.clearUserPref(CM_PREF);
|
||||
Services.prefs.clearUserPref(FP_PREF);
|
||||
|
|
|
@ -996,9 +996,10 @@ BrowserGlue.prototype = {
|
|||
os.removeObserver(this, "shield-init-complete");
|
||||
|
||||
Services.prefs.removeObserver("privacy.trackingprotection", this._matchCBCategory);
|
||||
Services.prefs.removeObserver("urlclassifier.trackingTable", this._matchCBCategory);
|
||||
Services.prefs.removeObserver("network.cookie.cookieBehavior", this._matchCBCategory);
|
||||
Services.prefs.removeObserver(ContentBlockingCategoriesPrefs.PREF_CB_CATEGORY, this._updateCBCategory);
|
||||
Services.prefs.removeObserver("browser.contentblocking.features.standard", this._setPrefExpectations);
|
||||
Services.prefs.removeObserver("browser.contentblocking.features.strict", this._setPrefExpectations);
|
||||
},
|
||||
|
||||
// runs on startup, before the first command line handler is invoked
|
||||
|
@ -1327,14 +1328,16 @@ BrowserGlue.prototype = {
|
|||
|
||||
// Set the default favicon size for UI views that use the page-icon protocol.
|
||||
PlacesUtils.favicons.setDefaultIconURIPreferredSize(16 * aWindow.devicePixelRatio);
|
||||
|
||||
this._setPrefExpectations();
|
||||
this._matchCBCategory();
|
||||
|
||||
// This observes the entire privacy.trackingprotection.* pref tree.
|
||||
Services.prefs.addObserver("privacy.trackingprotection", this._matchCBCategory);
|
||||
Services.prefs.addObserver("urlclassifier.trackingTable", this._matchCBCategory);
|
||||
Services.prefs.addObserver("network.cookie.cookieBehavior", this._matchCBCategory);
|
||||
Services.prefs.addObserver(ContentBlockingCategoriesPrefs.PREF_CB_CATEGORY, this._updateCBCategory);
|
||||
Services.prefs.addObserver("media.autoplay.default", this._updateAutoplayPref);
|
||||
Services.prefs.addObserver("browser.contentblocking.features.standard", this._setPrefExpectations);
|
||||
Services.prefs.addObserver("browser.contentblocking.features.strict", this._setPrefExpectations);
|
||||
},
|
||||
|
||||
_updateAutoplayPref() {
|
||||
|
@ -1342,6 +1345,11 @@ BrowserGlue.prototype = {
|
|||
Services.telemetry.scalarSet("media.autoplay_default_blocked", blocked);
|
||||
},
|
||||
|
||||
_setPrefExpectations() {
|
||||
ContentBlockingCategoriesPrefs.setPrefExpectations();
|
||||
ContentBlockingCategoriesPrefs.updateCBCategory();
|
||||
},
|
||||
|
||||
_matchCBCategory() {
|
||||
ContentBlockingCategoriesPrefs.matchCBCategory();
|
||||
},
|
||||
|
@ -2923,28 +2931,86 @@ BrowserGlue.prototype = {
|
|||
|
||||
var ContentBlockingCategoriesPrefs = {
|
||||
PREF_CB_CATEGORY: "browser.contentblocking.category",
|
||||
// The prefs inside CATEGORY_PREFS set expected value for each CB category.
|
||||
// A null value means that pref is default.
|
||||
CATEGORY_PREFS: {
|
||||
strict: [
|
||||
["urlclassifier.trackingTable", null],
|
||||
["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
|
||||
["privacy.trackingprotection.pbmode.enabled", true],
|
||||
["privacy.trackingprotection.enabled", true],
|
||||
["privacy.trackingprotection.fingerprinting.enabled", null],
|
||||
["privacy.trackingprotection.cryptomining.enabled", null],
|
||||
],
|
||||
standard: [
|
||||
["urlclassifier.trackingTable", null],
|
||||
["network.cookie.cookieBehavior", null],
|
||||
["privacy.trackingprotection.pbmode.enabled", null],
|
||||
["privacy.trackingprotection.enabled", null],
|
||||
["privacy.trackingprotection.fingerprinting.enabled", null],
|
||||
["privacy.trackingprotection.cryptomining.enabled", null],
|
||||
],
|
||||
},
|
||||
PREF_STRICT_DEF: "browser.contentblocking.features.strict",
|
||||
PREF_STANDARD_DEF: "browser.contentblocking.features.standard",
|
||||
switchingCategory: false,
|
||||
|
||||
setPrefExpectations() {
|
||||
// The prefs inside CATEGORY_PREFS are initial values, these values then get set.
|
||||
// If the pref remains null, then it will expect the default value,
|
||||
// but the UI will not respond correctly.
|
||||
this.CATEGORY_PREFS = {
|
||||
strict: {
|
||||
"network.cookie.cookieBehavior": null,
|
||||
"privacy.trackingprotection.pbmode.enabled": null,
|
||||
"privacy.trackingprotection.enabled": null,
|
||||
"privacy.trackingprotection.fingerprinting.enabled": null,
|
||||
"privacy.trackingprotection.cryptomining.enabled": null,
|
||||
},
|
||||
standard: {
|
||||
"network.cookie.cookieBehavior": null,
|
||||
"privacy.trackingprotection.pbmode.enabled": null,
|
||||
"privacy.trackingprotection.enabled": null,
|
||||
"privacy.trackingprotection.fingerprinting.enabled": null,
|
||||
"privacy.trackingprotection.cryptomining.enabled": null,
|
||||
},
|
||||
};
|
||||
let types = ["strict", "standard"];
|
||||
for (let type of types) {
|
||||
let rulesArray;
|
||||
if (type == "strict") {
|
||||
rulesArray = Services.prefs.getStringPref(this.PREF_STRICT_DEF).split(",");
|
||||
} else {
|
||||
rulesArray = Services.prefs.getStringPref(this.PREF_STANDARD_DEF).split(",");
|
||||
}
|
||||
for (let item of rulesArray) {
|
||||
switch (item) {
|
||||
case "tp":
|
||||
this.CATEGORY_PREFS[type]["privacy.trackingprotection.enabled"] = true;
|
||||
break;
|
||||
case "-tp":
|
||||
this.CATEGORY_PREFS[type]["privacy.trackingprotection.enabled"] = false;
|
||||
break;
|
||||
case "tpPrivate":
|
||||
this.CATEGORY_PREFS[type]["privacy.trackingprotection.pbmode.enabled"] = true;
|
||||
break;
|
||||
case "-tpPrivate":
|
||||
this.CATEGORY_PREFS[type]["privacy.trackingprotection.pbmode.enabled"] = false;
|
||||
break;
|
||||
case "fp":
|
||||
this.CATEGORY_PREFS[type]["privacy.trackingprotection.fingerprinting.enabled"] = true;
|
||||
break;
|
||||
case "-fp":
|
||||
this.CATEGORY_PREFS[type]["privacy.trackingprotection.fingerprinting.enabled"] = false;
|
||||
break;
|
||||
case "cm":
|
||||
this.CATEGORY_PREFS[type]["privacy.trackingprotection.cryptomining.enabled"] = true;
|
||||
break;
|
||||
case "-cm":
|
||||
this.CATEGORY_PREFS[type]["privacy.trackingprotection.cryptomining.enabled"] = false;
|
||||
break;
|
||||
case "cookieBehavior0":
|
||||
this.CATEGORY_PREFS[type]["network.cookie.cookieBehavior"] = Ci.nsICookieService.BEHAVIOR_ACCEPT;
|
||||
break;
|
||||
case "cookieBehavior1":
|
||||
this.CATEGORY_PREFS[type]["network.cookie.cookieBehavior"] = Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN;
|
||||
break;
|
||||
case "cookieBehavior2":
|
||||
this.CATEGORY_PREFS[type]["network.cookie.cookieBehavior"] = Ci.nsICookieService.BEHAVIOR_REJECT;
|
||||
break;
|
||||
case "cookieBehavior3":
|
||||
this.CATEGORY_PREFS[type]["network.cookie.cookieBehavior"] = Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN;
|
||||
break;
|
||||
case "cookieBehavior4":
|
||||
this.CATEGORY_PREFS[type]["network.cookie.cookieBehavior"] = Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER;
|
||||
break;
|
||||
default:
|
||||
Cu.reportError(`Error: Unknown rule observed ${item}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if CB prefs match perfectly with one of our pre-defined categories.
|
||||
*/
|
||||
|
@ -2954,8 +3020,10 @@ var ContentBlockingCategoriesPrefs = {
|
|||
Services.prefs.getStringPref(this.PREF_CB_CATEGORY) != category) {
|
||||
return false;
|
||||
}
|
||||
for (let [pref, value] of this.CATEGORY_PREFS[category]) {
|
||||
if (!value) {
|
||||
for (let pref in this.CATEGORY_PREFS[category]) {
|
||||
let value = this.CATEGORY_PREFS[category][pref];
|
||||
if (value == null) {
|
||||
Cu.reportError(`Error: ${pref} has not been defined in ${category}`);
|
||||
if (Services.prefs.prefHasUserValue(pref)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -3017,9 +3085,11 @@ var ContentBlockingCategoriesPrefs = {
|
|||
return;
|
||||
}
|
||||
|
||||
for (let [pref, value] of this.CATEGORY_PREFS[category]) {
|
||||
for (let pref in this.CATEGORY_PREFS[category]) {
|
||||
let value = this.CATEGORY_PREFS[category][pref];
|
||||
if (!Services.prefs.prefIsLocked(pref)) {
|
||||
if (!value) {
|
||||
if (value == null) {
|
||||
Cu.reportError(`Error: ${pref} has not been defined in ${category}`);
|
||||
Services.prefs.clearUserPref(pref);
|
||||
} else {
|
||||
switch (Services.prefs.getPrefType(pref)) {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<hbox id="customization-footer">
|
||||
<checkbox id="customization-titlebar-visibility-checkbox" class="customizationmode-checkbox"
|
||||
label="&customizeMode.titlebar;"
|
||||
#NB: because oncommand fires after click, by the time we've fired, the checkbox binding
|
||||
# NB: because oncommand fires after click, by the time we've fired, the checkbox binding
|
||||
# will already have switched the button's state, so this is correct:
|
||||
oncommand="gCustomizeMode.toggleTitlebar(this.checked)"/>
|
||||
<checkbox id="customization-extra-drag-space-checkbox" class="customizationmode-checkbox"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
accesskey="&editBookmarkOverlay.name.accesskey;"
|
||||
control="editBMPanel_namePicker"/>
|
||||
<textbox id="editBMPanel_namePicker"
|
||||
onchange="gEditItemOverlay.onNamePickerChange().catch(Components.utils.reportError);"/>
|
||||
onchange="gEditItemOverlay.onNamePickerChange().catch(Cu.reportError);"/>
|
||||
</vbox>
|
||||
|
||||
<vbox id="editBMPanel_locationRow"
|
||||
|
@ -31,7 +31,7 @@
|
|||
<menulist id="editBMPanel_folderMenuList"
|
||||
class="folder-icon panel-button"
|
||||
flex="1"
|
||||
oncommand="gEditItemOverlay.onFolderMenuListCommand(event).catch(Components.utils.reportError);">
|
||||
oncommand="gEditItemOverlay.onFolderMenuListCommand(event).catch(Cu.reportError);">
|
||||
<menupopup>
|
||||
<!-- Static item for special folders -->
|
||||
<menuitem id="editBMPanel_toolbarFolderItem"
|
||||
|
@ -63,7 +63,7 @@
|
|||
<button label="&editBookmarkOverlay.newFolderButton.label;"
|
||||
id="editBMPanel_newFolderButton"
|
||||
accesskey="&editBookmarkOverlay.newFolderButton.accesskey;"
|
||||
oncommand="gEditItemOverlay.newFolder().catch(Components.utils.reportError);"/>
|
||||
oncommand="gEditItemOverlay.newFolder().catch(Cu.reportError);"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<menupopup id="placesContext"
|
||||
onpopupshowing="this._view = PlacesUIUtils.getViewForNode(document.popupNode);
|
||||
if (!PlacesUIUtils.openInTabClosesMenu) {
|
||||
document.getElementById ('placesContext_open:newtab')
|
||||
document.getElementById('placesContext_open:newtab')
|
||||
.setAttribute('closemenu', 'single');
|
||||
}
|
||||
return this._view.buildContextMenu(this);"
|
||||
|
|
|
@ -25,8 +25,7 @@ const CONTENT_BLOCKING_PREFS = ["privacy.trackingprotection.enabled",
|
|||
"privacy.trackingprotection.pbmode.enabled",
|
||||
"network.cookie.cookieBehavior",
|
||||
"privacy.trackingprotection.fingerprinting.enabled",
|
||||
"privacy.trackingprotection.cryptomining.enabled",
|
||||
"urlclassifier.trackingTable"];
|
||||
"privacy.trackingprotection.cryptomining.enabled"];
|
||||
|
||||
const PREF_OPT_OUT_STUDIES_ENABLED = "app.shield.optoutstudies.enabled";
|
||||
const PREF_NORMANDY_ENABLED = "app.normandy.enabled";
|
||||
|
@ -79,7 +78,11 @@ Preferences.addAll([
|
|||
{ id: "network.cookie.cookieBehavior", type: "int" },
|
||||
{ id: "network.cookie.lifetimePolicy", type: "int" },
|
||||
{ id: "network.cookie.blockFutureCookies", type: "bool" },
|
||||
// Content blocking category
|
||||
{ id: "browser.contentblocking.category", type: "string"},
|
||||
{ id: "browser.contentblocking.features.standard", type: "string"},
|
||||
{ id: "browser.contentblocking.features.strict", type: "string"},
|
||||
|
||||
// Clear Private Data
|
||||
{ id: "privacy.sanitize.sanitizeOnShutdown", type: "bool" },
|
||||
{ id: "privacy.sanitize.timeSpan", type: "int" },
|
||||
|
@ -221,13 +224,6 @@ var gPrivacyPane = {
|
|||
Services.obs.notifyObservers(window, "privacy-pane-tp-ui-updated");
|
||||
}
|
||||
|
||||
// We watch the network.cookie.cookieBehavior default value, if it is
|
||||
// BEHAVIOR_ACCEPT (0) then show the fallback UI. When we change
|
||||
// this default to BEHAVIOR_REJECT_TRACKER (4) show our default UI.
|
||||
let defaults = Services.prefs.getDefaultBranch("");
|
||||
document.getElementById("contentBlockingCategories").toggleAttribute("fallback-ui",
|
||||
defaults.getIntPref("network.cookie.cookieBehavior") === Ci.nsICookieService.BEHAVIOR_ACCEPT);
|
||||
|
||||
let policy = Services.policies.getActivePolicies();
|
||||
if (policy && ((policy.EnableTrackingProtection && policy.EnableTrackingProtection.Locked) ||
|
||||
(policy.Cookies && policy.Cookies.Locked))) {
|
||||
|
@ -480,6 +476,7 @@ var gPrivacyPane = {
|
|||
for (let pref of CONTENT_BLOCKING_PREFS) {
|
||||
Preferences.get(pref).on("change", gPrivacyPane.notifyUserToReload);
|
||||
}
|
||||
Preferences.get("urlclassifier.trackingTable").on("change", gPrivacyPane.notifyUserToReload);
|
||||
for (let button of document.querySelectorAll(".reload-tabs-button")) {
|
||||
button.addEventListener("command", gPrivacyPane.reloadAllTabs);
|
||||
}
|
||||
|
@ -492,6 +489,11 @@ var gPrivacyPane = {
|
|||
fingerprintersOption.hidden =
|
||||
!Services.prefs.getBoolPref("browser.contentblocking.fingerprinting.preferences.ui.enabled");
|
||||
|
||||
Preferences.get("browser.contentblocking.features.standard").on("change",
|
||||
this.populateCategoryContents);
|
||||
Preferences.get("browser.contentblocking.features.strict").on("change",
|
||||
this.populateCategoryContents);
|
||||
this.populateCategoryContents();
|
||||
this.highlightCBCategory();
|
||||
this.readBlockCookies();
|
||||
|
||||
|
@ -507,6 +509,72 @@ var gPrivacyPane = {
|
|||
}
|
||||
},
|
||||
|
||||
populateCategoryContents() {
|
||||
for (let type of ["strict", "standard"]) {
|
||||
let rulesArray, selector;
|
||||
if (type == "strict") {
|
||||
selector = "#contentBlockingOptionStrict";
|
||||
rulesArray = Services.prefs.getStringPref("browser.contentblocking.features.strict").split(",");
|
||||
} else {
|
||||
selector = "#contentBlockingOptionStandard";
|
||||
let rulesString = Services.prefs.getStringPref("browser.contentblocking.features.standard");
|
||||
rulesArray = rulesString.split(",");
|
||||
}
|
||||
// Hide all cookie options first, until we learn which one should be showing.
|
||||
document.querySelector(selector + " .all-cookies-option").hidden = true;
|
||||
document.querySelector(selector + " .unvisited-cookies-option").hidden = true;
|
||||
document.querySelector(selector + " .third-party-tracking-cookies-option").hidden = true;
|
||||
document.querySelector(selector + " .all-third-party-cookies-option").hidden = true;
|
||||
|
||||
for (let item of rulesArray) {
|
||||
// Note "cookieBehavior0", will result in no UI changes, so is not listed here.
|
||||
switch (item) {
|
||||
case "tp":
|
||||
document.querySelector(selector + " .trackers-option").hidden = false;
|
||||
break;
|
||||
case "-tp":
|
||||
document.querySelector(selector + " .trackers-option").hidden = true;
|
||||
break;
|
||||
case "tpPrivate":
|
||||
document.querySelector(selector + " .pb-trackers-option").hidden = false;
|
||||
break;
|
||||
case "-tpPrivate":
|
||||
document.querySelector(selector + " .pb-trackers-option").hidden = true;
|
||||
break;
|
||||
case "fp":
|
||||
document.querySelector(selector + " .fingerprinters-option").hidden = false;
|
||||
break;
|
||||
case "-fp":
|
||||
document.querySelector(selector + " .fingerprinters-option").hidden = true;
|
||||
break;
|
||||
case "cm":
|
||||
document.querySelector(selector + " .cryptominers-option").hidden = false;
|
||||
break;
|
||||
case "-cm":
|
||||
document.querySelector(selector + " .cryptominers-option").hidden = true;
|
||||
break;
|
||||
case "cookieBehavior1":
|
||||
document.querySelector(selector + " .all-third-party-cookies-option").hidden = false;
|
||||
break;
|
||||
case "cookieBehavior2":
|
||||
document.querySelector(selector + " .all-cookies-option").hidden = false;
|
||||
break;
|
||||
case "cookieBehavior3":
|
||||
document.querySelector(selector + " .unvisited-cookies-option").hidden = false;
|
||||
break;
|
||||
case "cookieBehavior4":
|
||||
document.querySelector(selector + " .third-party-tracking-cookies-option").hidden = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Hide the "tracking protection in private browsing" list item
|
||||
// if the "tracking protection enabled in all windows" list item is showing.
|
||||
if (!document.querySelector(selector + " .trackers-option").hidden) {
|
||||
document.querySelector(selector + " .pb-trackers-option").hidden = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
highlightCBCategory() {
|
||||
let value = Preferences.get("browser.contentblocking.category").value;
|
||||
let standardEl = document.getElementById("contentBlockingOptionStandard");
|
||||
|
|
|
@ -66,43 +66,39 @@
|
|||
<description data-l10n-id="content-blocking-standard-desc"></description>
|
||||
<vbox class="content-blocking-extra-information">
|
||||
<vbox class="indent">
|
||||
<hbox class="extra-information-label">
|
||||
<hbox class="extra-information-label pb-trackers-option" hidden="true">
|
||||
<image class="content-blocking-trackers-image"/>
|
||||
<label data-l10n-id="content-blocking-private-trackers"/>
|
||||
</hbox>
|
||||
<hbox class="extra-information-label">
|
||||
<hbox class="extra-information-label trackers-option" hidden="true">
|
||||
<image class="content-blocking-trackers-image"/>
|
||||
<label data-l10n-id="content-blocking-all-windows-trackers"/>
|
||||
</hbox>
|
||||
<hbox class="extra-information-label all-third-party-cookies-option" hidden="true">
|
||||
<image class="content-blocking-cookies-image"/>
|
||||
<label data-l10n-id="content-blocking-all-third-party-cookies"/>
|
||||
</hbox>
|
||||
<hbox class="extra-information-label all-cookies-option" hidden="true">
|
||||
<image class="content-blocking-cookies-image"/>
|
||||
<label data-l10n-id="content-blocking-all-cookies"/>
|
||||
</hbox>
|
||||
<hbox class="extra-information-label unvisited-cookies-option" hidden="true">
|
||||
<image class="content-blocking-cookies-image"/>
|
||||
<label data-l10n-id="content-blocking-unvisited-cookies"/>
|
||||
</hbox>
|
||||
<hbox class="extra-information-label third-party-tracking-cookies-option" hidden="true">
|
||||
<image class="content-blocking-cookies-image"/>
|
||||
<label data-l10n-id="content-blocking-third-party-cookies"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<vbox class="content-blocking-warning reload-tabs" hidden="true">
|
||||
<hbox class="indent">
|
||||
<vbox>
|
||||
<spacer flex="1"/>
|
||||
<hbox>
|
||||
<vbox>
|
||||
<image class="content-blocking-info-image"/>
|
||||
<spacer flex="1"/>
|
||||
</vbox>
|
||||
<description>
|
||||
<html:span data-l10n-id="content-blocking-reload-description"></html:span>
|
||||
</description>
|
||||
</hbox>
|
||||
<spacer flex="1"/>
|
||||
</vbox>
|
||||
<vbox>
|
||||
<spacer flex="1"/>
|
||||
<button class="accessory-button reload-tabs-button"
|
||||
data-l10n-id="content-blocking-reload-tabs-button"/>
|
||||
<spacer flex="1"/>
|
||||
</vbox>
|
||||
<hbox class="extra-information-label cryptominers-option" hidden="true">
|
||||
<image class="content-blocking-cryptominers-image"/>
|
||||
<label data-l10n-id="content-blocking-cryptominers"/>
|
||||
</hbox>
|
||||
<hbox class="extra-information-label fingerprinters-option" hidden="true">
|
||||
<image class="content-blocking-fingerprinters-image"/>
|
||||
<label data-l10n-id="content-blocking-fingerprinters"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</vbox>
|
||||
</vbox>
|
||||
<vbox class="indent fallback-content-blocking-ui">
|
||||
<description data-l10n-id="content-blocking-standard-description"/>
|
||||
<vbox class="content-blocking-extra-information">
|
||||
<vbox class="content-blocking-warning reload-tabs" hidden="true">
|
||||
<hbox class="indent">
|
||||
<vbox>
|
||||
|
@ -141,17 +137,41 @@
|
|||
aria-expanded="false"/>
|
||||
</hbox>
|
||||
<vbox class="indent">
|
||||
<label data-l10n-id="content-blocking-strict-desc"></label>
|
||||
<label data-l10n-id="content-blocking-strict-description"></label>
|
||||
<vbox class="content-blocking-extra-information">
|
||||
<vbox class="indent">
|
||||
<hbox class="extra-information-label">
|
||||
<hbox class="extra-information-label pb-trackers-option" hidden="true">
|
||||
<image class="content-blocking-trackers-image"/>
|
||||
<label data-l10n-id="content-blocking-private-trackers"/>
|
||||
</hbox>
|
||||
<hbox class="extra-information-label trackers-option" hidden="true">
|
||||
<image class="content-blocking-trackers-image"/>
|
||||
<label data-l10n-id="content-blocking-all-windows-trackers"/>
|
||||
</hbox>
|
||||
<hbox class="extra-information-label">
|
||||
<hbox class="extra-information-label all-third-party-cookies-option" hidden="true">
|
||||
<image class="content-blocking-cookies-image"/>
|
||||
<label data-l10n-id="content-blocking-third-party-cookies"/>
|
||||
</hbox>
|
||||
<hbox class="extra-information-label all-cookies-option" hidden="true">
|
||||
<image class="content-blocking-cookies-image"/>
|
||||
<label data-l10n-id="content-blocking-third-party-cookies"/>
|
||||
</hbox>
|
||||
<hbox class="extra-information-label unvisited-cookies-option" hidden="true">
|
||||
<image class="content-blocking-cookies-image"/>
|
||||
<label data-l10n-id="content-blocking-third-party-cookies"/>
|
||||
</hbox>
|
||||
<hbox class="extra-information-label third-party-tracking-cookies-option" hidden="true">
|
||||
<image class="content-blocking-cookies-image"/>
|
||||
<label data-l10n-id="content-blocking-third-party-cookies"/>
|
||||
</hbox>
|
||||
<hbox class="extra-information-label cryptominers-option" hidden="true">
|
||||
<image class="content-blocking-cryptominers-image"/>
|
||||
<label data-l10n-id="content-blocking-cryptominers"/>
|
||||
</hbox>
|
||||
<hbox class="extra-information-label fingerprinters-option" hidden="true">
|
||||
<image class="content-blocking-fingerprinters-image"/>
|
||||
<label data-l10n-id="content-blocking-fingerprinters"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<vbox class="content-blocking-warning reload-tabs" hidden="true">
|
||||
<hbox class="indent">
|
||||
|
|
|
@ -47,6 +47,7 @@ skip-if = os != "win" # Windows-specific handler application selection dialog
|
|||
[browser_connection_bug1445991.js]
|
||||
skip-if = (verify && debug && (os == 'linux' || os == 'mac'))
|
||||
[browser_connection_dnsoverhttps.js]
|
||||
[browser_contentblocking_categories.js]
|
||||
[browser_contentblocking.js]
|
||||
[browser_cookies_exceptions.js]
|
||||
[browser_defaultbrowser_alwayscheck.js]
|
||||
|
|
|
@ -5,7 +5,6 @@ ChromeUtils.defineModuleGetter(this, "Preferences",
|
|||
|
||||
const TP_PREF = "privacy.trackingprotection.enabled";
|
||||
const TP_PBM_PREF = "privacy.trackingprotection.pbmode.enabled";
|
||||
const TP_LIST_PREF = "urlclassifier.trackingTable";
|
||||
const NCB_PREF = "network.cookie.cookieBehavior";
|
||||
const CAT_PREF = "browser.contentblocking.category";
|
||||
const FP_PREF = "privacy.trackingprotection.fingerprinting.enabled";
|
||||
|
@ -144,7 +143,6 @@ add_task(async function testContentBlockingMainCategory() {
|
|||
// Tests that the content blocking "Standard" category radio sets the prefs to their default values.
|
||||
add_task(async function testContentBlockingStandardCategory() {
|
||||
let prefs = {
|
||||
[TP_LIST_PREF]: null,
|
||||
[TP_PREF]: null,
|
||||
[TP_PBM_PREF]: null,
|
||||
[NCB_PREF]: null,
|
||||
|
@ -168,7 +166,6 @@ add_task(async function testContentBlockingStandardCategory() {
|
|||
}
|
||||
}
|
||||
|
||||
Services.prefs.setStringPref(TP_LIST_PREF, "test-track-simple,base-track-digest256,content-track-digest256");
|
||||
Services.prefs.setBoolPref(TP_PREF, true);
|
||||
Services.prefs.setBoolPref(TP_PBM_PREF, false);
|
||||
Services.prefs.setIntPref(NCB_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER);
|
||||
|
@ -220,7 +217,6 @@ add_task(async function testContentBlockingStrictCategory() {
|
|||
Services.prefs.setBoolPref(TP_PREF, false);
|
||||
Services.prefs.setBoolPref(TP_PBM_PREF, false);
|
||||
Services.prefs.setIntPref(NCB_PREF, Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN);
|
||||
Services.prefs.setStringPref(TP_LIST_PREF, "test-track-simple,base-track-digest256,content-track-digest256");
|
||||
|
||||
await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
|
||||
let doc = gBrowser.contentDocument;
|
||||
|
@ -235,7 +231,6 @@ add_task(async function testContentBlockingStrictCategory() {
|
|||
is(Services.prefs.getBoolPref(TP_PREF), true, `${TP_PREF} has been set to true`);
|
||||
is(Services.prefs.getBoolPref(TP_PBM_PREF), true, `${TP_PBM_PREF} has been set to true`);
|
||||
is(Services.prefs.getIntPref(NCB_PREF), Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER, `${NCB_PREF} has been set to ${Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER}`);
|
||||
ok(!Services.prefs.prefHasUserValue(TP_LIST_PREF), `reset the pref ${TP_LIST_PREF}`);
|
||||
ok(!Services.prefs.prefHasUserValue(FP_PREF), `reset the pref ${FP_PREF}`);
|
||||
ok(!Services.prefs.prefHasUserValue(CM_PREF), `reset the pref ${CM_PREF}`);
|
||||
|
||||
|
@ -244,7 +239,7 @@ add_task(async function testContentBlockingStrictCategory() {
|
|||
|
||||
// Tests that the content blocking "Custom" category behaves as expected.
|
||||
add_task(async function testContentBlockingCustomCategory() {
|
||||
let prefs = [TP_LIST_PREF, TP_PREF, TP_PBM_PREF, NCB_PREF, FP_PREF, CM_PREF];
|
||||
let prefs = [TP_PREF, TP_PBM_PREF, NCB_PREF, FP_PREF, CM_PREF];
|
||||
|
||||
await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
|
||||
let doc = gBrowser.contentDocument;
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/* eslint-env webextensions */
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "Preferences",
|
||||
"resource://gre/modules/Preferences.jsm");
|
||||
|
||||
const TP_PREF = "privacy.trackingprotection.enabled";
|
||||
const TP_PBM_PREF = "privacy.trackingprotection.pbmode.enabled";
|
||||
const NCB_PREF = "network.cookie.cookieBehavior";
|
||||
const CAT_PREF = "browser.contentblocking.category";
|
||||
const FP_PREF = "privacy.trackingprotection.fingerprinting.enabled";
|
||||
const CM_PREF = "privacy.trackingprotection.cryptomining.enabled";
|
||||
const STRICT_DEF_PREF = "browser.contentblocking.features.strict";
|
||||
const STANDARD_DEF_PREF = "browser.contentblocking.features.standard";
|
||||
|
||||
// Tests that the content blocking standard category definition changes the behavior
|
||||
// of the standard category pref and all prefs it controls.
|
||||
// Changing the definition does not remove the user from the category.
|
||||
add_task(async function testContentBlockingStandardDefinition() {
|
||||
let defaults = Services.prefs.getDefaultBranch("");
|
||||
let originalStandardPref = defaults.getStringPref(STANDARD_DEF_PREF);
|
||||
defaults.setStringPref(STANDARD_DEF_PREF, "tp,tpPrivate,fp,cm,cookieBehavior4");
|
||||
is(Services.prefs.getStringPref(CAT_PREF), "standard", `${CAT_PREF} starts on standard`);
|
||||
|
||||
ok(!Services.prefs.prefHasUserValue(STANDARD_DEF_PREF), `We changed the default value of ${STANDARD_DEF_PREF}`);
|
||||
is(Services.prefs.getStringPref(STANDARD_DEF_PREF), "tp,tpPrivate,fp,cm,cookieBehavior4", "The pref changed to what we set.");
|
||||
|
||||
is(Services.prefs.getBoolPref(TP_PREF), true, `${TP_PREF} pref has been set to true`);
|
||||
is(Services.prefs.getBoolPref(TP_PBM_PREF), true, `${TP_PBM_PREF} pref has been set to true`);
|
||||
is(Services.prefs.getBoolPref(FP_PREF), true, `${CM_PREF} pref has been set to true`);
|
||||
is(Services.prefs.getBoolPref(CM_PREF), true, `${CM_PREF} pref has been set to true`);
|
||||
is(Services.prefs.getIntPref(NCB_PREF), Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER, `${NCB_PREF} has been set to BEHAVIOR_REJECT_TRACKER`);
|
||||
|
||||
// Note, if a pref is not listed it will use the default value, however this is only meant as a
|
||||
// backup if a mistake is made. The UI will not respond correctly.
|
||||
defaults.setStringPref(STANDARD_DEF_PREF, "");
|
||||
ok(!Services.prefs.prefHasUserValue(TP_PREF), `${TP_PREF} pref has the default value`);
|
||||
ok(!Services.prefs.prefHasUserValue(TP_PBM_PREF), `${TP_PBM_PREF} pref has the default value`);
|
||||
ok(!Services.prefs.prefHasUserValue(FP_PREF), `${FP_PREF} pref has the default value`);
|
||||
ok(!Services.prefs.prefHasUserValue(CM_PREF), `${CM_PREF} pref has the default value`);
|
||||
ok(!Services.prefs.prefHasUserValue(NCB_PREF), `${NCB_PREF} pref has the default value`);
|
||||
|
||||
defaults.setStringPref(STANDARD_DEF_PREF, "-tpPrivate,-fp,-cm,-tp,cookieBehavior2");
|
||||
is(Services.prefs.getBoolPref(TP_PREF), false, `${TP_PREF} pref has been set to false`);
|
||||
is(Services.prefs.getBoolPref(TP_PBM_PREF), false, `${TP_PBM_PREF} pref has been set to false`);
|
||||
is(Services.prefs.getBoolPref(FP_PREF), false, `${FP_PREF} pref has been set to false`);
|
||||
is(Services.prefs.getBoolPref(CM_PREF), false, `${CM_PREF} pref has been set to false`);
|
||||
is(Services.prefs.getIntPref(NCB_PREF), Ci.nsICookieService.BEHAVIOR_REJECT, `${NCB_PREF} has been set to BEHAVIOR_REJECT_TRACKER`);
|
||||
|
||||
// cleanup
|
||||
defaults.setStringPref(STANDARD_DEF_PREF, originalStandardPref);
|
||||
});
|
||||
|
||||
// Tests that the content blocking strict category definition changes the behavior
|
||||
// of the strict category pref and all prefs it controls.
|
||||
// Changing the definition does not remove the user from the category.
|
||||
add_task(async function testContentBlockingStrictDefinition() {
|
||||
let defaults = Services.prefs.getDefaultBranch("");
|
||||
let originalStrictPref = defaults.getStringPref(STRICT_DEF_PREF);
|
||||
defaults.setStringPref(STRICT_DEF_PREF, "tp,tpPrivate,fp,cm,cookieBehavior0");
|
||||
Services.prefs.setStringPref(CAT_PREF, "strict");
|
||||
is(Services.prefs.getStringPref(CAT_PREF), "strict", `${CAT_PREF} has changed to strict`);
|
||||
|
||||
ok(!Services.prefs.prefHasUserValue(STRICT_DEF_PREF), `We changed the default value of ${STRICT_DEF_PREF}`);
|
||||
is(Services.prefs.getStringPref(STRICT_DEF_PREF), "tp,tpPrivate,fp,cm,cookieBehavior0", `${STRICT_DEF_PREF} changed to what we set.`);
|
||||
|
||||
is(Services.prefs.getBoolPref(TP_PREF), true, `${TP_PREF} pref has been set to true`);
|
||||
is(Services.prefs.getBoolPref(TP_PBM_PREF), true, `${TP_PBM_PREF} pref has been set to true`);
|
||||
is(Services.prefs.getBoolPref(FP_PREF), true, `${CM_PREF} pref has been set to true`);
|
||||
is(Services.prefs.getBoolPref(CM_PREF), true, `${CM_PREF} pref has been set to true`);
|
||||
is(Services.prefs.getIntPref(NCB_PREF), Ci.nsICookieService.BEHAVIOR_ACCEPT, `${NCB_PREF} has been set to BEHAVIOR_REJECT_TRACKER`);
|
||||
|
||||
// Note, if a pref is not listed it will use the default value, however this is only meant as a
|
||||
// backup if a mistake is made. The UI will not respond correctly.
|
||||
defaults.setStringPref(STRICT_DEF_PREF, "");
|
||||
ok(!Services.prefs.prefHasUserValue(TP_PREF), `${TP_PREF} pref has the default value`);
|
||||
ok(!Services.prefs.prefHasUserValue(TP_PBM_PREF), `${TP_PBM_PREF} pref has the default value`);
|
||||
ok(!Services.prefs.prefHasUserValue(FP_PREF), `${FP_PREF} pref has the default value`);
|
||||
ok(!Services.prefs.prefHasUserValue(CM_PREF), `${CM_PREF} pref has the default value`);
|
||||
ok(!Services.prefs.prefHasUserValue(NCB_PREF), `${NCB_PREF} pref has the default value`);
|
||||
|
||||
defaults.setStringPref(STRICT_DEF_PREF, "-tpPrivate,-fp,-cm,-tp,cookieBehavior3");
|
||||
is(Services.prefs.getBoolPref(TP_PREF), false, `${TP_PREF} pref has been set to false`);
|
||||
is(Services.prefs.getBoolPref(TP_PBM_PREF), false, `${TP_PBM_PREF} pref has been set to false`);
|
||||
is(Services.prefs.getBoolPref(FP_PREF), false, `${FP_PREF} pref has been set to false`);
|
||||
is(Services.prefs.getBoolPref(CM_PREF), false, `${CM_PREF} pref has been set to false`);
|
||||
is(Services.prefs.getIntPref(NCB_PREF), Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN, `${NCB_PREF} has been set to BEHAVIOR_REJECT_TRACKER`);
|
||||
|
||||
// cleanup
|
||||
defaults.setStringPref(STRICT_DEF_PREF, originalStrictPref);
|
||||
Services.prefs.setStringPref(CAT_PREF, "standard");
|
||||
});
|
|
@ -9,7 +9,6 @@ support-files =
|
|||
|
||||
[browser_clearSiteData.js]
|
||||
[browser_siteData.js]
|
||||
skip-if = (os == 'linux') || (os == 'mac' && !debug) || verify # Bug 1439332, Bug 1436395, Bug 1415037
|
||||
[browser_siteData2.js]
|
||||
[browser_siteData3.js]
|
||||
[browser_siteData_multi_select.js]
|
||||
|
|
|
@ -305,6 +305,12 @@ class UrlbarController {
|
|||
}
|
||||
event.preventDefault();
|
||||
break;
|
||||
case KeyEvent.DOM_VK_LEFT:
|
||||
case KeyEvent.DOM_VK_RIGHT:
|
||||
case KeyEvent.DOM_VK_HOME:
|
||||
case KeyEvent.DOM_VK_END:
|
||||
this.view.removeAccessibleFocus();
|
||||
break;
|
||||
case KeyEvent.DOM_VK_DELETE:
|
||||
case KeyEvent.DOM_VK_BACK_SPACE:
|
||||
if (event.shiftKey && this.view.isOpen && this._handleDeleteEntry()) {
|
||||
|
|
|
@ -202,6 +202,7 @@ Var ArchToInstall
|
|||
!define NONADMIN_ELEVATE
|
||||
|
||||
!define CONFIG_INI "config.ini"
|
||||
!define PARTNER_INI "$EXEDIR\partner.ini"
|
||||
|
||||
!ifndef FILE_SHARE_READ
|
||||
!define FILE_SHARE_READ 1
|
||||
|
@ -907,19 +908,10 @@ FunctionEnd
|
|||
|
||||
Function StartDownload
|
||||
${NSD_KillTimer} StartDownload
|
||||
${If} $ArchToInstall == ${ARCH_AMD64}
|
||||
InetBgDL::Get "${URLStubDownloadAMD64}${URLStubDownloadAppend}" \
|
||||
"$PLUGINSDIR\download.exe" \
|
||||
/CONNECTTIMEOUT 120 /RECEIVETIMEOUT 120 /END
|
||||
${ElseIf} $ArchToInstall == ${ARCH_AARCH64}
|
||||
InetBgDL::Get "${URLStubDownloadAArch64}${URLStubDownloadAppend}" \
|
||||
"$PLUGINSDIR\download.exe" \
|
||||
/CONNECTTIMEOUT 120 /RECEIVETIMEOUT 120 /END
|
||||
${Else}
|
||||
InetBgDL::Get "${URLStubDownloadX86}${URLStubDownloadAppend}" \
|
||||
"$PLUGINSDIR\download.exe" \
|
||||
/CONNECTTIMEOUT 120 /RECEIVETIMEOUT 120 /END
|
||||
${EndIf}
|
||||
Call GetDownloadURL
|
||||
Pop $0
|
||||
InetBgDL::Get "$0" "$PLUGINSDIR\download.exe" \
|
||||
/CONNECTTIMEOUT 120 /RECEIVETIMEOUT 120 /END
|
||||
StrCpy $4 ""
|
||||
${NSD_CreateTimer} OnDownload ${DownloadIntervalMS}
|
||||
${If} ${FileExists} "$INSTDIR\${TO_BE_DELETED}"
|
||||
|
@ -1965,13 +1957,15 @@ FunctionEnd
|
|||
; 2) An amount of RAM strictly greater than RAM_NEEDED_FOR_64BIT
|
||||
; 3) No third-party products installed that cause issues with the 64-bit build.
|
||||
; Currently this includes Lenovo OneKey Theater and Lenovo Energy Management.
|
||||
; We also make sure that the partner.ini file contains a download URL for the
|
||||
; selected architecture, when a partner.ini file eixsts.
|
||||
; If any of those checks fail, the 32-bit x86 build is selected.
|
||||
Function GetArchToInstall
|
||||
StrCpy $ArchToInstall ${ARCH_X86}
|
||||
|
||||
${If} ${IsNativeARM64}
|
||||
StrCpy $ArchToInstall ${ARCH_AARCH64}
|
||||
Return
|
||||
GoTo downloadUrlCheck
|
||||
${EndIf}
|
||||
|
||||
${IfNot} ${IsNativeAMD64}
|
||||
|
@ -1997,6 +1991,59 @@ Function GetArchToInstall
|
|||
${EndIf}
|
||||
|
||||
StrCpy $ArchToInstall ${ARCH_AMD64}
|
||||
|
||||
downloadUrlCheck:
|
||||
; If we've selected an architecture that doesn't have a download URL in the
|
||||
; partner.ini, but there is a URL there for 32-bit x86, then fall back to
|
||||
; 32-bit x86 on the theory that we should never use a non-partner build if
|
||||
; we are configured as a partner installer, even if the only build that's
|
||||
; provided is suboptimal for the machine. If there isn't even an x86 URL,
|
||||
; then we won't force x86 and GetDownloadURL will stick with the built-in URL.
|
||||
ClearErrors
|
||||
ReadINIStr $1 "${PARTNER_INI}" "DownloadURL" "X86"
|
||||
${IfNot} ${Errors}
|
||||
${If} $ArchToInstall == ${ARCH_AMD64}
|
||||
ReadINIStr $1 "${PARTNER_INI}" "DownloadURL" "AMD64"
|
||||
${If} ${Errors}
|
||||
StrCpy $ArchToInstall ${ARCH_X86}
|
||||
${EndIf}
|
||||
${ElseIf} $ArchToInstall == ${ARCH_AARCH64}
|
||||
ReadINIStr $1 "${PARTNER_INI}" "DownloadURL" "AArch64"
|
||||
${If} ${Errors}
|
||||
StrCpy $ArchToInstall ${ARCH_X86}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function GetDownloadURL
|
||||
Push $0
|
||||
Push $1
|
||||
|
||||
; Start with the appropriate URL from our built-in branding info.
|
||||
${If} $ArchToInstall == ${ARCH_AMD64}
|
||||
StrCpy $0 "${URLStubDownloadAMD64}${URLStubDownloadAppend}"
|
||||
${ElseIf} $ArchToInstall == ${ARCH_AARCH64}
|
||||
StrCpy $0 "${URLStubDownloadAArch64}${URLStubDownloadAppend}"
|
||||
${Else}
|
||||
StrCpy $0 "${URLStubDownloadX86}${URLStubDownloadAppend}"
|
||||
${EndIf}
|
||||
|
||||
; If we have a partner.ini file then use the URL from there instead.
|
||||
ClearErrors
|
||||
${If} $ArchToInstall == ${ARCH_AMD64}
|
||||
ReadINIStr $1 "${PARTNER_INI}" "DownloadURL" "AMD64"
|
||||
${ElseIf} $ArchToInstall == ${ARCH_AARCH64}
|
||||
ReadINIStr $1 "${PARTNER_INI}" "DownloadURL" "AArch64"
|
||||
${Else}
|
||||
ReadINIStr $1 "${PARTNER_INI}" "DownloadURL" "X86"
|
||||
${EndIf}
|
||||
${IfNot} ${Errors}
|
||||
StrCpy $0 "$1"
|
||||
${EndIf}
|
||||
|
||||
Pop $1
|
||||
Exch $0
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
|
|
|
@ -840,15 +840,18 @@ content-blocking-setting-custom =
|
|||
.label = Custom
|
||||
.accesskey = C
|
||||
|
||||
content-blocking-standard-description = Only blocks known trackers in Private Windows.
|
||||
content-blocking-standard-desc = Balanced for protection and performance. Allows some trackers so websites function properly.
|
||||
content-blocking-strict-desc = Blocks all trackers { -brand-short-name } detects. May cause some sites to break.
|
||||
content-blocking-strict-description = Stronger protection, may cause some sites to break.
|
||||
content-blocking-custom-desc = Choose what to block.
|
||||
|
||||
content-blocking-private-trackers = Known trackers only in Private Windows
|
||||
content-blocking-third-party-cookies = Third-party tracking cookies
|
||||
content-blocking-all-cookies = All cookies
|
||||
content-blocking-unvisited-cookies = Cookies from unvisited sites
|
||||
content-blocking-all-windows-trackers = Known trackers in all windows
|
||||
content-blocking-all-third-party-cookies = All third-party cookies
|
||||
content-blocking-cryptominers = Cryptominers
|
||||
content-blocking-fingerprinters = Fingerprinters
|
||||
|
||||
content-blocking-warning-title = Heads up!
|
||||
content-blocking-warning-description = Blocking content can cause some websites to break. It’s easy to disable blocking for sites you trust.
|
||||
|
|
|
@ -131,11 +131,6 @@
|
|||
margin-inline-end: 28px;
|
||||
}
|
||||
|
||||
#contentBlockingCategories[fallback-ui] .default-content-blocking-ui,
|
||||
#contentBlockingCategories:not([fallback-ui]) .fallback-content-blocking-ui {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.arrowhead {
|
||||
-moz-appearance: none;
|
||||
border: none;
|
||||
|
@ -240,15 +235,15 @@
|
|||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.extra-information-label:last-child {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.content-blocking-category.expanded .content-blocking-extra-information,
|
||||
.content-blocking-category.selected .content-blocking-extra-information {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.content-blocking-extra-information > .indent {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.content-blocking-extra-information > .custom-option {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
@ -260,7 +255,7 @@
|
|||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.content-blocking-warning + .content-blocking-warning {
|
||||
.content-blocking-warning:not([hidden]) + .content-blocking-warning {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
|
@ -274,6 +269,16 @@
|
|||
margin-inline-end: 5px;
|
||||
}
|
||||
|
||||
.content-blocking-cryptominers-image {
|
||||
list-style-image: url("chrome://browser/skin/controlcenter/cryptominers-disabled.svg");
|
||||
margin-inline-end: 5px;
|
||||
}
|
||||
|
||||
.content-blocking-fingerprinters-image {
|
||||
list-style-image: url("chrome://browser/skin/controlcenter/fingerprinters-disabled.svg");
|
||||
margin-inline-end: 5px;
|
||||
}
|
||||
|
||||
.content-blocking-warning-image {
|
||||
list-style-image: url("chrome://global/skin/icons/warning.svg");
|
||||
-moz-context-properties: fill;
|
||||
|
|
|
@ -22,7 +22,17 @@ if CONFIG['WIN32_REDIST_DIR'] and CONFIG['COMPILE_ENVIRONMENT']:
|
|||
]
|
||||
|
||||
if CONFIG['WIN_UCRT_REDIST_DIR'] and CONFIG['COMPILE_ENVIRONMENT']:
|
||||
for f in ['api-ms-win-*.dll', 'ucrtbase.dll']:
|
||||
win7_ucrt_redists = [
|
||||
'api-ms-win-core-file-l1-2-0.dll',
|
||||
'api-ms-win-core-file-l2-1-0.dll',
|
||||
'api-ms-win-core-localization-l1-2-0.dll',
|
||||
'api-ms-win-core-processthreads-l1-1-1.dll',
|
||||
'api-ms-win-core-synch-l1-2-0.dll',
|
||||
'api-ms-win-core-timezone-l1-1-0.dll',
|
||||
'api-ms-win-crt-*.dll',
|
||||
'ucrtbase.dll',
|
||||
]
|
||||
for f in win7_ucrt_redists:
|
||||
FINAL_TARGET_FILES += [
|
||||
'%%%s/%s' % (CONFIG['WIN_UCRT_REDIST_DIR'], f)
|
||||
]
|
||||
|
|
|
@ -137,14 +137,13 @@ class Editor extends PureComponent<Props, State> {
|
|||
this.setText(nextProps, editor);
|
||||
this.setSize(nextProps, editor);
|
||||
this.scrollToLocation(nextProps, editor);
|
||||
endOperation();
|
||||
|
||||
if (this.props.selectedSource != nextProps.selectedSource) {
|
||||
this.props.updateViewport();
|
||||
resizeBreakpointGutter(editor.codeMirror);
|
||||
resizeToggleButton(editor.codeMirror);
|
||||
}
|
||||
|
||||
endOperation();
|
||||
}
|
||||
|
||||
setupEditor() {
|
||||
|
|
|
@ -9,10 +9,11 @@
|
|||
add_task(async function() {
|
||||
const dbg = await initDebugger("doc-audiocontext.html");
|
||||
|
||||
invokeInTab("myFunction");
|
||||
invokeInTab("suspendAC");
|
||||
await invokeInTab("myFunction");
|
||||
await invokeInTab("suspendAC");
|
||||
invokeInTab("debuggerStatement");
|
||||
await waitForPaused(dbg);
|
||||
invokeInTab("checkACState");
|
||||
await resume(dbg);
|
||||
await invokeInTab("checkACState");
|
||||
ok(true, "No AudioContext state transition are caused by the debugger")
|
||||
});
|
||||
|
|
|
@ -15,10 +15,8 @@
|
|||
<button id="check" onclick="checkACState()">check ac state</button>
|
||||
<script type="text/javascript">
|
||||
var ac = null;
|
||||
var suspend_called = false;
|
||||
function suspendAC() {
|
||||
suspend_called = true;
|
||||
ac.suspend();
|
||||
async function suspendAC() {
|
||||
await ac.suspend();
|
||||
}
|
||||
|
||||
function debuggerStatement() {
|
||||
|
@ -31,17 +29,20 @@ function checkACState() {
|
|||
}
|
||||
}
|
||||
|
||||
function myFunction() {
|
||||
ac = new AudioContext();
|
||||
function statechange_suspend() {
|
||||
ac.onstatechange = statechange_fail;
|
||||
}
|
||||
function statechange_fail() {
|
||||
throw "No state change should occur when paused in the debugger.";
|
||||
}
|
||||
ac.onstatechange = function() {
|
||||
ac.onstatechange = statechange_suspend;
|
||||
}
|
||||
async function myFunction() {
|
||||
await new Promise((resolve) => {
|
||||
ac = new AudioContext();
|
||||
function statechange_suspend() {
|
||||
ac.onstatechange = statechange_fail;
|
||||
}
|
||||
function statechange_fail() {
|
||||
throw "No state change should occur when paused in the debugger.";
|
||||
}
|
||||
ac.onstatechange = function() {
|
||||
ac.onstatechange = statechange_suspend;
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -417,6 +417,8 @@ MessageManagerTunnel.prototype = {
|
|||
"SessionStore:flush",
|
||||
"SessionStore:restoreHistory",
|
||||
"SessionStore:restoreTabContent",
|
||||
// Messages sent from viewZoomOverlay.js.
|
||||
"FullZoom",
|
||||
],
|
||||
|
||||
INNER_TO_OUTER_MESSAGES: [
|
||||
|
|
|
@ -61,6 +61,7 @@ skip-if = true # Bug 1413765
|
|||
[browser_tab_remoteness_change.js]
|
||||
[browser_target_blank.js]
|
||||
[browser_telemetry_activate_rdm.js]
|
||||
[browser_toggle_zoom.js]
|
||||
[browser_toolbox_computed_view.js]
|
||||
[browser_toolbox_rule_view.js]
|
||||
[browser_toolbox_rule_view_reload.js]
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Verify full zoom levels inherit RDM full zoom after exiting RDM.
|
||||
|
||||
const TEST_URL = "http://example.com/";
|
||||
|
||||
function getZoomForBrowser(browser) {
|
||||
return ZoomManager.getZoomForBrowser(browser);
|
||||
}
|
||||
|
||||
function setZoomForBrowser(browser, zoom) {
|
||||
ZoomManager.setZoomForBrowser(browser, zoom);
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
const INITIAL_ZOOM_LEVEL = 1;
|
||||
const MID_RDM_ZOOM_LEVEL = 2;
|
||||
|
||||
const tab = await addTab(TEST_URL);
|
||||
const browser = tab.linkedBrowser;
|
||||
|
||||
await load(browser, TEST_URL);
|
||||
|
||||
// Change the zoom level before we open RDM.
|
||||
setZoomForBrowser(browser, INITIAL_ZOOM_LEVEL);
|
||||
|
||||
// Start RDM on the tab. This will fundamentally change the way that browser behaves.
|
||||
// It will now pass all of its messages through to the RDM docshell, meaning that when
|
||||
// we request zoom level from it now, we are getting the RDM zoom level.
|
||||
const { ui } = await openRDM(tab);
|
||||
const uiDocShell = ui.toolWindow.docShell;
|
||||
|
||||
// Bug 1541692: openRDM behaves differently in the test harness than it does
|
||||
// interactively. Interactively, many features of the container docShell -- including
|
||||
// zoom -- are copied over to the RDM browser. In the test harness, this seems to first
|
||||
// reset the docShell before toggling RDM, which makes checking the initial zoom of the
|
||||
// UI and the RDM pane not useful.
|
||||
|
||||
const initialUIZoom = uiDocShell.contentViewer.fullZoom;
|
||||
isnot(initialUIZoom, MID_RDM_ZOOM_LEVEL,
|
||||
"We should have a different UI initial zoom, so we can ensure it stays unchanged.");
|
||||
|
||||
// Set the zoom level. This should tunnel to the inner browser and leave the UI alone.
|
||||
setZoomForBrowser(browser, MID_RDM_ZOOM_LEVEL);
|
||||
|
||||
// The UI zoom should be unchanged by this.
|
||||
const postZoomUIZoom = uiDocShell.contentViewer.fullZoom;
|
||||
is(postZoomUIZoom, initialUIZoom, "UI zoom should be unchanged by RDM zoom.");
|
||||
|
||||
// The RDM zoom should be changed.
|
||||
const finalRDMZoom = getZoomForBrowser(browser);
|
||||
is(finalRDMZoom, MID_RDM_ZOOM_LEVEL, "RDM zoom should be " + MID_RDM_ZOOM_LEVEL + ".");
|
||||
|
||||
// Leave RDM. This should cause the outer pane to take on the full zoom of the RDM pane.
|
||||
await closeRDM(tab);
|
||||
});
|
146
devtools/client/shared/sourceeditor/codemirror/addon/accessibleTextarea.js
поставляемый
Normal file
146
devtools/client/shared/sourceeditor/codemirror/addon/accessibleTextarea.js
поставляемый
Normal file
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* Copyright (C) 2012 Google Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
(function(mod) {
|
||||
mod(require("../lib/codemirror"));
|
||||
})(function(CodeMirror) {
|
||||
// CodeMirror uses an offscreen <textarea> to detect input.
|
||||
// Due to inconsistencies in the many browsers it supports, it simplifies things by
|
||||
// regularly checking if something is in the textarea, adding those characters to the
|
||||
// document, and then clearing the textarea.
|
||||
// This breaks assistive technology that wants to read from CodeMirror, because the
|
||||
// <textarea> that they interact with is constantly empty.
|
||||
// Because we target up-to-date Firefox, we can guarantee consistent input events.
|
||||
// This lets us leave the current line from the editor in our <textarea>.
|
||||
// CodeMirror still expects a mostly empty <textarea>, so we pass CodeMirror a fake
|
||||
// <textarea> that only contains the users input.
|
||||
CodeMirror.inputStyles.accessibleTextArea = class extends CodeMirror.inputStyles.textarea {
|
||||
/**
|
||||
* @override
|
||||
* @param {!Object} display
|
||||
*/
|
||||
init(display) {
|
||||
super.init(display);
|
||||
this.textarea.addEventListener("compositionstart",
|
||||
this._onCompositionStart.bind(this));
|
||||
}
|
||||
|
||||
_onCompositionStart() {
|
||||
if (this.textarea.selectionEnd === this.textarea.value.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
// CodeMirror always expects the caret to be at the end of the textarea
|
||||
// When in IME composition mode, clip the textarea to how CodeMirror expects it,
|
||||
// and then let CodeMirror do its thing.
|
||||
this.textarea.value = this.textarea.value.substring(0, this.textarea.selectionEnd);
|
||||
const length = this.textarea.value.length;
|
||||
this.textarea.setSelectionRange(length, length);
|
||||
this.prevInput = this.textarea.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
* @param {Boolean} typing
|
||||
*/
|
||||
reset(typing) {
|
||||
if (
|
||||
typing ||
|
||||
this.contextMenuPending ||
|
||||
this.composing ||
|
||||
this.cm.somethingSelected()
|
||||
) {
|
||||
super.reset(typing);
|
||||
return;
|
||||
}
|
||||
|
||||
// When navigating around the document, keep the current visual line in the textarea.
|
||||
const cursor = this.cm.getCursor();
|
||||
let start, end;
|
||||
if (this.cm.options.lineWrapping) {
|
||||
// To get the visual line, compute the leftmost and rightmost character positions.
|
||||
const top = this.cm.charCoords(cursor, "page").top;
|
||||
start = this.cm.coordsChar({left: -Infinity, top});
|
||||
end = this.cm.coordsChar({left: Infinity, top});
|
||||
} else {
|
||||
// Limit the line to 1000 characters to prevent lag.
|
||||
const offset = Math.floor(cursor.ch / 1000) * 1000;
|
||||
start = {ch: offset, line: cursor.line};
|
||||
end = {ch: offset + 1000, line: cursor.line};
|
||||
}
|
||||
|
||||
this.textarea.value = this.cm.getRange(start, end);
|
||||
const caretPosition = cursor.ch - start.ch;
|
||||
this.textarea.setSelectionRange(caretPosition, caretPosition);
|
||||
this.prevInput = this.textarea.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
* @return {boolean}
|
||||
*/
|
||||
poll() {
|
||||
if (this.contextMenuPending || this.composing) {
|
||||
return super.poll();
|
||||
}
|
||||
|
||||
const text = this.textarea.value;
|
||||
let start = 0;
|
||||
const length = Math.min(this.prevInput.length, text.length);
|
||||
|
||||
while (start < length && this.prevInput[start] === text[start]) {
|
||||
++start;
|
||||
}
|
||||
|
||||
let end = 0;
|
||||
|
||||
while (
|
||||
end < length - start &&
|
||||
this.prevInput[this.prevInput.length - end - 1] === text[text.length - end - 1]
|
||||
) {
|
||||
++end;
|
||||
}
|
||||
|
||||
// CodeMirror expects the user to be typing into a blank <textarea>.
|
||||
// Pass a fake textarea into super.poll that only contains the users input.
|
||||
const placeholder = this.textarea;
|
||||
this.textarea = document.createElement("textarea");
|
||||
this.textarea.value = text.substring(start, text.length - end);
|
||||
this.textarea.setSelectionRange(
|
||||
placeholder.selectionStart - start,
|
||||
placeholder.selectionEnd - start
|
||||
);
|
||||
this.prevInput = "";
|
||||
const result = super.poll();
|
||||
this.prevInput = text;
|
||||
this.textarea = placeholder;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
});
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -129,7 +129,11 @@ function Editor(config) {
|
|||
matchBrackets: true,
|
||||
extraKeys: {},
|
||||
indentWithTabs: useTabs,
|
||||
inputStyle: "textarea",
|
||||
inputStyle: "accessibleTextArea",
|
||||
// This is set to the biggest value for setTimeout (See https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#Maximum_delay_value)
|
||||
// This is because codeMirror queries the underlying textArea for some things that
|
||||
// can't be retrieved with events in some browser (but we're fine in Firefox).
|
||||
pollInterval: Math.pow(2, 31) - 1,
|
||||
styleActiveLine: true,
|
||||
autoCloseBrackets: "()[]{}''\"\"``",
|
||||
autoCloseEnabled: useAutoClose,
|
||||
|
|
|
@ -16,6 +16,7 @@ module.exports = [{
|
|||
"./codemirror/addon/edit/matchbrackets.js",
|
||||
"./codemirror/addon/edit/closebrackets.js",
|
||||
"./codemirror/addon/comment/comment.js",
|
||||
"./codemirror/addon/accessibleTextarea.js",
|
||||
"./codemirror/mode/javascript/javascript.js",
|
||||
"./codemirror/mode/xml/xml.js",
|
||||
"./codemirror/mode/css/css.js",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
const {Utils: WebConsoleUtils} = require("devtools/client/webconsole/utils");
|
||||
const Services = require("Services");
|
||||
const { debounce } = require("devtools/shared/debounce");
|
||||
|
||||
loader.lazyServiceGetter(this, "clipboardHelper",
|
||||
"@mozilla.org/widget/clipboardhelper;1",
|
||||
|
@ -77,6 +78,7 @@ class JSTerm extends Component {
|
|||
updateHistoryPosition: PropTypes.func.isRequired,
|
||||
// Update autocomplete popup state.
|
||||
autocompleteUpdate: PropTypes.func.isRequired,
|
||||
autocompleteClear: PropTypes.func.isRequired,
|
||||
// Data to be displayed in the autocomplete popup.
|
||||
autocompleteData: PropTypes.object.isRequired,
|
||||
// Is the input in editor mode.
|
||||
|
@ -101,6 +103,11 @@ class JSTerm extends Component {
|
|||
this.onContextMenu = this.onContextMenu.bind(this);
|
||||
this.imperativeUpdate = this.imperativeUpdate.bind(this);
|
||||
|
||||
// We debounce the autocompleteUpdate so we don't send too many requests to the server
|
||||
// as the user is typing.
|
||||
// The delay should be small enough to be unnoticed by the user.
|
||||
this.autocompleteUpdate = debounce(this.props.autocompleteUpdate, 75, this);
|
||||
|
||||
/**
|
||||
* Last input value.
|
||||
* @type string
|
||||
|
@ -808,7 +815,7 @@ class JSTerm extends Component {
|
|||
if (this.lastInputValue !== value) {
|
||||
this.resizeInput();
|
||||
if (this.props.autocomplete) {
|
||||
this.props.autocompleteUpdate();
|
||||
this.autocompleteUpdate();
|
||||
}
|
||||
this.lastInputValue = value;
|
||||
}
|
||||
|
@ -1347,7 +1354,7 @@ class JSTerm extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
this.clearCompletion();
|
||||
this.props.autocompleteClear();
|
||||
|
||||
if (completionText) {
|
||||
this.insertStringAtCursor(completionText, numberOfCharsToReplaceCharsBeforeCursor);
|
||||
|
@ -1630,7 +1637,7 @@ function mapDispatchToProps(dispatch) {
|
|||
updateHistoryPosition: (direction, expression) =>
|
||||
dispatch(historyActions.updateHistoryPosition(direction, expression)),
|
||||
autocompleteUpdate: force => dispatch(autocompleteActions.autocompleteUpdate(force)),
|
||||
autocompleteBailOut: () => dispatch(autocompleteActions.autocompleteBailOut()),
|
||||
autocompleteClear: () => dispatch(autocompleteActions.autocompleteClear()),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -12,13 +12,12 @@ loader.lazyRequireGetter(this, "getContrastRatioFor", "devtools/server/actors/ac
|
|||
loader.lazyRequireGetter(this, "isDefunct", "devtools/server/actors/utils/accessibility", true);
|
||||
loader.lazyRequireGetter(this, "findCssSelector", "devtools/shared/inspector/css-logic", true);
|
||||
|
||||
const nsIAccessibleRelation = Ci.nsIAccessibleRelation;
|
||||
const RELATIONS_TO_IGNORE = new Set([
|
||||
nsIAccessibleRelation.RELATION_CONTAINING_APPLICATION,
|
||||
nsIAccessibleRelation.RELATION_CONTAINING_TAB_PANE,
|
||||
nsIAccessibleRelation.RELATION_CONTAINING_WINDOW,
|
||||
nsIAccessibleRelation.RELATION_PARENT_WINDOW_OF,
|
||||
nsIAccessibleRelation.RELATION_SUBWINDOW_OF,
|
||||
Ci.nsIAccessibleRelation.RELATION_CONTAINING_APPLICATION,
|
||||
Ci.nsIAccessibleRelation.RELATION_CONTAINING_TAB_PANE,
|
||||
Ci.nsIAccessibleRelation.RELATION_CONTAINING_WINDOW,
|
||||
Ci.nsIAccessibleRelation.RELATION_PARENT_WINDOW_OF,
|
||||
Ci.nsIAccessibleRelation.RELATION_SUBWINDOW_OF,
|
||||
]);
|
||||
|
||||
const nsIAccessibleRole = Ci.nsIAccessibleRole;
|
||||
|
@ -312,7 +311,7 @@ const AccessibleActor = ActorClassWithSpec(accessibleSpec, {
|
|||
}
|
||||
|
||||
const relations =
|
||||
[...this.rawAccessible.getRelations().enumerate(nsIAccessibleRelation)];
|
||||
[...this.rawAccessible.getRelations().enumerate(Ci.nsIAccessibleRelation)];
|
||||
if (relations.length === 0) {
|
||||
return relationObjects;
|
||||
}
|
||||
|
|
|
@ -35,10 +35,6 @@ const HIGHLIGHTER_STYLES_SHEET = `data:text/css;charset=utf-8,
|
|||
text-shadow: none !important;
|
||||
}`;
|
||||
|
||||
const nsIAccessibleEvent = Ci.nsIAccessibleEvent;
|
||||
const nsIAccessibleStateChangeEvent = Ci.nsIAccessibleStateChangeEvent;
|
||||
const nsIAccessibleRole = Ci.nsIAccessibleRole;
|
||||
|
||||
const {
|
||||
EVENT_TEXT_CHANGED,
|
||||
EVENT_TEXT_INSERTED,
|
||||
|
@ -55,56 +51,56 @@ const {
|
|||
EVENT_STATE_CHANGE,
|
||||
EVENT_TEXT_ATTRIBUTE_CHANGED,
|
||||
EVENT_VALUE_CHANGE,
|
||||
} = nsIAccessibleEvent;
|
||||
} = Ci.nsIAccessibleEvent;
|
||||
|
||||
// TODO: We do not need this once bug 1422913 is fixed. We also would not need
|
||||
// to fire a name change event for an accessible that has an updated subtree and
|
||||
// that has its name calculated from the said subtree.
|
||||
const NAME_FROM_SUBTREE_RULE_ROLES = new Set([
|
||||
nsIAccessibleRole.ROLE_BUTTONDROPDOWN,
|
||||
nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID,
|
||||
nsIAccessibleRole.ROLE_BUTTONMENU,
|
||||
nsIAccessibleRole.ROLE_CELL,
|
||||
nsIAccessibleRole.ROLE_CHECKBUTTON,
|
||||
nsIAccessibleRole.ROLE_CHECK_MENU_ITEM,
|
||||
nsIAccessibleRole.ROLE_CHECK_RICH_OPTION,
|
||||
nsIAccessibleRole.ROLE_COLUMN,
|
||||
nsIAccessibleRole.ROLE_COLUMNHEADER,
|
||||
nsIAccessibleRole.ROLE_COMBOBOX_OPTION,
|
||||
nsIAccessibleRole.ROLE_DEFINITION,
|
||||
nsIAccessibleRole.ROLE_GRID_CELL,
|
||||
nsIAccessibleRole.ROLE_HEADING,
|
||||
nsIAccessibleRole.ROLE_HELPBALLOON,
|
||||
nsIAccessibleRole.ROLE_HTML_CONTAINER,
|
||||
nsIAccessibleRole.ROLE_KEY,
|
||||
nsIAccessibleRole.ROLE_LABEL,
|
||||
nsIAccessibleRole.ROLE_LINK,
|
||||
nsIAccessibleRole.ROLE_LISTITEM,
|
||||
nsIAccessibleRole.ROLE_MATHML_IDENTIFIER,
|
||||
nsIAccessibleRole.ROLE_MATHML_NUMBER,
|
||||
nsIAccessibleRole.ROLE_MATHML_OPERATOR,
|
||||
nsIAccessibleRole.ROLE_MATHML_TEXT,
|
||||
nsIAccessibleRole.ROLE_MATHML_STRING_LITERAL,
|
||||
nsIAccessibleRole.ROLE_MATHML_GLYPH,
|
||||
nsIAccessibleRole.ROLE_MENUITEM,
|
||||
nsIAccessibleRole.ROLE_OPTION,
|
||||
nsIAccessibleRole.ROLE_OUTLINEITEM,
|
||||
nsIAccessibleRole.ROLE_PAGETAB,
|
||||
nsIAccessibleRole.ROLE_PARENT_MENUITEM,
|
||||
nsIAccessibleRole.ROLE_PUSHBUTTON,
|
||||
nsIAccessibleRole.ROLE_RADIOBUTTON,
|
||||
nsIAccessibleRole.ROLE_RADIO_MENU_ITEM,
|
||||
nsIAccessibleRole.ROLE_RICH_OPTION,
|
||||
nsIAccessibleRole.ROLE_ROW,
|
||||
nsIAccessibleRole.ROLE_ROWHEADER,
|
||||
nsIAccessibleRole.ROLE_SUMMARY,
|
||||
nsIAccessibleRole.ROLE_SWITCH,
|
||||
nsIAccessibleRole.ROLE_TABLE_COLUMN_HEADER,
|
||||
nsIAccessibleRole.ROLE_TABLE_ROW_HEADER,
|
||||
nsIAccessibleRole.ROLE_TEAR_OFF_MENU_ITEM,
|
||||
nsIAccessibleRole.ROLE_TERM,
|
||||
nsIAccessibleRole.ROLE_TOGGLE_BUTTON,
|
||||
nsIAccessibleRole.ROLE_TOOLTIP,
|
||||
Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWN,
|
||||
Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID,
|
||||
Ci.nsIAccessibleRole.ROLE_BUTTONMENU,
|
||||
Ci.nsIAccessibleRole.ROLE_CELL,
|
||||
Ci.nsIAccessibleRole.ROLE_CHECKBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_CHECK_MENU_ITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_CHECK_RICH_OPTION,
|
||||
Ci.nsIAccessibleRole.ROLE_COLUMN,
|
||||
Ci.nsIAccessibleRole.ROLE_COLUMNHEADER,
|
||||
Ci.nsIAccessibleRole.ROLE_COMBOBOX_OPTION,
|
||||
Ci.nsIAccessibleRole.ROLE_DEFINITION,
|
||||
Ci.nsIAccessibleRole.ROLE_GRID_CELL,
|
||||
Ci.nsIAccessibleRole.ROLE_HEADING,
|
||||
Ci.nsIAccessibleRole.ROLE_HELPBALLOON,
|
||||
Ci.nsIAccessibleRole.ROLE_HTML_CONTAINER,
|
||||
Ci.nsIAccessibleRole.ROLE_KEY,
|
||||
Ci.nsIAccessibleRole.ROLE_LABEL,
|
||||
Ci.nsIAccessibleRole.ROLE_LINK,
|
||||
Ci.nsIAccessibleRole.ROLE_LISTITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_MATHML_IDENTIFIER,
|
||||
Ci.nsIAccessibleRole.ROLE_MATHML_NUMBER,
|
||||
Ci.nsIAccessibleRole.ROLE_MATHML_OPERATOR,
|
||||
Ci.nsIAccessibleRole.ROLE_MATHML_TEXT,
|
||||
Ci.nsIAccessibleRole.ROLE_MATHML_STRING_LITERAL,
|
||||
Ci.nsIAccessibleRole.ROLE_MATHML_GLYPH,
|
||||
Ci.nsIAccessibleRole.ROLE_MENUITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_OPTION,
|
||||
Ci.nsIAccessibleRole.ROLE_OUTLINEITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_PAGETAB,
|
||||
Ci.nsIAccessibleRole.ROLE_PARENT_MENUITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_PUSHBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_RADIOBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_RADIO_MENU_ITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_RICH_OPTION,
|
||||
Ci.nsIAccessibleRole.ROLE_ROW,
|
||||
Ci.nsIAccessibleRole.ROLE_ROWHEADER,
|
||||
Ci.nsIAccessibleRole.ROLE_SUMMARY,
|
||||
Ci.nsIAccessibleRole.ROLE_SWITCH,
|
||||
Ci.nsIAccessibleRole.ROLE_TABLE_COLUMN_HEADER,
|
||||
Ci.nsIAccessibleRole.ROLE_TABLE_ROW_HEADER,
|
||||
Ci.nsIAccessibleRole.ROLE_TEAR_OFF_MENU_ITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_TERM,
|
||||
Ci.nsIAccessibleRole.ROLE_TOGGLE_BUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_TOOLTIP,
|
||||
]);
|
||||
|
||||
const IS_OSX = Services.appinfo.OS === "Darwin";
|
||||
|
@ -378,11 +374,11 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, {
|
|||
/**
|
||||
* Accessible event observer function.
|
||||
*
|
||||
* @param {nsIAccessibleEvent} subject
|
||||
* @param {Ci.nsIAccessibleEvent} subject
|
||||
* accessible event object.
|
||||
*/
|
||||
observe(subject) {
|
||||
const event = subject.QueryInterface(nsIAccessibleEvent);
|
||||
const event = subject.QueryInterface(Ci.nsIAccessibleEvent);
|
||||
const rawAccessible = event.accessible;
|
||||
const accessible = this.getRef(rawAccessible);
|
||||
|
||||
|
@ -398,7 +394,8 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, {
|
|||
|
||||
switch (event.eventType) {
|
||||
case EVENT_STATE_CHANGE:
|
||||
const { state, isEnabled } = event.QueryInterface(nsIAccessibleStateChangeEvent);
|
||||
const { state, isEnabled } =
|
||||
event.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
|
||||
const isBusy = state & Ci.nsIAccessibleStates.STATE_BUSY;
|
||||
if (accessible) {
|
||||
// Only propagate state change events for active accessibles.
|
||||
|
|
|
@ -602,6 +602,8 @@ var testIDBEntries = async function(index, hosts, indexedDBActor) {
|
|||
};
|
||||
|
||||
add_task(async function() {
|
||||
await SpecialPowers.pushPrefEnv({set: [["privacy.documentCookies.maxage", 0]]});
|
||||
|
||||
const { target, front } =
|
||||
await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html");
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="600"
|
||||
height="600"
|
||||
onload="setTimeout(nextTest,0);"
|
||||
onload="setTimeout(nextTest, 0);"
|
||||
title="bug 293235 test">
|
||||
|
||||
<script type="text/javascript"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="600"
|
||||
height="600"
|
||||
onload="setTimeout(nextTest,0);"
|
||||
onload="setTimeout(nextTest, 0);"
|
||||
title="bug 294258 test">
|
||||
|
||||
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="600"
|
||||
height="600"
|
||||
onload="setTimeout(nextTest,0);"
|
||||
onload="setTimeout(nextTest, 0);"
|
||||
title="bug 298622 test">
|
||||
|
||||
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="600"
|
||||
height="600"
|
||||
onload="setTimeout(nextTest,0);"
|
||||
onload="setTimeout(nextTest, 0);"
|
||||
title="bug 301397 test">
|
||||
|
||||
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="600"
|
||||
height="600"
|
||||
onload="setTimeout(nextTest,0);"
|
||||
onload="setTimeout(nextTest, 0);"
|
||||
title="bug 303267 test">
|
||||
|
||||
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="600"
|
||||
height="600"
|
||||
onload="setTimeout(nextTest,0);"
|
||||
onload="setTimeout(nextTest, 0);"
|
||||
title="bug 321671 test">
|
||||
|
||||
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="600"
|
||||
height="600"
|
||||
onload="setTimeout(nextTest,0);"
|
||||
onload="setTimeout(nextTest, 0);"
|
||||
title="bug 360511 test">
|
||||
|
||||
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="600"
|
||||
height="600"
|
||||
onload="setTimeout(nextTest,0);"
|
||||
onload="setTimeout(nextTest, 0);"
|
||||
title="bug 396649 test">
|
||||
|
||||
<script type="text/javascript"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="600"
|
||||
height="600"
|
||||
onload="setTimeout(nextTest,0);"
|
||||
onload="setTimeout(nextTest, 0);"
|
||||
title="bug 662200 test">
|
||||
|
||||
<script type="application/javascript"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="600"
|
||||
height="600"
|
||||
onload="setTimeout(nextTest,0);"
|
||||
onload="setTimeout(nextTest, 0);"
|
||||
title="bug 6500056 test">
|
||||
|
||||
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="600"
|
||||
height="600"
|
||||
onload="setTimeout(nextTest,0);"
|
||||
onload="setTimeout(nextTest, 0);"
|
||||
title="bug 89419 test">
|
||||
|
||||
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
|
||||
|
|
|
@ -1046,7 +1046,7 @@ static bool NativeInterface2JSObjectAndThrowIfFailed(
|
|||
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!XPCConvert::NativeInterface2JSObject(aRetval, aHelper, aIID,
|
||||
if (!XPCConvert::NativeInterface2JSObject(aCx, aRetval, aHelper, aIID,
|
||||
aAllowNativeWrapper, &rv)) {
|
||||
// I can't tell if NativeInterface2JSObject throws JS exceptions
|
||||
// or not. This is a sloppy stab at the right semantics; the
|
||||
|
@ -1116,7 +1116,7 @@ bool XPCOMObjectToJsval(JSContext* cx, JS::Handle<JSObject*> scope,
|
|||
bool VariantToJsval(JSContext* aCx, nsIVariant* aVariant,
|
||||
JS::MutableHandle<JS::Value> aRetval) {
|
||||
nsresult rv;
|
||||
if (!XPCVariant::VariantDataToJS(aVariant, &rv, aRetval)) {
|
||||
if (!XPCVariant::VariantDataToJS(aCx, aVariant, &rv, aRetval)) {
|
||||
// Does it throw? Who knows
|
||||
if (!JS_IsExceptionPending(aCx)) {
|
||||
Throw(aCx, NS_FAILED(rv) ? rv : NS_ERROR_UNEXPECTED);
|
||||
|
|
|
@ -250,7 +250,7 @@
|
|||
</toolbar>
|
||||
<toolbar>
|
||||
<label value="Eval script in chrome context"/>
|
||||
<textbox flex="1"/><button label="run" oncommand="eval(this.previousSibling.value);"/>
|
||||
<textbox flex="1"/><button label="run" oncommand="eval(this.previousSibling.value); // eslint-disable-line no-eval"/>
|
||||
</toolbar>
|
||||
|
||||
<browser type="content" src="http://www.google.com/" flex="1" id="page" remote="true"/>
|
||||
|
|
|
@ -117,6 +117,7 @@ struct WebAuthnGetAssertionResult {
|
|||
WebAuthnExtensionResult[] Extensions;
|
||||
/* Might be empty if the token implementation doesn't support CTAP1. */
|
||||
uint8_t[] SignatureData;
|
||||
uint8_t[] UserHandle;
|
||||
};
|
||||
|
||||
async protocol PWebAuthnTransaction {
|
||||
|
|
|
@ -400,9 +400,11 @@ void U2FHIDTokenManager::HandleSignResult(UniquePtr<U2FResult>&& aResult) {
|
|||
return;
|
||||
}
|
||||
|
||||
nsTArray<uint8_t> userHandle;
|
||||
|
||||
WebAuthnGetAssertionResult result(mTransaction.ref().mClientDataJSON,
|
||||
keyHandle, signatureBuf, authenticatorData,
|
||||
extensions, rawSignatureBuf);
|
||||
extensions, rawSignatureBuf, userHandle);
|
||||
mSignPromise.Resolve(std::move(result), __func__);
|
||||
}
|
||||
|
||||
|
|
|
@ -964,9 +964,11 @@ RefPtr<U2FSignPromise> U2FSoftTokenManager::Sign(
|
|||
return U2FSignPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
|
||||
nsTArray<uint8_t> userHandle;
|
||||
|
||||
WebAuthnGetAssertionResult result(aInfo.ClientDataJSON(), keyHandle,
|
||||
signatureBuf, authenticatorData, extensions,
|
||||
signatureDataBuf);
|
||||
signatureDataBuf, userHandle);
|
||||
return U2FSignPromise::CreateAndResolve(std::move(result), __func__);
|
||||
}
|
||||
|
||||
|
|
|
@ -734,6 +734,11 @@ void WebAuthnManager::FinishGetAssertion(
|
|||
return;
|
||||
}
|
||||
|
||||
CryptoBuffer userHandleBuf;
|
||||
// U2FTokenManager don't return user handle.
|
||||
// Best effort.
|
||||
userHandleBuf.Assign(aResult.UserHandle());
|
||||
|
||||
// If any authenticator returns success:
|
||||
|
||||
// Create a new PublicKeyCredential object named value and populate its fields
|
||||
|
@ -744,6 +749,9 @@ void WebAuthnManager::FinishGetAssertion(
|
|||
assertion->SetClientDataJSON(clientDataBuf);
|
||||
assertion->SetAuthenticatorData(authenticatorDataBuf);
|
||||
assertion->SetSignature(signatureBuf);
|
||||
if (!userHandleBuf.IsEmpty()) {
|
||||
assertion->SetUserHandle(userHandleBuf);
|
||||
}
|
||||
|
||||
RefPtr<PublicKeyCredential> credential = new PublicKeyCredential(mParent);
|
||||
credential->SetId(credentialBase64Url);
|
||||
|
|
|
@ -629,6 +629,10 @@ void WinWebAuthnManager::Sign(PWebAuthnTransactionParent* aTransactionParent,
|
|||
keyHandle.AppendElements(pWebAuthNAssertion->Credential.pbId,
|
||||
pWebAuthNAssertion->Credential.cbId);
|
||||
|
||||
nsTArray<uint8_t> userHandle;
|
||||
userHandle.AppendElements(pWebAuthNAssertion->pbUserId,
|
||||
pWebAuthNAssertion->cbUserId);
|
||||
|
||||
nsTArray<uint8_t> authenticatorData;
|
||||
authenticatorData.AppendElements(pWebAuthNAssertion->pbAuthenticatorData,
|
||||
pWebAuthNAssertion->cbAuthenticatorData);
|
||||
|
@ -641,7 +645,7 @@ void WinWebAuthnManager::Sign(PWebAuthnTransactionParent* aTransactionParent,
|
|||
|
||||
WebAuthnGetAssertionResult result(aInfo.ClientDataJSON(), keyHandle,
|
||||
signature, authenticatorData, extensions,
|
||||
signature);
|
||||
signature, userHandle);
|
||||
|
||||
Unused << mTransactionParent->SendConfirmSign(aTransactionId, result);
|
||||
ClearTransaction();
|
||||
|
|
|
@ -303,7 +303,6 @@ WebRenderBridgeParent::WebRenderBridgeParent(
|
|||
: mCompositorBridge(aCompositorBridge),
|
||||
mPipelineId(aPipelineId),
|
||||
mWidget(aWidget),
|
||||
mApis(aApis),
|
||||
mAsyncImageManager(aImageMgr),
|
||||
mCompositorScheduler(aScheduler),
|
||||
mAnimStorage(aAnimStorage),
|
||||
|
@ -330,6 +329,11 @@ WebRenderBridgeParent::WebRenderBridgeParent(
|
|||
if (!IsRootWebRenderBridgeParent() && gfxPrefs::WebRenderSplitRenderRoots()) {
|
||||
mRenderRoot = wr::RenderRoot::Content;
|
||||
}
|
||||
|
||||
for (auto& api : aApis) {
|
||||
MOZ_ASSERT(api);
|
||||
mApis[api->GetRenderRoot()] = api;
|
||||
}
|
||||
}
|
||||
|
||||
WebRenderBridgeParent::WebRenderBridgeParent(const wr::PipelineId& aPipelineId)
|
||||
|
@ -742,7 +746,7 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvUpdateResources(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
MOZ_RELEASE_ASSERT((size_t)aRenderRoot < mApis.Length());
|
||||
MOZ_RELEASE_ASSERT(aRenderRoot <= wr::kHighestRenderRoot);
|
||||
|
||||
wr::TransactionBuilder txn;
|
||||
txn.SetLowPriority(!IsRootWebRenderBridgeParent());
|
||||
|
@ -970,10 +974,7 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvSetDisplayList(
|
|||
// Guard against malicious content processes
|
||||
MOZ_RELEASE_ASSERT(aDisplayLists.Length() > 0);
|
||||
for (auto& displayList : aDisplayLists) {
|
||||
// mApis.Length() should be the lowest possible length of things that we
|
||||
// will be indexing via a RenderRoot, so it should be sufficient to check
|
||||
// just that.
|
||||
MOZ_RELEASE_ASSERT((size_t)displayList.mRenderRoot < mApis.Length());
|
||||
MOZ_RELEASE_ASSERT(displayList.mRenderRoot <= wr::kHighestRenderRoot);
|
||||
}
|
||||
|
||||
if (!IsRootWebRenderBridgeParent()) {
|
||||
|
@ -1106,10 +1107,7 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvEmptyTransaction(
|
|||
|
||||
// Guard against malicious content processes
|
||||
for (auto& update : aRenderRootUpdates) {
|
||||
// mApis.Length() should be the lowest possible length of things that we
|
||||
// will be indexing via a RenderRoot, so it should be sufficient to check
|
||||
// just that.
|
||||
MOZ_RELEASE_ASSERT((size_t)update.mRenderRoot < mApis.Length());
|
||||
MOZ_RELEASE_ASSERT(update.mRenderRoot <= wr::kHighestRenderRoot);
|
||||
}
|
||||
|
||||
if (!IsRootWebRenderBridgeParent()) {
|
||||
|
@ -1661,7 +1659,9 @@ wr::Epoch WebRenderBridgeParent::UpdateWebRender(
|
|||
ClearResources();
|
||||
mCompositorBridge = cBridge;
|
||||
mCompositorScheduler = aScheduler;
|
||||
mApis = aApis;
|
||||
for (auto& api : aApis) {
|
||||
mApis[api->GetRenderRoot()] = api;
|
||||
}
|
||||
mAsyncImageManager = aImageMgr;
|
||||
mAnimStorage = aAnimStorage;
|
||||
|
||||
|
@ -1929,6 +1929,9 @@ void WebRenderBridgeParent::MaybeGenerateFrame(VsyncId aId,
|
|||
wr::RenderRootArray<Maybe<wr::TransactionBuilder>> sceneBuilderTxns;
|
||||
wr::RenderRootArray<Maybe<wr::AutoTransactionSender>> senders;
|
||||
for (auto& api : mApis) {
|
||||
if (!api) {
|
||||
continue;
|
||||
}
|
||||
auto renderRoot = api->GetRenderRoot();
|
||||
// Ensure GenerateFrame is handled on the render backend thread rather
|
||||
// than going through the scene builder thread. That way we continue
|
||||
|
@ -1953,6 +1956,9 @@ void WebRenderBridgeParent::MaybeGenerateFrame(VsyncId aId,
|
|||
uint8_t framesGenerated = 0;
|
||||
wr::RenderRootArray<bool> generateFrame;
|
||||
for (auto& api : mApis) {
|
||||
if (!api) {
|
||||
continue;
|
||||
}
|
||||
auto renderRoot = api->GetRenderRoot();
|
||||
generateFrame[renderRoot] =
|
||||
mAsyncImageManager->GetAndResetWillGenerateFrame(renderRoot) ||
|
||||
|
@ -1979,6 +1985,9 @@ void WebRenderBridgeParent::MaybeGenerateFrame(VsyncId aId,
|
|||
// We do this even if the arrays are empty, because it will clear out any
|
||||
// previous properties store on the WR side, which is desirable.
|
||||
for (auto& api : mApis) {
|
||||
if (!api) {
|
||||
continue;
|
||||
}
|
||||
auto renderRoot = api->GetRenderRoot();
|
||||
fastTxns[renderRoot]->UpdateDynamicProperties(opacityArrays[renderRoot],
|
||||
transformArrays[renderRoot]);
|
||||
|
@ -1996,10 +2005,13 @@ void WebRenderBridgeParent::MaybeGenerateFrame(VsyncId aId,
|
|||
|
||||
MOZ_ASSERT(framesGenerated > 0);
|
||||
for (auto& api : mApis) {
|
||||
if (!api) {
|
||||
continue;
|
||||
}
|
||||
auto renderRoot = api->GetRenderRoot();
|
||||
if (generateFrame[renderRoot]) {
|
||||
fastTxns[renderRoot]->GenerateFrame();
|
||||
mApis[(size_t)renderRoot]->SendTransaction(*fastTxns[renderRoot]);
|
||||
api->SendTransaction(*fastTxns[renderRoot]);
|
||||
}
|
||||
}
|
||||
mMostRecentComposite = TimeStamp::Now();
|
||||
|
@ -2228,7 +2240,7 @@ bool WebRenderBridgeParent::Resume() {
|
|||
}
|
||||
|
||||
void WebRenderBridgeParent::ClearResources() {
|
||||
if (mApis.IsEmpty()) {
|
||||
if (!mApis[wr::RenderRoot::Default]) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2255,6 +2267,9 @@ void WebRenderBridgeParent::ClearResources() {
|
|||
mAsyncImageManager->RemovePipeline(mPipelineId, wrEpoch);
|
||||
|
||||
for (auto& api : mApis) {
|
||||
if (!api) {
|
||||
continue;
|
||||
}
|
||||
wr::TransactionBuilder txn;
|
||||
txn.SetLowPriority(true);
|
||||
txn.ClearDisplayList(wrEpoch, mPipelineId);
|
||||
|
@ -2286,7 +2301,9 @@ void WebRenderBridgeParent::ClearResources() {
|
|||
mAnimStorage = nullptr;
|
||||
mCompositorScheduler = nullptr;
|
||||
mAsyncImageManager = nullptr;
|
||||
mApis.Clear();
|
||||
for (auto& api : mApis) {
|
||||
api = nullptr;
|
||||
}
|
||||
mCompositorBridge = nullptr;
|
||||
}
|
||||
|
||||
|
@ -2348,7 +2365,7 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvReleaseCompositable(
|
|||
}
|
||||
|
||||
TextureFactoryIdentifier WebRenderBridgeParent::GetTextureFactoryIdentifier() {
|
||||
MOZ_ASSERT(!mApis.IsEmpty());
|
||||
MOZ_ASSERT(!!mApis[wr::RenderRoot::Default]);
|
||||
|
||||
return TextureFactoryIdentifier(
|
||||
LayersBackend::LAYERS_WR, XRE_GetProcessType(),
|
||||
|
|
|
@ -71,11 +71,13 @@ class WebRenderBridgeParent final
|
|||
|
||||
bool CloneWebRenderAPIs(nsTArray<RefPtr<wr::WebRenderAPI>>& aOutAPIs) {
|
||||
for (auto& api : mApis) {
|
||||
RefPtr<wr::WebRenderAPI> clone = api->Clone();
|
||||
if (!clone) {
|
||||
return false;
|
||||
if (api) {
|
||||
RefPtr<wr::WebRenderAPI> clone = api->Clone();
|
||||
if (!clone) {
|
||||
return false;
|
||||
}
|
||||
aOutAPIs.AppendElement(clone);
|
||||
}
|
||||
aOutAPIs.AppendElement(clone);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -83,10 +85,10 @@ class WebRenderBridgeParent final
|
|||
const ScreenPoint& aPoint);
|
||||
already_AddRefed<wr::WebRenderAPI> GetWebRenderAPI(
|
||||
wr::RenderRoot aRenderRoot) {
|
||||
if ((size_t)aRenderRoot >= mApis.Length()) {
|
||||
if (aRenderRoot > wr::kHighestRenderRoot) {
|
||||
return nullptr;
|
||||
}
|
||||
return do_AddRef(mApis[(int)aRenderRoot]);
|
||||
return do_AddRef(mApis[aRenderRoot]);
|
||||
}
|
||||
AsyncImagePipelineManager* AsyncImageManager() { return mAsyncImageManager; }
|
||||
CompositorVsyncScheduler* CompositorScheduler() {
|
||||
|
@ -273,10 +275,10 @@ class WebRenderBridgeParent final
|
|||
|
||||
wr::WebRenderAPI* Api(wr::RenderRoot aRenderRoot) {
|
||||
if (IsRootWebRenderBridgeParent()) {
|
||||
return mApis[(size_t)aRenderRoot];
|
||||
return mApis[aRenderRoot];
|
||||
} else {
|
||||
MOZ_ASSERT(aRenderRoot == wr::RenderRoot::Default);
|
||||
return mApis[(size_t)mRenderRoot];
|
||||
return mApis[mRenderRoot];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -435,7 +437,14 @@ class WebRenderBridgeParent final
|
|||
CompositorBridgeParentBase* MOZ_NON_OWNING_REF mCompositorBridge;
|
||||
wr::PipelineId mPipelineId;
|
||||
RefPtr<widget::CompositorWidget> mWidget;
|
||||
nsTArray<RefPtr<wr::WebRenderAPI>> mApis;
|
||||
// The RenderRootArray means there will always be a fixed number of apis,
|
||||
// one for each RenderRoot, even if renderroot splitting isn't enabled.
|
||||
// In this case, the unused apis will be nullptrs. Also, if this is not
|
||||
// the root WebRenderBridgeParent, there should only be one api in this
|
||||
// list. We avoid using a dynamically sized array for this because we
|
||||
// need to be able to null these out in a thread-safe way from
|
||||
// ClearResources, and there's no way to do that with an nsTArray.
|
||||
wr::RenderRootArray<RefPtr<wr::WebRenderAPI>> mApis;
|
||||
RefPtr<AsyncImagePipelineManager> mAsyncImageManager;
|
||||
RefPtr<CompositorVsyncScheduler> mCompositorScheduler;
|
||||
RefPtr<CompositorAnimationStorage> mAnimStorage;
|
||||
|
|
|
@ -3220,7 +3220,8 @@ bool gfxFont::InitFakeSmallCapsRun(DrawTarget* aDrawTarget,
|
|||
AutoTArray<bool, 50> deletedCharsArray;
|
||||
|
||||
bool mergeNeeded = nsCaseTransformTextRunFactory::TransformString(
|
||||
origString, convertedString, true,
|
||||
origString, convertedString, /* aAllUppercase = */ true,
|
||||
/* aCaseTransformsOnly = */ false,
|
||||
mStyle.explicitLanguage ? mStyle.language.get() : nullptr,
|
||||
charsToMergeArray, deletedCharsArray);
|
||||
|
||||
|
|
|
@ -327,16 +327,10 @@ XPCShellEnvironment::~XPCShellEnvironment() {
|
|||
if (!jsapi.Init(GetGlobalObject())) {
|
||||
return;
|
||||
}
|
||||
JSContext *cx = jsapi.cx();
|
||||
Rooted<JSObject *> global(cx, GetGlobalObject());
|
||||
|
||||
{
|
||||
JSAutoRealm ar(cx, global);
|
||||
JS_SetAllNonReservedSlotsToUndefined(cx, global);
|
||||
}
|
||||
JS_SetAllNonReservedSlotsToUndefined(mGlobalHolder);
|
||||
mGlobalHolder.reset();
|
||||
|
||||
JS_GC(cx);
|
||||
JS_GC(jsapi.cx());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4220,7 +4220,6 @@ bool GCRuntime::prepareZonesForCollection(JS::GCReason reason,
|
|||
c->gcState.maybeAlive = false;
|
||||
c->gcState.hasEnteredRealm = false;
|
||||
for (RealmsInCompartmentIter r(c); !r.done(); r.next()) {
|
||||
r->unmark();
|
||||
if (r->shouldTraceGlobal() || !r->zone()->isGCScheduled()) {
|
||||
c->gcState.maybeAlive = true;
|
||||
}
|
||||
|
|
|
@ -1408,10 +1408,7 @@ void js::ObjectGroup::traceChildren(JSTracer* trc) {
|
|||
TraceEdge(trc, &proto(), "group_proto");
|
||||
}
|
||||
|
||||
if (trc->isMarkingTracer()) {
|
||||
realm()->mark();
|
||||
}
|
||||
|
||||
// Note: the realm's global can be nullptr if we GC while creating the global.
|
||||
if (JSObject* global = realm()->unsafeUnbarrieredMaybeGlobal()) {
|
||||
TraceManuallyBarrieredEdge(trc, &global, "group_global");
|
||||
}
|
||||
|
@ -1447,8 +1444,7 @@ void js::GCMarker::lazilyMarkChildren(ObjectGroup* group) {
|
|||
traverseEdge(group, group->proto().toObject());
|
||||
}
|
||||
|
||||
group->realm()->mark();
|
||||
|
||||
// Note: the realm's global can be nullptr if we GC while creating the global.
|
||||
if (GlobalObject* global = group->realm()->unsafeUnbarrieredMaybeGlobal()) {
|
||||
traverseEdge(group, static_cast<JSObject*>(global));
|
||||
}
|
||||
|
|
|
@ -85,21 +85,22 @@ RematerializedFrame* RematerializedFrame::New(JSContext* cx, uint8_t* top,
|
|||
/* static */
|
||||
bool RematerializedFrame::RematerializeInlineFrames(
|
||||
JSContext* cx, uint8_t* top, InlineFrameIterator& iter,
|
||||
MaybeReadFallback& fallback, GCVector<RematerializedFrame*>& frames) {
|
||||
Rooted<GCVector<RematerializedFrame*>> tempFrames(
|
||||
cx, GCVector<RematerializedFrame*>(cx));
|
||||
MaybeReadFallback& fallback, RematerializedFrameVector& frames) {
|
||||
Rooted<RematerializedFrameVector> tempFrames(cx,
|
||||
RematerializedFrameVector(cx));
|
||||
if (!tempFrames.resize(iter.frameCount())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
size_t frameNo = iter.frameNo();
|
||||
tempFrames[frameNo].set(RematerializedFrame::New(cx, top, iter, fallback));
|
||||
tempFrames[frameNo].reset(
|
||||
RematerializedFrame::New(cx, top, iter, fallback));
|
||||
if (!tempFrames[frameNo]) {
|
||||
return false;
|
||||
}
|
||||
if (tempFrames[frameNo]->environmentChain()) {
|
||||
if (!EnsureHasEnvironmentObjects(cx, tempFrames[frameNo].get())) {
|
||||
if (!EnsureHasEnvironmentObjects(cx, tempFrames[frameNo].get().get())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -114,17 +115,6 @@ bool RematerializedFrame::RematerializeInlineFrames(
|
|||
return true;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void RematerializedFrame::FreeInVector(GCVector<RematerializedFrame*>& frames) {
|
||||
for (size_t i = 0; i < frames.length(); i++) {
|
||||
RematerializedFrame* f = frames[i];
|
||||
MOZ_ASSERT(!Debugger::inFrameMaps(f));
|
||||
f->RematerializedFrame::~RematerializedFrame();
|
||||
js_free(f);
|
||||
}
|
||||
frames.clear();
|
||||
}
|
||||
|
||||
CallObject& RematerializedFrame::callObj() const {
|
||||
MOZ_ASSERT(hasInitialEnvironment());
|
||||
MOZ_ASSERT(callee()->needsCallObject());
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "jit/JitFrames.h"
|
||||
#include "jit/JSJitFrameIter.h"
|
||||
#include "js/UniquePtr.h"
|
||||
#include "vm/EnvironmentObject.h"
|
||||
#include "vm/JSFunction.h"
|
||||
#include "vm/Stack.h"
|
||||
|
@ -69,15 +70,15 @@ class RematerializedFrame {
|
|||
InlineFrameIterator& iter,
|
||||
MaybeReadFallback& fallback);
|
||||
|
||||
// RematerializedFrame are allocated on non-GC heap, so use GCVector and
|
||||
// UniquePtr to ensure they are traced and cleaned up correctly.
|
||||
using RematerializedFrameVector = GCVector<UniquePtr<RematerializedFrame>>;
|
||||
|
||||
// Rematerialize all remaining frames pointed to by |iter| into |frames|
|
||||
// in older-to-younger order, e.g., frames[0] is the oldest frame.
|
||||
static MOZ_MUST_USE bool RematerializeInlineFrames(
|
||||
JSContext* cx, uint8_t* top, InlineFrameIterator& iter,
|
||||
MaybeReadFallback& fallback, GCVector<RematerializedFrame*>& frames);
|
||||
|
||||
// Free a vector of RematerializedFrames; takes care to call the
|
||||
// destructor. Also clears the vector.
|
||||
static void FreeInVector(GCVector<RematerializedFrame*>& frames);
|
||||
MaybeReadFallback& fallback, RematerializedFrameVector& frames);
|
||||
|
||||
bool prevUpToDate() const { return prevUpToDate_; }
|
||||
void setPrevUpToDate() { prevUpToDate_ = true; }
|
||||
|
@ -201,17 +202,4 @@ class RematerializedFrame {
|
|||
} // namespace jit
|
||||
} // namespace js
|
||||
|
||||
namespace JS {
|
||||
|
||||
template <>
|
||||
struct MapTypeToRootKind<js::jit::RematerializedFrame*> {
|
||||
static const RootKind kind = RootKind::Traceable;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct GCPolicy<js::jit::RematerializedFrame*>
|
||||
: public NonGCPointerPolicy<js::jit::RematerializedFrame*> {};
|
||||
|
||||
} // namespace JS
|
||||
|
||||
#endif // jit_RematerializedFrame_h
|
||||
|
|
|
@ -2972,13 +2972,7 @@ JS_PUBLIC_API bool JS::ObjectToCompletePropertyDescriptor(
|
|||
return true;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API void JS_SetAllNonReservedSlotsToUndefined(JSContext* cx,
|
||||
JSObject* objArg) {
|
||||
RootedObject obj(cx, objArg);
|
||||
AssertHeapIsIdle();
|
||||
CHECK_THREAD(cx);
|
||||
cx->check(obj);
|
||||
|
||||
JS_PUBLIC_API void JS_SetAllNonReservedSlotsToUndefined(JS::HandleObject obj) {
|
||||
if (!obj->isNative()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1757,8 +1757,7 @@ extern JS_PUBLIC_API bool IsSetObject(JSContext* cx, JS::HandleObject obj,
|
|||
* Assign 'undefined' to all of the object's non-reserved slots. Note: this is
|
||||
* done for all slots, regardless of the associated property descriptor.
|
||||
*/
|
||||
JS_PUBLIC_API void JS_SetAllNonReservedSlotsToUndefined(JSContext* cx,
|
||||
JSObject* objArg);
|
||||
JS_PUBLIC_API void JS_SetAllNonReservedSlotsToUndefined(JS::HandleObject obj);
|
||||
|
||||
extern JS_PUBLIC_API JS::Value JS_GetReservedSlot(JSObject* obj,
|
||||
uint32_t index);
|
||||
|
|
|
@ -1396,10 +1396,6 @@ bool JSContext::inAtomsZone() const { return zone_->isAtomsZone(); }
|
|||
void JSContext::trace(JSTracer* trc) {
|
||||
cycleDetectorVector().trace(trc);
|
||||
geckoProfiler().trace(trc);
|
||||
|
||||
if (trc->isMarkingTracer() && realm_) {
|
||||
realm_->mark();
|
||||
}
|
||||
}
|
||||
|
||||
void* JSContext::stackLimitAddressForJitCode(JS::StackKind kind) {
|
||||
|
|
|
@ -117,10 +117,11 @@ inline js::RegExpObject* JSScript::getRegExp(jsbytecode* pc) {
|
|||
|
||||
inline js::GlobalObject& JSScript::global() const {
|
||||
/*
|
||||
* A JSScript always marks its realm's global (via bindings) so we can
|
||||
* assert that maybeGlobal is non-null here.
|
||||
* A JSScript always marks its realm's global so we can assert it's non-null
|
||||
* here. We don't need a read barrier here for the same reason
|
||||
* JSObject::nonCCWGlobal doesn't need one.
|
||||
*/
|
||||
return *realm()->maybeGlobal();
|
||||
return *realm()->unsafeUnbarrieredMaybeGlobal();
|
||||
}
|
||||
|
||||
inline bool JSScript::hasGlobal(const js::GlobalObject* global) const {
|
||||
|
|
|
@ -4583,9 +4583,9 @@ void JSScript::traceChildren(JSTracer* trc) {
|
|||
TraceManuallyBarrieredEdge(trc, &lazyScript, "lazyScript");
|
||||
}
|
||||
|
||||
if (trc->isMarkingTracer()) {
|
||||
realm()->mark();
|
||||
}
|
||||
JSObject* global = realm()->unsafeUnbarrieredMaybeGlobal();
|
||||
MOZ_ASSERT(global);
|
||||
TraceManuallyBarrieredEdge(trc, &global, "script_global");
|
||||
|
||||
jit::TraceJitScripts(trc, this);
|
||||
|
||||
|
|
|
@ -37,11 +37,17 @@ inline bool JS::Realm::globalIsAboutToBeFinalized() {
|
|||
js::gc::IsAboutToBeFinalizedUnbarriered(global_.unsafeGet());
|
||||
}
|
||||
|
||||
inline bool JS::Realm::hasLiveGlobal() {
|
||||
inline bool JS::Realm::hasLiveGlobal() const {
|
||||
js::GlobalObject* global = unsafeUnbarrieredMaybeGlobal();
|
||||
return global && !js::gc::IsAboutToBeFinalizedUnbarriered(&global);
|
||||
}
|
||||
|
||||
inline bool JS::Realm::marked() const {
|
||||
// Preserve this Realm if it has a live global or if it has been entered (to
|
||||
// ensure we don't destroy the Realm while we're allocating its global).
|
||||
return hasLiveGlobal() || hasBeenEnteredIgnoringJit();
|
||||
}
|
||||
|
||||
/* static */ inline js::ObjectRealm& js::ObjectRealm::get(const JSObject* obj) {
|
||||
// Note: obj might be a CCW if we're accessing ObjectRealm::enumerators.
|
||||
// CCWs here are fine because we always return the same ObjectRealm for a
|
||||
|
|
|
@ -395,7 +395,6 @@ class JS::Realm : public JS::shadow::Realm {
|
|||
friend class js::AutoRestoreRealmDebugMode;
|
||||
|
||||
bool isSelfHostingRealm_ = false;
|
||||
bool marked_ = true;
|
||||
bool isSystem_ = false;
|
||||
|
||||
public:
|
||||
|
@ -518,7 +517,7 @@ class JS::Realm : public JS::shadow::Realm {
|
|||
inline bool globalIsAboutToBeFinalized();
|
||||
|
||||
/* True if a global exists and it's not being collected. */
|
||||
inline bool hasLiveGlobal();
|
||||
inline bool hasLiveGlobal() const;
|
||||
|
||||
inline void initGlobal(js::GlobalObject& global);
|
||||
|
||||
|
@ -635,9 +634,7 @@ class JS::Realm : public JS::shadow::Realm {
|
|||
realmStats_ = newStats;
|
||||
}
|
||||
|
||||
bool marked() const { return marked_; }
|
||||
void mark() { marked_ = true; }
|
||||
void unmark() { marked_ = false; }
|
||||
inline bool marked() const;
|
||||
|
||||
/*
|
||||
* The principals associated with this realm. Note that the same several
|
||||
|
|
|
@ -1541,7 +1541,6 @@ void jit::JitActivation::removeRematerializedFrame(uint8_t* top) {
|
|||
}
|
||||
|
||||
if (RematerializedFrameTable::Ptr p = rematerializedFrames_->lookup(top)) {
|
||||
RematerializedFrame::FreeInVector(p->value());
|
||||
rematerializedFrames_->remove(p);
|
||||
}
|
||||
}
|
||||
|
@ -1553,7 +1552,6 @@ void jit::JitActivation::clearRematerializedFrames() {
|
|||
|
||||
for (RematerializedFrameTable::Enum e(*rematerializedFrames_); !e.empty();
|
||||
e.popFront()) {
|
||||
RematerializedFrame::FreeInVector(e.front().value());
|
||||
e.removeFront();
|
||||
}
|
||||
}
|
||||
|
@ -1599,10 +1597,11 @@ jit::RematerializedFrame* jit::JitActivation::getRematerializedFrame(
|
|||
}
|
||||
|
||||
// See comment in unsetPrevUpToDateUntil.
|
||||
DebugEnvironments::unsetPrevUpToDateUntil(cx, p->value()[inlineDepth]);
|
||||
DebugEnvironments::unsetPrevUpToDateUntil(cx,
|
||||
p->value()[inlineDepth].get());
|
||||
}
|
||||
|
||||
return p->value()[inlineDepth];
|
||||
return p->value()[inlineDepth].get();
|
||||
}
|
||||
|
||||
jit::RematerializedFrame* jit::JitActivation::lookupRematerializedFrame(
|
||||
|
@ -1611,7 +1610,7 @@ jit::RematerializedFrame* jit::JitActivation::lookupRematerializedFrame(
|
|||
return nullptr;
|
||||
}
|
||||
if (RematerializedFrameTable::Ptr p = rematerializedFrames_->lookup(top)) {
|
||||
return inlineDepth < p->value().length() ? p->value()[inlineDepth]
|
||||
return inlineDepth < p->value().length() ? p->value()[inlineDepth].get()
|
||||
: nullptr;
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -1627,9 +1626,8 @@ void jit::JitActivation::removeRematerializedFramesFromDebugger(JSContext* cx,
|
|||
}
|
||||
if (RematerializedFrameTable::Ptr p = rematerializedFrames_->lookup(top)) {
|
||||
for (uint32_t i = 0; i < p->value().length(); i++) {
|
||||
Debugger::handleUnrecoverableIonBailoutError(cx, p->value()[i]);
|
||||
Debugger::handleUnrecoverableIonBailoutError(cx, p->value()[i].get());
|
||||
}
|
||||
RematerializedFrame::FreeInVector(p->value());
|
||||
rematerializedFrames_->remove(p);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1585,7 +1585,7 @@ class JitActivation : public Activation {
|
|||
// all inline frames associated with that frame.
|
||||
//
|
||||
// This table is lazily initialized by calling getRematerializedFrame.
|
||||
typedef GCVector<RematerializedFrame*> RematerializedFrameVector;
|
||||
typedef GCVector<UniquePtr<RematerializedFrame>> RematerializedFrameVector;
|
||||
typedef HashMap<uint8_t*, RematerializedFrameVector> RematerializedFrameTable;
|
||||
js::UniquePtr<RematerializedFrameTable> rematerializedFrames_;
|
||||
|
||||
|
|
|
@ -950,15 +950,11 @@ void mozJSComponentLoader::UnloadModules() {
|
|||
mInitialized = false;
|
||||
|
||||
if (mLoaderGlobal) {
|
||||
dom::AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JSContext* cx = jsapi.cx();
|
||||
RootedObject global(cx, mLoaderGlobal);
|
||||
JSAutoRealm ar(cx, global);
|
||||
MOZ_ASSERT(JS_HasExtensibleLexicalEnvironment(global));
|
||||
JS_SetAllNonReservedSlotsToUndefined(
|
||||
cx, JS_ExtensibleLexicalEnvironment(global));
|
||||
JS_SetAllNonReservedSlotsToUndefined(cx, global);
|
||||
MOZ_ASSERT(JS_HasExtensibleLexicalEnvironment(mLoaderGlobal));
|
||||
JS::RootedObject lexicalEnv(dom::RootingCx(),
|
||||
JS_ExtensibleLexicalEnvironment(mLoaderGlobal));
|
||||
JS_SetAllNonReservedSlotsToUndefined(lexicalEnv);
|
||||
JS_SetAllNonReservedSlotsToUndefined(mLoaderGlobal);
|
||||
mLoaderGlobal = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -146,14 +146,12 @@ class mozJSComponentLoader final {
|
|||
getfactoryobj = nullptr;
|
||||
|
||||
if (obj) {
|
||||
mozilla::AutoJSContext cx;
|
||||
JSAutoRealm ar(cx, obj);
|
||||
|
||||
if (JS_HasExtensibleLexicalEnvironment(obj)) {
|
||||
JS_SetAllNonReservedSlotsToUndefined(
|
||||
cx, JS_ExtensibleLexicalEnvironment(obj));
|
||||
JS::RootedObject lexicalEnv(mozilla::dom::RootingCx(),
|
||||
JS_ExtensibleLexicalEnvironment(obj));
|
||||
JS_SetAllNonReservedSlotsToUndefined(lexicalEnv);
|
||||
}
|
||||
JS_SetAllNonReservedSlotsToUndefined(cx, obj);
|
||||
JS_SetAllNonReservedSlotsToUndefined(obj);
|
||||
obj = nullptr;
|
||||
thisObjectKey = nullptr;
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ nsresult XPCCallContext::CanCallNow() {
|
|||
}
|
||||
|
||||
if (!mTearOff) {
|
||||
mTearOff = mWrapper->FindTearOff(mInterface, false, &rv);
|
||||
mTearOff = mWrapper->FindTearOff(mJSContext, mInterface, false, &rv);
|
||||
if (!mTearOff || mTearOff->GetInterface() != mInterface) {
|
||||
mTearOff = nullptr;
|
||||
return NS_FAILED(rv) ? rv : NS_ERROR_UNEXPECTED;
|
||||
|
|
|
@ -95,12 +95,12 @@ bool XPCConvert::GetISupportsFromJSObject(JSObject* obj, nsISupports** iface) {
|
|||
/***************************************************************************/
|
||||
|
||||
// static
|
||||
bool XPCConvert::NativeData2JS(MutableHandleValue d, const void* s,
|
||||
const nsXPTType& type, const nsID* iid,
|
||||
uint32_t arrlen, nsresult* pErr) {
|
||||
bool XPCConvert::NativeData2JS(JSContext* cx, MutableHandleValue d,
|
||||
const void* s, const nsXPTType& type,
|
||||
const nsID* iid, uint32_t arrlen,
|
||||
nsresult* pErr) {
|
||||
MOZ_ASSERT(s, "bad param");
|
||||
|
||||
AutoJSContext cx;
|
||||
if (pErr) {
|
||||
*pErr = NS_ERROR_XPC_BAD_CONVERT_NATIVE;
|
||||
}
|
||||
|
@ -376,11 +376,11 @@ bool XPCConvert::NativeData2JS(MutableHandleValue d, const void* s,
|
|||
return false;
|
||||
}
|
||||
|
||||
return XPCVariant::VariantDataToJS(variant, pErr, d);
|
||||
return XPCVariant::VariantDataToJS(cx, variant, pErr, d);
|
||||
}
|
||||
|
||||
xpcObjectHelper helper(iface);
|
||||
return NativeInterface2JSObject(d, helper, iid, true, pErr);
|
||||
return NativeInterface2JSObject(cx, d, helper, iid, true, pErr);
|
||||
}
|
||||
|
||||
case nsXPTType::T_DOMOBJECT: {
|
||||
|
@ -409,13 +409,13 @@ bool XPCConvert::NativeData2JS(MutableHandleValue d, const void* s,
|
|||
}
|
||||
|
||||
case nsXPTType::T_LEGACY_ARRAY:
|
||||
return NativeArray2JS(d, *static_cast<const void* const*>(s),
|
||||
return NativeArray2JS(cx, d, *static_cast<const void* const*>(s),
|
||||
type.ArrayElementType(), iid, arrlen, pErr);
|
||||
|
||||
case nsXPTType::T_ARRAY: {
|
||||
auto* array = static_cast<const xpt::detail::UntypedTArray*>(s);
|
||||
return NativeArray2JS(d, array->Elements(), type.ArrayElementType(), iid,
|
||||
array->Length(), pErr);
|
||||
return NativeArray2JS(cx, d, array->Elements(), type.ArrayElementType(),
|
||||
iid, array->Length(), pErr);
|
||||
}
|
||||
|
||||
default:
|
||||
|
@ -860,8 +860,8 @@ bool XPCConvert::JSData2Native(JSContext* cx, void* d, HandleValue s,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ok =
|
||||
JSArray2Native(s, elty, iid, pErr, [&](uint32_t* aLength) -> void* {
|
||||
bool ok = JSArray2Native(
|
||||
cx, s, elty, iid, pErr, [&](uint32_t* aLength) -> void* {
|
||||
// Check that we have enough elements in our array.
|
||||
if (*aLength < arrlen) {
|
||||
if (pErr) {
|
||||
|
@ -888,16 +888,16 @@ bool XPCConvert::JSData2Native(JSContext* cx, void* d, HandleValue s,
|
|||
auto* dest = (xpt::detail::UntypedTArray*)d;
|
||||
const nsXPTType& elty = type.ArrayElementType();
|
||||
|
||||
bool ok =
|
||||
JSArray2Native(s, elty, iid, pErr, [&](uint32_t* aLength) -> void* {
|
||||
if (!dest->SetLength(elty, *aLength)) {
|
||||
if (pErr) {
|
||||
*pErr = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
return dest->Elements();
|
||||
});
|
||||
bool ok = JSArray2Native(cx, s, elty, iid, pErr,
|
||||
[&](uint32_t* aLength) -> void* {
|
||||
if (!dest->SetLength(elty, *aLength)) {
|
||||
if (pErr) {
|
||||
*pErr = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
return dest->Elements();
|
||||
});
|
||||
|
||||
if (!ok) {
|
||||
// An error occurred, free any allocated backing buffer.
|
||||
|
@ -915,7 +915,7 @@ bool XPCConvert::JSData2Native(JSContext* cx, void* d, HandleValue s,
|
|||
|
||||
/***************************************************************************/
|
||||
// static
|
||||
bool XPCConvert::NativeInterface2JSObject(MutableHandleValue d,
|
||||
bool XPCConvert::NativeInterface2JSObject(JSContext* cx, MutableHandleValue d,
|
||||
xpcObjectHelper& aHelper,
|
||||
const nsID* iid,
|
||||
bool allowNativeWrapper,
|
||||
|
@ -939,7 +939,6 @@ bool XPCConvert::NativeInterface2JSObject(MutableHandleValue d,
|
|||
// (that means an XPCWrappedNative around an nsXPCWrappedJS). This isn't
|
||||
// optimal -- we could detect this and roll the functionality into a
|
||||
// single wrapper, but the current solution is good enough for now.
|
||||
AutoJSContext cx;
|
||||
XPCWrappedNativeScope* xpcscope = ObjectScope(JS::CurrentGlobalOrNull(cx));
|
||||
if (!xpcscope) {
|
||||
return false;
|
||||
|
@ -998,13 +997,13 @@ bool XPCConvert::NativeInterface2JSObject(MutableHandleValue d,
|
|||
}
|
||||
|
||||
// Go ahead and create an XPCWrappedNative for this object.
|
||||
RefPtr<XPCNativeInterface> iface = XPCNativeInterface::GetNewOrUsed(iid);
|
||||
RefPtr<XPCNativeInterface> iface = XPCNativeInterface::GetNewOrUsed(cx, iid);
|
||||
if (!iface) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<XPCWrappedNative> wrapper;
|
||||
nsresult rv = XPCWrappedNative::GetNewOrUsed(aHelper, xpcscope, iface,
|
||||
nsresult rv = XPCWrappedNative::GetNewOrUsed(cx, aHelper, xpcscope, iface,
|
||||
getter_AddRefs(wrapper));
|
||||
if (NS_FAILED(rv) && pErr) {
|
||||
*pErr = rv;
|
||||
|
@ -1221,12 +1220,11 @@ class MOZ_STACK_CLASS AutoExceptionRestorer {
|
|||
RootedValue tvr;
|
||||
};
|
||||
|
||||
static nsresult JSErrorToXPCException(const char* toStringResult,
|
||||
static nsresult JSErrorToXPCException(JSContext* cx, const char* toStringResult,
|
||||
const char* ifaceName,
|
||||
const char* methodName,
|
||||
const JSErrorReport* report,
|
||||
Exception** exceptn) {
|
||||
AutoJSContext cx;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
RefPtr<nsScriptError> data;
|
||||
if (report) {
|
||||
|
@ -1268,11 +1266,10 @@ static nsresult JSErrorToXPCException(const char* toStringResult,
|
|||
}
|
||||
|
||||
// static
|
||||
nsresult XPCConvert::JSValToXPCException(MutableHandleValue s,
|
||||
nsresult XPCConvert::JSValToXPCException(JSContext* cx, MutableHandleValue s,
|
||||
const char* ifaceName,
|
||||
const char* methodName,
|
||||
Exception** exceptn) {
|
||||
AutoJSContext cx;
|
||||
AutoExceptionRestorer aer(cx, s);
|
||||
|
||||
if (!s.isPrimitive()) {
|
||||
|
@ -1317,7 +1314,7 @@ nsresult XPCConvert::JSValToXPCException(MutableHandleValue s,
|
|||
if (str) {
|
||||
toStringResult = JS_EncodeStringToUTF8(cx, str);
|
||||
}
|
||||
return JSErrorToXPCException(toStringResult.get(), ifaceName,
|
||||
return JSErrorToXPCException(cx, toStringResult.get(), ifaceName,
|
||||
methodName, report, exceptn);
|
||||
}
|
||||
|
||||
|
@ -1415,13 +1412,12 @@ nsresult XPCConvert::JSValToXPCException(MutableHandleValue s,
|
|||
// array fun...
|
||||
|
||||
// static
|
||||
bool XPCConvert::NativeArray2JS(MutableHandleValue d, const void* buf,
|
||||
const nsXPTType& type, const nsID* iid,
|
||||
uint32_t count, nsresult* pErr) {
|
||||
bool XPCConvert::NativeArray2JS(JSContext* cx, MutableHandleValue d,
|
||||
const void* buf, const nsXPTType& type,
|
||||
const nsID* iid, uint32_t count,
|
||||
nsresult* pErr) {
|
||||
MOZ_ASSERT(buf || count == 0, "Must have buf or 0 elements");
|
||||
|
||||
AutoJSContext cx;
|
||||
|
||||
RootedObject array(cx, JS_NewArrayObject(cx, count));
|
||||
if (!array) {
|
||||
return false;
|
||||
|
@ -1433,7 +1429,8 @@ bool XPCConvert::NativeArray2JS(MutableHandleValue d, const void* buf,
|
|||
|
||||
RootedValue current(cx, JS::NullValue());
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
if (!NativeData2JS(¤t, type.ElementPtr(buf, i), type, iid, 0, pErr) ||
|
||||
if (!NativeData2JS(cx, ¤t, type.ElementPtr(buf, i), type, iid, 0,
|
||||
pErr) ||
|
||||
!JS_DefineElement(cx, array, i, current, JSPROP_ENUMERATE))
|
||||
return false;
|
||||
}
|
||||
|
@ -1446,7 +1443,7 @@ bool XPCConvert::NativeArray2JS(MutableHandleValue d, const void* buf,
|
|||
}
|
||||
|
||||
// static
|
||||
bool XPCConvert::JSArray2Native(JS::HandleValue aJSVal,
|
||||
bool XPCConvert::JSArray2Native(JSContext* cx, JS::HandleValue aJSVal,
|
||||
const nsXPTType& aEltType, const nsIID* aIID,
|
||||
nsresult* pErr,
|
||||
const ArrayAllocFixupLen& aAllocFixupLen) {
|
||||
|
@ -1469,8 +1466,6 @@ bool XPCConvert::JSArray2Native(JS::HandleValue aJSVal,
|
|||
return buf;
|
||||
};
|
||||
|
||||
AutoJSContext cx;
|
||||
|
||||
// JSArray2Native only accepts objects (Array and TypedArray).
|
||||
if (!aJSVal.isObject()) {
|
||||
if (pErr) {
|
||||
|
|
|
@ -201,7 +201,7 @@ inline size_t XPCNativeInterface::OffsetOfMembers() {
|
|||
|
||||
inline XPCNativeSetKey::XPCNativeSetKey(XPCNativeSet* baseSet,
|
||||
XPCNativeInterface* addition)
|
||||
: mBaseSet(baseSet), mAddition(addition) {
|
||||
: mCx(nullptr), mBaseSet(baseSet), mAddition(addition) {
|
||||
MOZ_ASSERT(mBaseSet);
|
||||
MOZ_ASSERT(mAddition);
|
||||
MOZ_ASSERT(!mBaseSet->HasInterface(mAddition));
|
||||
|
|
|
@ -430,7 +430,7 @@ nsresult HasInstance(JSContext* cx, HandleObject objArg, const nsID* iid,
|
|||
// preserve that behavior. This is just a compatibility hack, so we don't
|
||||
// really care if it fails.
|
||||
if (IS_WN_REFLECTOR(obj)) {
|
||||
(void)XPCWrappedNative::Get(obj)->FindTearOff(*iid);
|
||||
(void)XPCWrappedNative::Get(obj)->FindTearOff(cx, *iid);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -1397,9 +1397,9 @@ int XRE_XPCShellMain(int argc, char** argv, char** envp,
|
|||
}
|
||||
|
||||
JS_DropPrincipals(cx, gJSPrincipals);
|
||||
JS_SetAllNonReservedSlotsToUndefined(cx, glob);
|
||||
JS_SetAllNonReservedSlotsToUndefined(cx,
|
||||
JS_GlobalLexicalEnvironment(glob));
|
||||
JS_SetAllNonReservedSlotsToUndefined(glob);
|
||||
JS::RootedObject lexicalEnv(cx, JS_GlobalLexicalEnvironment(glob));
|
||||
JS_SetAllNonReservedSlotsToUndefined(lexicalEnv);
|
||||
JS_GC(cx);
|
||||
}
|
||||
JS_GC(cx);
|
||||
|
|
|
@ -373,12 +373,11 @@ XPCVariant::GetAsJSVal(MutableHandleValue result) {
|
|||
}
|
||||
|
||||
// static
|
||||
bool XPCVariant::VariantDataToJS(nsIVariant* variant, nsresult* pErr,
|
||||
MutableHandleValue pJSVal) {
|
||||
bool XPCVariant::VariantDataToJS(JSContext* cx, nsIVariant* variant,
|
||||
nsresult* pErr, MutableHandleValue pJSVal) {
|
||||
// Get the type early because we might need to spoof it below.
|
||||
uint16_t type = variant->GetDataType();
|
||||
|
||||
AutoJSContext cx;
|
||||
RootedValue realVal(cx);
|
||||
nsresult rv = variant->GetAsJSVal(&realVal);
|
||||
|
||||
|
@ -449,15 +448,15 @@ bool XPCVariant::VariantDataToJS(nsIVariant* variant, nsresult* pErr,
|
|||
if (NS_FAILED(variant->GetAsChar(&c))) {
|
||||
return false;
|
||||
}
|
||||
return XPCConvert::NativeData2JS(pJSVal, (const void*)&c, {TD_CHAR}, &iid,
|
||||
0, pErr);
|
||||
return XPCConvert::NativeData2JS(cx, pJSVal, (const void*)&c, {TD_CHAR},
|
||||
&iid, 0, pErr);
|
||||
}
|
||||
case nsIDataType::VTYPE_WCHAR: {
|
||||
char16_t wc;
|
||||
if (NS_FAILED(variant->GetAsWChar(&wc))) {
|
||||
return false;
|
||||
}
|
||||
return XPCConvert::NativeData2JS(pJSVal, (const void*)&wc, {TD_WCHAR},
|
||||
return XPCConvert::NativeData2JS(cx, pJSVal, (const void*)&wc, {TD_WCHAR},
|
||||
&iid, 0, pErr);
|
||||
}
|
||||
case nsIDataType::VTYPE_ID: {
|
||||
|
@ -465,31 +464,31 @@ bool XPCVariant::VariantDataToJS(nsIVariant* variant, nsresult* pErr,
|
|||
return false;
|
||||
}
|
||||
nsID* v = &iid;
|
||||
return XPCConvert::NativeData2JS(pJSVal, (const void*)&v, {TD_NSIDPTR},
|
||||
&iid, 0, pErr);
|
||||
return XPCConvert::NativeData2JS(cx, pJSVal, (const void*)&v,
|
||||
{TD_NSIDPTR}, &iid, 0, pErr);
|
||||
}
|
||||
case nsIDataType::VTYPE_ASTRING: {
|
||||
nsAutoString astring;
|
||||
if (NS_FAILED(variant->GetAsAString(astring))) {
|
||||
return false;
|
||||
}
|
||||
return XPCConvert::NativeData2JS(pJSVal, &astring, {TD_ASTRING}, &iid, 0,
|
||||
pErr);
|
||||
return XPCConvert::NativeData2JS(cx, pJSVal, &astring, {TD_ASTRING}, &iid,
|
||||
0, pErr);
|
||||
}
|
||||
case nsIDataType::VTYPE_CSTRING: {
|
||||
nsAutoCString cString;
|
||||
if (NS_FAILED(variant->GetAsACString(cString))) {
|
||||
return false;
|
||||
}
|
||||
return XPCConvert::NativeData2JS(pJSVal, &cString, {TD_CSTRING}, &iid, 0,
|
||||
pErr);
|
||||
return XPCConvert::NativeData2JS(cx, pJSVal, &cString, {TD_CSTRING}, &iid,
|
||||
0, pErr);
|
||||
}
|
||||
case nsIDataType::VTYPE_UTF8STRING: {
|
||||
nsUTF8String utf8String;
|
||||
if (NS_FAILED(variant->GetAsAUTF8String(utf8String))) {
|
||||
return false;
|
||||
}
|
||||
return XPCConvert::NativeData2JS(pJSVal, &utf8String, {TD_UTF8STRING},
|
||||
return XPCConvert::NativeData2JS(cx, pJSVal, &utf8String, {TD_UTF8STRING},
|
||||
&iid, 0, pErr);
|
||||
}
|
||||
case nsIDataType::VTYPE_CHAR_STR: {
|
||||
|
@ -497,7 +496,7 @@ bool XPCVariant::VariantDataToJS(nsIVariant* variant, nsresult* pErr,
|
|||
if (NS_FAILED(variant->GetAsString(&pc))) {
|
||||
return false;
|
||||
}
|
||||
bool success = XPCConvert::NativeData2JS(pJSVal, (const void*)&pc,
|
||||
bool success = XPCConvert::NativeData2JS(cx, pJSVal, (const void*)&pc,
|
||||
{TD_PSTRING}, &iid, 0, pErr);
|
||||
free(pc);
|
||||
return success;
|
||||
|
@ -509,7 +508,7 @@ bool XPCVariant::VariantDataToJS(nsIVariant* variant, nsresult* pErr,
|
|||
return false;
|
||||
}
|
||||
bool success = XPCConvert::NativeData2JS(
|
||||
pJSVal, (const void*)&pc, {TD_PSTRING_SIZE_IS}, &iid, size, pErr);
|
||||
cx, pJSVal, (const void*)&pc, {TD_PSTRING_SIZE_IS}, &iid, size, pErr);
|
||||
free(pc);
|
||||
return success;
|
||||
}
|
||||
|
@ -518,7 +517,7 @@ bool XPCVariant::VariantDataToJS(nsIVariant* variant, nsresult* pErr,
|
|||
if (NS_FAILED(variant->GetAsWString(&pwc))) {
|
||||
return false;
|
||||
}
|
||||
bool success = XPCConvert::NativeData2JS(pJSVal, (const void*)&pwc,
|
||||
bool success = XPCConvert::NativeData2JS(cx, pJSVal, (const void*)&pwc,
|
||||
{TD_PSTRING}, &iid, 0, pErr);
|
||||
free(pwc);
|
||||
return success;
|
||||
|
@ -529,8 +528,9 @@ bool XPCVariant::VariantDataToJS(nsIVariant* variant, nsresult* pErr,
|
|||
if (NS_FAILED(variant->GetAsWStringWithSize(&size, &pwc))) {
|
||||
return false;
|
||||
}
|
||||
bool success = XPCConvert::NativeData2JS(
|
||||
pJSVal, (const void*)&pwc, {TD_PWSTRING_SIZE_IS}, &iid, size, pErr);
|
||||
bool success =
|
||||
XPCConvert::NativeData2JS(cx, pJSVal, (const void*)&pwc,
|
||||
{TD_PWSTRING_SIZE_IS}, &iid, size, pErr);
|
||||
free(pwc);
|
||||
return success;
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ bool XPCVariant::VariantDataToJS(nsIVariant* variant, nsresult* pErr,
|
|||
free((char*)piid);
|
||||
|
||||
bool success = XPCConvert::NativeData2JS(
|
||||
pJSVal, (const void*)&pi, {TD_INTERFACE_IS_TYPE}, &iid, 0, pErr);
|
||||
cx, pJSVal, (const void*)&pi, {TD_INTERFACE_IS_TYPE}, &iid, 0, pErr);
|
||||
if (pi) {
|
||||
pi->Release();
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ bool XPCVariant::VariantDataToJS(nsIVariant* variant, nsresult* pErr,
|
|||
}
|
||||
|
||||
bool success = XPCConvert::NativeData2JS(
|
||||
pJSVal, (const void*)&du.u.array.mArrayValue,
|
||||
cx, pJSVal, (const void*)&du.u.array.mArrayValue,
|
||||
nsXPTType::MkArrayType(xptIndex), pid, du.u.array.mArrayCount, pErr);
|
||||
|
||||
return success;
|
||||
|
|
|
@ -640,7 +640,7 @@ nsresult nsXPCWrappedJSClass::CheckForException(
|
|||
/* JS might throw an expection whether the reporter was called or not */
|
||||
if (is_js_exception) {
|
||||
if (!xpc_exception) {
|
||||
XPCConvert::JSValToXPCException(&js_exception, anInterfaceName,
|
||||
XPCConvert::JSValToXPCException(cx, &js_exception, anInterfaceName,
|
||||
aPropertyName,
|
||||
getter_AddRefs(xpc_exception));
|
||||
}
|
||||
|
@ -939,8 +939,8 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex,
|
|||
!GetArraySizeFromParam(info, type, nativeParams, &array_count))
|
||||
goto pre_call_clean_up;
|
||||
|
||||
if (!XPCConvert::NativeData2JS(&val, pv, type, ¶m_iid, array_count,
|
||||
nullptr))
|
||||
if (!XPCConvert::NativeData2JS(cx, &val, pv, type, ¶m_iid,
|
||||
array_count, nullptr))
|
||||
goto pre_call_clean_up;
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ static void DEBUG_CheckClassInfoClaims(XPCWrappedNative* wrapper);
|
|||
#endif
|
||||
|
||||
/***************************************************************************/
|
||||
static nsresult FinishCreate(XPCWrappedNativeScope* Scope,
|
||||
static nsresult FinishCreate(JSContext* cx, XPCWrappedNativeScope* Scope,
|
||||
XPCNativeInterface* Interface,
|
||||
nsWrapperCache* cache, XPCWrappedNative* inWrapper,
|
||||
XPCWrappedNative** resultWrapper);
|
||||
|
@ -146,12 +146,12 @@ static nsresult FinishCreate(XPCWrappedNativeScope* Scope,
|
|||
// very early on that we have an XPCWrappedNativeScope and corresponding global
|
||||
// JS object, which are the very things we need to create here. So we special-
|
||||
// case the logic and do some things in a different order.
|
||||
nsresult XPCWrappedNative::WrapNewGlobal(xpcObjectHelper& nativeHelper,
|
||||
nsresult XPCWrappedNative::WrapNewGlobal(JSContext* cx,
|
||||
xpcObjectHelper& nativeHelper,
|
||||
nsIPrincipal* principal,
|
||||
bool initStandardClasses,
|
||||
JS::RealmOptions& aOptions,
|
||||
XPCWrappedNative** wrappedGlobal) {
|
||||
AutoJSContext cx;
|
||||
nsCOMPtr<nsISupports> identity = do_QueryInterface(nativeHelper.Object());
|
||||
|
||||
// The object should specify that it's meant to be global.
|
||||
|
@ -196,7 +196,7 @@ nsresult XPCWrappedNative::WrapNewGlobal(xpcObjectHelper& nativeHelper,
|
|||
|
||||
// Make a proto.
|
||||
XPCWrappedNativeProto* proto = XPCWrappedNativeProto::GetNewOrUsed(
|
||||
scope, nativeHelper.GetClassInfo(), scrProto);
|
||||
cx, scope, nativeHelper.GetClassInfo(), scrProto);
|
||||
if (!proto) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ nsresult XPCWrappedNative::WrapNewGlobal(xpcObjectHelper& nativeHelper,
|
|||
// on behalf of XPConnect (the corresponding Release is in the finalizer
|
||||
// hook), but it does some other miscellaneous things too, so we don't
|
||||
// inline it.
|
||||
success = wrapper->FinishInit();
|
||||
success = wrapper->FinishInit(cx);
|
||||
MOZ_ASSERT(success);
|
||||
|
||||
// Go through some extra work to find the tearoff. This is kind of silly
|
||||
|
@ -247,10 +247,10 @@ nsresult XPCWrappedNative::WrapNewGlobal(xpcObjectHelper& nativeHelper,
|
|||
// since we're dealing with nsISupports. But lots of code expects tearoffs
|
||||
// to exist for everything, so we just follow along.
|
||||
RefPtr<XPCNativeInterface> iface =
|
||||
XPCNativeInterface::GetNewOrUsed(&NS_GET_IID(nsISupports));
|
||||
XPCNativeInterface::GetNewOrUsed(cx, &NS_GET_IID(nsISupports));
|
||||
MOZ_ASSERT(iface);
|
||||
nsresult status;
|
||||
success = wrapper->FindTearOff(iface, false, &status);
|
||||
success = wrapper->FindTearOff(cx, iface, false, &status);
|
||||
if (!success) {
|
||||
return status;
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ nsresult XPCWrappedNative::WrapNewGlobal(xpcObjectHelper& nativeHelper,
|
|||
// Call the common creation finish routine. This does all of the bookkeeping
|
||||
// like inserting the wrapper into the wrapper map and setting up the wrapper
|
||||
// cache.
|
||||
nsresult rv = FinishCreate(scope, iface, nativeHelper.GetWrapperCache(),
|
||||
nsresult rv = FinishCreate(cx, scope, iface, nativeHelper.GetWrapperCache(),
|
||||
wrapper, wrappedGlobal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -266,12 +266,11 @@ nsresult XPCWrappedNative::WrapNewGlobal(xpcObjectHelper& nativeHelper,
|
|||
}
|
||||
|
||||
// static
|
||||
nsresult XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
|
||||
nsresult XPCWrappedNative::GetNewOrUsed(JSContext* cx, xpcObjectHelper& helper,
|
||||
XPCWrappedNativeScope* Scope,
|
||||
XPCNativeInterface* Interface,
|
||||
XPCWrappedNative** resultWrapper) {
|
||||
MOZ_ASSERT(Interface);
|
||||
AutoJSContext cx;
|
||||
nsWrapperCache* cache = helper.GetWrapperCache();
|
||||
|
||||
MOZ_ASSERT(!cache || !cache->GetWrapperPreserveColor(),
|
||||
|
@ -299,7 +298,7 @@ nsresult XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
|
|||
wrapper = map->Find(identity);
|
||||
|
||||
if (wrapper) {
|
||||
if (!wrapper->FindTearOff(Interface, false, &rv)) {
|
||||
if (!wrapper->FindTearOff(cx, Interface, false, &rv)) {
|
||||
MOZ_ASSERT(NS_FAILED(rv), "returning NS_OK on failure");
|
||||
return rv;
|
||||
}
|
||||
|
@ -366,7 +365,7 @@ nsresult XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
|
|||
XPCWrappedNativeScope* betterScope = ObjectScope(parent);
|
||||
MOZ_ASSERT(betterScope != Scope,
|
||||
"How can we have the same scope for two different globals?");
|
||||
return GetNewOrUsed(helper, betterScope, Interface, resultWrapper);
|
||||
return GetNewOrUsed(cx, helper, betterScope, Interface, resultWrapper);
|
||||
}
|
||||
|
||||
// Take the performance hit of checking the hashtable again in case
|
||||
|
@ -383,7 +382,7 @@ nsresult XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
|
|||
}
|
||||
|
||||
if (wrapper) {
|
||||
if (wrapper->FindTearOff(Interface, false, &rv)) {
|
||||
if (!wrapper->FindTearOff(cx, Interface, false, &rv)) {
|
||||
MOZ_ASSERT(NS_FAILED(rv), "returning NS_OK on failure");
|
||||
return rv;
|
||||
}
|
||||
|
@ -403,7 +402,7 @@ nsresult XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
|
|||
// wrapper is actually created, but before JS code can see it.
|
||||
|
||||
if (info && !isClassInfoSingleton) {
|
||||
proto = XPCWrappedNativeProto::GetNewOrUsed(Scope, info, scrProto);
|
||||
proto = XPCWrappedNativeProto::GetNewOrUsed(cx, Scope, info, scrProto);
|
||||
if (!proto) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -412,11 +411,11 @@ nsresult XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
|
|||
} else {
|
||||
RefPtr<XPCNativeInterface> iface = Interface;
|
||||
if (!iface) {
|
||||
iface = XPCNativeInterface::GetISupports();
|
||||
iface = XPCNativeInterface::GetISupports(cx);
|
||||
}
|
||||
|
||||
XPCNativeSetKey key(iface);
|
||||
RefPtr<XPCNativeSet> set = XPCNativeSet::GetNewOrUsed(&key);
|
||||
XPCNativeSetKey key(cx, iface);
|
||||
RefPtr<XPCNativeSet> set = XPCNativeSet::GetNewOrUsed(cx, &key);
|
||||
|
||||
if (!set) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -434,23 +433,22 @@ nsresult XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
|
|||
// *seen* this happen.
|
||||
AutoMarkingWrappedNativePtr wrapperMarker(cx, wrapper);
|
||||
|
||||
if (!wrapper->Init(scrWrapper)) {
|
||||
if (!wrapper->Init(cx, scrWrapper)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!wrapper->FindTearOff(Interface, false, &rv)) {
|
||||
if (!wrapper->FindTearOff(cx, Interface, false, &rv)) {
|
||||
MOZ_ASSERT(NS_FAILED(rv), "returning NS_OK on failure");
|
||||
return rv;
|
||||
}
|
||||
|
||||
return FinishCreate(Scope, Interface, cache, wrapper, resultWrapper);
|
||||
return FinishCreate(cx, Scope, Interface, cache, wrapper, resultWrapper);
|
||||
}
|
||||
|
||||
static nsresult FinishCreate(XPCWrappedNativeScope* Scope,
|
||||
static nsresult FinishCreate(JSContext* cx, XPCWrappedNativeScope* Scope,
|
||||
XPCNativeInterface* Interface,
|
||||
nsWrapperCache* cache, XPCWrappedNative* inWrapper,
|
||||
XPCWrappedNative** resultWrapper) {
|
||||
AutoJSContext cx;
|
||||
MOZ_ASSERT(inWrapper);
|
||||
|
||||
Native2WrappedNativeMap* map = Scope->GetWrappedNativeMap();
|
||||
|
@ -604,9 +602,7 @@ void XPCWrappedNative::GatherScriptable(nsISupports* aObj,
|
|||
scrWrapper.forget(aScrWrapper);
|
||||
}
|
||||
|
||||
bool XPCWrappedNative::Init(nsIXPCScriptable* aScriptable) {
|
||||
AutoJSContext cx;
|
||||
|
||||
bool XPCWrappedNative::Init(JSContext* cx, nsIXPCScriptable* aScriptable) {
|
||||
// Setup our scriptable...
|
||||
MOZ_ASSERT(!mScriptable);
|
||||
mScriptable = aScriptable;
|
||||
|
@ -639,12 +635,10 @@ bool XPCWrappedNative::Init(nsIXPCScriptable* aScriptable) {
|
|||
mFlatJSObject.setFlags(FLAT_JS_OBJECT_VALID);
|
||||
JS_SetPrivate(mFlatJSObject, this);
|
||||
|
||||
return FinishInit();
|
||||
return FinishInit(cx);
|
||||
}
|
||||
|
||||
bool XPCWrappedNative::FinishInit() {
|
||||
AutoJSContext cx;
|
||||
|
||||
bool XPCWrappedNative::FinishInit(JSContext* cx) {
|
||||
// This reference will be released when mFlatJSObject is finalized.
|
||||
// Since this reference will push the refcount to 2 it will also root
|
||||
// mFlatJSObject;
|
||||
|
@ -854,10 +848,11 @@ class MOZ_STACK_CLASS AutoClonePrivateGuard {
|
|||
RootedObject mNewReflector;
|
||||
};
|
||||
|
||||
bool XPCWrappedNative::ExtendSet(XPCNativeInterface* aInterface) {
|
||||
bool XPCWrappedNative::ExtendSet(JSContext* aCx,
|
||||
XPCNativeInterface* aInterface) {
|
||||
if (!mSet->HasInterface(aInterface)) {
|
||||
XPCNativeSetKey key(mSet, aInterface);
|
||||
RefPtr<XPCNativeSet> newSet = XPCNativeSet::GetNewOrUsed(&key);
|
||||
RefPtr<XPCNativeSet> newSet = XPCNativeSet::GetNewOrUsed(aCx, &key);
|
||||
if (!newSet) {
|
||||
return false;
|
||||
}
|
||||
|
@ -868,9 +863,8 @@ bool XPCWrappedNative::ExtendSet(XPCNativeInterface* aInterface) {
|
|||
}
|
||||
|
||||
XPCWrappedNativeTearOff* XPCWrappedNative::FindTearOff(
|
||||
XPCNativeInterface* aInterface, bool needJSObject /* = false */,
|
||||
nsresult* pError /* = nullptr */) {
|
||||
AutoJSContext cx;
|
||||
JSContext* cx, XPCNativeInterface* aInterface,
|
||||
bool needJSObject /* = false */, nsresult* pError /* = nullptr */) {
|
||||
nsresult rv = NS_OK;
|
||||
XPCWrappedNativeTearOff* to;
|
||||
XPCWrappedNativeTearOff* firstAvailable = nullptr;
|
||||
|
@ -881,7 +875,7 @@ XPCWrappedNativeTearOff* XPCWrappedNative::FindTearOff(
|
|||
if (to->GetInterface() == aInterface) {
|
||||
if (needJSObject && !to->GetJSObjectPreserveColor()) {
|
||||
AutoMarkingWrappedNativeTearOffPtr tearoff(cx, to);
|
||||
bool ok = InitTearOffJSObject(to);
|
||||
bool ok = InitTearOffJSObject(cx, to);
|
||||
// During shutdown, we don't sweep tearoffs. So make sure
|
||||
// to unmark manually in case the auto-marker marked us.
|
||||
// We shouldn't ever be getting here _during_ our
|
||||
|
@ -911,7 +905,7 @@ XPCWrappedNativeTearOff* XPCWrappedNative::FindTearOff(
|
|||
{
|
||||
// Scope keeps |tearoff| from leaking across the rest of the function.
|
||||
AutoMarkingWrappedNativeTearOffPtr tearoff(cx, to);
|
||||
rv = InitTearOff(to, aInterface, needJSObject);
|
||||
rv = InitTearOff(cx, to, aInterface, needJSObject);
|
||||
// During shutdown, we don't sweep tearoffs. So make sure to unmark
|
||||
// manually in case the auto-marker marked us. We shouldn't ever be
|
||||
// getting here _during_ our Mark/Sweep cycle, so this should be safe.
|
||||
|
@ -927,16 +921,16 @@ XPCWrappedNativeTearOff* XPCWrappedNative::FindTearOff(
|
|||
return to;
|
||||
}
|
||||
|
||||
XPCWrappedNativeTearOff* XPCWrappedNative::FindTearOff(const nsIID& iid) {
|
||||
RefPtr<XPCNativeInterface> iface = XPCNativeInterface::GetNewOrUsed(&iid);
|
||||
return iface ? FindTearOff(iface) : nullptr;
|
||||
XPCWrappedNativeTearOff* XPCWrappedNative::FindTearOff(JSContext* cx,
|
||||
const nsIID& iid) {
|
||||
RefPtr<XPCNativeInterface> iface = XPCNativeInterface::GetNewOrUsed(cx, &iid);
|
||||
return iface ? FindTearOff(cx, iface) : nullptr;
|
||||
}
|
||||
|
||||
nsresult XPCWrappedNative::InitTearOff(XPCWrappedNativeTearOff* aTearOff,
|
||||
nsresult XPCWrappedNative::InitTearOff(JSContext* cx,
|
||||
XPCWrappedNativeTearOff* aTearOff,
|
||||
XPCNativeInterface* aInterface,
|
||||
bool needJSObject) {
|
||||
AutoJSContext cx;
|
||||
|
||||
// Determine if the object really does this interface...
|
||||
|
||||
const nsIID* iid = aInterface->GetIID();
|
||||
|
@ -1012,7 +1006,7 @@ nsresult XPCWrappedNative::InitTearOff(XPCWrappedNativeTearOff* aTearOff,
|
|||
// because we unlocked and called out in the interim and the result of the
|
||||
// previous call might not be correct anymore.
|
||||
|
||||
if (!mSet->HasInterface(aInterface) && !ExtendSet(aInterface)) {
|
||||
if (!mSet->HasInterface(aInterface) && !ExtendSet(cx, aInterface)) {
|
||||
aTearOff->SetInterface(nullptr);
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
@ -1021,16 +1015,15 @@ nsresult XPCWrappedNative::InitTearOff(XPCWrappedNativeTearOff* aTearOff,
|
|||
aTearOff->SetNative(qiResult);
|
||||
RecordReplayRegisterDeferredFinalizeThing(nullptr, nullptr, qiResult);
|
||||
|
||||
if (needJSObject && !InitTearOffJSObject(aTearOff)) {
|
||||
if (needJSObject && !InitTearOffJSObject(cx, aTearOff)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool XPCWrappedNative::InitTearOffJSObject(XPCWrappedNativeTearOff* to) {
|
||||
AutoJSContext cx;
|
||||
|
||||
bool XPCWrappedNative::InitTearOffJSObject(JSContext* cx,
|
||||
XPCWrappedNativeTearOff* to) {
|
||||
JSObject* obj = JS_NewObject(cx, Jsvalify(&XPC_WN_Tearoff_JSClass));
|
||||
if (!obj) {
|
||||
return false;
|
||||
|
@ -1322,8 +1315,8 @@ bool CallMethodHelper::GatherAndConvertResults() {
|
|||
return false;
|
||||
|
||||
nsresult err;
|
||||
if (!XPCConvert::NativeData2JS(&v, &dp->val, type, ¶m_iid, array_count,
|
||||
&err)) {
|
||||
if (!XPCConvert::NativeData2JS(mCallContext, &v, &dp->val, type, ¶m_iid,
|
||||
array_count, &err)) {
|
||||
ThrowBadParam(err, i, mCallContext);
|
||||
return false;
|
||||
}
|
||||
|
@ -1378,8 +1371,9 @@ bool CallMethodHelper::QueryInterfaceFastPath() {
|
|||
|
||||
RootedValue v(mCallContext, NullValue());
|
||||
nsresult err;
|
||||
bool success = XPCConvert::NativeData2JS(
|
||||
&v, &qiresult, {nsXPTType::T_INTERFACE_IS}, iid.ptr(), 0, &err);
|
||||
bool success = XPCConvert::NativeData2JS(mCallContext, &v, &qiresult,
|
||||
{nsXPTType::T_INTERFACE_IS},
|
||||
iid.ptr(), 0, &err);
|
||||
NS_IF_RELEASE(qiresult);
|
||||
|
||||
if (!success) {
|
||||
|
@ -1714,7 +1708,7 @@ NS_IMETHODIMP XPCWrappedNative::DebugDump(int16_t depth) {
|
|||
/***************************************************************************/
|
||||
|
||||
char* XPCWrappedNative::ToString(
|
||||
XPCWrappedNativeTearOff* to /* = nullptr */) const {
|
||||
JSContext* cx, XPCWrappedNativeTearOff* to /* = nullptr */) const {
|
||||
#ifdef DEBUG
|
||||
# define FMT_ADDR " @ 0x%p"
|
||||
# define FMT_STR(str) str
|
||||
|
@ -1739,7 +1733,7 @@ char* XPCWrappedNative::ToString(
|
|||
} else if (!name) {
|
||||
XPCNativeSet* set = GetSet();
|
||||
XPCNativeInterface** array = set->GetInterfaceArray();
|
||||
RefPtr<XPCNativeInterface> isupp = XPCNativeInterface::GetISupports();
|
||||
RefPtr<XPCNativeInterface> isupp = XPCNativeInterface::GetISupports(cx);
|
||||
uint16_t count = set->GetInterfaceCount();
|
||||
|
||||
if (count == 1) {
|
||||
|
|
|
@ -118,7 +118,7 @@ XPCNativeInterface::~XPCNativeInterface() {
|
|||
|
||||
// static
|
||||
already_AddRefed<XPCNativeInterface> XPCNativeInterface::GetNewOrUsed(
|
||||
const nsIID* iid) {
|
||||
JSContext* cx, const nsIID* iid) {
|
||||
RefPtr<XPCNativeInterface> iface;
|
||||
XPCJSRuntime* rt = XPCJSRuntime::Get();
|
||||
|
||||
|
@ -138,7 +138,7 @@ already_AddRefed<XPCNativeInterface> XPCNativeInterface::GetNewOrUsed(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
iface = NewInstance(info);
|
||||
iface = NewInstance(cx, info);
|
||||
if (!iface) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ already_AddRefed<XPCNativeInterface> XPCNativeInterface::GetNewOrUsed(
|
|||
|
||||
// static
|
||||
already_AddRefed<XPCNativeInterface> XPCNativeInterface::GetNewOrUsed(
|
||||
const nsXPTInterfaceInfo* info) {
|
||||
JSContext* cx, const nsXPTInterfaceInfo* info) {
|
||||
RefPtr<XPCNativeInterface> iface;
|
||||
|
||||
XPCJSRuntime* rt = XPCJSRuntime::Get();
|
||||
|
@ -172,7 +172,7 @@ already_AddRefed<XPCNativeInterface> XPCNativeInterface::GetNewOrUsed(
|
|||
return iface.forget();
|
||||
}
|
||||
|
||||
iface = NewInstance(info);
|
||||
iface = NewInstance(cx, info);
|
||||
if (!iface) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -190,21 +190,21 @@ already_AddRefed<XPCNativeInterface> XPCNativeInterface::GetNewOrUsed(
|
|||
|
||||
// static
|
||||
already_AddRefed<XPCNativeInterface> XPCNativeInterface::GetNewOrUsed(
|
||||
const char* name) {
|
||||
JSContext* cx, const char* name) {
|
||||
const nsXPTInterfaceInfo* info = nsXPTInterfaceInfo::ByName(name);
|
||||
return info ? GetNewOrUsed(info) : nullptr;
|
||||
return info ? GetNewOrUsed(cx, info) : nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<XPCNativeInterface> XPCNativeInterface::GetISupports() {
|
||||
already_AddRefed<XPCNativeInterface> XPCNativeInterface::GetISupports(
|
||||
JSContext* cx) {
|
||||
// XXX We should optimize this to cache this common XPCNativeInterface.
|
||||
return GetNewOrUsed(&NS_GET_IID(nsISupports));
|
||||
return GetNewOrUsed(cx, &NS_GET_IID(nsISupports));
|
||||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<XPCNativeInterface> XPCNativeInterface::NewInstance(
|
||||
const nsXPTInterfaceInfo* aInfo) {
|
||||
AutoJSContext cx;
|
||||
JSContext* cx, const nsXPTInterfaceInfo* aInfo) {
|
||||
static const uint16_t MAX_LOCAL_MEMBER_COUNT = 16;
|
||||
XPCNativeMember local_members[MAX_LOCAL_MEMBER_COUNT];
|
||||
RefPtr<XPCNativeInterface> obj;
|
||||
|
@ -429,6 +429,7 @@ PLDHashNumber XPCNativeSetKey::Hash() const {
|
|||
PLDHashNumber h = 0;
|
||||
|
||||
if (mBaseSet) {
|
||||
// If we ever start using mCx here, adjust the constructors accordingly.
|
||||
XPCNativeInterface** current = mBaseSet->GetInterfaceArray();
|
||||
uint16_t count = mBaseSet->GetInterfaceCount();
|
||||
for (uint16_t i = 0; i < count; i++) {
|
||||
|
@ -436,7 +437,7 @@ PLDHashNumber XPCNativeSetKey::Hash() const {
|
|||
}
|
||||
} else {
|
||||
// A newly created set will contain nsISupports first...
|
||||
RefPtr<XPCNativeInterface> isupp = XPCNativeInterface::GetISupports();
|
||||
RefPtr<XPCNativeInterface> isupp = XPCNativeInterface::GetISupports(mCx);
|
||||
h ^= HashPointer(isupp);
|
||||
|
||||
// ...but no more than once.
|
||||
|
@ -458,6 +459,7 @@ PLDHashNumber XPCNativeSetKey::Hash() const {
|
|||
XPCNativeSet::~XPCNativeSet() {
|
||||
// Remove |this| before we clear the interfaces to ensure that the
|
||||
// hashtable look up is correct.
|
||||
|
||||
XPCJSRuntime::Get()->GetNativeSetMap()->Remove(this);
|
||||
|
||||
for (int i = 0; i < mInterfaceCount; i++) {
|
||||
|
@ -466,13 +468,14 @@ XPCNativeSet::~XPCNativeSet() {
|
|||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<XPCNativeSet> XPCNativeSet::GetNewOrUsed(const nsIID* iid) {
|
||||
RefPtr<XPCNativeInterface> iface = XPCNativeInterface::GetNewOrUsed(iid);
|
||||
already_AddRefed<XPCNativeSet> XPCNativeSet::GetNewOrUsed(JSContext* cx,
|
||||
const nsIID* iid) {
|
||||
RefPtr<XPCNativeInterface> iface = XPCNativeInterface::GetNewOrUsed(cx, iid);
|
||||
if (!iface) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
XPCNativeSetKey key(iface);
|
||||
XPCNativeSetKey key(cx, iface);
|
||||
|
||||
XPCJSRuntime* xpcrt = XPCJSRuntime::Get();
|
||||
NativeSetMap* map = xpcrt->GetNativeSetMap();
|
||||
|
@ -486,7 +489,7 @@ already_AddRefed<XPCNativeSet> XPCNativeSet::GetNewOrUsed(const nsIID* iid) {
|
|||
return set.forget();
|
||||
}
|
||||
|
||||
set = NewInstance({iface.forget()});
|
||||
set = NewInstance(cx, {iface.forget()});
|
||||
if (!set) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -501,7 +504,7 @@ already_AddRefed<XPCNativeSet> XPCNativeSet::GetNewOrUsed(const nsIID* iid) {
|
|||
|
||||
// static
|
||||
already_AddRefed<XPCNativeSet> XPCNativeSet::GetNewOrUsed(
|
||||
nsIClassInfo* classInfo) {
|
||||
JSContext* cx, nsIClassInfo* classInfo) {
|
||||
XPCJSRuntime* xpcrt = XPCJSRuntime::Get();
|
||||
ClassInfo2NativeSetMap* map = xpcrt->GetClassInfo2NativeSetMap();
|
||||
if (!map) {
|
||||
|
@ -527,7 +530,8 @@ already_AddRefed<XPCNativeSet> XPCNativeSet::GetNewOrUsed(
|
|||
// Try to look up each IID's XPCNativeInterface object.
|
||||
nsTArray<RefPtr<XPCNativeInterface>> interfaces(iids.Length());
|
||||
for (auto& iid : iids) {
|
||||
RefPtr<XPCNativeInterface> iface = XPCNativeInterface::GetNewOrUsed(&iid);
|
||||
RefPtr<XPCNativeInterface> iface =
|
||||
XPCNativeInterface::GetNewOrUsed(cx, &iid);
|
||||
if (iface) {
|
||||
interfaces.AppendElement(iface.forget());
|
||||
}
|
||||
|
@ -535,7 +539,7 @@ already_AddRefed<XPCNativeSet> XPCNativeSet::GetNewOrUsed(
|
|||
|
||||
// Build a set from the interfaces specified here.
|
||||
if (interfaces.Length() > 0) {
|
||||
set = NewInstance(std::move(interfaces));
|
||||
set = NewInstance(cx, std::move(interfaces));
|
||||
if (set) {
|
||||
NativeSetMap* map2 = xpcrt->GetNativeSetMap();
|
||||
if (!map2) {
|
||||
|
@ -556,7 +560,7 @@ already_AddRefed<XPCNativeSet> XPCNativeSet::GetNewOrUsed(
|
|||
}
|
||||
}
|
||||
} else {
|
||||
set = GetNewOrUsed(&NS_GET_IID(nsISupports));
|
||||
set = GetNewOrUsed(cx, &NS_GET_IID(nsISupports));
|
||||
}
|
||||
|
||||
if (set) {
|
||||
|
@ -582,7 +586,7 @@ void XPCNativeSet::ClearCacheEntryForClassInfo(nsIClassInfo* classInfo) {
|
|||
|
||||
// static
|
||||
already_AddRefed<XPCNativeSet> XPCNativeSet::GetNewOrUsed(
|
||||
XPCNativeSetKey* key) {
|
||||
JSContext* cx, XPCNativeSetKey* key) {
|
||||
NativeSetMap* map = XPCJSRuntime::Get()->GetNativeSetMap();
|
||||
if (!map) {
|
||||
return nullptr;
|
||||
|
@ -597,7 +601,7 @@ already_AddRefed<XPCNativeSet> XPCNativeSet::GetNewOrUsed(
|
|||
if (key->GetBaseSet()) {
|
||||
set = NewInstanceMutate(key);
|
||||
} else {
|
||||
set = NewInstance({key->GetAddition()});
|
||||
set = NewInstance(cx, {key->GetAddition()});
|
||||
}
|
||||
|
||||
if (!set) {
|
||||
|
@ -614,7 +618,7 @@ already_AddRefed<XPCNativeSet> XPCNativeSet::GetNewOrUsed(
|
|||
|
||||
// static
|
||||
already_AddRefed<XPCNativeSet> XPCNativeSet::GetNewOrUsed(
|
||||
XPCNativeSet* firstSet, XPCNativeSet* secondSet,
|
||||
JSContext* cx, XPCNativeSet* firstSet, XPCNativeSet* secondSet,
|
||||
bool preserveFirstSetOrder) {
|
||||
// Figure out how many interfaces we'll need in the new set.
|
||||
uint32_t uniqueCount = firstSet->mInterfaceCount;
|
||||
|
@ -649,7 +653,7 @@ already_AddRefed<XPCNativeSet> XPCNativeSet::GetNewOrUsed(
|
|||
if (!currentSet->HasInterface(iface)) {
|
||||
// Create a new augmented set, inserting this interface at the end.
|
||||
XPCNativeSetKey key(currentSet, iface);
|
||||
currentSet = XPCNativeSet::GetNewOrUsed(&key);
|
||||
currentSet = XPCNativeSet::GetNewOrUsed(cx, &key);
|
||||
if (!currentSet) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -663,7 +667,7 @@ already_AddRefed<XPCNativeSet> XPCNativeSet::GetNewOrUsed(
|
|||
|
||||
// static
|
||||
already_AddRefed<XPCNativeSet> XPCNativeSet::NewInstance(
|
||||
nsTArray<RefPtr<XPCNativeInterface>>&& array) {
|
||||
JSContext* cx, nsTArray<RefPtr<XPCNativeInterface>>&& array) {
|
||||
if (array.Length() == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -673,7 +677,7 @@ already_AddRefed<XPCNativeSet> XPCNativeSet::NewInstance(
|
|||
// This is the place where we impose that rule - even if given inputs
|
||||
// that don't exactly follow the rule.
|
||||
|
||||
RefPtr<XPCNativeInterface> isup = XPCNativeInterface::GetISupports();
|
||||
RefPtr<XPCNativeInterface> isup = XPCNativeInterface::GetISupports(cx);
|
||||
uint16_t slots = array.Length() + 1;
|
||||
|
||||
for (auto key = array.begin(); key != array.end(); key++) {
|
||||
|
|
|
@ -43,7 +43,7 @@ static bool ToStringGuts(XPCCallContext& ccx) {
|
|||
XPCWrappedNative* wrapper = ccx.GetWrapper();
|
||||
|
||||
if (wrapper) {
|
||||
sz.reset(wrapper->ToString(ccx.GetTearOff()));
|
||||
sz.reset(wrapper->ToString(ccx, ccx.GetTearOff()));
|
||||
} else {
|
||||
sz = JS_smprintf("[xpconnect wrapped native prototype]");
|
||||
}
|
||||
|
@ -349,12 +349,13 @@ static bool DefinePropertyIfFound(
|
|||
break;
|
||||
}
|
||||
|
||||
iface2 = XPCNativeInterface::GetNewOrUsed(name.get());
|
||||
iface2 = XPCNativeInterface::GetNewOrUsed(ccx, name.get());
|
||||
if (!iface2) {
|
||||
break;
|
||||
}
|
||||
|
||||
to = wrapperToReflectInterfaceNames->FindTearOff(iface2, true, &rv);
|
||||
to =
|
||||
wrapperToReflectInterfaceNames->FindTearOff(ccx, iface2, true, &rv);
|
||||
if (!to) {
|
||||
break;
|
||||
}
|
||||
|
@ -421,7 +422,7 @@ static bool DefinePropertyIfFound(
|
|||
if (!member) {
|
||||
if (wrapperToReflectInterfaceNames) {
|
||||
XPCWrappedNativeTearOff* to =
|
||||
wrapperToReflectInterfaceNames->FindTearOff(iface, true);
|
||||
wrapperToReflectInterfaceNames->FindTearOff(ccx, iface, true);
|
||||
|
||||
if (!to) {
|
||||
return false;
|
||||
|
|
|
@ -48,8 +48,7 @@ XPCWrappedNativeProto::~XPCWrappedNativeProto() {
|
|||
DeferredFinalize(mClassInfo.forget().take());
|
||||
}
|
||||
|
||||
bool XPCWrappedNativeProto::Init(nsIXPCScriptable* scriptable) {
|
||||
AutoJSContext cx;
|
||||
bool XPCWrappedNativeProto::Init(JSContext* cx, nsIXPCScriptable* scriptable) {
|
||||
mScriptable = scriptable;
|
||||
|
||||
JS::RootedObject proto(cx, JS::GetRealmObjectPrototype(cx));
|
||||
|
@ -98,9 +97,8 @@ void XPCWrappedNativeProto::SystemIsBeingShutDown() {
|
|||
|
||||
// static
|
||||
XPCWrappedNativeProto* XPCWrappedNativeProto::GetNewOrUsed(
|
||||
XPCWrappedNativeScope* scope, nsIClassInfo* classInfo,
|
||||
JSContext* cx, XPCWrappedNativeScope* scope, nsIClassInfo* classInfo,
|
||||
nsIXPCScriptable* scriptable) {
|
||||
AutoJSContext cx;
|
||||
MOZ_ASSERT(scope, "bad param");
|
||||
MOZ_ASSERT(classInfo, "bad param");
|
||||
|
||||
|
@ -113,14 +111,14 @@ XPCWrappedNativeProto* XPCWrappedNativeProto::GetNewOrUsed(
|
|||
return proto;
|
||||
}
|
||||
|
||||
RefPtr<XPCNativeSet> set = XPCNativeSet::GetNewOrUsed(classInfo);
|
||||
RefPtr<XPCNativeSet> set = XPCNativeSet::GetNewOrUsed(cx, classInfo);
|
||||
if (!set) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
proto = new XPCWrappedNativeProto(scope, classInfo, set.forget());
|
||||
|
||||
if (!proto || !proto->Init(scriptable)) {
|
||||
if (!proto || !proto->Init(cx, scriptable)) {
|
||||
delete proto.get();
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -89,8 +89,8 @@ XPCWrappedNativeScope::XPCWrappedNativeScope(JS::Compartment* aCompartment,
|
|||
mAllowContentXBLScope = !RemoteXULForbidsXBLScope(aFirstGlobal);
|
||||
}
|
||||
|
||||
bool XPCWrappedNativeScope::GetComponentsJSObject(JS::MutableHandleObject obj) {
|
||||
AutoJSContext cx;
|
||||
bool XPCWrappedNativeScope::GetComponentsJSObject(JSContext* cx,
|
||||
JS::MutableHandleObject obj) {
|
||||
if (!mComponents) {
|
||||
bool system = AccessCheck::isChrome(mCompartment);
|
||||
mComponents =
|
||||
|
@ -99,8 +99,8 @@ bool XPCWrappedNativeScope::GetComponentsJSObject(JS::MutableHandleObject obj) {
|
|||
|
||||
RootedValue val(cx);
|
||||
xpcObjectHelper helper(mComponents);
|
||||
bool ok = XPCConvert::NativeInterface2JSObject(&val, helper, nullptr, false,
|
||||
nullptr);
|
||||
bool ok = XPCConvert::NativeInterface2JSObject(cx, &val, helper, nullptr,
|
||||
false, nullptr);
|
||||
if (NS_WARN_IF(!ok)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -131,8 +131,8 @@ static bool DefineSubcomponentProperty(JSContext* aCx, HandleObject aGlobal,
|
|||
unsigned int aStringIndex) {
|
||||
RootedValue subcompVal(aCx);
|
||||
xpcObjectHelper helper(aSubcomponent);
|
||||
if (!XPCConvert::NativeInterface2JSObject(&subcompVal, helper, aIID, false,
|
||||
nullptr))
|
||||
if (!XPCConvert::NativeInterface2JSObject(aCx, &subcompVal, helper, aIID,
|
||||
false, nullptr))
|
||||
return false;
|
||||
if (NS_WARN_IF(!subcompVal.isObject())) {
|
||||
return false;
|
||||
|
@ -143,7 +143,7 @@ static bool DefineSubcomponentProperty(JSContext* aCx, HandleObject aGlobal,
|
|||
|
||||
bool XPCWrappedNativeScope::AttachComponentsObject(JSContext* aCx) {
|
||||
RootedObject components(aCx);
|
||||
if (!GetComponentsJSObject(&components)) {
|
||||
if (!GetComponentsJSObject(aCx, &components)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,8 +57,6 @@ static bool XrayWrapperConstructor(JSContext* cx, unsigned argc, Value* vp) {
|
|||
// static
|
||||
bool AttachNewConstructorObject(JSContext* aCx,
|
||||
JS::HandleObject aGlobalObject) {
|
||||
// Pushing a JSContext calls ActivateDebugger which calls this function, so
|
||||
// we can't use an AutoJSContext here until JSD is gone.
|
||||
JSAutoRealm ar(aCx, aGlobalObject);
|
||||
JSFunction* xpcnativewrapper = JS_DefineFunction(
|
||||
aCx, aGlobalObject, "XPCNativeWrapper", XrayWrapperConstructor, 1,
|
||||
|
|
|
@ -548,8 +548,8 @@ nsresult InitClassesWithNewWrappedGlobal(JSContext* aJSContext,
|
|||
MOZ_ASSERT(helper.GetScriptableFlags() & XPC_SCRIPTABLE_IS_GLOBAL_OBJECT);
|
||||
RefPtr<XPCWrappedNative> wrappedGlobal;
|
||||
nsresult rv = XPCWrappedNative::WrapNewGlobal(
|
||||
helper, aPrincipal, aFlags & xpc::INIT_JS_STANDARD_CLASSES, aOptions,
|
||||
getter_AddRefs(wrappedGlobal));
|
||||
aJSContext, helper, aPrincipal, aFlags & xpc::INIT_JS_STANDARD_CLASSES,
|
||||
aOptions, getter_AddRefs(wrappedGlobal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Grab a copy of the global and enter its compartment.
|
||||
|
@ -566,18 +566,17 @@ nsresult InitClassesWithNewWrappedGlobal(JSContext* aJSContext,
|
|||
|
||||
} // namespace xpc
|
||||
|
||||
static nsresult NativeInterface2JSObject(HandleObject aScope,
|
||||
static nsresult NativeInterface2JSObject(JSContext* aCx, HandleObject aScope,
|
||||
nsISupports* aCOMObj,
|
||||
nsWrapperCache* aCache,
|
||||
const nsIID* aIID, bool aAllowWrapping,
|
||||
MutableHandleValue aVal) {
|
||||
AutoJSContext cx;
|
||||
JSAutoRealm ar(cx, aScope);
|
||||
JSAutoRealm ar(aCx, aScope);
|
||||
|
||||
nsresult rv;
|
||||
xpcObjectHelper helper(aCOMObj, aCache);
|
||||
if (!XPCConvert::NativeInterface2JSObject(aVal, helper, aIID, aAllowWrapping,
|
||||
&rv)) {
|
||||
if (!XPCConvert::NativeInterface2JSObject(aCx, aVal, helper, aIID,
|
||||
aAllowWrapping, &rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -598,8 +597,8 @@ nsXPConnect::WrapNative(JSContext* aJSContext, JSObject* aScopeArg,
|
|||
|
||||
RootedObject aScope(aJSContext, aScopeArg);
|
||||
RootedValue v(aJSContext);
|
||||
nsresult rv =
|
||||
NativeInterface2JSObject(aScope, aCOMObj, nullptr, &aIID, true, &v);
|
||||
nsresult rv = NativeInterface2JSObject(aJSContext, aScope, aCOMObj, nullptr,
|
||||
&aIID, true, &v);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -622,8 +621,8 @@ nsXPConnect::WrapNativeToJSVal(JSContext* aJSContext, JSObject* aScopeArg,
|
|||
MOZ_ASSERT(aCOMObj, "bad param");
|
||||
|
||||
RootedObject aScope(aJSContext, aScopeArg);
|
||||
return NativeInterface2JSObject(aScope, aCOMObj, aCache, aIID, aAllowWrapping,
|
||||
aVal);
|
||||
return NativeInterface2JSObject(aJSContext, aScope, aCOMObj, aCache, aIID,
|
||||
aAllowWrapping, aVal);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -843,7 +842,7 @@ nsXPConnect::VariantToJS(JSContext* ctx, JSObject* scopeArg, nsIVariant* value,
|
|||
MOZ_ASSERT(js::IsObjectInContextCompartment(scope, ctx));
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (!XPCVariant::VariantDataToJS(value, &rv, _retval)) {
|
||||
if (!XPCVariant::VariantDataToJS(ctx, value, &rv, _retval)) {
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -838,7 +838,7 @@ class XPCWrappedNativeScope final
|
|||
bool AttachComponentsObject(JSContext* aCx);
|
||||
|
||||
// Returns the JS object reflection of the Components object.
|
||||
bool GetComponentsJSObject(JS::MutableHandleObject obj);
|
||||
bool GetComponentsJSObject(JSContext* cx, JS::MutableHandleObject obj);
|
||||
|
||||
JSObject* GetExpandoChain(JS::HandleObject target);
|
||||
|
||||
|
@ -1055,11 +1055,13 @@ class XPCNativeInterface final {
|
|||
NS_INLINE_DECL_REFCOUNTING_WITH_DESTROY(XPCNativeInterface,
|
||||
DestroyInstance(this))
|
||||
|
||||
static already_AddRefed<XPCNativeInterface> GetNewOrUsed(const nsIID* iid);
|
||||
static already_AddRefed<XPCNativeInterface> GetNewOrUsed(JSContext* cx,
|
||||
const nsIID* iid);
|
||||
static already_AddRefed<XPCNativeInterface> GetNewOrUsed(
|
||||
const nsXPTInterfaceInfo* info);
|
||||
static already_AddRefed<XPCNativeInterface> GetNewOrUsed(const char* name);
|
||||
static already_AddRefed<XPCNativeInterface> GetISupports();
|
||||
JSContext* cx, const nsXPTInterfaceInfo* info);
|
||||
static already_AddRefed<XPCNativeInterface> GetNewOrUsed(JSContext* cx,
|
||||
const char* name);
|
||||
static already_AddRefed<XPCNativeInterface> GetISupports(JSContext* cx);
|
||||
|
||||
inline const nsXPTInterfaceInfo* GetInterfaceInfo() const { return mInfo; }
|
||||
inline jsid GetName() const { return mName; }
|
||||
|
@ -1083,7 +1085,7 @@ class XPCNativeInterface final {
|
|||
|
||||
protected:
|
||||
static already_AddRefed<XPCNativeInterface> NewInstance(
|
||||
const nsXPTInterfaceInfo* aInfo);
|
||||
JSContext* cx, const nsXPTInterfaceInfo* aInfo);
|
||||
|
||||
XPCNativeInterface() = delete;
|
||||
XPCNativeInterface(const nsXPTInterfaceInfo* aInfo, jsid aName)
|
||||
|
@ -1113,14 +1115,16 @@ class MOZ_STACK_CLASS XPCNativeSetKey final {
|
|||
public:
|
||||
// This represents an existing set |baseSet|.
|
||||
explicit XPCNativeSetKey(XPCNativeSet* baseSet)
|
||||
: mBaseSet(baseSet), mAddition(nullptr) {
|
||||
: mCx(nullptr), mBaseSet(baseSet), mAddition(nullptr) {
|
||||
MOZ_ASSERT(baseSet);
|
||||
}
|
||||
|
||||
// This represents a new set containing only nsISupports and
|
||||
// |addition|.
|
||||
explicit XPCNativeSetKey(XPCNativeInterface* addition)
|
||||
: mBaseSet(nullptr), mAddition(addition) {
|
||||
// |addition|. This needs a JSContext because it may need to
|
||||
// construct some data structures that need one to construct them.
|
||||
explicit XPCNativeSetKey(JSContext* cx, XPCNativeInterface* addition)
|
||||
: mCx(cx), mBaseSet(nullptr), mAddition(addition) {
|
||||
MOZ_ASSERT(cx);
|
||||
MOZ_ASSERT(addition);
|
||||
}
|
||||
|
||||
|
@ -1138,6 +1142,7 @@ class MOZ_STACK_CLASS XPCNativeSetKey final {
|
|||
// Allow shallow copy
|
||||
|
||||
private:
|
||||
JSContext* mCx;
|
||||
RefPtr<XPCNativeSet> mBaseSet;
|
||||
RefPtr<XPCNativeInterface> mAddition;
|
||||
};
|
||||
|
@ -1149,9 +1154,12 @@ class XPCNativeSet final {
|
|||
public:
|
||||
NS_INLINE_DECL_REFCOUNTING_WITH_DESTROY(XPCNativeSet, DestroyInstance(this))
|
||||
|
||||
static already_AddRefed<XPCNativeSet> GetNewOrUsed(const nsIID* iid);
|
||||
static already_AddRefed<XPCNativeSet> GetNewOrUsed(nsIClassInfo* classInfo);
|
||||
static already_AddRefed<XPCNativeSet> GetNewOrUsed(XPCNativeSetKey* key);
|
||||
static already_AddRefed<XPCNativeSet> GetNewOrUsed(JSContext* cx,
|
||||
const nsIID* iid);
|
||||
static already_AddRefed<XPCNativeSet> GetNewOrUsed(JSContext* cx,
|
||||
nsIClassInfo* classInfo);
|
||||
static already_AddRefed<XPCNativeSet> GetNewOrUsed(JSContext* cx,
|
||||
XPCNativeSetKey* key);
|
||||
|
||||
// This generates a union set.
|
||||
//
|
||||
|
@ -1161,7 +1169,7 @@ class XPCNativeSet final {
|
|||
// |firstSet|, we return |secondSet| without worrying about whether the
|
||||
// ordering might differ from |firstSet|.
|
||||
static already_AddRefed<XPCNativeSet> GetNewOrUsed(
|
||||
XPCNativeSet* firstSet, XPCNativeSet* secondSet,
|
||||
JSContext* cx, XPCNativeSet* firstSet, XPCNativeSet* secondSet,
|
||||
bool preserveFirstSetOrder);
|
||||
|
||||
static void ClearCacheEntryForClassInfo(nsIClassInfo* classInfo);
|
||||
|
@ -1200,7 +1208,7 @@ class XPCNativeSet final {
|
|||
|
||||
protected:
|
||||
static already_AddRefed<XPCNativeSet> NewInstance(
|
||||
nsTArray<RefPtr<XPCNativeInterface>>&& array);
|
||||
JSContext* cx, nsTArray<RefPtr<XPCNativeInterface>>&& array);
|
||||
static already_AddRefed<XPCNativeSet> NewInstanceMutate(XPCNativeSetKey* key);
|
||||
|
||||
XPCNativeSet() : mMemberCount(0), mInterfaceCount(0) {}
|
||||
|
@ -1223,7 +1231,8 @@ class XPCNativeSet final {
|
|||
|
||||
class XPCWrappedNativeProto final {
|
||||
public:
|
||||
static XPCWrappedNativeProto* GetNewOrUsed(XPCWrappedNativeScope* scope,
|
||||
static XPCWrappedNativeProto* GetNewOrUsed(JSContext* cx,
|
||||
XPCWrappedNativeScope* scope,
|
||||
nsIClassInfo* classInfo,
|
||||
nsIXPCScriptable* scriptable);
|
||||
|
||||
|
@ -1281,7 +1290,7 @@ class XPCWrappedNativeProto final {
|
|||
XPCWrappedNativeProto(XPCWrappedNativeScope* Scope, nsIClassInfo* ClassInfo,
|
||||
already_AddRefed<XPCNativeSet>&& Set);
|
||||
|
||||
bool Init(nsIXPCScriptable* scriptable);
|
||||
bool Init(JSContext* cx, nsIXPCScriptable* scriptable);
|
||||
|
||||
private:
|
||||
#ifdef DEBUG
|
||||
|
@ -1454,13 +1463,13 @@ class XPCWrappedNative final : public nsIXPConnectWrappedNative {
|
|||
return scope ? scope->GetRuntime() : nullptr;
|
||||
}
|
||||
|
||||
static nsresult WrapNewGlobal(xpcObjectHelper& nativeHelper,
|
||||
static nsresult WrapNewGlobal(JSContext* cx, xpcObjectHelper& nativeHelper,
|
||||
nsIPrincipal* principal,
|
||||
bool initStandardClasses,
|
||||
JS::RealmOptions& aOptions,
|
||||
XPCWrappedNative** wrappedGlobal);
|
||||
|
||||
static nsresult GetNewOrUsed(xpcObjectHelper& helper,
|
||||
static nsresult GetNewOrUsed(JSContext* cx, xpcObjectHelper& helper,
|
||||
XPCWrappedNativeScope* Scope,
|
||||
XPCNativeInterface* Interface,
|
||||
XPCWrappedNative** wrapper);
|
||||
|
@ -1484,10 +1493,11 @@ class XPCWrappedNative final : public nsIXPConnectWrappedNative {
|
|||
|
||||
inline bool HasInterfaceNoQI(const nsIID& iid);
|
||||
|
||||
XPCWrappedNativeTearOff* FindTearOff(XPCNativeInterface* aInterface,
|
||||
XPCWrappedNativeTearOff* FindTearOff(JSContext* cx,
|
||||
XPCNativeInterface* aInterface,
|
||||
bool needJSObject = false,
|
||||
nsresult* pError = nullptr);
|
||||
XPCWrappedNativeTearOff* FindTearOff(const nsIID& iid);
|
||||
XPCWrappedNativeTearOff* FindTearOff(JSContext* cx, const nsIID& iid);
|
||||
|
||||
void Mark() const {}
|
||||
|
||||
|
@ -1520,7 +1530,7 @@ class XPCWrappedNative final : public nsIXPConnectWrappedNative {
|
|||
|
||||
// Returns a string that should be freed with js_free, or nullptr on
|
||||
// failure.
|
||||
char* ToString(XPCWrappedNativeTearOff* to = nullptr) const;
|
||||
char* ToString(JSContext* cx, XPCWrappedNativeTearOff* to = nullptr) const;
|
||||
|
||||
static nsIXPCScriptable* GatherProtoScriptable(nsIClassInfo* classInfo);
|
||||
|
||||
|
@ -1551,15 +1561,15 @@ class XPCWrappedNative final : public nsIXPConnectWrappedNative {
|
|||
FLAT_JS_OBJECT_VALID = JS_BIT(0)
|
||||
};
|
||||
|
||||
bool Init(nsIXPCScriptable* scriptable);
|
||||
bool FinishInit();
|
||||
bool Init(JSContext* cx, nsIXPCScriptable* scriptable);
|
||||
bool FinishInit(JSContext* cx);
|
||||
|
||||
bool ExtendSet(XPCNativeInterface* aInterface);
|
||||
bool ExtendSet(JSContext* aCx, XPCNativeInterface* aInterface);
|
||||
|
||||
nsresult InitTearOff(XPCWrappedNativeTearOff* aTearOff,
|
||||
nsresult InitTearOff(JSContext* cx, XPCWrappedNativeTearOff* aTearOff,
|
||||
XPCNativeInterface* aInterface, bool needJSObject);
|
||||
|
||||
bool InitTearOffJSObject(XPCWrappedNativeTearOff* to);
|
||||
bool InitTearOffJSObject(JSContext* cx, XPCWrappedNativeTearOff* to);
|
||||
|
||||
public:
|
||||
static void GatherScriptable(nsISupports* obj, nsIClassInfo* classInfo,
|
||||
|
@ -1836,6 +1846,7 @@ class XPCConvert {
|
|||
/**
|
||||
* Convert a native object into a JS::Value.
|
||||
*
|
||||
* @param cx the JSContext representing the global we want the value in
|
||||
* @param d [out] the resulting JS::Value
|
||||
* @param s the native object we're working with
|
||||
* @param type the type of object that s is
|
||||
|
@ -1845,9 +1856,9 @@ class XPCConvert {
|
|||
* @param pErr [out] relevant error code, if any.
|
||||
*/
|
||||
|
||||
static bool NativeData2JS(JS::MutableHandleValue d, const void* s,
|
||||
const nsXPTType& type, const nsID* iid,
|
||||
uint32_t arrlen, nsresult* pErr);
|
||||
static bool NativeData2JS(JSContext* cx, JS::MutableHandleValue d,
|
||||
const void* s, const nsXPTType& type,
|
||||
const nsID* iid, uint32_t arrlen, nsresult* pErr);
|
||||
|
||||
static bool JSData2Native(JSContext* cx, void* d, JS::HandleValue s,
|
||||
const nsXPTType& type, const nsID* iid,
|
||||
|
@ -1856,6 +1867,7 @@ class XPCConvert {
|
|||
/**
|
||||
* Convert a native nsISupports into a JSObject.
|
||||
*
|
||||
* @param cx the JSContext representing the global we want the object in.
|
||||
* @param dest [out] the resulting JSObject
|
||||
* @param src the native object we're working with
|
||||
* @param iid the interface of src that we want (may be null)
|
||||
|
@ -1867,7 +1879,8 @@ class XPCConvert {
|
|||
* @param src_is_identity optional performance hint. Set to true only
|
||||
* if src is the identity pointer.
|
||||
*/
|
||||
static bool NativeInterface2JSObject(JS::MutableHandleValue dest,
|
||||
static bool NativeInterface2JSObject(JSContext* cx,
|
||||
JS::MutableHandleValue dest,
|
||||
xpcObjectHelper& aHelper,
|
||||
const nsID* iid, bool allowNativeWrapper,
|
||||
nsresult* pErr);
|
||||
|
@ -1882,7 +1895,7 @@ class XPCConvert {
|
|||
// for the WN case. You probably want UnwrapReflectorToISupports.
|
||||
static bool GetISupportsFromJSObject(JSObject* obj, nsISupports** iface);
|
||||
|
||||
static nsresult JSValToXPCException(JS::MutableHandleValue s,
|
||||
static nsresult JSValToXPCException(JSContext* cx, JS::MutableHandleValue s,
|
||||
const char* ifaceName,
|
||||
const char* methodName,
|
||||
mozilla::dom::Exception** exception);
|
||||
|
@ -1897,6 +1910,8 @@ class XPCConvert {
|
|||
/**
|
||||
* Convert a native array into a JS::Value.
|
||||
*
|
||||
* @param cx the JSContext we're working with and in whose global the array
|
||||
* should be created.
|
||||
* @param d [out] the resulting JS::Value
|
||||
* @param buf the native buffer containing input values
|
||||
* @param type the type of objects in the array
|
||||
|
@ -1905,15 +1920,16 @@ class XPCConvert {
|
|||
* @param scope the default scope to put on the new JSObjects' parent chain
|
||||
* @param pErr [out] relevant error code, if any.
|
||||
*/
|
||||
static bool NativeArray2JS(JS::MutableHandleValue d, const void* buf,
|
||||
const nsXPTType& type, const nsID* iid,
|
||||
uint32_t count, nsresult* pErr);
|
||||
static bool NativeArray2JS(JSContext* cx, JS::MutableHandleValue d,
|
||||
const void* buf, const nsXPTType& type,
|
||||
const nsID* iid, uint32_t count, nsresult* pErr);
|
||||
|
||||
typedef std::function<void*(uint32_t*)> ArrayAllocFixupLen;
|
||||
|
||||
/**
|
||||
* Convert a JS::Value into a native array.
|
||||
*
|
||||
* @param cx the JSContext we're working with
|
||||
* @param aJSVal the JS::Value to convert
|
||||
* @param aEltType the type of objects in the array
|
||||
* @param aIID the interface of each object in the array
|
||||
|
@ -1922,8 +1938,9 @@ class XPCConvert {
|
|||
* allocate the backing buffer. This function may
|
||||
* modify the length of array to be converted.
|
||||
*/
|
||||
static bool JSArray2Native(JS::HandleValue aJSVal, const nsXPTType& aEltType,
|
||||
const nsIID* aIID, nsresult* pErr,
|
||||
static bool JSArray2Native(JSContext* cx, JS::HandleValue aJSVal,
|
||||
const nsXPTType& aEltType, const nsIID* aIID,
|
||||
nsresult* pErr,
|
||||
const ArrayAllocFixupLen& aAllocFixupLen);
|
||||
|
||||
XPCConvert() = delete;
|
||||
|
@ -2238,14 +2255,14 @@ class XPCVariant : public nsIVariant {
|
|||
/**
|
||||
* Convert a variant into a JS::Value.
|
||||
*
|
||||
* @param ccx the context for the whole procedure
|
||||
* @param cx the context for the whole procedure
|
||||
* @param variant the variant to convert
|
||||
* @param scope the default scope to put on the new JSObject's parent chain
|
||||
* @param pErr [out] relevant error code, if any.
|
||||
* @param pJSVal [out] the resulting jsval.
|
||||
*/
|
||||
static bool VariantDataToJS(nsIVariant* variant, nsresult* pErr,
|
||||
JS::MutableHandleValue pJSVal);
|
||||
static bool VariantDataToJS(JSContext* cx, nsIVariant* variant,
|
||||
nsresult* pErr, JS::MutableHandleValue pJSVal);
|
||||
|
||||
bool IsPurple() { return mRefCnt.IsPurple(); }
|
||||
|
||||
|
|
|
@ -301,7 +301,7 @@ void WrapperFactory::PrepareForWrapping(JSContext* cx, HandleObject scope,
|
|||
// to do this cleverly in the common case to avoid too much overhead.
|
||||
XPCWrappedNative* newwn = XPCWrappedNative::Get(obj);
|
||||
RefPtr<XPCNativeSet> unionSet =
|
||||
XPCNativeSet::GetNewOrUsed(newwn->GetSet(), wn->GetSet(), false);
|
||||
XPCNativeSet::GetNewOrUsed(cx, newwn->GetSet(), wn->GetSet(), false);
|
||||
if (!unionSet) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -9698,7 +9698,8 @@ static void TransformChars(nsTextFrame* aFrame, const nsStyleText* aStyle,
|
|||
AutoTArray<bool, 50> charsToMergeArray;
|
||||
AutoTArray<bool, 50> deletedCharsArray;
|
||||
nsCaseTransformTextRunFactory::TransformString(
|
||||
fragString, convertedString, false, nullptr, charsToMergeArray,
|
||||
fragString, convertedString, /* aAllUppercase = */ false,
|
||||
/* aCaseTransformsOnly = */ true, nullptr, charsToMergeArray,
|
||||
deletedCharsArray, transformedTextRun, aSkippedOffset);
|
||||
aOut.Append(convertedString);
|
||||
} else {
|
||||
|
|
|
@ -259,9 +259,10 @@ static LanguageSpecificCasingBehavior GetCasingFor(const nsAtom* aLang) {
|
|||
|
||||
bool nsCaseTransformTextRunFactory::TransformString(
|
||||
const nsAString& aString, nsString& aConvertedString, bool aAllUppercase,
|
||||
const nsAtom* aLanguage, nsTArray<bool>& aCharsToMergeArray,
|
||||
nsTArray<bool>& aDeletedCharsArray, const nsTransformedTextRun* aTextRun,
|
||||
uint32_t aOffsetInTextRun, nsTArray<uint8_t>* aCanBreakBeforeArray,
|
||||
bool aCaseTransformsOnly, const nsAtom* aLanguage,
|
||||
nsTArray<bool>& aCharsToMergeArray, nsTArray<bool>& aDeletedCharsArray,
|
||||
const nsTransformedTextRun* aTextRun, uint32_t aOffsetInTextRun,
|
||||
nsTArray<uint8_t>* aCanBreakBeforeArray,
|
||||
nsTArray<RefPtr<nsTransformedCharStyle>>* aStyleArray) {
|
||||
bool auxiliaryOutputArrays = aCanBreakBeforeArray && aStyleArray;
|
||||
MOZ_ASSERT(!auxiliaryOutputArrays || aTextRun,
|
||||
|
@ -575,7 +576,9 @@ bool nsCaseTransformTextRunFactory::TransformString(
|
|||
break;
|
||||
|
||||
case NS_STYLE_TEXT_TRANSFORM_FULL_WIDTH:
|
||||
ch = mozilla::unicode::GetFullWidth(ch);
|
||||
if (!aCaseTransformsOnly) {
|
||||
ch = mozilla::unicode::GetFullWidth(ch);
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_STYLE_TEXT_TRANSFORM_FULL_SIZE_KANA: {
|
||||
|
@ -612,10 +615,12 @@ bool nsCaseTransformTextRunFactory::TransformString(
|
|||
0xFF71, 0xFF72, 0xFF73, 0xFF74, 0xFF75, 0xFF94, 0xFF95, 0xFF96, 0xFF82};
|
||||
// clang-format on
|
||||
|
||||
size_t index;
|
||||
const uint16_t len = MOZ_ARRAY_LENGTH(kSmallKanas);
|
||||
if (mozilla::BinarySearch(kSmallKanas, 0, len, ch, &index)) {
|
||||
ch = kFullSizeKanas[index];
|
||||
if (!aCaseTransformsOnly) {
|
||||
size_t index;
|
||||
const uint16_t len = MOZ_ARRAY_LENGTH(kSmallKanas);
|
||||
if (mozilla::BinarySearch(kSmallKanas, 0, len, ch, &index)) {
|
||||
ch = kFullSizeKanas[index];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -679,10 +684,10 @@ void nsCaseTransformTextRunFactory::RebuildTextRun(
|
|||
AutoTArray<uint8_t, 50> canBreakBeforeArray;
|
||||
AutoTArray<RefPtr<nsTransformedCharStyle>, 50> styleArray;
|
||||
|
||||
bool mergeNeeded =
|
||||
TransformString(aTextRun->mString, convertedString, mAllUppercase,
|
||||
nullptr, charsToMergeArray, deletedCharsArray, aTextRun,
|
||||
0, &canBreakBeforeArray, &styleArray);
|
||||
bool mergeNeeded = TransformString(
|
||||
aTextRun->mString, convertedString, mAllUppercase,
|
||||
/* aCaseTransformsOnly = */ false, nullptr, charsToMergeArray,
|
||||
deletedCharsArray, aTextRun, 0, &canBreakBeforeArray, &styleArray);
|
||||
|
||||
gfx::ShapedTextFlags flags;
|
||||
gfxTextRunFactory::Parameters innerParams =
|
||||
|
|
|
@ -103,10 +103,12 @@ class nsCaseTransformTextRunFactory : public nsTransformingTextRunFactory {
|
|||
// will be copied to the output arrays, which must also be provided by
|
||||
// the caller. For the global upper-casing usage (no input textrun),
|
||||
// these are ignored.
|
||||
// If aCaseTransformsOnly is true, then only the upper/lower/capitalize
|
||||
// transformations are performed; full-width and full-size-kana are ignored.
|
||||
static bool TransformString(
|
||||
const nsAString& aString, nsString& aConvertedString, bool aAllUppercase,
|
||||
const nsAtom* aLanguage, nsTArray<bool>& aCharsToMergeArray,
|
||||
nsTArray<bool>& aDeletedCharsArray,
|
||||
bool aCaseTransformsOnly, const nsAtom* aLanguage,
|
||||
nsTArray<bool>& aCharsToMergeArray, nsTArray<bool>& aDeletedCharsArray,
|
||||
const nsTransformedTextRun* aTextRun = nullptr,
|
||||
uint32_t aOffsetInTextRun = 0,
|
||||
nsTArray<uint8_t>* aCanBreakBeforeArray = nullptr,
|
||||
|
|
|
@ -6,10 +6,6 @@ var gBrowser;
|
|||
var gProgressListener;
|
||||
var gDebugger;
|
||||
|
||||
const nsILayoutDebuggingTools = Ci.nsILayoutDebuggingTools;
|
||||
const nsIDocShell = Ci.nsIDocShell;
|
||||
const nsIWebProgressListener = Ci.nsIWebProgressListener;
|
||||
|
||||
const NS_LAYOUT_DEBUGGINGTOOLS_CONTRACTID = "@mozilla.org/layout-debug/layout-debuggingtools;1";
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
|
@ -41,18 +37,18 @@ nsLDBBrowserContentListener.prototype = {
|
|||
// nsIWebProgressListener implementation
|
||||
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
|
||||
{
|
||||
if (!(aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) ||
|
||||
if (!(aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) ||
|
||||
aWebProgress != gBrowser.webProgress)
|
||||
return;
|
||||
|
||||
if (aStateFlags & nsIWebProgressListener.STATE_START) {
|
||||
if (aStateFlags & Ci.nsIWebProgressListener.STATE_START) {
|
||||
this.setButtonEnabled(this.mStopButton, true);
|
||||
this.setButtonEnabled(this.mForwardButton, gBrowser.canGoForward);
|
||||
this.setButtonEnabled(this.mBackButton, gBrowser.canGoBack);
|
||||
this.mStatusText.value = "loading...";
|
||||
this.mLoading = true;
|
||||
|
||||
} else if (aStateFlags & nsIWebProgressListener.STATE_STOP) {
|
||||
} else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
|
||||
this.setButtonEnabled(this.mStopButton, false);
|
||||
this.mStatusText.value = this.mURLBar.value + " loaded";
|
||||
this.mLoading = false;
|
||||
|
@ -112,7 +108,7 @@ function OnLDBLoad()
|
|||
gBrowser.addProgressListener(gProgressListener);
|
||||
|
||||
gDebugger = Cc[NS_LAYOUT_DEBUGGINGTOOLS_CONTRACTID].
|
||||
createInstance(nsILayoutDebuggingTools);
|
||||
createInstance(Ci.nsILayoutDebuggingTools);
|
||||
|
||||
if (window.arguments && window.arguments[0]) {
|
||||
gBrowser.loadURI(window.arguments[0], {
|
||||
|
@ -162,13 +158,12 @@ function toggle(menuitem)
|
|||
|
||||
function openFile()
|
||||
{
|
||||
var nsIFilePicker = Ci.nsIFilePicker;
|
||||
var fp = Cc["@mozilla.org/filepicker;1"]
|
||||
.createInstance(nsIFilePicker);
|
||||
fp.init(window, "Select a File", nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterAll);
|
||||
.createInstance(Ci.nsIFilePicker);
|
||||
fp.init(window, "Select a File", Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterHTML | Ci.nsIFilePicker.filterAll);
|
||||
fp.open(rv => {
|
||||
if (rv == nsIFilePicker.returnOK && fp.fileURL.spec &&
|
||||
if (rv == Ci.nsIFilePicker.returnOK && fp.fileURL.spec &&
|
||||
fp.fileURL.spec.length > 0) {
|
||||
gBrowser.loadURI(fp.fileURL.spec, {
|
||||
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
|
|
|
@ -2,14 +2,11 @@
|
|||
* 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/. */
|
||||
|
||||
const nsICommandLineHandler = Ci.nsICommandLineHandler;
|
||||
const nsIWindowWatcher = Ci.nsIWindowWatcher;
|
||||
|
||||
function RecordingCmdLineHandler() {}
|
||||
RecordingCmdLineHandler.prototype =
|
||||
{
|
||||
/* nsISupports */
|
||||
QueryInterface: ChromeUtils.generateQI([nsICommandLineHandler]),
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsICommandLineHandler]),
|
||||
|
||||
/* nsICommandLineHandler */
|
||||
handle : function handler_handle(cmdLine) {
|
||||
|
@ -53,7 +50,7 @@ RecordingCmdLineHandler.prototype =
|
|||
branch.setBoolPref("gfx.2d.recording", true);
|
||||
|
||||
var wwatch = Cc["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(nsIWindowWatcher);
|
||||
.getService(Ci.nsIWindowWatcher);
|
||||
wwatch.openWindow(null, "chrome://recording/content/recording.xul", "_blank",
|
||||
"chrome,dialog=no,all", args);
|
||||
cmdLine.preventDefault = true;
|
||||
|
|
|
@ -1900,6 +1900,7 @@ VARCACHE_PREF(
|
|||
// 0-Accept, 1-dontAcceptForeign, 2-dontAcceptAny, 3-limitForeign,
|
||||
// 4-rejectTracker
|
||||
// Keep the old default of accepting all cookies
|
||||
// In Firefox Desktop this pref is set by browser.contentblocking.features.[standard, strict] see firefox.js for details.
|
||||
VARCACHE_PREF(
|
||||
"network.cookie.cookieBehavior",
|
||||
network_cookie_cookieBehavior,
|
||||
|
@ -2106,6 +2107,7 @@ VARCACHE_PREF(
|
|||
)
|
||||
|
||||
// Block 3rd party fingerprinting resources.
|
||||
// In Firefox Desktop this pref is set by browser.contentblocking.features.[standard, strict] see firefox.js for details.
|
||||
VARCACHE_PREF(
|
||||
"privacy.trackingprotection.fingerprinting.enabled",
|
||||
privacy_trackingprotection_fingerprinting_enabled,
|
||||
|
@ -2120,6 +2122,7 @@ VARCACHE_PREF(
|
|||
)
|
||||
|
||||
// Block 3rd party cryptomining resources.
|
||||
// In Firefox Desktop this pref is set by browser.contentblocking.features.[standard, strict] see firefox.js for details.
|
||||
VARCACHE_PREF(
|
||||
"privacy.trackingprotection.cryptomining.enabled",
|
||||
privacy_trackingprotection_cryptomining_enabled,
|
||||
|
@ -2178,11 +2181,17 @@ VARCACHE_PREF(
|
|||
)
|
||||
|
||||
// Maximum client-side cookie life-time cap
|
||||
#ifdef NIGHTLY_BUILD
|
||||
# define PREF_VALUE 604800 // 7 days
|
||||
#else
|
||||
# define PREF_VALUE 0
|
||||
#endif
|
||||
VARCACHE_PREF(
|
||||
"privacy.documentCookies.maxage",
|
||||
privacy_documentCookies_maxage,
|
||||
uint32_t, 0 // Disabled (in seconds, set to 0 to disable)
|
||||
uint32_t, PREF_VALUE // (in seconds, set to 0 to disable)
|
||||
)
|
||||
#undef PREF_VALUE
|
||||
|
||||
// Anti-fingerprinting, disabled by default
|
||||
VARCACHE_PREF(
|
||||
|
|
|
@ -446,6 +446,9 @@ pref("media.peerconnection.sdp.rust.compare", false);
|
|||
#endif
|
||||
|
||||
pref("media.videocontrols.picture-in-picture.enabled", false);
|
||||
pref("media.videocontrols.picture-in-picture.video-toggle.enabled", false);
|
||||
pref("media.videocontrols.picture-in-picture.video-toggle.flyout-enabled", false);
|
||||
pref("media.videocontrols.picture-in-picture.video-toggle.flyout-wait-ms", 5000);
|
||||
|
||||
pref("media.webrtc.debug.trace_mask", 0);
|
||||
pref("media.webrtc.debug.multi_log", false);
|
||||
|
@ -1413,8 +1416,10 @@ pref("privacy.popups.maxReported", 100);
|
|||
// send "do not track" HTTP header, disabled by default
|
||||
pref("privacy.donottrackheader.enabled", false);
|
||||
// Enforce tracking protection in all modes
|
||||
// In Firefox Desktop this pref is set by browser.contentblocking.features.[standard, strict] see firefox.js for details.
|
||||
pref("privacy.trackingprotection.enabled", false);
|
||||
// Enforce tracking protection in Private Browsing mode
|
||||
// In Firefox Desktop this pref is set by browser.contentblocking.features.[standard, strict] see firefox.js for details.
|
||||
pref("privacy.trackingprotection.pbmode.enabled", true);
|
||||
// First Party Isolation (double keying), disabled by default
|
||||
pref("privacy.firstparty.isolate", false);
|
||||
|
|
|
@ -4,23 +4,13 @@
|
|||
/* import-globals-from pippki.js */
|
||||
"use strict";
|
||||
|
||||
const nsIFilePicker = Ci.nsIFilePicker;
|
||||
const nsFilePicker = "@mozilla.org/filepicker;1";
|
||||
const nsIX509CertDB = Ci.nsIX509CertDB;
|
||||
const nsX509CertDB = "@mozilla.org/security/x509certdb;1";
|
||||
const nsIX509Cert = Ci.nsIX509Cert;
|
||||
const nsStringBundle = "@mozilla.org/intl/stringbundle;1";
|
||||
const nsIStringBundleService = Ci.nsIStringBundleService;
|
||||
const nsICertTree = Ci.nsICertTree;
|
||||
const nsCertTree = "@mozilla.org/security/nsCertTree;1";
|
||||
|
||||
const gCertFileTypes = "*.p7b; *.crt; *.cert; *.cer; *.pem; *.der";
|
||||
|
||||
var { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
var key;
|
||||
|
||||
var certdialogs = Cc[nsCertificateDialogs].getService(nsICertificateDialogs);
|
||||
var certdialogs = Cc["@mozilla.org/nsCertificateDialogs;1"].getService(Ci.nsICertificateDialogs);
|
||||
|
||||
/**
|
||||
* List of certs currently selected in the active tab.
|
||||
|
@ -53,27 +43,27 @@ var emailTreeView;
|
|||
var userTreeView;
|
||||
|
||||
function LoadCerts() {
|
||||
certdb = Cc[nsX509CertDB].getService(nsIX509CertDB);
|
||||
certdb = Cc["@mozilla.org/security/x509certdb;1"].getService(Ci.nsIX509CertDB);
|
||||
var certcache = certdb.getCerts();
|
||||
|
||||
caTreeView = Cc[nsCertTree]
|
||||
.createInstance(nsICertTree);
|
||||
caTreeView.loadCertsFromCache(certcache, nsIX509Cert.CA_CERT);
|
||||
caTreeView = Cc["@mozilla.org/security/nsCertTree;1"]
|
||||
.createInstance(Ci.nsICertTree);
|
||||
caTreeView.loadCertsFromCache(certcache, Ci.nsIX509Cert.CA_CERT);
|
||||
document.getElementById("ca-tree").view = caTreeView;
|
||||
|
||||
serverTreeView = Cc[nsCertTree]
|
||||
.createInstance(nsICertTree);
|
||||
serverTreeView.loadCertsFromCache(certcache, nsIX509Cert.SERVER_CERT);
|
||||
serverTreeView = Cc["@mozilla.org/security/nsCertTree;1"]
|
||||
.createInstance(Ci.nsICertTree);
|
||||
serverTreeView.loadCertsFromCache(certcache, Ci.nsIX509Cert.SERVER_CERT);
|
||||
document.getElementById("server-tree").view = serverTreeView;
|
||||
|
||||
emailTreeView = Cc[nsCertTree]
|
||||
.createInstance(nsICertTree);
|
||||
emailTreeView.loadCertsFromCache(certcache, nsIX509Cert.EMAIL_CERT);
|
||||
emailTreeView = Cc["@mozilla.org/security/nsCertTree;1"]
|
||||
.createInstance(Ci.nsICertTree);
|
||||
emailTreeView.loadCertsFromCache(certcache, Ci.nsIX509Cert.EMAIL_CERT);
|
||||
document.getElementById("email-tree").view = emailTreeView;
|
||||
|
||||
userTreeView = Cc[nsCertTree]
|
||||
.createInstance(nsICertTree);
|
||||
userTreeView.loadCertsFromCache(certcache, nsIX509Cert.USER_CERT);
|
||||
userTreeView = Cc["@mozilla.org/security/nsCertTree;1"]
|
||||
.createInstance(Ci.nsICertTree);
|
||||
userTreeView.loadCertsFromCache(certcache, Ci.nsIX509Cert.USER_CERT);
|
||||
document.getElementById("user-tree").view = userTreeView;
|
||||
|
||||
enableBackupAllButton();
|
||||
|
@ -301,17 +291,17 @@ async function backupCerts() {
|
|||
return;
|
||||
}
|
||||
|
||||
var fp = Cc[nsFilePicker].createInstance(nsIFilePicker);
|
||||
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let [backupFileDialog, filePkcs12Spec] = await document.l10n.formatValues([
|
||||
{id: "choose-p12-backup-file-dialog"},
|
||||
{id: "file-browse-pkcs12-spec"},
|
||||
]);
|
||||
fp.init(window, backupFileDialog, nsIFilePicker.modeSave);
|
||||
fp.init(window, backupFileDialog, Ci.nsIFilePicker.modeSave);
|
||||
fp.appendFilter(filePkcs12Spec, "*.p12");
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterAll);
|
||||
fp.defaultExtension = "p12";
|
||||
fp.open(rv => {
|
||||
if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
|
||||
if (rv == Ci.nsIFilePicker.returnOK || rv == Ci.nsIFilePicker.returnReplace) {
|
||||
let password = {};
|
||||
if (certdialogs.setPKCS12FilePassword(window, password)) {
|
||||
let errorCode = certdb.exportPKCS12File(fp.file, selected_certs.length,
|
||||
|
@ -338,18 +328,18 @@ function editCerts() {
|
|||
}
|
||||
|
||||
async function restoreCerts() {
|
||||
var fp = Cc[nsFilePicker].createInstance(nsIFilePicker);
|
||||
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let [restoreFileDialog, filePkcs12Spec, fileCertSpec] = await document.l10n.formatValues([
|
||||
{id: "choose-p12-restore-file-dialog"},
|
||||
{id: "file-browse-pkcs12-spec"},
|
||||
{id: "file-browse-certificate-spec"},
|
||||
]);
|
||||
fp.init(window, restoreFileDialog, nsIFilePicker.modeOpen);
|
||||
fp.init(window, restoreFileDialog, Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilter(filePkcs12Spec, "*.p12; *.pfx");
|
||||
fp.appendFilter(fileCertSpec, gCertFileTypes);
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterAll);
|
||||
fp.open(rv => {
|
||||
if (rv != nsIFilePicker.returnOK) {
|
||||
if (rv != Ci.nsIFilePicker.returnOK) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -398,9 +388,9 @@ async function restoreCerts() {
|
|||
}
|
||||
|
||||
var certcache = certdb.getCerts();
|
||||
userTreeView.loadCertsFromCache(certcache, nsIX509Cert.USER_CERT);
|
||||
userTreeView.loadCertsFromCache(certcache, Ci.nsIX509Cert.USER_CERT);
|
||||
userTreeView.selection.clearSelection();
|
||||
caTreeView.loadCertsFromCache(certcache, nsIX509Cert.CA_CERT);
|
||||
caTreeView.loadCertsFromCache(certcache, Ci.nsIX509Cert.CA_CERT);
|
||||
caTreeView.selection.clearSelection();
|
||||
enableBackupAllButton();
|
||||
});
|
||||
|
@ -469,39 +459,39 @@ function viewCerts() {
|
|||
}
|
||||
|
||||
async function addCACerts() {
|
||||
var fp = Cc[nsFilePicker].createInstance(nsIFilePicker);
|
||||
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let [importCa, fileCertSpec] = await document.l10n.formatValues([
|
||||
{id: "import-ca-certs-prompt"},
|
||||
{id: "file-browse-certificate-spec"},
|
||||
]);
|
||||
fp.init(window, importCa, nsIFilePicker.modeOpen);
|
||||
fp.init(window, importCa, Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilter(fileCertSpec, gCertFileTypes);
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterAll);
|
||||
fp.open(rv => {
|
||||
if (rv == nsIFilePicker.returnOK) {
|
||||
certdb.importCertsFromFile(fp.file, nsIX509Cert.CA_CERT);
|
||||
caTreeView.loadCerts(nsIX509Cert.CA_CERT);
|
||||
if (rv == Ci.nsIFilePicker.returnOK) {
|
||||
certdb.importCertsFromFile(fp.file, Ci.nsIX509Cert.CA_CERT);
|
||||
caTreeView.loadCerts(Ci.nsIX509Cert.CA_CERT);
|
||||
caTreeView.selection.clearSelection();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function addEmailCert() {
|
||||
var fp = Cc[nsFilePicker].createInstance(nsIFilePicker);
|
||||
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let [importEmail, fileCertSpec] = await document.l10n.formatValues([
|
||||
{id: "import-email-cert-prompt"},
|
||||
{id: "file-browse-certificate-spec"},
|
||||
]);
|
||||
fp.init(window, importEmail, nsIFilePicker.modeOpen);
|
||||
fp.init(window, importEmail, Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilter(fileCertSpec, gCertFileTypes);
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterAll);
|
||||
fp.open(rv => {
|
||||
if (rv == nsIFilePicker.returnOK) {
|
||||
certdb.importCertsFromFile(fp.file, nsIX509Cert.EMAIL_CERT);
|
||||
if (rv == Ci.nsIFilePicker.returnOK) {
|
||||
certdb.importCertsFromFile(fp.file, Ci.nsIX509Cert.EMAIL_CERT);
|
||||
var certcache = certdb.getCerts();
|
||||
emailTreeView.loadCertsFromCache(certcache, nsIX509Cert.EMAIL_CERT);
|
||||
emailTreeView.loadCertsFromCache(certcache, Ci.nsIX509Cert.EMAIL_CERT);
|
||||
emailTreeView.selection.clearSelection();
|
||||
caTreeView.loadCertsFromCache(certcache, nsIX509Cert.CA_CERT);
|
||||
caTreeView.loadCertsFromCache(certcache, Ci.nsIX509Cert.CA_CERT);
|
||||
caTreeView.selection.clearSelection();
|
||||
}
|
||||
});
|
||||
|
@ -511,6 +501,6 @@ function addException() {
|
|||
window.openDialog("chrome://pippki/content/exceptionDialog.xul", "",
|
||||
"chrome,centerscreen,modal");
|
||||
var certcache = certdb.getCerts();
|
||||
serverTreeView.loadCertsFromCache(certcache, nsIX509Cert.SERVER_CERT);
|
||||
serverTreeView.loadCertsFromCache(certcache, Ci.nsIX509Cert.SERVER_CERT);
|
||||
serverTreeView.selection.clearSelection();
|
||||
}
|
||||
|
|
|
@ -12,17 +12,6 @@
|
|||
* The cert to view, queryable to nsIX509Cert.
|
||||
*/
|
||||
|
||||
const nsIX509Cert = Ci.nsIX509Cert;
|
||||
const nsX509CertDB = "@mozilla.org/security/x509certdb;1";
|
||||
const nsIX509CertDB = Ci.nsIX509CertDB;
|
||||
const nsPK11TokenDB = "@mozilla.org/security/pk11tokendb;1";
|
||||
const nsIPK11TokenDB = Ci.nsIPK11TokenDB;
|
||||
const nsIASN1Object = Ci.nsIASN1Object;
|
||||
const nsIASN1Sequence = Ci.nsIASN1Sequence;
|
||||
const nsIASN1PrintableItem = Ci.nsIASN1PrintableItem;
|
||||
const nsIASN1Tree = Ci.nsIASN1Tree;
|
||||
const nsASN1Tree = "@mozilla.org/security/nsASN1Tree;1";
|
||||
|
||||
/**
|
||||
* Fills out the "Certificate Hierarchy" tree of the cert viewer "Details" tab.
|
||||
*
|
||||
|
@ -196,7 +185,7 @@ function addTreeItemToTreeChild(treeChild, label, value, addTwistie) {
|
|||
|
||||
function displaySelected() {
|
||||
var asn1Tree = document.getElementById("prettyDumpTree")
|
||||
.view.QueryInterface(nsIASN1Tree);
|
||||
.view.QueryInterface(Ci.nsIASN1Tree);
|
||||
var items = asn1Tree.selection;
|
||||
var certDumpVal = document.getElementById("certDumpVal");
|
||||
if (items.currentIndex != -1) {
|
||||
|
@ -208,8 +197,8 @@ function displaySelected() {
|
|||
}
|
||||
|
||||
function BuildPrettyPrint(cert) {
|
||||
var certDumpTree = Cc[nsASN1Tree].
|
||||
createInstance(nsIASN1Tree);
|
||||
var certDumpTree = Cc["@mozilla.org/security/nsASN1Tree;1"].
|
||||
createInstance(Ci.nsIASN1Tree);
|
||||
certDumpTree.loadASN1Structure(cert.ASN1Structure);
|
||||
document.getElementById("prettyDumpTree").view = certDumpTree;
|
||||
}
|
||||
|
@ -246,14 +235,14 @@ function DisplayGeneralDataFromCert(cert) {
|
|||
|
||||
function updateCertDump() {
|
||||
var asn1Tree = document.getElementById("prettyDumpTree")
|
||||
.view.QueryInterface(nsIASN1Tree);
|
||||
.view.QueryInterface(Ci.nsIASN1Tree);
|
||||
|
||||
var tree = document.getElementById("treesetDump");
|
||||
if (tree.currentIndex >= 0) {
|
||||
var item = tree.view.getItemAtIndex(tree.currentIndex);
|
||||
var dbKey = item.firstChild.firstChild.getAttribute("display");
|
||||
// Get the cert from the cert database
|
||||
var certdb = Cc[nsX509CertDB].getService(nsIX509CertDB);
|
||||
var certdb = Cc["@mozilla.org/security/x509certdb;1"].getService(Ci.nsIX509CertDB);
|
||||
var cert = certdb.findCertByDBKey(dbKey);
|
||||
asn1Tree.loadASN1Structure(cert.ASN1Structure);
|
||||
}
|
||||
|
@ -277,7 +266,7 @@ function getCurrentCert() {
|
|||
if (realIndex >= 0) {
|
||||
var item = tree.view.getItemAtIndex(realIndex);
|
||||
var dbKey = item.firstChild.firstChild.getAttribute("display");
|
||||
var certdb = Cc[nsX509CertDB].getService(nsIX509CertDB);
|
||||
var certdb = Cc["@mozilla.org/security/x509certdb;1"].getService(Ci.nsIX509CertDB);
|
||||
var cert = certdb.findCertByDBKey(dbKey);
|
||||
return cert;
|
||||
}
|
||||
|
|
|
@ -5,12 +5,6 @@
|
|||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const nsIPK11TokenDB = Ci.nsIPK11TokenDB;
|
||||
const nsPKCS11ModuleDB = "@mozilla.org/security/pkcs11moduledb;1";
|
||||
const nsIPKCS11ModuleDB = Ci.nsIPKCS11ModuleDB;
|
||||
const nsIPKCS11Slot = Ci.nsIPKCS11Slot;
|
||||
const nsIPK11Token = Ci.nsIPK11Token;
|
||||
|
||||
var params;
|
||||
var token;
|
||||
var pw1;
|
||||
|
@ -89,7 +83,7 @@ function setPassword(event) {
|
|||
// checkPasswords() should have prevented this path from being reached.
|
||||
} else {
|
||||
if (pw1.value == "") {
|
||||
var secmoddb = Cc[nsPKCS11ModuleDB].getService(nsIPKCS11ModuleDB);
|
||||
var secmoddb = Cc["@mozilla.org/security/pkcs11moduledb;1"].getService(Ci.nsIPKCS11ModuleDB);
|
||||
if (secmoddb.isFIPSEnabled) {
|
||||
// empty passwords are not allowed in FIPS mode
|
||||
doPrompt(bundle.getString("pw_change2empty_in_fips_mode"));
|
||||
|
|
|
@ -6,12 +6,10 @@
|
|||
/* import-globals-from pippki.js */
|
||||
"use strict";
|
||||
|
||||
const nsIDialogParamBlock = Ci.nsIDialogParamBlock;
|
||||
|
||||
var dialogParams;
|
||||
|
||||
function onLoad() {
|
||||
dialogParams = window.arguments[0].QueryInterface(nsIDialogParamBlock);
|
||||
dialogParams = window.arguments[0].QueryInterface(Ci.nsIDialogParamBlock);
|
||||
let selectElement = document.getElementById("tokens");
|
||||
let count = dialogParams.GetInt(0);
|
||||
for (let i = 0; i < count; i++) {
|
||||
|
|
|
@ -6,22 +6,12 @@
|
|||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
const nsIPKCS11Slot = Ci.nsIPKCS11Slot;
|
||||
const nsIPKCS11Module = Ci.nsIPKCS11Module;
|
||||
const nsPKCS11ModuleDB = "@mozilla.org/security/pkcs11moduledb;1";
|
||||
const nsIPKCS11ModuleDB = Ci.nsIPKCS11ModuleDB;
|
||||
const nsIPK11Token = Ci.nsIPK11Token;
|
||||
const nsPK11TokenDB = "@mozilla.org/security/pk11tokendb;1";
|
||||
const nsIPK11TokenDB = Ci.nsIPK11TokenDB;
|
||||
const nsIDialogParamBlock = Ci.nsIDialogParamBlock;
|
||||
const nsDialogParamBlock = "@mozilla.org/embedcomp/dialogparam;1";
|
||||
|
||||
var secmoddb;
|
||||
var skip_enable_buttons = false;
|
||||
|
||||
/* Do the initial load of all PKCS# modules and list them. */
|
||||
function LoadModules() {
|
||||
secmoddb = Cc[nsPKCS11ModuleDB].getService(nsIPKCS11ModuleDB);
|
||||
secmoddb = Cc["@mozilla.org/security/pkcs11moduledb;1"].getService(Ci.nsIPKCS11ModuleDB);
|
||||
RefreshDeviceList();
|
||||
}
|
||||
|
||||
|
@ -192,24 +182,24 @@ function showSlotInfo() {
|
|||
var present = true;
|
||||
ClearInfoList();
|
||||
switch (selected_slot.status) {
|
||||
case nsIPKCS11Slot.SLOT_DISABLED:
|
||||
case Ci.nsIPKCS11Slot.SLOT_DISABLED:
|
||||
AddInfoRow("devinfo-status", {l10nID: "devinfo-status-disabled"}, "tok_status");
|
||||
present = false;
|
||||
break;
|
||||
case nsIPKCS11Slot.SLOT_NOT_PRESENT:
|
||||
case Ci.nsIPKCS11Slot.SLOT_NOT_PRESENT:
|
||||
AddInfoRow("devinfo-status", {l10nID: "devinfo-status-not-present"}, "tok_status");
|
||||
present = false;
|
||||
break;
|
||||
case nsIPKCS11Slot.SLOT_UNINITIALIZED:
|
||||
case Ci.nsIPKCS11Slot.SLOT_UNINITIALIZED:
|
||||
AddInfoRow("devinfo-status", {l10nID: "devinfo-status-uninitialized"}, "tok_status");
|
||||
break;
|
||||
case nsIPKCS11Slot.SLOT_NOT_LOGGED_IN:
|
||||
case Ci.nsIPKCS11Slot.SLOT_NOT_LOGGED_IN:
|
||||
AddInfoRow("devinfo-status", {l10nID: "devinfo-status-not-logged-in"}, "tok_status");
|
||||
break;
|
||||
case nsIPKCS11Slot.SLOT_LOGGED_IN:
|
||||
case Ci.nsIPKCS11Slot.SLOT_LOGGED_IN:
|
||||
AddInfoRow("devinfo-status", {l10nID: "devinfo-status-logged-in"}, "tok_status");
|
||||
break;
|
||||
case nsIPKCS11Slot.SLOT_READY:
|
||||
case Ci.nsIPKCS11Slot.SLOT_READY:
|
||||
AddInfoRow("devinfo-status", {l10nID: "devinfo-status-ready"}, "tok_status");
|
||||
break;
|
||||
default:
|
||||
|
@ -321,8 +311,8 @@ async function doUnload() {
|
|||
|
||||
function changePassword() {
|
||||
getSelectedItem();
|
||||
let params = Cc[nsDialogParamBlock]
|
||||
.createInstance(nsIDialogParamBlock);
|
||||
let params = Cc["@mozilla.org/embedcomp/dialogparam;1"]
|
||||
.createInstance(Ci.nsIDialogParamBlock);
|
||||
let objects = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
|
||||
objects.appendElement(selected_slot.getToken());
|
||||
params.objects = objects;
|
||||
|
@ -349,7 +339,7 @@ function toggleFIPS() {
|
|||
// In FIPS mode the password must be non-empty.
|
||||
// This is different from what we allow in NON-Fips mode.
|
||||
|
||||
var tokendb = Cc[nsPK11TokenDB].getService(nsIPK11TokenDB);
|
||||
var tokendb = Cc["@mozilla.org/security/pk11tokendb;1"].getService(Ci.nsIPK11TokenDB);
|
||||
var internal_token = tokendb.getInternalKeyToken(); // nsIPK11Token
|
||||
if (!internal_token.hasPassword) {
|
||||
// Token has either no or an empty password.
|
||||
|
|
|
@ -11,7 +11,6 @@ var gChecking;
|
|||
var gBroken;
|
||||
var gNeedReset;
|
||||
var gSecHistogram;
|
||||
var gNsISecTel;
|
||||
|
||||
const {PrivateBrowsingUtils} = ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
|
||||
|
@ -19,7 +18,6 @@ function initExceptionDialog() {
|
|||
gNeedReset = false;
|
||||
gDialog = document.documentElement;
|
||||
gSecHistogram = Services.telemetry.getHistogramById("SECURITY_UI");
|
||||
gNsISecTel = Ci.nsISecurityUITelemetry;
|
||||
let warningText = document.getElementById("warningText");
|
||||
document.l10n.setAttributes(warningText, "add-exception-branded-warning");
|
||||
let confirmButton = gDialog.getButton("extra1");
|
||||
|
@ -191,7 +189,7 @@ function updateCertStatus() {
|
|||
var shortDesc3, longDesc3;
|
||||
var use2 = false;
|
||||
var use3 = false;
|
||||
let bucketId = gNsISecTel.WARNING_BAD_CERT_TOP_ADD_EXCEPTION_BASE;
|
||||
let bucketId = Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_ADD_EXCEPTION_BASE;
|
||||
let l10nUpdatedElements = [];
|
||||
if (gCert) {
|
||||
if (gBroken) {
|
||||
|
@ -203,13 +201,13 @@ function updateCertStatus() {
|
|||
var utl = "add-exception-unverified-or-bad-signature-long";
|
||||
var use1 = false;
|
||||
if (gSecInfo.isDomainMismatch) {
|
||||
bucketId += gNsISecTel.WARNING_BAD_CERT_TOP_ADD_EXCEPTION_FLAG_DOMAIN;
|
||||
bucketId += Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_ADD_EXCEPTION_FLAG_DOMAIN;
|
||||
use1 = true;
|
||||
shortDesc = mms;
|
||||
longDesc = mml;
|
||||
}
|
||||
if (gSecInfo.isNotValidAtThisTime) {
|
||||
bucketId += gNsISecTel.WARNING_BAD_CERT_TOP_ADD_EXCEPTION_FLAG_TIME;
|
||||
bucketId += Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_ADD_EXCEPTION_FLAG_TIME;
|
||||
if (!use1) {
|
||||
use1 = true;
|
||||
shortDesc = exs;
|
||||
|
@ -222,7 +220,7 @@ function updateCertStatus() {
|
|||
}
|
||||
if (gSecInfo.isUntrusted) {
|
||||
bucketId +=
|
||||
gNsISecTel.WARNING_BAD_CERT_TOP_ADD_EXCEPTION_FLAG_UNTRUSTED;
|
||||
Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_ADD_EXCEPTION_FLAG_UNTRUSTED;
|
||||
if (!use1) {
|
||||
use1 = true;
|
||||
shortDesc = uts;
|
||||
|
@ -318,7 +316,7 @@ function updateCertStatus() {
|
|||
* Handle user request to display certificate details
|
||||
*/
|
||||
function viewCertButtonClick() {
|
||||
gSecHistogram.add(gNsISecTel.WARNING_BAD_CERT_TOP_CLICK_VIEW_CERT);
|
||||
gSecHistogram.add(Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_CLICK_VIEW_CERT);
|
||||
if (gCert) {
|
||||
viewCertHelper(this, gCert);
|
||||
}
|
||||
|
@ -336,28 +334,28 @@ function addException() {
|
|||
.getService(Ci.nsICertOverrideService);
|
||||
var flags = 0;
|
||||
let confirmBucketId =
|
||||
gNsISecTel.WARNING_BAD_CERT_TOP_CONFIRM_ADD_EXCEPTION_BASE;
|
||||
Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_CONFIRM_ADD_EXCEPTION_BASE;
|
||||
if (gSecInfo.isUntrusted) {
|
||||
flags |= overrideService.ERROR_UNTRUSTED;
|
||||
confirmBucketId +=
|
||||
gNsISecTel.WARNING_BAD_CERT_TOP_CONFIRM_ADD_EXCEPTION_FLAG_UNTRUSTED;
|
||||
Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_CONFIRM_ADD_EXCEPTION_FLAG_UNTRUSTED;
|
||||
}
|
||||
if (gSecInfo.isDomainMismatch) {
|
||||
flags |= overrideService.ERROR_MISMATCH;
|
||||
confirmBucketId +=
|
||||
gNsISecTel.WARNING_BAD_CERT_TOP_CONFIRM_ADD_EXCEPTION_FLAG_DOMAIN;
|
||||
Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_CONFIRM_ADD_EXCEPTION_FLAG_DOMAIN;
|
||||
}
|
||||
if (gSecInfo.isNotValidAtThisTime) {
|
||||
flags |= overrideService.ERROR_TIME;
|
||||
confirmBucketId +=
|
||||
gNsISecTel.WARNING_BAD_CERT_TOP_CONFIRM_ADD_EXCEPTION_FLAG_TIME;
|
||||
Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_CONFIRM_ADD_EXCEPTION_FLAG_TIME;
|
||||
}
|
||||
|
||||
var permanentCheckbox = document.getElementById("permanent");
|
||||
var shouldStorePermanently = permanentCheckbox.checked &&
|
||||
!inPrivateBrowsingMode();
|
||||
if (!permanentCheckbox.checked) {
|
||||
gSecHistogram.add(gNsISecTel.WARNING_BAD_CERT_TOP_DONT_REMEMBER_EXCEPTION);
|
||||
gSecHistogram.add(Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_DONT_REMEMBER_EXCEPTION);
|
||||
}
|
||||
|
||||
gSecHistogram.add(confirmBucketId);
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче