Merge inbound to mozilla-central r=merge a=merge

This commit is contained in:
Margareta Eliza Balazs 2017-12-20 11:47:11 +02:00
Родитель 5c6d9cde51 14856e7b50
Коммит 060948a574
288 изменённых файлов: 8324 добавлений и 3195 удалений

Просмотреть файл

@ -214,9 +214,9 @@ XULMenuitemAccessible::KeyboardShortcut() const
nsAutoString keyCodeStr;
keyElm->GetAttr(kNameSpaceID_None, nsGkAtoms::keycode, keyCodeStr);
nsresult errorCode;
key = keyStr.ToInteger(&errorCode, kRadix10);
key = keyStr.ToInteger(&errorCode, /* aRadix = */ 10);
if (NS_FAILED(errorCode)) {
key = keyStr.ToInteger(&errorCode, kRadix16);
key = keyStr.ToInteger(&errorCode, /* aRadix = */ 16);
}
} else {
key = keyStr[0];

Просмотреть файл

@ -244,7 +244,7 @@ var gXPInstallObserver = {
notificationID = "xpinstall-disabled";
let secondaryActions = null;
if (gPrefService.prefIsLocked("xpinstall.enabled")) {
if (Services.prefs.prefIsLocked("xpinstall.enabled")) {
messageString = gNavigatorBundle.getString("xpinstallDisabledMessageLocked");
} else {
messageString = gNavigatorBundle.getString("xpinstallDisabledMessage");
@ -253,7 +253,7 @@ var gXPInstallObserver = {
label: gNavigatorBundle.getString("xpinstallDisabledButton"),
accessKey: gNavigatorBundle.getString("xpinstallDisabledButton.accesskey"),
callback: function editPrefs() {
gPrefService.setBoolPref("xpinstall.enabled", true);
Services.prefs.setBoolPref("xpinstall.enabled", true);
}
};

Просмотреть файл

@ -216,8 +216,8 @@ var ctrlTab = {
prefName: "browser.ctrlTab.previews",
readPref: function ctrlTab_readPref() {
var enable =
gPrefService.getBoolPref(this.prefName) &&
!gPrefService.getBoolPref("browser.ctrlTab.disallowForScreenReaders", false);
Services.prefs.getBoolPref(this.prefName) &&
!Services.prefs.getBoolPref("browser.ctrlTab.disallowForScreenReaders", false);
if (enable)
this.init();

Просмотреть файл

@ -43,14 +43,14 @@ var PointerlockFsWarning = {
showPointerLock(aOrigin) {
if (!document.fullscreen) {
let timeout = gPrefService.getIntPref("pointer-lock-api.warning.timeout");
let timeout = Services.prefs.getIntPref("pointer-lock-api.warning.timeout");
this.show(aOrigin, "pointerlock-warning", timeout, 0);
}
},
showFullScreen(aOrigin) {
let timeout = gPrefService.getIntPref("full-screen-api.warning.timeout");
let delay = gPrefService.getIntPref("full-screen-api.warning.delay");
let timeout = Services.prefs.getIntPref("full-screen-api.warning.timeout");
let delay = Services.prefs.getIntPref("full-screen-api.warning.delay");
this.show(aOrigin, "fullscreen-warning", timeout, delay);
},
@ -529,7 +529,7 @@ var FullScreen = {
_isPopupOpen: false,
_isChromeCollapsed: false,
_safeToCollapse() {
if (!gPrefService.getBoolPref("browser.fullscreen.autohide"))
if (!Services.prefs.getBoolPref("browser.fullscreen.autohide"))
return false;
// a popup menu is open in chrome: don't collapse chrome
@ -573,10 +573,10 @@ var FullScreen = {
// Autohide helpers for the context menu item
getAutohide(aItem) {
aItem.setAttribute("checked", gPrefService.getBoolPref("browser.fullscreen.autohide"));
aItem.setAttribute("checked", Services.prefs.getBoolPref("browser.fullscreen.autohide"));
},
setAutohide() {
gPrefService.setBoolPref("browser.fullscreen.autohide", !gPrefService.getBoolPref("browser.fullscreen.autohide"));
Services.prefs.setBoolPref("browser.fullscreen.autohide", !Services.prefs.getBoolPref("browser.fullscreen.autohide"));
// Try again to hide toolbar when we change the pref.
FullScreen.hideNavToolbox(true);
},
@ -612,7 +612,7 @@ var FullScreen = {
this._fullScrToggler.hidden = false;
if (aAnimate && gPrefService.getBoolPref("toolkit.cosmeticAnimations.enabled")) {
if (aAnimate && Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled")) {
gNavToolbox.setAttribute("fullscreenShouldAnimate", true);
// Hide the fullscreen toggler until the transition ends.
let listener = () => {

Просмотреть файл

@ -31,8 +31,8 @@ var FullZoom = {
get siteSpecific() {
if (this._siteSpecificPref === undefined) {
this._siteSpecificPref =
!gPrefService.getBoolPref("privacy.resistFingerprinting") &&
gPrefService.getBoolPref("browser.zoom.siteSpecific");
!Services.prefs.getBoolPref("privacy.resistFingerprinting") &&
Services.prefs.getBoolPref("browser.zoom.siteSpecific");
}
return this._siteSpecificPref;
},
@ -56,15 +56,15 @@ var FullZoom = {
this._cps2.addObserverForName(this.name, this);
this.updateBackgroundTabs =
gPrefService.getBoolPref("browser.zoom.updateBackgroundTabs");
Services.prefs.getBoolPref("browser.zoom.updateBackgroundTabs");
// Listen for changes to the browser.zoom branch so we can enable/disable
// updating background tabs and per-site saving and restoring of zoom levels.
gPrefService.addObserver("browser.zoom.", this, true);
Services.prefs.addObserver("browser.zoom.", this, true);
// Also need to listen to privacy.resistFingerprinting in order to update
// this._siteSpecificPref.
gPrefService.addObserver("privacy.resistFingerprinting", this, true);
Services.prefs.addObserver("privacy.resistFingerprinting", this, true);
// If we received onLocationChange events for any of the current browsers
// before we were initialized we want to replay those upon initialization.
@ -79,7 +79,7 @@ var FullZoom = {
},
destroy: function FullZoom_destroy() {
gPrefService.removeObserver("browser.zoom.", this);
Services.prefs.removeObserver("browser.zoom.", this);
this._cps2.removeObserverForName(this.name, this);
gBrowser.removeEventListener("ZoomChangeUsingMouseWheel", this);
},
@ -113,7 +113,7 @@ var FullZoom = {
break;
case "browser.zoom.updateBackgroundTabs":
this.updateBackgroundTabs =
gPrefService.getBoolPref("browser.zoom.updateBackgroundTabs");
Services.prefs.getBoolPref("browser.zoom.updateBackgroundTabs");
break;
}
break;

Просмотреть файл

@ -433,7 +433,7 @@ var gGestureSupport = {
getFunc = "Bool";
else if (type == "number")
getFunc = "Int";
return gPrefService["get" + getFunc + "Pref"](branch + aPref);
return Services.prefs["get" + getFunc + "Pref"](branch + aPref);
} catch (e) {
return aDef;
}
@ -1014,7 +1014,7 @@ var gHistorySwipeAnimation = {
* This limit is a global limit and is valid across all open tabs.
*/
_getMaxSnapshots: function HSA__getMaxSnapshots() {
return gPrefService.getIntPref("browser.snapshots.limit");
return Services.prefs.getIntPref("browser.snapshots.limit");
},
/**

Просмотреть файл

@ -108,10 +108,10 @@ var TrackingProtection = {
// Open the tracking protection introduction panel, if applicable.
if (this.enabledGlobally) {
let introCount = gPrefService.getIntPref("privacy.trackingprotection.introCount");
let introCount = Services.prefs.getIntPref("privacy.trackingprotection.introCount");
if (introCount < TrackingProtection.MAX_INTROS) {
gPrefService.setIntPref("privacy.trackingprotection.introCount", ++introCount);
gPrefService.savePrefFile(null);
Services.prefs.setIntPref("privacy.trackingprotection.introCount", ++introCount);
Services.prefs.savePrefFile(null);
this.showIntroPanel();
}
}
@ -188,9 +188,9 @@ var TrackingProtection = {
// This function may be called in private windows, but it does not change
// any preference unless Tracking Protection is enabled globally.
if (this.enabledGlobally) {
gPrefService.setIntPref("privacy.trackingprotection.introCount",
this.MAX_INTROS);
gPrefService.savePrefFile(null);
Services.prefs.setIntPref("privacy.trackingprotection.introCount",
this.MAX_INTROS);
Services.prefs.savePrefFile(null);
}
},

Просмотреть файл

@ -149,10 +149,6 @@ XPCOMUtils.defineLazyGetter(this, "gCustomizeMode", function() {
return new scope.CustomizeMode(window);
});
XPCOMUtils.defineLazyGetter(this, "gPrefService", function() {
return Services.prefs;
});
XPCOMUtils.defineLazyGetter(this, "InlineSpellCheckerUI", function() {
let tmp = {};
Cu.import("resource://gre/modules/InlineSpellChecker.jsm", tmp);
@ -606,7 +602,7 @@ var gPopupBlockerObserver = {
// notifications are per-browser, we don't need to worry about re-adding
// it.
if (!gBrowser.selectedBrowser.blockedPopups.reported) {
if (gPrefService.getBoolPref("privacy.popups.showBrowserMessage")) {
if (Services.prefs.getBoolPref("privacy.popups.showBrowserMessage")) {
var brandBundle = document.getElementById("bundle_brand");
var brandShortName = brandBundle.getString("brandShortName");
var popupCount = gBrowser.selectedBrowser.blockedPopups.length;
@ -699,7 +695,7 @@ var gPopupBlockerObserver = {
blockedPopupAllowSite.removeAttribute("disabled");
let blockedPopupDontShowMessage = document.getElementById("blockedPopupDontShowMessage");
let showMessage = gPrefService.getBoolPref("privacy.popups.showBrowserMessage");
let showMessage = Services.prefs.getBoolPref("privacy.popups.showBrowserMessage");
blockedPopupDontShowMessage.setAttribute("checked", !showMessage);
blockedPopupDontShowMessage.setAttribute("label", gNavigatorBundle.getString("popupWarningDontShowFromMessage"));
@ -817,8 +813,8 @@ var gPopupBlockerObserver = {
},
dontShowMessage() {
var showMessage = gPrefService.getBoolPref("privacy.popups.showBrowserMessage");
gPrefService.setBoolPref("privacy.popups.showBrowserMessage", !showMessage);
var showMessage = Services.prefs.getBoolPref("privacy.popups.showBrowserMessage");
Services.prefs.setBoolPref("privacy.popups.showBrowserMessage", !showMessage);
gBrowser.getNotificationBox().removeCurrentNotification();
}
};
@ -1279,7 +1275,7 @@ var gBrowserInit = {
gDragSpaceObserver.init();
}
let isResistFingerprintingEnabled = gPrefService.getBoolPref("privacy.resistFingerprinting");
let isResistFingerprintingEnabled = Services.prefs.getBoolPref("privacy.resistFingerprinting");
// Set a sane starting width/height for all resolutions on new profiles.
if (isResistFingerprintingEnabled) {
@ -1445,7 +1441,7 @@ var gBrowserInit = {
BookmarkingUI.init();
AutoShowBookmarksToolbar.init();
gPrefService.addObserver(gHomeButton.prefDomain, gHomeButton);
Services.prefs.addObserver(gHomeButton.prefDomain, gHomeButton);
var homeButton = document.getElementById("home-button");
gHomeButton.updateTooltip(homeButton);
@ -1476,7 +1472,7 @@ var gBrowserInit = {
PlacesToolbarHelper.init();
ctrlTab.readPref();
gPrefService.addObserver(ctrlTab.prefName, ctrlTab);
Services.prefs.addObserver(ctrlTab.prefName, ctrlTab);
// The object handling the downloads indicator is initialized here in the
// delayed startup function, but the actual indicator element is not loaded
@ -1832,7 +1828,7 @@ var gBrowserInit = {
if (Win7Features)
Win7Features.onCloseWindow();
gPrefService.removeObserver(ctrlTab.prefName, ctrlTab);
Services.prefs.removeObserver(ctrlTab.prefName, ctrlTab);
ctrlTab.uninit();
gBrowserThumbnails.uninit();
FullZoom.destroy();
@ -1852,7 +1848,7 @@ var gBrowserInit = {
window.messageManager.removeMessageListener("Browser:LoadURI", RedirectLoad);
try {
gPrefService.removeObserver(gHomeButton.prefDomain, gHomeButton);
Services.prefs.removeObserver(gHomeButton.prefDomain, gHomeButton);
} catch (ex) {
Cu.reportError(ex);
}
@ -2085,7 +2081,7 @@ function BrowserBack(aEvent) {
}
function BrowserHandleBackspace() {
switch (gPrefService.getIntPref("browser.backspace_action")) {
switch (Services.prefs.getIntPref("browser.backspace_action")) {
case 0:
BrowserBack();
break;
@ -2096,7 +2092,7 @@ function BrowserHandleBackspace() {
}
function BrowserHandleShiftBackspace() {
switch (gPrefService.getIntPref("browser.backspace_action")) {
switch (Services.prefs.getIntPref("browser.backspace_action")) {
case 0:
BrowserForward();
break;
@ -2292,8 +2288,8 @@ var gLastOpenDirectory = {
get path() {
if (!this._lastDir || !this._lastDir.exists()) {
try {
this._lastDir = gPrefService.getComplexValue("browser.open.lastDir",
Ci.nsIFile);
this._lastDir = Services.prefs.getComplexValue("browser.open.lastDir",
Ci.nsIFile);
if (!this._lastDir.exists())
this._lastDir = null;
} catch (e) {}
@ -2311,8 +2307,8 @@ var gLastOpenDirectory = {
// Don't save the last open directory pref inside the Private Browsing mode
if (!PrivateBrowsingUtils.isWindowPrivate(window))
gPrefService.setComplexValue("browser.open.lastDir", Ci.nsIFile,
this._lastDir);
Services.prefs.setComplexValue("browser.open.lastDir", Ci.nsIFile,
this._lastDir);
},
reset() {
this._lastDir = null;
@ -2878,7 +2874,7 @@ function UpdatePopupNotificationsVisibility() {
}
function PageProxyClickHandler(aEvent) {
if (aEvent.button == 1 && gPrefService.getBoolPref("middlemouse.paste"))
if (aEvent.button == 1 && Services.prefs.getBoolPref("middlemouse.paste"))
middleMousePaste(aEvent);
}
@ -3085,7 +3081,7 @@ var BrowserOnClick = {
getMeOutOfHere();
break;
case "ignore_warning_link":
if (gPrefService.getBoolPref("browser.safebrowsing.allowOverride")) {
if (Services.prefs.getBoolPref("browser.safebrowsing.allowOverride")) {
if (sendTelemetry) {
secHistogram.add(nsISecTel[bucketName + "IGNORE_WARNING"]);
}
@ -3517,7 +3513,7 @@ var homeButtonObserver = {
},
onDragOver(aEvent) {
if (gPrefService.prefIsLocked("browser.startup.homepage")) {
if (Services.prefs.prefIsLocked("browser.startup.homepage")) {
return;
}
browserDragAndDrop.dragOver(aEvent);
@ -3542,7 +3538,7 @@ function openHomeDialog(aURL) {
if (pressedVal == 0) {
try {
gPrefService.setStringPref("browser.startup.homepage", aURL);
Services.prefs.setStringPref("browser.startup.homepage", aURL);
} catch (ex) {
dump("Failed to set the home page.\n" + ex + "\n");
}
@ -3846,7 +3842,7 @@ const BrowserSearch = {
},
loadAddEngines: function BrowserSearch_loadAddEngines() {
var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow");
var newWindowPref = Services.prefs.getIntPref("browser.link.open_newwindow");
var where = newWindowPref == 3 ? "tab" : "window";
openUILinkIn(this.searchEnginesURL, where);
},
@ -5146,7 +5142,7 @@ nsBrowserAccess.prototype = {
return win.gBrowser.selectedBrowser;
}
let loadInBackground = gPrefService.getBoolPref("browser.tabs.loadDivertedInBackground");
let loadInBackground = Services.prefs.getBoolPref("browser.tabs.loadDivertedInBackground");
let tab = win.gBrowser.loadOneTab(aURI ? aURI.spec : "about:blank", {
triggeringPrincipal: aTriggeringPrincipal,
@ -5208,10 +5204,10 @@ nsBrowserAccess.prototype = {
if (aWhere == Ci.nsIBrowserDOMWindow.OPEN_DEFAULTWINDOW) {
if (isExternal &&
gPrefService.prefHasUserValue("browser.link.open_newwindow.override.external"))
aWhere = gPrefService.getIntPref("browser.link.open_newwindow.override.external");
Services.prefs.prefHasUserValue("browser.link.open_newwindow.override.external"))
aWhere = Services.prefs.getIntPref("browser.link.open_newwindow.override.external");
else
aWhere = gPrefService.getIntPref("browser.link.open_newwindow");
aWhere = Services.prefs.getIntPref("browser.link.open_newwindow");
}
let referrer = aOpener ? makeURI(aOpener.location.href) : null;
@ -5268,7 +5264,7 @@ nsBrowserAccess.prototype = {
referrerPolicy,
});
}
if (!gPrefService.getBoolPref("browser.tabs.loadDivertedInBackground"))
if (!Services.prefs.getBoolPref("browser.tabs.loadDivertedInBackground"))
window.focus();
}
return newWindow;
@ -5552,11 +5548,11 @@ var gDragSpaceObserver = {
init() {
this.update();
gPrefService.addObserver(this.pref, this);
Services.prefs.addObserver(this.pref, this);
},
uninit() {
gPrefService.removeObserver(this.pref, this);
Services.prefs.removeObserver(this.pref, this);
},
observe(aSubject, aTopic, aPrefName) {
@ -5568,7 +5564,7 @@ var gDragSpaceObserver = {
},
update() {
if (gPrefService.getBoolPref(this.pref)) {
if (Services.prefs.getBoolPref(this.pref)) {
document.documentElement.setAttribute("extradragspace", "true");
} else {
document.documentElement.removeAttribute("extradragspace");
@ -5587,13 +5583,13 @@ var gUIDensity = {
init() {
this.update();
gPrefService.addObserver(this.uiDensityPref, this);
gPrefService.addObserver(this.autoTouchModePref, this);
Services.prefs.addObserver(this.uiDensityPref, this);
Services.prefs.addObserver(this.autoTouchModePref, this);
},
uninit() {
gPrefService.removeObserver(this.uiDensityPref, this);
gPrefService.removeObserver(this.autoTouchModePref, this);
Services.prefs.removeObserver(this.uiDensityPref, this);
Services.prefs.removeObserver(this.autoTouchModePref, this);
},
observe(aSubject, aTopic, aPrefName) {
@ -5610,14 +5606,14 @@ var gUIDensity = {
// Automatically override the uidensity to touch in Windows tablet mode.
if (AppConstants.isPlatformAndVersionAtLeast("win", "10") &&
WindowsUIUtils.inTabletMode &&
gPrefService.getBoolPref(this.autoTouchModePref)) {
Services.prefs.getBoolPref(this.autoTouchModePref)) {
return { mode: this.MODE_TOUCH, overridden: true };
}
return { mode: gPrefService.getIntPref(this.uiDensityPref), overridden: false };
return { mode: Services.prefs.getIntPref(this.uiDensityPref), overridden: false };
},
setCurrentMode(mode) {
gPrefService.setIntPref(this.uiDensityPref, mode);
Services.prefs.setIntPref(this.uiDensityPref, mode);
},
update(mode) {
@ -5680,8 +5676,8 @@ var gHomeButton = {
getHomePage() {
var url;
try {
url = gPrefService.getComplexValue(this.prefDomain,
Components.interfaces.nsIPrefLocalizedString).data;
url = Services.prefs.getComplexValue(this.prefDomain,
Components.interfaces.nsIPrefLocalizedString).data;
} catch (e) {
}
@ -5867,8 +5863,8 @@ function contentAreaClick(event, isPanelClick) {
if (!href) {
// Not a link, handle middle mouse navigation.
if (event.button == 1 &&
gPrefService.getBoolPref("middlemouse.contentLoadURL") &&
!gPrefService.getBoolPref("general.autoScroll")) {
Services.prefs.getBoolPref("middlemouse.contentLoadURL") &&
!Services.prefs.getBoolPref("general.autoScroll")) {
middleMousePaste(event);
event.preventDefault();
}
@ -6341,7 +6337,7 @@ var BrowserOffline = {
_uiElement: null,
_updateOfflineUI(aOffline) {
var offlineLocked = gPrefService.prefIsLocked("network.online");
var offlineLocked = Services.prefs.prefIsLocked("network.online");
if (offlineLocked)
this._uiElement.setAttribute("disabled", "true");
@ -8167,7 +8163,7 @@ function getBrowser() {
const gAccessibilityServiceIndicator = {
init() {
// Pref to enable accessibility service indicator.
gPrefService.addObserver("accessibility.indicator.enabled", this);
Services.prefs.addObserver("accessibility.indicator.enabled", this);
// Accessibility service init/shutdown event.
Services.obs.addObserver(this, "a11y-init-or-shutdown");
this.update(Services.appinfo.accessibilityEnabled);
@ -8202,7 +8198,7 @@ const gAccessibilityServiceIndicator = {
},
get enabled() {
return gPrefService.getBoolPref("accessibility.indicator.enabled");
return Services.prefs.getBoolPref("accessibility.indicator.enabled");
},
handleEvent({ key, type }) {
@ -8216,7 +8212,7 @@ const gAccessibilityServiceIndicator = {
},
uninit() {
gPrefService.removeObserver("accessibility.indicator.enabled", this);
Services.prefs.removeObserver("accessibility.indicator.enabled", this);
Services.obs.removeObserver(this, "a11y-init-or-shutdown");
this.update();
}

Просмотреть файл

@ -133,8 +133,8 @@ nsContextMenu.prototype = {
this.isFrameImage = document.getElementById("isFrameImage");
this.ellipsis = "\u2026";
try {
this.ellipsis = gPrefService.getComplexValue("intl.ellipsis",
Ci.nsIPrefLocalizedString).data;
this.ellipsis = Services.prefs.getComplexValue("intl.ellipsis",
Ci.nsIPrefLocalizedString).data;
} catch (e) { }
// Reset after "on-build-contextmenu" notification in case selection was
@ -433,7 +433,7 @@ nsContextMenu.prototype = {
this.onLink || this.onTextInput);
var showInspect = this.inTabBrowser &&
gPrefService.getBoolPref("devtools.inspector.enabled", true);
Services.prefs.getBoolPref("devtools.inspector.enabled", true);
this.showItem("context-viewsource", shouldShow);
this.showItem("context-viewinfo", shouldShow);
@ -1179,7 +1179,7 @@ nsContextMenu.prototype = {
// fallback to the old way if we don't see the headers quickly
var timeToWait =
gPrefService.getIntPref("browser.download.saveLinkAsFilenameTimeout");
Services.prefs.getIntPref("browser.download.saveLinkAsFilenameTimeout");
var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
timer.initWithCallback(new timerCallback(), timeToWait,
timer.TYPE_ONE_SHOT);
@ -1383,8 +1383,8 @@ nsContextMenu.prototype = {
var locale = "-";
try {
locale = gPrefService.getComplexValue("intl.accept_languages",
Ci.nsIPrefLocalizedString).data;
locale = Services.prefs.getComplexValue("intl.accept_languages",
Ci.nsIPrefLocalizedString).data;
} catch (e) { }
var version = "-";
@ -1394,7 +1394,7 @@ nsContextMenu.prototype = {
uri = uri.replace(/%LOCALE%/, escape(locale)).replace(/%VERSION%/, version);
var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow");
var newWindowPref = Services.prefs.getIntPref("browser.link.open_newwindow");
var where = newWindowPref == 3 ? "tab" : "window";
openUILinkIn(uri, where);

Просмотреть файл

@ -17,15 +17,15 @@ function test() {
let tab2Zoom = ZoomManager.getZoomForBrowser(tab2.linkedBrowser);
is(tab2Zoom, tab1Zoom, "Zoom should affect background tabs");
gPrefService.setBoolPref("browser.zoom.updateBackgroundTabs", false);
Services.prefs.setBoolPref("browser.zoom.updateBackgroundTabs", false);
await FullZoom.reset();
gBrowser.selectedTab = tab1;
tab1Zoom = ZoomManager.getZoomForBrowser(tab1.linkedBrowser);
tab2Zoom = ZoomManager.getZoomForBrowser(tab2.linkedBrowser);
isnot(tab1Zoom, tab2Zoom, "Zoom should not affect background tabs");
if (gPrefService.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
gPrefService.clearUserPref("browser.zoom.updateBackgroundTabs");
if (Services.prefs.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
Services.prefs.clearUserPref("browser.zoom.updateBackgroundTabs");
await FullZoomHelper.removeTabAndWaitForLocationChange(tab1);
await FullZoomHelper.removeTabAndWaitForLocationChange(tab2);
})().then(finish, FullZoomHelper.failAndContinue(finish));

Просмотреть файл

@ -24,7 +24,7 @@ add_task(async function() {
});
// Tweak the expert mode pref
gPrefService.setBoolPref("browser.xul.error_pages.expert_bad_cert", true);
Services.prefs.setBoolPref("browser.xul.error_pages.expert_bad_cert", true);
promise = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser);
gBrowser.reload();
@ -39,6 +39,6 @@ add_task(async function() {
// Clean up
gBrowser.removeCurrentTab();
if (gPrefService.prefHasUserValue("browser.xul.error_pages.expert_bad_cert"))
gPrefService.clearUserPref("browser.xul.error_pages.expert_bad_cert");
if (Services.prefs.prefHasUserValue("browser.xul.error_pages.expert_bad_cert"))
Services.prefs.clearUserPref("browser.xul.error_pages.expert_bad_cert");
});

Просмотреть файл

@ -5,7 +5,7 @@ add_task(async function() {
isnot(document.activeElement, gURLBar.inputField, "location bar is not focused");
var tab = gBrowser.selectedTab;
gPrefService.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
Services.prefs.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
let tabClosedPromise = BrowserTestUtils.tabRemoved(tab);
EventUtils.synthesizeKey("w", { accelKey: true });
@ -15,6 +15,6 @@ add_task(async function() {
is(gBrowser.tabs.length, 1, "a new tab has been opened");
is(document.activeElement, gURLBar.inputField, "location bar is focused for the new tab");
if (gPrefService.prefHasUserValue("browser.tabs.closeWindowWithLastTab"))
gPrefService.clearUserPref("browser.tabs.closeWindowWithLastTab");
if (Services.prefs.prefHasUserValue("browser.tabs.closeWindowWithLastTab"))
Services.prefs.clearUserPref("browser.tabs.closeWindowWithLastTab");
});

Просмотреть файл

@ -5,15 +5,15 @@ function test() {
while (enumerator.hasMoreElements()) {
let win = enumerator.getNext();
if (win.content == contentWin) {
gPrefService.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
Services.prefs.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
win.gBrowser.removeCurrentTab();
ok(win.closed, "popup is closed");
// clean up
if (!win.closed)
win.close();
if (gPrefService.prefHasUserValue("browser.tabs.closeWindowWithLastTab"))
gPrefService.clearUserPref("browser.tabs.closeWindowWithLastTab");
if (Services.prefs.prefHasUserValue("browser.tabs.closeWindowWithLastTab"))
Services.prefs.clearUserPref("browser.tabs.closeWindowWithLastTab");
return;
}

Просмотреть файл

@ -7,8 +7,8 @@ function test() {
waitForExplicitFinish();
gPrefService.setBoolPref("browser.zoom.updateBackgroundTabs", true);
gPrefService.setBoolPref("browser.zoom.siteSpecific", true);
Services.prefs.setBoolPref("browser.zoom.updateBackgroundTabs", true);
Services.prefs.setBoolPref("browser.zoom.siteSpecific", true);
let uri = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
@ -31,11 +31,11 @@ function endTest() {
tab = null;
if (gPrefService.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
gPrefService.clearUserPref("browser.zoom.updateBackgroundTabs");
if (Services.prefs.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
Services.prefs.clearUserPref("browser.zoom.updateBackgroundTabs");
if (gPrefService.prefHasUserValue("browser.zoom.siteSpecific"))
gPrefService.clearUserPref("browser.zoom.siteSpecific");
if (Services.prefs.prefHasUserValue("browser.zoom.siteSpecific"))
Services.prefs.clearUserPref("browser.zoom.siteSpecific");
finish();
})();

Просмотреть файл

@ -10,8 +10,8 @@ function isUndoCloseEnabled() {
function test() {
waitForExplicitFinish();
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", 0);
gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo", 0);
Services.prefs.clearUserPref("browser.sessionstore.max_tabs_undo");
is(numClosedTabs(), 0, "There should be 0 closed tabs.");
ok(!isUndoCloseEnabled(), "Undo Close Tab should be disabled.");

Просмотреть файл

@ -18,7 +18,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
"resource://testing-common/PlacesTestUtils.jsm");
function setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
Services.prefs.setBoolPref("browser.altClickSave", true);
let testPage =
"data:text/html," +
@ -40,7 +40,7 @@ async function clean_up() {
// Remove download history.
await PlacesTestUtils.clearHistory();
gPrefService.clearUserPref("browser.altClickSave");
Services.prefs.clearUserPref("browser.altClickSave");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
}

Просмотреть файл

@ -42,10 +42,10 @@ var gTests = [
{
desc: "Shift+Alt left click",
setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
Services.prefs.setBoolPref("browser.altClickSave", true);
},
clean() {
gPrefService.clearUserPref("browser.altClickSave");
Services.prefs.clearUserPref("browser.altClickSave");
},
event: { shiftKey: true,
altKey: true },
@ -57,10 +57,10 @@ var gTests = [
{
desc: "Shift+Alt left click on XLinks",
setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
Services.prefs.setBoolPref("browser.altClickSave", true);
},
clean() {
gPrefService.clearUserPref("browser.altClickSave");
Services.prefs.clearUserPref("browser.altClickSave");
},
event: { shiftKey: true,
altKey: true },
@ -82,10 +82,10 @@ var gTests = [
{
desc: "Alt click",
setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
Services.prefs.setBoolPref("browser.altClickSave", true);
},
clean() {
gPrefService.clearUserPref("browser.altClickSave");
Services.prefs.clearUserPref("browser.altClickSave");
},
event: { altKey: true },
targets: [ "commonlink", "maplink" ],
@ -96,10 +96,10 @@ var gTests = [
{
desc: "Alt click on XLinks",
setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
Services.prefs.setBoolPref("browser.altClickSave", true);
},
clean() {
gPrefService.clearUserPref("browser.altClickSave");
Services.prefs.clearUserPref("browser.altClickSave");
},
event: { altKey: true },
targets: [ "mathxlink", "svgxlink" ],
@ -130,10 +130,10 @@ var gTests = [
{
desc: "Simple middle click openwin",
setup() {
gPrefService.setBoolPref("browser.tabs.opentabfor.middleclick", false);
Services.prefs.setBoolPref("browser.tabs.opentabfor.middleclick", false);
},
clean() {
gPrefService.clearUserPref("browser.tabs.opentabfor.middleclick");
Services.prefs.clearUserPref("browser.tabs.opentabfor.middleclick");
},
event: { button: 1 },
targets: [ "commonlink", "mathxlink", "svgxlink", "maplink" ],
@ -144,12 +144,12 @@ var gTests = [
{
desc: "Middle mouse paste",
setup() {
gPrefService.setBoolPref("middlemouse.contentLoadURL", true);
gPrefService.setBoolPref("general.autoScroll", false);
Services.prefs.setBoolPref("middlemouse.contentLoadURL", true);
Services.prefs.setBoolPref("general.autoScroll", false);
},
clean() {
gPrefService.clearUserPref("middlemouse.contentLoadURL");
gPrefService.clearUserPref("general.autoScroll");
Services.prefs.clearUserPref("middlemouse.contentLoadURL");
Services.prefs.clearUserPref("general.autoScroll");
},
event: { button: 1 },
targets: [ "emptylink" ],

Просмотреть файл

@ -1,5 +1,5 @@
add_task(async function() {
gPrefService.setBoolPref("browser.ctrlTab.previews", true);
Services.prefs.setBoolPref("browser.ctrlTab.previews", true);
BrowserTestUtils.addTab(gBrowser);
BrowserTestUtils.addTab(gBrowser);
@ -112,8 +112,8 @@ add_task(async function() {
}
// cleanup
if (gPrefService.prefHasUserValue("browser.ctrlTab.previews"))
gPrefService.clearUserPref("browser.ctrlTab.previews");
if (Services.prefs.prefHasUserValue("browser.ctrlTab.previews"))
Services.prefs.clearUserPref("browser.ctrlTab.previews");
/* private utility functions */
@ -150,7 +150,7 @@ add_task(async function() {
}
function canOpen() {
return gPrefService.getBoolPref("browser.ctrlTab.previews") && gBrowser.tabs.length > 2;
return Services.prefs.getBoolPref("browser.ctrlTab.previews") && gBrowser.tabs.length > 2;
}
function checkTabs(aTabs) {

Просмотреть файл

@ -342,14 +342,14 @@ function test_addCommand(prefName, id) {
cmd.setAttribute("oncommand", "this.callCount++;");
cmd.origPrefName = prefName;
cmd.origPrefValue = gPrefService.getCharPref(prefName);
gPrefService.setCharPref(prefName, id);
cmd.origPrefValue = Services.prefs.getCharPref(prefName);
Services.prefs.setCharPref(prefName, id);
return cmd;
}
function test_removeCommand(cmd) {
gPrefService.setCharPref(cmd.origPrefName, cmd.origPrefValue);
Services.prefs.setCharPref(cmd.origPrefName, cmd.origPrefValue);
test_commandset.removeChild(cmd);
}
@ -358,8 +358,8 @@ function test_latchedGesture(gesture, inc, dec, eventPrefix) {
let branch = test_prefBranch + gesture + ".";
// Put the gesture into latched mode.
let oldLatchedValue = gPrefService.getBoolPref(branch + "latched");
gPrefService.setBoolPref(branch + "latched", true);
let oldLatchedValue = Services.prefs.getBoolPref(branch + "latched");
Services.prefs.setBoolPref(branch + "latched", true);
// Install the test commands for increasing and decreasing motion.
let cmd = {
@ -372,7 +372,7 @@ function test_latchedGesture(gesture, inc, dec, eventPrefix) {
test_emitLatchedEvents(eventPrefix, -500, cmd);
// Restore the gesture to its original configuration.
gPrefService.setBoolPref(branch + "latched", oldLatchedValue);
Services.prefs.setBoolPref(branch + "latched", oldLatchedValue);
for (let dir in cmd)
test_removeCommand(cmd[dir]);
}
@ -382,12 +382,12 @@ function test_thresholdGesture(gesture, inc, dec, eventPrefix) {
let branch = test_prefBranch + gesture + ".";
// Disable latched mode for this gesture.
let oldLatchedValue = gPrefService.getBoolPref(branch + "latched");
gPrefService.setBoolPref(branch + "latched", false);
let oldLatchedValue = Services.prefs.getBoolPref(branch + "latched");
Services.prefs.setBoolPref(branch + "latched", false);
// Set the triggering threshold value to 50.
let oldThresholdValue = gPrefService.getIntPref(branch + "threshold");
gPrefService.setIntPref(branch + "threshold", 50);
let oldThresholdValue = Services.prefs.getIntPref(branch + "threshold");
Services.prefs.setIntPref(branch + "threshold", 50);
// Install the test commands for increasing and decreasing motion.
let cmdInc = test_addCommand(branch + inc, "test:incMotion");
@ -425,8 +425,8 @@ function test_thresholdGesture(gesture, inc, dec, eventPrefix) {
ok(cmdDec.callCount == 0, "Decreasing command was triggered");
// Restore the gesture to its original configuration.
gPrefService.setBoolPref(branch + "latched", oldLatchedValue);
gPrefService.setIntPref(branch + "threshold", oldThresholdValue);
Services.prefs.setBoolPref(branch + "latched", oldLatchedValue);
Services.prefs.setIntPref(branch + "threshold", oldThresholdValue);
test_removeCommand(cmdInc);
test_removeCommand(cmdDec);
}

Просмотреть файл

@ -19,7 +19,7 @@ add_task(async function() {
let s = new Sanitizer();
s.ignoreTimespan = false;
s.prefDomain = "privacy.cpd.";
var itemPrefs = gPrefService.getBranch(s.prefDomain);
var itemPrefs = Services.prefs.getBranch(s.prefDomain);
itemPrefs.setBoolPref("history", false);
itemPrefs.setBoolPref("downloads", false);
itemPrefs.setBoolPref("cache", false);

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function test() {
let s = new Sanitizer();
s.ignoreTimespan = false;
s.prefDomain = "privacy.cpd.";
var itemPrefs = gPrefService.getBranch(s.prefDomain);
var itemPrefs = Services.prefs.getBranch(s.prefDomain);
itemPrefs.setBoolPref("history", false);
itemPrefs.setBoolPref("downloads", false);
itemPrefs.setBoolPref("cache", false);

Просмотреть файл

@ -82,7 +82,7 @@ async function onHistoryReady() {
let s = new Sanitizer();
s.ignoreTimespan = false;
s.prefDomain = "privacy.cpd.";
var itemPrefs = gPrefService.getBranch(s.prefDomain);
var itemPrefs = Services.prefs.getBranch(s.prefDomain);
itemPrefs.setBoolPref("history", true);
itemPrefs.setBoolPref("downloads", true);
itemPrefs.setBoolPref("cache", false);

Просмотреть файл

@ -965,7 +965,7 @@ async function blankSlate() {
* Passed to is()
*/
function boolPrefIs(aPrefName, aExpectedVal, aMsg) {
is(gPrefService.getBoolPref("privacy." + aPrefName), aExpectedVal, aMsg);
is(Services.prefs.getBoolPref("privacy." + aPrefName), aExpectedVal, aMsg);
}
/**
@ -1008,7 +1008,7 @@ async function ensureDownloadsClearedState(aDownloadIDs, aShouldBeCleared) {
* Passed to is()
*/
function intPrefIs(aPrefName, aExpectedVal, aMsg) {
is(gPrefService.getIntPref("privacy." + aPrefName), aExpectedVal, aMsg);
is(Services.prefs.getIntPref("privacy." + aPrefName), aExpectedVal, aMsg);
}
/**

Просмотреть файл

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async function test() {
gPrefService.setBoolPref("browser.ctrlTab.previews", true);
Services.prefs.setBoolPref("browser.ctrlTab.previews", true);
let [origTab] = gBrowser.visibleTabs;
let tabOne = BrowserTestUtils.addTab(gBrowser);
@ -28,8 +28,8 @@ add_task(async function test() {
gBrowser.removeTab(tabOne);
gBrowser.removeTab(tabTwo);
if (gPrefService.prefHasUserValue("browser.ctrlTab.previews"))
gPrefService.clearUserPref("browser.ctrlTab.previews");
if (Services.prefs.prefHasUserValue("browser.ctrlTab.previews"))
Services.prefs.clearUserPref("browser.ctrlTab.previews");
});
function pressCtrlTab(aShiftKey) {

Просмотреть файл

@ -56,7 +56,7 @@ function promiseSanitizeHistory() {
let s = new Sanitizer();
s.prefDomain = "privacy.cpd.";
let prefs = gPrefService.getBranch(s.prefDomain);
let prefs = Services.prefs.getBranch(s.prefDomain);
prefs.setBoolPref("history", true);
prefs.setBoolPref("downloads", false);
prefs.setBoolPref("cache", false);

Просмотреть файл

@ -48,13 +48,6 @@ add_task(async function() {
inRange(r.x1, width * .75, width * .9)
},
{name: "bug 1394914 - sidebar toolbar icon should be visible at first paint",
condition: r => r.h == 13 && inRange(r.w, 14, 16) && // icon size
inRange(r.y1, 40, 80) && // in the toolbar
// near the right end of screen
inRange(r.x1, width - 100, width - 50)
},
{name: "bug 1403648 - urlbar should be focused at first paint",
condition: r => inRange(r.y2, 60, 80) && // in the toolbar
// taking 50% to 75% of the window width

Просмотреть файл

@ -98,13 +98,6 @@ add_task(async function() {
inRange(r.x1, width * .75, width * .9)
},
{name: "bug 1394914 - sidebar toolbar icon should be visible at first paint",
condition: r => r.h == 13 && inRange(r.w, 14, 16) && // icon size
inRange(r.y1, 40, 80) && // in the toolbar
// near the right end of screen
inRange(r.x1, width - 100, width - 50)
},
{name: "bug 1403648 - urlbar should be focused at first paint",
condition: r => inRange(r.y2, 60, 80) && // in the toolbar
// taking 50% to 75% of the window width

Просмотреть файл

@ -45,6 +45,15 @@ if (Services.appinfo.OS == "WINNT" || Services.appinfo.OS == "Darwin") {
],
times: 4, // This number should only ever go down - never up.
},
{
stack: [
"onOverflow@resource:///modules/CustomizableUI.jsm",
"init@resource:///modules/CustomizableUI.jsm",
"observe@resource:///modules/CustomizableUI.jsm",
"_delayedStartup@chrome://browser/content/browser.js",
],
times: 2, // This number should only ever go down - never up.
},
);
}

Просмотреть файл

@ -56,7 +56,7 @@ function setPrefs(cookies, pluginData) {
sanitizer = new Sanitizer();
sanitizer.ignoreTimespan = false;
sanitizer.prefDomain = "privacy.cpd.";
let itemPrefs = gPrefService.getBranch(sanitizer.prefDomain);
let itemPrefs = Services.prefs.getBranch(sanitizer.prefDomain);
itemPrefs.setBoolPref("history", false);
itemPrefs.setBoolPref("downloads", false);
itemPrefs.setBoolPref("cache", false);

Просмотреть файл

@ -60,12 +60,12 @@ add_task(async function() {
is(gURLBar.textValue, testURL, "gURLBar.textValue should be testURL after initial switch to deletedURLTab");
// simulate the user removing the whole url from the location bar
gPrefService.setBoolPref("browser.urlbar.clickSelectsAll", true);
Services.prefs.setBoolPref("browser.urlbar.clickSelectsAll", true);
await urlbarBackspace();
is(gURLBar.textValue, "", 'gURLBar.textValue should be "" (just set)');
if (gPrefService.prefHasUserValue("browser.urlbar.clickSelectsAll")) {
gPrefService.clearUserPref("browser.urlbar.clickSelectsAll");
if (Services.prefs.prefHasUserValue("browser.urlbar.clickSelectsAll")) {
Services.prefs.clearUserPref("browser.urlbar.clickSelectsAll");
}
}
@ -79,7 +79,7 @@ add_task(async function() {
is(gURLBar.textValue, testURL, "gURLBar.textValue should be testURL after initial switch to partialURLTab");
// simulate the user removing part of the url from the location bar
gPrefService.setBoolPref("browser.urlbar.clickSelectsAll", false);
Services.prefs.setBoolPref("browser.urlbar.clickSelectsAll", false);
let deleted = 0;
while (deleted < charsToDelete) {
@ -88,8 +88,8 @@ add_task(async function() {
}
is(gURLBar.textValue, testPartialURL, "gURLBar.textValue should be testPartialURL (just set)");
if (gPrefService.prefHasUserValue("browser.urlbar.clickSelectsAll")) {
gPrefService.clearUserPref("browser.urlbar.clickSelectsAll");
if (Services.prefs.prefHasUserValue("browser.urlbar.clickSelectsAll")) {
Services.prefs.clearUserPref("browser.urlbar.clickSelectsAll");
}
}

Просмотреть файл

@ -837,7 +837,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
break;
case (accel):
try {
suffix = gPrefService.getCharPref("browser.fixup.alternate.suffix");
suffix = Services.prefs.getCharPref("browser.fixup.alternate.suffix");
if (suffix.charAt(suffix.length - 1) != "/")
suffix += "/";
} catch (e) {

Просмотреть файл

@ -18,33 +18,14 @@
<constructor><![CDATA[
let scope = {};
Cu.import("resource:///modules/CustomizableUI.jsm", scope);
let CustomizableUI = scope.CustomizableUI;
// Add an early overflow event listener that will mark if the
// toolbar overflowed during construction.
if (scope.CustomizableUI.isAreaOverflowable(this.id)) {
if (CustomizableUI.isAreaOverflowable(this.id)) {
this.addEventListener("overflow", this);
this.addEventListener("underflow", this);
}
if (document.readyState == "complete") {
this._init();
} else {
// Need to wait until XUL overlays are loaded. See bug 554279.
let self = this;
document.addEventListener("readystatechange", function onReadyStateChange() {
if (document.readyState != "complete")
return;
document.removeEventListener("readystatechange", onReadyStateChange);
self._init();
});
}
]]></constructor>
<method name="_init">
<body><![CDATA[
let scope = {};
Cu.import("resource:///modules/CustomizableUI.jsm", scope);
let CustomizableUI = scope.CustomizableUI;
// Bug 989289: Forcibly set the now unsupported "mode" and "iconsize"
// attributes, just in case they accidentally get restored from
// persistence from a user that's been upgrading and downgrading.
@ -83,8 +64,7 @@
.filter(node => node.getAttribute("skipintoolbarset") != "true" && node.id)
.map(node => node.id);
CustomizableUI.registerToolbarNode(this, children);
]]></body>
</method>
]]></constructor>
<method name="handleEvent">
<parameter name="aEvent"/>

Просмотреть файл

@ -32,7 +32,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
BrowserUsageTelemetry: "resource:///modules/BrowserUsageTelemetry.jsm",
ContentClick: "resource:///modules/ContentClick.jsm",
ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.jsm",
CustomizableUI: "resource:///modules/CustomizableUI.jsm",
DateTimePickerHelper: "resource://gre/modules/DateTimePickerHelper.jsm",
DirectoryLinksProvider: "resource:///modules/DirectoryLinksProvider.jsm",
ExtensionsUI: "resource:///modules/ExtensionsUI.jsm",
@ -1170,10 +1169,6 @@ BrowserGlue.prototype = {
Services.tm.idleDispatchToMainThread(() => {
LanguagePrompt.init();
});
Services.tm.idleDispatchToMainThread(() => {
this._urlbarMatchBuckets.init();
});
},
/**
@ -2346,49 +2341,6 @@ BrowserGlue.prototype = {
}
},
// This keeps the browser.urlbar.matchBuckets pref updated depending on the
// placement of the searchbar.
_urlbarMatchBuckets: {
searchbarWidgetID: "search-container",
prefName: "browser.urlbar.matchBuckets",
searchbarPresentPrefValue: "general:5,suggestion:Infinity",
init() {
this._updatePref();
let checkWidget = widgetID => {
if (widgetID == this.searchbarWidgetID) {
this._updatePref();
}
};
CustomizableUI.addListener({
onWidgetAdded: checkWidget,
onWidgetRemoved: checkWidget,
});
},
_checkWidget(widgetID) {
if (widgetID == this.searchbarWidgetID) {
this._updatePref();
}
},
_updatePref() {
let pref = Services.prefs.getCharPref(this.prefName, "");
if (pref && pref != this.searchbarPresentPrefValue) {
// The user has customized the pref. Don't touch it.
return;
}
let placement =
CustomizableUI.getPlacementOfWidget(this.searchbarWidgetID);
if (placement) {
Services.prefs.setCharPref(this.prefName,
this.searchbarPresentPrefValue);
} else {
Services.prefs.clearUserPref(this.prefName);
}
},
},
// ------------------------------
// public nsIBrowserGlue members
// ------------------------------

Просмотреть файл

@ -307,13 +307,9 @@ var gEditItemOverlay = {
// Note: since all controls are collapsed by default, we don't get the
// default XUL dialog behavior, that selects the first control, so we set
// the focus explicitly.
// Note: If focusedElement === "preferred", this file expects gPrefService
// to be defined in the global scope.
let elt;
if (focusedElement === "preferred") {
/* eslint-disable no-undef */
elt = this._element(gPrefService.getCharPref("browser.bookmarks.editDialog.firstEditField"));
/* eslint-enable no-undef */
elt = this._element(Services.prefs.getCharPref("browser.bookmarks.editDialog.firstEditField"));
} else if (focusedElement === "first") {
elt = document.querySelector("textbox:not([collapsed=true])");
}

Просмотреть файл

@ -53,6 +53,7 @@ subsuite = clipboard
[browser_forgetthissite_single.js]
[browser_history_sidebar_search.js]
[browser_library_add_tags.js]
skip-if = (os == 'win' && ccov) # Bug 1423667
[browser_library_batch_delete.js]
skip-if = (os == 'win' && ccov) # Bug 1423667
[browser_library_commands.js]
@ -76,6 +77,8 @@ skip-if = (os == 'win' && ccov) # Bug 1423667
skip-if = (os == 'win' && ccov) # Bug 1423667
[browser_library_panel_leak.js]
skip-if = (os == 'win' && ccov) # Bug 1423667
[browser_library_remove_bookmark.js]
skip-if = (os == 'win' && ccov) # Bug 1423667
[browser_library_search.js]
skip-if = (os == 'win' && ccov) # Bug 1423667
[browser_library_views_liveupdate.js]

Просмотреть файл

@ -0,0 +1,67 @@
/**
* Test deleting bookmarks from library.
*/
"use strict";
add_task(async function test_remove_bookmark() {
const uris = [
"http://example.com/1",
"http://example.com/2",
"http://example.com/3",
];
let children = uris.map((uri, index) => {
return {
title: `bm${index}`,
url: uri,
};
});
// Insert Bookmarks.
await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.unfiledGuid,
children
});
// Open the Library and select the "UnfiledBookmarks".
let library = await promiseLibrary("UnfiledBookmarks");
let PO = library.PlacesOrganizer;
Assert.equal(PlacesUtils.getConcreteItemGuid(PO._places.selectedNode),
PlacesUtils.bookmarks.unfiledGuid, "Should have selected unfiled bookmarks.");
let contextMenu = library.document.getElementById("placesContext");
let contextMenuDeleteItem = library.document.getElementById("placesContext_delete");
let popupShownPromise = BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
let treeBoxObject = library.ContentTree.view.treeBoxObject;
let firstColumn = library.ContentTree.view.columns[0];
let firstBookmarkRect = treeBoxObject.getCoordsForCellItem(0, firstColumn, "bm0");
EventUtils.synthesizeMouse(
library.ContentTree.view.body,
firstBookmarkRect.x,
firstBookmarkRect.y,
{ type: "contextmenu", button: 2 },
library
);
await popupShownPromise;
Assert.equal(library.ContentTree.view.result.root.childCount, 3, "Number of bookmarks before removal is right");
let removePromise = PlacesTestUtils.waitForNotification("onItemRemoved", (itemId, parentId, index, type, uri, guid) => uri.spec == uris[0]);
EventUtils.synthesizeMouseAtCenter(contextMenuDeleteItem, {}, library);
await removePromise;
Assert.equal(library.ContentTree.view.result.root.childCount, 2, "Should have removed the bookmark from the display");
// Cleanup
registerCleanupFunction(async function() {
await promiseLibraryClosed(library);
await PlacesUtils.bookmarks.eraseEverything();
});
});

Просмотреть файл

@ -47,7 +47,7 @@ function sanitizeCache() {
s.ignoreTimespan = false;
s.prefDomain = "privacy.cpd.";
let prefs = gPrefService.getBranch(s.prefDomain);
let prefs = Services.prefs.getBranch(s.prefDomain);
prefs.setBoolPref("history", false);
prefs.setBoolPref("downloads", false);
prefs.setBoolPref("cache", true);

Просмотреть файл

@ -33,7 +33,7 @@ function test() {
function setupCleanSlate(win) {
win.gLastOpenDirectory.reset();
gPrefService.clearUserPref(kPrefName);
Services.prefs.clearUserPref(kPrefName);
}
setupCleanSlate(window);
@ -91,7 +91,7 @@ function test() {
// Test 3: the last open directory is set from a previous session, it should be used
// in normal mode
gPrefService.setComplexValue(kPrefName, Ci.nsIFile, dir1);
Services.prefs.setComplexValue(kPrefName, Ci.nsIFile, dir1);
is(nonPrivateWindow.gLastOpenDirectory.path.path, dir1.path,
"The pref set from last session should take effect outside the private browsing mode");
@ -101,7 +101,7 @@ function test() {
// Test 4: the last open directory is set from a previous session, it should be used
// in private browsing mode mode
gPrefService.setComplexValue(kPrefName, Ci.nsIFile, dir1);
Services.prefs.setComplexValue(kPrefName, Ci.nsIFile, dir1);
// test the private window
is(privateWindow.gLastOpenDirectory.path.path, dir1.path,
"The pref set from last session should take effect inside the private browsing mode");

Просмотреть файл

@ -6,11 +6,11 @@
// for the popup blocker menu.
add_task(async function test() {
let testURI = "http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/popup.html";
let oldPopupPolicy = gPrefService.getBoolPref("dom.disable_open_during_load");
gPrefService.setBoolPref("dom.disable_open_during_load", true);
let oldPopupPolicy = Services.prefs.getBoolPref("dom.disable_open_during_load");
Services.prefs.setBoolPref("dom.disable_open_during_load", true);
registerCleanupFunction(() => {
gPrefService.setBoolPref("dom.disable_open_during_load", oldPopupPolicy);
Services.prefs.setBoolPref("dom.disable_open_during_load", oldPopupPolicy);
});
function testPopupBlockerMenuItem(aExpectedDisabled, aWindow, aCallback) {

Просмотреть файл

@ -69,7 +69,7 @@ add_task(async function() {
// get closed tab count
let count = ss.getClosedTabCount(window);
let max_tabs_undo = gPrefService.getIntPref("browser.sessionstore.max_tabs_undo");
let max_tabs_undo = Services.prefs.getIntPref("browser.sessionstore.max_tabs_undo");
ok(0 <= count && count <= max_tabs_undo,
"getClosedTabCount returns zero or at most max_tabs_undo");
@ -79,8 +79,8 @@ add_task(async function() {
await promiseBrowserLoaded(tab.linkedBrowser);
// make sure that the next closed tab will increase getClosedTabCount
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo + 1);
registerCleanupFunction(() => gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo"));
Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo + 1);
registerCleanupFunction(() => Services.prefs.clearUserPref("browser.sessionstore.max_tabs_undo"));
// remove tab
await promiseRemoveTab(tab);

Просмотреть файл

@ -6,9 +6,9 @@
add_task(async function() {
// make sure that the next closed tab will increase getClosedTabCount
let max_tabs_undo = gPrefService.getIntPref("browser.sessionstore.max_tabs_undo");
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo + 1);
registerCleanupFunction(() => gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo"));
let max_tabs_undo = Services.prefs.getIntPref("browser.sessionstore.max_tabs_undo");
Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo + 1);
registerCleanupFunction(() => Services.prefs.clearUserPref("browser.sessionstore.max_tabs_undo"));
// Empty the list of closed tabs.
while (ss.getClosedTabCount(window)) {

Просмотреть файл

@ -10,17 +10,17 @@ function test() {
"browser/components/sessionstore/test/browser_447951_sample.html#";
// Make sure the functionality added in bug 943339 doesn't affect the results
gPrefService.setIntPref("browser.sessionstore.max_serialize_back", -1);
gPrefService.setIntPref("browser.sessionstore.max_serialize_forward", -1);
Services.prefs.setIntPref("browser.sessionstore.max_serialize_back", -1);
Services.prefs.setIntPref("browser.sessionstore.max_serialize_forward", -1);
registerCleanupFunction(function() {
gPrefService.clearUserPref("browser.sessionstore.max_serialize_back");
gPrefService.clearUserPref("browser.sessionstore.max_serialize_forward");
Services.prefs.clearUserPref("browser.sessionstore.max_serialize_back");
Services.prefs.clearUserPref("browser.sessionstore.max_serialize_forward");
});
let tab = BrowserTestUtils.addTab(gBrowser);
promiseBrowserLoaded(tab.linkedBrowser).then(() => {
let tabState = { entries: [] };
let max_entries = gPrefService.getIntPref("browser.sessionhistory.max_entries");
let max_entries = Services.prefs.getIntPref("browser.sessionhistory.max_entries");
for (let i = 0; i < max_entries; i++)
tabState.entries.push({ url: baseURL + i, triggeringPrincipal_base64});

Просмотреть файл

@ -34,8 +34,8 @@ function test() {
// Open a window and add the above closed tab list.
let newWin = openDialog(location, "", "chrome,all,dialog=no");
promiseWindowLoaded(newWin).then(() => {
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);
Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);
ss.setWindowState(newWin, JSON.stringify(test_state), true);
let closedTabs = SessionStore.getClosedTabData(newWin, false);
@ -78,7 +78,7 @@ function test() {
"... and tabs not specifically forgetten weren't");
// Clean up.
gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
Services.prefs.clearUserPref("browser.sessionstore.max_tabs_undo");
BrowserTestUtils.closeWindow(newWin).then(finish);
});
}

Просмотреть файл

@ -54,8 +54,8 @@ add_task(async function() {
// open a window and add the above closed tab list
let newWin = openDialog(location, "", "chrome,all,dialog=no");
await promiseWindowLoaded(newWin);
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);
Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);
ss.setWindowState(newWin, JSON.stringify(test_state), true);
let closedTabs = JSON.parse(ss.getClosedTabData(newWin));
@ -77,6 +77,6 @@ add_task(async function() {
is(countByTitle(closedTabs, REMEMBER), remember_count,
"... and tabs to be remembered weren't.");
// clean up
gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
Services.prefs.clearUserPref("browser.sessionstore.max_tabs_undo");
await BrowserTestUtils.closeWindow(newWin);
});

Просмотреть файл

@ -81,8 +81,8 @@ function test() {
// open a window and add the above closed window list
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
promiseWindowLoaded(newWin).then(() => {
gPrefService.setIntPref("browser.sessionstore.max_windows_undo",
test_state._closedWindows.length);
Services.prefs.setIntPref("browser.sessionstore.max_windows_undo",
test_state._closedWindows.length);
ss.setWindowState(newWin, JSON.stringify(test_state), true);
let closedWindows = JSON.parse(ss.getClosedWindowData());
@ -113,7 +113,7 @@ function test() {
"... and windows not specifically forgetten weren't.");
// clean up
gPrefService.clearUserPref("browser.sessionstore.max_windows_undo");
Services.prefs.clearUserPref("browser.sessionstore.max_windows_undo");
BrowserTestUtils.closeWindow(newWin).then(finish);
});
}

Просмотреть файл

@ -38,7 +38,7 @@ function test() {
const PREF_INTERVAL = "browser.sessionstore.interval";
// make sure sessionstore.js is saved ASAP on all events
gPrefService.setIntPref(PREF_INTERVAL, 0);
Services.prefs.setIntPref(PREF_INTERVAL, 0);
// get the initial sessionstore.js mtime (-1 if it doesn't exist yet)
let mtime0 = getSessionstorejsModificationTime();
@ -62,8 +62,8 @@ function test() {
"tab selection and scrolling: sessionstore.js not updated");
// ok, done, cleanup and finish
if (gPrefService.prefHasUserValue(PREF_INTERVAL))
gPrefService.clearUserPref(PREF_INTERVAL);
if (Services.prefs.prefHasUserValue(PREF_INTERVAL))
Services.prefs.clearUserPref(PREF_INTERVAL);
gBrowser.removeTab(tab);
finish();
}, 3500); // end of sleep after tab selection and scrolling

Просмотреть файл

@ -7,8 +7,8 @@ const WINDOW_ATTRIBUTES = ["width", "height", "screenX", "screenY", "sizemode"];
var stateBackup = ss.getBrowserState();
var originalWarnOnClose = gPrefService.getBoolPref("browser.tabs.warnOnClose");
var originalStartupPage = gPrefService.getIntPref("browser.startup.page");
var originalWarnOnClose = Services.prefs.getBoolPref("browser.tabs.warnOnClose");
var originalStartupPage = Services.prefs.getIntPref("browser.startup.page");
var originalWindowType = document.documentElement.getAttribute("windowtype");
var gotLastWindowClosedTopic = false;
@ -108,9 +108,9 @@ function test() {
requestLongerTimeout(2);
// We don't want the quit dialog pref
gPrefService.setBoolPref("browser.tabs.warnOnClose", false);
Services.prefs.setBoolPref("browser.tabs.warnOnClose", false);
// Ensure that we would restore the session (important for Windows)
gPrefService.setIntPref("browser.startup.page", 3);
Services.prefs.setIntPref("browser.startup.page", 3);
runNextTestOrFinish();
}
@ -121,8 +121,8 @@ function runNextTestOrFinish() {
} else {
// some state is cleaned up at the end of each test, but not all
["browser.tabs.warnOnClose", "browser.startup.page"].forEach(function(p) {
if (gPrefService.prefHasUserValue(p))
gPrefService.clearUserPref(p);
if (Services.prefs.prefHasUserValue(p))
Services.prefs.clearUserPref(p);
});
ss.setBrowserState(stateBackup);

Просмотреть файл

@ -32,7 +32,7 @@ add_task(async function() {
};
const maxTabsUndo = 4;
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", maxTabsUndo);
Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo", maxTabsUndo);
// Open a new window and restore it to an initial state.
let win = await promiseNewWindowLoaded({private: false});
@ -64,7 +64,7 @@ add_task(async function() {
}
// Clean up.
gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
Services.prefs.clearUserPref("browser.sessionstore.max_tabs_undo");
await BrowserTestUtils.closeWindow(win);
});

Просмотреть файл

@ -5,4 +5,3 @@ skip-if = !updater
reason = test depends on update channel
[browser_contentpermissionprompt.js]
[browser_default_bookmark_toolbar_visibility.js]
[browser_urlbar_matchBuckets.js]

Просмотреть файл

@ -117,12 +117,12 @@ function test() {
// and we will assume it is default.
Services.prefs.clearUserPref("browser.startup.page");
if (gPrefService.prefHasUserValue(PREF_MSTONE)) {
gOriginalMStone = gPrefService.getCharPref(PREF_MSTONE);
if (Services.prefs.prefHasUserValue(PREF_MSTONE)) {
gOriginalMStone = Services.prefs.getCharPref(PREF_MSTONE);
}
if (gPrefService.prefHasUserValue(PREF_OVERRIDE_URL)) {
gOriginalOverrideURL = gPrefService.getCharPref(PREF_OVERRIDE_URL);
if (Services.prefs.prefHasUserValue(PREF_OVERRIDE_URL)) {
gOriginalOverrideURL = Services.prefs.getCharPref(PREF_OVERRIDE_URL);
}
testDefaultArgs();
@ -174,17 +174,17 @@ function finish_test() {
// Reset browser.startup.homepage_override.mstone to the original value or
// clear it if it didn't exist.
if (gOriginalMStone) {
gPrefService.setCharPref(PREF_MSTONE, gOriginalMStone);
} else if (gPrefService.prefHasUserValue(PREF_MSTONE)) {
gPrefService.clearUserPref(PREF_MSTONE);
Services.prefs.setCharPref(PREF_MSTONE, gOriginalMStone);
} else if (Services.prefs.prefHasUserValue(PREF_MSTONE)) {
Services.prefs.clearUserPref(PREF_MSTONE);
}
// Reset startup.homepage_override_url to the original value or clear it if
// it didn't exist.
if (gOriginalOverrideURL) {
gPrefService.setCharPref(PREF_OVERRIDE_URL, gOriginalOverrideURL);
} else if (gPrefService.prefHasUserValue(PREF_OVERRIDE_URL)) {
gPrefService.clearUserPref(PREF_OVERRIDE_URL);
Services.prefs.setCharPref(PREF_OVERRIDE_URL, gOriginalOverrideURL);
} else if (Services.prefs.prefHasUserValue(PREF_OVERRIDE_URL)) {
Services.prefs.clearUserPref(PREF_OVERRIDE_URL);
}
writeUpdatesToXMLFile(XML_EMPTY);
@ -200,9 +200,9 @@ function testDefaultArgs() {
// if it isn't already set.
Cc["@mozilla.org/browser/clh;1"].getService(Ci.nsIBrowserHandler).defaultArgs;
let originalMstone = gPrefService.getCharPref(PREF_MSTONE);
let originalMstone = Services.prefs.getCharPref(PREF_MSTONE);
gPrefService.setCharPref(PREF_OVERRIDE_URL, DEFAULT_PREF_URL);
Services.prefs.setCharPref(PREF_OVERRIDE_URL, DEFAULT_PREF_URL);
writeUpdatesToXMLFile(XML_EMPTY);
reloadUpdateManagerData();
@ -240,11 +240,11 @@ function testDefaultArgs() {
}
if (testCase.noMstoneChange === undefined) {
gPrefService.setCharPref(PREF_MSTONE, "PreviousMilestone");
Services.prefs.setCharPref(PREF_MSTONE, "PreviousMilestone");
}
if (testCase.noPostUpdatePref == undefined) {
gPrefService.setBoolPref(PREF_POSTUPDATE, true);
Services.prefs.setBoolPref(PREF_POSTUPDATE, true);
}
let defaultArgs = Cc["@mozilla.org/browser/clh;1"].
@ -252,13 +252,13 @@ function testDefaultArgs() {
is(defaultArgs, overrideArgs, "correct value returned by defaultArgs");
if (testCase.noMstoneChange === undefined || testCase.noMstoneChange != true) {
let newMstone = gPrefService.getCharPref(PREF_MSTONE);
let newMstone = Services.prefs.getCharPref(PREF_MSTONE);
is(originalMstone, newMstone, "preference " + PREF_MSTONE +
" should have been updated");
}
if (gPrefService.prefHasUserValue(PREF_POSTUPDATE)) {
gPrefService.clearUserPref(PREF_POSTUPDATE);
if (Services.prefs.prefHasUserValue(PREF_POSTUPDATE)) {
Services.prefs.clearUserPref(PREF_POSTUPDATE);
}
}
@ -324,7 +324,7 @@ function testShowNotification() {
}
reloadUpdateManagerData();
gPrefService.setBoolPref(PREF_POSTUPDATE, true);
Services.prefs.setBoolPref(PREF_POSTUPDATE, true);
gBG.observe(null, "browser-glue-test", "post-update-notification");
@ -367,7 +367,7 @@ function testShowNotification() {
ok(!updateBox, "Update notification box should not have been displayed");
}
let prefHasUserValue = gPrefService.prefHasUserValue(PREF_POSTUPDATE);
let prefHasUserValue = Services.prefs.prefHasUserValue(PREF_POSTUPDATE);
is(prefHasUserValue, false, "preference " + PREF_POSTUPDATE +
" shouldn't have a user value");
}

Просмотреть файл

@ -1,80 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Makes sure the browser.urlbar.matchBuckets pref is correct and updated when
// the searchbar is added to or removed from the UI.
const SEARCHBAR_WIDGET_ID = "search-container";
const PREF_NAME = "browser.urlbar.matchBuckets";
const SEARCHBAR_PRESENT_PREF_VALUE = "general:5,suggestion:Infinity";
// nsBrowserGlue initializes the relevant code via idleDispatchToMainThread(),
// so to make sure this test runs after that happens, first run a dummy task
// that queues an idle callback.
add_task(async function waitForIdle() {
await TestUtils.waitForIdle();
});
add_task(async function test() {
// Initial checks.
Assert.equal(CustomizableUI.getPlacementOfWidget(SEARCHBAR_WIDGET_ID), null,
"Sanity check: searchbar should not be placed initially");
Assert.equal(Services.prefs.getCharPref(PREF_NAME, ""), "",
"Sanity check: pref should be cleared initially");
// Add the searchbar. The pref should be set.
let widgetPromise = promiseWidget("onWidgetAdded");
CustomizableUI.addWidgetToArea(SEARCHBAR_WIDGET_ID,
CustomizableUI.AREA_NAVBAR);
info("Waiting for searchbar to be added");
await widgetPromise;
Assert.equal(Services.prefs.getCharPref(PREF_NAME),
SEARCHBAR_PRESENT_PREF_VALUE,
"Pref should be set after adding searchbar");
// Remove the searchbar. The pref should be cleared.
widgetPromise = promiseWidget("onWidgetRemoved");
CustomizableUI.removeWidgetFromArea(SEARCHBAR_WIDGET_ID);
info("Waiting for searchbar to be removed");
await widgetPromise;
Assert.equal(Services.prefs.getCharPref(PREF_NAME, ""), "",
"Pref should be cleared after removing searchbar");
// Customize the pref.
let customizedPref = "extension:1," + SEARCHBAR_PRESENT_PREF_VALUE;
Services.prefs.setCharPref(PREF_NAME, customizedPref);
// Add the searchbar again. Since the pref is customized, it shouldn't be
// changed.
widgetPromise = promiseWidget("onWidgetAdded");
CustomizableUI.addWidgetToArea(SEARCHBAR_WIDGET_ID,
CustomizableUI.AREA_NAVBAR);
info("Waiting for searchbar to be added");
await widgetPromise;
Assert.equal(Services.prefs.getCharPref(PREF_NAME), customizedPref,
"Customized pref should remain same after adding searchbar");
// Remove the searchbar again. Since the pref is customized, it shouldn't be
// changed.
widgetPromise = promiseWidget("onWidgetRemoved");
CustomizableUI.removeWidgetFromArea(SEARCHBAR_WIDGET_ID);
info("Waiting for searchbar to be removed");
await widgetPromise;
Assert.equal(Services.prefs.getCharPref(PREF_NAME), customizedPref,
"Customized pref should remain same after removing searchbar");
Services.prefs.clearUserPref(PREF_NAME);
});
function promiseWidget(observerName) {
return new Promise(resolve => {
let listener = {};
listener[observerName] = widgetID => {
if (widgetID == SEARCHBAR_WIDGET_ID) {
CustomizableUI.removeListener(listener);
executeSoon(resolve);
}
};
CustomizableUI.addListener(listener);
});
}

Просмотреть файл

@ -14,6 +14,7 @@ head = head.js
[browser_Storage.js]
[browser_Heartbeat.js]
[browser_RecipeRunner.js]
skip-if = true # bug 1424400
[browser_LogManager.js]
[browser_ClientEnvironment.js]
[browser_ShieldRecipeClient.js]

Просмотреть файл

@ -19,7 +19,7 @@ function test() {
waitForExplicitFinish();
gPrefService.setBoolPref(ENABLE_PREF_NAME, true);
Services.prefs.setBoolPref(ENABLE_PREF_NAME, true);
is(1, AeroPeek.windows.length, "Got the expected number of windows");
@ -34,10 +34,10 @@ function test() {
for (let preview of AeroPeek.previews)
ok(preview.visible, "Preview is shown as expected");
gPrefService.setBoolPref(ENABLE_PREF_NAME, false);
Services.prefs.setBoolPref(ENABLE_PREF_NAME, false);
is(0, AeroPeek.previews.length, "Should have 0 previews when disabled");
gPrefService.setBoolPref(ENABLE_PREF_NAME, true);
Services.prefs.setBoolPref(ENABLE_PREF_NAME, true);
checkPreviews(4, "Previews are back when re-enabling");
for (let preview of AeroPeek.previews)
ok(preview.visible, "Preview is shown as expected after re-enabling");
@ -78,8 +78,8 @@ function test() {
getPreviewForTab(gBrowser.tabs[1]).controller.onClose();
checkPreviews(1);
if (gPrefService.prefHasUserValue(ENABLE_PREF_NAME))
gPrefService.setBoolPref(ENABLE_PREF_NAME, !gPrefService.getBoolPref(ENABLE_PREF_NAME));
if (Services.prefs.prefHasUserValue(ENABLE_PREF_NAME))
Services.prefs.setBoolPref(ENABLE_PREF_NAME, !Services.prefs.getBoolPref(ENABLE_PREF_NAME));
finish();

Просмотреть файл

@ -12,6 +12,7 @@
"cc": "cl.exe",
"cxx": "cl.exe",
"patches": [
"r318309.patch",
"msvc-host-x64.patch",
"loosen-msvc-detection.patch"
]

Просмотреть файл

@ -13,6 +13,7 @@
"cxx": "cl.exe",
"ml": "ml64.exe",
"patches": [
"r318309.patch",
"loosen-msvc-detection.patch",
"hide-gcda-profiling-symbols.patch",
"fflush-before-unlocking.patch"

Просмотреть файл

@ -0,0 +1,279 @@
From a53ee5453ba652fc640467847415dd44c24fed02 Mon Sep 17 00:00:00 2001
From: Hans Wennborg <hans@hanshq.net>
Date: Wed, 15 Nov 2017 17:11:53 +0000
Subject: [PATCH] BuiltinOperatorOverloadBuilder: Don't consider types that are
unavailable on the target (PR35174)
In the PR, Clang ended up in a situation where it tried to mangle the
__float128 type, which isn't supported when targetingt MSVC, because
Clang instantiated a variable template with that type when searching for
a conversion to use in an arithmetic expression.
Differential revision: https://reviews.llvm.org/D39579
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318309 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index f4b8b4e34a8..fa6279800dc 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -7615,53 +7615,62 @@ class BuiltinOperatorOverloadBuilder {
SmallVectorImpl<BuiltinCandidateTypeSet> &CandidateTypes;
OverloadCandidateSet &CandidateSet;
- // Define some constants used to index and iterate over the arithemetic types
- // provided via the getArithmeticType() method below.
- // The "promoted arithmetic types" are the arithmetic
+ static constexpr int ArithmeticTypesCap = 24;
+ SmallVector<CanQualType, ArithmeticTypesCap> ArithmeticTypes;
+
+ // Define some indices used to iterate over the arithemetic types in
+ // ArithmeticTypes. The "promoted arithmetic types" are the arithmetic
// types are that preserved by promotion (C++ [over.built]p2).
- static const unsigned FirstIntegralType = 4;
- static const unsigned LastIntegralType = 21;
- static const unsigned FirstPromotedIntegralType = 4,
- LastPromotedIntegralType = 12;
- static const unsigned FirstPromotedArithmeticType = 0,
- LastPromotedArithmeticType = 12;
- static const unsigned NumArithmeticTypes = 21;
-
- /// \brief Get the canonical type for a given arithmetic type index.
- CanQualType getArithmeticType(unsigned index) {
- assert(index < NumArithmeticTypes);
- static CanQualType ASTContext::* const
- ArithmeticTypes[NumArithmeticTypes] = {
- // Start of promoted types.
- &ASTContext::FloatTy,
- &ASTContext::DoubleTy,
- &ASTContext::LongDoubleTy,
- &ASTContext::Float128Ty,
-
- // Start of integral types.
- &ASTContext::IntTy,
- &ASTContext::LongTy,
- &ASTContext::LongLongTy,
- &ASTContext::Int128Ty,
- &ASTContext::UnsignedIntTy,
- &ASTContext::UnsignedLongTy,
- &ASTContext::UnsignedLongLongTy,
- &ASTContext::UnsignedInt128Ty,
- // End of promoted types.
-
- &ASTContext::BoolTy,
- &ASTContext::CharTy,
- &ASTContext::WCharTy,
- &ASTContext::Char16Ty,
- &ASTContext::Char32Ty,
- &ASTContext::SignedCharTy,
- &ASTContext::ShortTy,
- &ASTContext::UnsignedCharTy,
- &ASTContext::UnsignedShortTy,
- // End of integral types.
- // FIXME: What about complex? What about half?
- };
- return S.Context.*ArithmeticTypes[index];
+ unsigned FirstIntegralType,
+ LastIntegralType;
+ unsigned FirstPromotedIntegralType,
+ LastPromotedIntegralType;
+ unsigned FirstPromotedArithmeticType,
+ LastPromotedArithmeticType;
+ unsigned NumArithmeticTypes;
+
+ void InitArithmeticTypes() {
+ // Start of promoted types.
+ FirstPromotedArithmeticType = 0;
+ ArithmeticTypes.push_back(S.Context.FloatTy);
+ ArithmeticTypes.push_back(S.Context.DoubleTy);
+ ArithmeticTypes.push_back(S.Context.LongDoubleTy);
+ if (S.Context.getTargetInfo().hasFloat128Type())
+ ArithmeticTypes.push_back(S.Context.Float128Ty);
+
+ // Start of integral types.
+ FirstIntegralType = ArithmeticTypes.size();
+ FirstPromotedIntegralType = ArithmeticTypes.size();
+ ArithmeticTypes.push_back(S.Context.IntTy);
+ ArithmeticTypes.push_back(S.Context.LongTy);
+ ArithmeticTypes.push_back(S.Context.LongLongTy);
+ if (S.Context.getTargetInfo().hasInt128Type())
+ ArithmeticTypes.push_back(S.Context.Int128Ty);
+ ArithmeticTypes.push_back(S.Context.UnsignedIntTy);
+ ArithmeticTypes.push_back(S.Context.UnsignedLongTy);
+ ArithmeticTypes.push_back(S.Context.UnsignedLongLongTy);
+ if (S.Context.getTargetInfo().hasInt128Type())
+ ArithmeticTypes.push_back(S.Context.UnsignedInt128Ty);
+ LastPromotedIntegralType = ArithmeticTypes.size();
+ LastPromotedArithmeticType = ArithmeticTypes.size();
+ // End of promoted types.
+
+ ArithmeticTypes.push_back(S.Context.BoolTy);
+ ArithmeticTypes.push_back(S.Context.CharTy);
+ ArithmeticTypes.push_back(S.Context.WCharTy);
+ ArithmeticTypes.push_back(S.Context.Char16Ty);
+ ArithmeticTypes.push_back(S.Context.Char32Ty);
+ ArithmeticTypes.push_back(S.Context.SignedCharTy);
+ ArithmeticTypes.push_back(S.Context.ShortTy);
+ ArithmeticTypes.push_back(S.Context.UnsignedCharTy);
+ ArithmeticTypes.push_back(S.Context.UnsignedShortTy);
+ LastIntegralType = ArithmeticTypes.size();
+ NumArithmeticTypes = ArithmeticTypes.size();
+ // End of integral types.
+ // FIXME: What about complex? What about half?
+
+ assert(ArithmeticTypes.size() <= ArithmeticTypesCap &&
+ "Enough inline storage for all arithmetic types.");
}
/// \brief Helper method to factor out the common pattern of adding overloads
@@ -7720,18 +7729,8 @@ class BuiltinOperatorOverloadBuilder {
HasArithmeticOrEnumeralCandidateType),
CandidateTypes(CandidateTypes),
CandidateSet(CandidateSet) {
- // Validate some of our static helper constants in debug builds.
- assert(getArithmeticType(FirstPromotedIntegralType) == S.Context.IntTy &&
- "Invalid first promoted integral type");
- assert(getArithmeticType(LastPromotedIntegralType - 1)
- == S.Context.UnsignedInt128Ty &&
- "Invalid last promoted integral type");
- assert(getArithmeticType(FirstPromotedArithmeticType)
- == S.Context.FloatTy &&
- "Invalid first promoted arithmetic type");
- assert(getArithmeticType(LastPromotedArithmeticType - 1)
- == S.Context.UnsignedInt128Ty &&
- "Invalid last promoted arithmetic type");
+
+ InitArithmeticTypes();
}
// C++ [over.built]p3:
@@ -7758,7 +7757,7 @@ class BuiltinOperatorOverloadBuilder {
for (unsigned Arith = (Op == OO_PlusPlus? 0 : 1);
Arith < NumArithmeticTypes; ++Arith) {
addPlusPlusMinusMinusStyleOverloads(
- getArithmeticType(Arith),
+ ArithmeticTypes[Arith],
VisibleTypeConversionsQuals.hasVolatile(),
VisibleTypeConversionsQuals.hasRestrict());
}
@@ -7831,7 +7830,7 @@ class BuiltinOperatorOverloadBuilder {
for (unsigned Arith = FirstPromotedArithmeticType;
Arith < LastPromotedArithmeticType; ++Arith) {
- QualType ArithTy = getArithmeticType(Arith);
+ QualType ArithTy = ArithmeticTypes[Arith];
S.AddBuiltinCandidate(&ArithTy, Args, CandidateSet);
}
@@ -7871,7 +7870,7 @@ class BuiltinOperatorOverloadBuilder {
for (unsigned Int = FirstPromotedIntegralType;
Int < LastPromotedIntegralType; ++Int) {
- QualType IntTy = getArithmeticType(Int);
+ QualType IntTy = ArithmeticTypes[Int];
S.AddBuiltinCandidate(&IntTy, Args, CandidateSet);
}
@@ -8099,8 +8098,8 @@ class BuiltinOperatorOverloadBuilder {
Left < LastPromotedArithmeticType; ++Left) {
for (unsigned Right = FirstPromotedArithmeticType;
Right < LastPromotedArithmeticType; ++Right) {
- QualType LandR[2] = { getArithmeticType(Left),
- getArithmeticType(Right) };
+ QualType LandR[2] = { ArithmeticTypes[Left],
+ ArithmeticTypes[Right] };
S.AddBuiltinCandidate(LandR, Args, CandidateSet);
}
}
@@ -8143,8 +8142,8 @@ class BuiltinOperatorOverloadBuilder {
Left < LastPromotedIntegralType; ++Left) {
for (unsigned Right = FirstPromotedIntegralType;
Right < LastPromotedIntegralType; ++Right) {
- QualType LandR[2] = { getArithmeticType(Left),
- getArithmeticType(Right) };
+ QualType LandR[2] = { ArithmeticTypes[Left],
+ ArithmeticTypes[Right] };
S.AddBuiltinCandidate(LandR, Args, CandidateSet);
}
}
@@ -8324,18 +8323,18 @@ class BuiltinOperatorOverloadBuilder {
for (unsigned Right = FirstPromotedArithmeticType;
Right < LastPromotedArithmeticType; ++Right) {
QualType ParamTypes[2];
- ParamTypes[1] = getArithmeticType(Right);
+ ParamTypes[1] = ArithmeticTypes[Right];
// Add this built-in operator as a candidate (VQ is empty).
ParamTypes[0] =
- S.Context.getLValueReferenceType(getArithmeticType(Left));
+ S.Context.getLValueReferenceType(ArithmeticTypes[Left]);
S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet,
/*IsAssigmentOperator=*/isEqualOp);
// Add this built-in operator as a candidate (VQ is 'volatile').
if (VisibleTypeConversionsQuals.hasVolatile()) {
ParamTypes[0] =
- S.Context.getVolatileType(getArithmeticType(Left));
+ S.Context.getVolatileType(ArithmeticTypes[Left]);
ParamTypes[0] = S.Context.getLValueReferenceType(ParamTypes[0]);
S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet,
/*IsAssigmentOperator=*/isEqualOp);
@@ -8390,15 +8389,15 @@ class BuiltinOperatorOverloadBuilder {
for (unsigned Right = FirstPromotedIntegralType;
Right < LastPromotedIntegralType; ++Right) {
QualType ParamTypes[2];
- ParamTypes[1] = getArithmeticType(Right);
+ ParamTypes[1] = ArithmeticTypes[Right];
// Add this built-in operator as a candidate (VQ is empty).
ParamTypes[0] =
- S.Context.getLValueReferenceType(getArithmeticType(Left));
+ S.Context.getLValueReferenceType(ArithmeticTypes[Left]);
S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet);
if (VisibleTypeConversionsQuals.hasVolatile()) {
// Add this built-in operator as a candidate (VQ is 'volatile').
- ParamTypes[0] = getArithmeticType(Left);
+ ParamTypes[0] = ArithmeticTypes[Left];
ParamTypes[0] = S.Context.getVolatileType(ParamTypes[0]);
ParamTypes[0] = S.Context.getLValueReferenceType(ParamTypes[0]);
S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet);
diff --git a/test/SemaCXX/microsoft-vs-float128.cpp b/test/SemaCXX/microsoft-vs-float128.cpp
new file mode 100644
index 00000000000..d271e470032
--- /dev/null
+++ b/test/SemaCXX/microsoft-vs-float128.cpp
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fms-compatibility -fms-extensions -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -triple i686-pc-win32 -fms-compatibility -fms-extensions -fsyntax-only -verify -std=c++11 -DMS %s
+
+template <bool> struct enable_if {};
+template<> struct enable_if<true> { typedef void type; };
+
+template <typename, typename> struct is_same { static constexpr bool value = false; };
+template <typename T> struct is_same<T, T> { static constexpr bool value = true; };
+
+
+
+
+struct S {
+ // The only numeric types S can be converted to is __int128 and __float128.
+ template <typename T, typename = typename enable_if<
+ !((__is_integral(T) && sizeof(T) != 16) ||
+ is_same<T, float>::value ||
+ is_same<T, double>::value ||
+ is_same<T, long double>::value)>::type>
+ operator T() { return T(); }
+};
+
+void f() {
+#ifdef MS
+ // When targeting Win32, __float128 and __int128 do not exist, so the S
+ // object cannot be converted to anything usable in the expression.
+ // expected-error@+2{{invalid operands to binary expression ('S' and 'double')}}
+#endif
+ double d = S() + 1.0;
+#ifndef MS
+ // expected-error@-2{{use of overloaded operator '+' is ambiguous}}
+ // expected-note@-3 36{{built-in candidate operator+}}
+#endif
+}

Просмотреть файл

@ -840,7 +840,7 @@ nsScriptSecurityManager::CheckLoadURIFlags(nsIURI *aSourceURI,
// Check for chrome target URI
bool hasFlags = false;
rv = NS_URIChainHasFlags(aTargetBaseURI,
rv = NS_URIChainHasFlags(aTargetURI,
nsIProtocolHandler::URI_IS_UI_RESOURCE,
&hasFlags);
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -1,7 +1,7 @@
This is the debugger.html project output.
See https://github.com/devtools-html/debugger.html
Taken from upstream commit: 95faec6ebf536f313288cd67868d560b52b1dc5b
Taken from upstream commit: 53faca589b021f01c7af5980c8c0e98b58c02e4c
Packages:
- babel-plugin-transform-es2015-modules-commonjs @6.26.0

Просмотреть файл

@ -1631,53 +1631,83 @@ html[dir="rtl"] .managed-tree .tree .node > div {
.function-signature .comma {
color: var(--object-color);
}
.command-bar-button {
appearance: none;
background: transparent;
border: none;
display: inline-block;
text-align: center;
position: relative;
padding: 0px 5px;
margin-inline-end: 0.3em;
fill: currentColor;
}
.command-bar-button:focus {
outline: none;
}
.command-bar-button:disabled {
opacity: 0.8;
cursor: default;
}
.command-bar-button:not(.disabled):hover {
background: var(--theme-toolbar-background-hover);
}
:root.theme-dark .command-bar-button {
color: var(--theme-body-color);
}
.command-bar-button > * {
width: 16px;
height: 16px;
display: inline-block;
vertical-align: middle;
}
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/>. */
.toggle-button-start,
.toggle-button-end {
.toggle-button {
transform: translate(0, 0px);
transition: transform 0.25s ease-in-out;
padding: 5px;
}
.toggle-button-start.vertical,
.toggle-button-end.vertical {
.toggle-button.vertical {
padding: 2.5px 2.5px;
}
.toggle-button-start svg,
.toggle-button-end svg {
width: 16px;
.toggle-button svg {
fill: var(--theme-comment);
}
.theme-dark .toggle-button-start svg,
.theme-dark .toggle-button-end svg {
:root.theme-dark .toggle-button svg {
fill: var(--theme-comment-alt);
}
.toggle-button-end {
.toggle-button.end {
margin-inline-end: 0px;
margin-inline-start: auto;
}
.toggle-button-start {
.toggle-button.start {
margin-inline-start: 0px;
}
html:not([dir="rtl"]) .toggle-button-end svg,
html[dir="rtl"] .toggle-button-start svg {
html:not([dir="rtl"]) .toggle-button.end svg,
html[dir="rtl"] .toggle-button.start svg {
transform: rotate(180deg);
}
html .toggle-button-end.vertical svg {
html .toggle-button.end.vertical svg {
transform: rotate(-90deg);
}
.toggle-button-start.collapsed,
.toggle-button-end.collapsed {
.toggle-button.start.collapsed,
.toggle-button.end.collapsed {
transform: rotate(180deg);
}
/* This Source Code Form is subject to the terms of the Mozilla Public
@ -3242,40 +3272,6 @@ html[dir="rtl"] .command-bar {
background-color: var(--theme-tab-toolbar-background);
}
.command-bar > button {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: transparent;
border: none;
display: inline-block;
text-align: center;
padding: 8px 5px;
position: relative;
fill: currentColor;
}
.command-bar > button:not(.disabled):hover {
background: var(--theme-toolbar-background-hover);
}
:root.theme-dark .command-bar > button {
color: var(--theme-body-color);
}
.command-bar > button {
margin-inline-end: 0.3em;
}
.command-bar > button:focus {
outline: none;
}
html .command-bar > button:disabled {
opacity: 0.8;
cursor: default;
}
img.pause,
img.stepOver,
img.stepIn,
@ -3284,45 +3280,39 @@ img.resume {
background-color: var(--theme-body-color);
}
.command-bar > button > img {
width: 16px;
height: 16px;
display: inline-block;
}
.command-bar > button > img.pause {
.command-bar img.pause {
mask: url("chrome://devtools/skin/images/debugger/pause.svg") no-repeat;
}
.command-bar > button > img.stepOver {
.command-bar img.stepOver {
mask: url("chrome://devtools/skin/images/debugger/stepOver.svg") no-repeat;
}
.command-bar > button > img.stepIn {
.command-bar img.stepIn {
mask: url("chrome://devtools/skin/images/debugger/stepIn.svg") no-repeat;
}
.command-bar > button > img.stepOut {
.command-bar img.stepOut {
mask: url("chrome://devtools/skin/images/debugger/stepOut.svg") no-repeat;
}
.command-bar > button > img.resume {
.command-bar img.resume {
mask: url("chrome://devtools/skin/images/debugger/resume.svg") no-repeat;
}
.command-bar > button.pause-exceptions.uncaught.enabled > img.pause-exceptions {
.command-bar > .pause-exceptions.uncaught.enabled > img.pause-exceptions {
background-color: var(--theme-highlight-purple);
}
.command-bar > button.pause-exceptions.all.enabled > img.pause-exceptions {
.command-bar > .pause-exceptions.all.enabled > img.pause-exceptions {
background-color: var(--theme-highlight-blue);
}
.command-bar > button.pause-exceptions.enabled > img.pause-exceptions {
.command-bar > .pause-exceptions.enabled > img.pause-exceptions {
background-color: var(--theme-body-color);
}
.command-bar > button > img.pause-exceptions {
.command-bar img.pause-exceptions {
mask: url("chrome://devtools/skin/images/debugger/pause-exceptions.svg") no-repeat;
margin-inline-start: 0.2em;
}
@ -3338,10 +3328,6 @@ img.resume {
flex: 0 0 27px;
}
.command-bar > button {
padding: 6px 5px;
}
.command-bar.bottom {
justify-content: flex-end;
}
@ -3683,7 +3669,6 @@ html .welcomebox .toggle-button-end.collapsed {
width: 100%;
height: 30px;
display: flex;
align-items: flex-end;
}
.source-header * {

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -31653,40 +31653,19 @@ module.exports = isEmpty;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.parseScriptTags = exports.parseScripts = exports.parseScript = exports.getCandidateScriptLocations = exports.generateWhitespace = exports.extractScriptTags = undefined;
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var _babelTypes = __webpack_require__(493);
var babylon = __webpack_require__(435);
var types = __webpack_require__(493);
var types = _interopRequireWildcard(_babelTypes);
var startScript = /<script[^>]*>/im;
var endScript = /<\/script\s*>/im;
// https://stackoverflow.com/questions/5034781/js-regex-to-split-by-line#comment5633979_5035005
var newLines = /\r\n|[\n\v\f\r\x85\u2028\u2029]/;
var _babylon = __webpack_require__(435);
function getCandidateScriptLocations(source, index) {
var i = index || 0;
var str = source.substring(i);
var babylon = _interopRequireWildcard(_babylon);
var startMatch = startScript.exec(str);
if (startMatch) {
var startsAt = startMatch.index + startMatch[0].length;
var afterStart = str.substring(startsAt);
var endMatch = endScript.exec(afterStart);
if (endMatch) {
var locLength = endMatch.index;
var locIndex = i + startsAt;
var _customParse = __webpack_require__(1794);
return [adjustForLineAndColumn(source, {
index: locIndex,
length: locLength,
source: source.substring(locIndex, locIndex + locLength)
})].concat(_toConsumableArray(getCandidateScriptLocations(source, locIndex + locLength + endMatch[0].length)));
}
}
return [];
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function parseScript(_ref) {
var source = _ref.source,
@ -31710,69 +31689,11 @@ function parseScript(_ref) {
function parseScripts(locations) {
var parser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : parseScript;
return locations.map(parser);
}
function generateWhitespace(length) {
return Array.from(new Array(length + 1)).join(" ");
}
function calcLineAndColumn(source, index) {
var lines = source.substring(0, index).split(newLines);
var line = lines.length;
var column = lines.pop().length + 1;
return {
column: column,
line: line
};
}
function adjustForLineAndColumn(fullSource, location) {
var _calcLineAndColumn = calcLineAndColumn(fullSource, location.index),
column = _calcLineAndColumn.column,
line = _calcLineAndColumn.line;
return Object.assign({}, location, {
line: line,
column: column,
// prepend whitespace for scripts that do not start on the first column
source: generateWhitespace(column) + location.source
});
}
function parseScriptTags(source, parser) {
var scripts = parseScripts(getCandidateScriptLocations(source), parser).filter(types.isFile).reduce(function (main, script) {
return {
statements: main.statements.concat(script.program.body),
comments: main.comments.concat(script.comments),
tokens: main.tokens.concat(script.tokens)
};
}, {
statements: [],
comments: [],
tokens: []
});
var program = types.program(scripts.statements);
var file = types.file(program, scripts.comments, scripts.tokens);
var end = calcLineAndColumn(source, source.length);
file.start = program.start = 0;
file.end = program.end = source.length;
file.loc = program.loc = {
start: {
line: 1,
column: 0
},
end: end
};
return file;
return (0, _customParse.parseScripts)(locations, parser);
}
function extractScriptTags(source) {
return parseScripts(getCandidateScriptLocations(source), function (loc) {
return parseScripts((0, _customParse.getCandidateScriptLocations)(source), function (loc) {
var ast = parseScript(loc);
if (ast) {
@ -31783,10 +31704,16 @@ function extractScriptTags(source) {
}).filter(types.isFile);
}
function parseScriptTags(source) {
var parser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : parseScript;
return (0, _customParse.parseScriptTags)(source, parser);
}
exports.default = parseScriptTags;
exports.extractScriptTags = extractScriptTags;
exports.generateWhitespace = generateWhitespace;
exports.getCandidateScriptLocations = getCandidateScriptLocations;
exports.generateWhitespace = _customParse.generateWhitespace;
exports.getCandidateScriptLocations = _customParse.getCandidateScriptLocations;
exports.parseScript = parseScript;
exports.parseScripts = parseScripts;
exports.parseScriptTags = parseScriptTags;
@ -35988,6 +35915,7 @@ function extractSymbols(source) {
const identifiers = [];
const classes = [];
const imports = [];
let hasJsx = false;
const ast = (0, _ast.traverseAst)(source, {
enter(path) {
@ -36005,6 +35933,10 @@ function extractSymbols(source) {
});
}
if (t.isJSXElement(path)) {
hasJsx = true;
}
if (t.isClassDeclaration(path)) {
classes.push({
name: path.node.id.name,
@ -36102,7 +36034,8 @@ function extractSymbols(source) {
comments,
identifiers,
classes,
imports
imports,
hasJsx
};
}
@ -41876,6 +41809,344 @@ function baseToPairs(object, props) {
module.exports = baseToPairs;
/***/ }),
/* 1758 */,
/* 1759 */,
/* 1760 */,
/* 1761 */,
/* 1762 */,
/* 1763 */,
/* 1764 */,
/* 1765 */,
/* 1766 */,
/* 1767 */,
/* 1768 */,
/* 1769 */,
/* 1770 */,
/* 1771 */,
/* 1772 */,
/* 1773 */,
/* 1774 */,
/* 1775 */,
/* 1776 */,
/* 1777 */,
/* 1778 */,
/* 1779 */,
/* 1780 */,
/* 1781 */,
/* 1782 */,
/* 1783 */,
/* 1784 */,
/* 1785 */,
/* 1786 */,
/* 1787 */,
/* 1788 */,
/* 1789 */,
/* 1790 */,
/* 1791 */,
/* 1792 */,
/* 1793 */,
/* 1794 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.parseScriptTags = exports.parseScripts = exports.getCandidateScriptLocations = exports.generateWhitespace = undefined;
var _babelTypes = __webpack_require__(493);
var types = _interopRequireWildcard(_babelTypes);
var _parseScriptFragment = __webpack_require__(1795);
var _parseScriptFragment2 = _interopRequireDefault(_parseScriptFragment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var startScript = /<script[^>]*>/im;
var endScript = /<\/script\s*>/im;
// https://stackoverflow.com/questions/5034781/js-regex-to-split-by-line#comment5633979_5035005
var newLines = /\r\n|[\n\v\f\r\x85\u2028\u2029]/;
function getType(tag) {
var fragment = (0, _parseScriptFragment2.default)(tag);
if (fragment) {
var type = fragment.attributes.type;
return type ? type.toLowerCase() : null;
}
return null;
}
function getCandidateScriptLocations(source, index) {
var i = index || 0;
var str = source.substring(i);
var startMatch = startScript.exec(str);
if (startMatch) {
var startsAt = startMatch.index + startMatch[0].length;
var afterStart = str.substring(startsAt);
var endMatch = endScript.exec(afterStart);
if (endMatch) {
var locLength = endMatch.index;
var locIndex = i + startsAt;
var endIndex = locIndex + locLength + endMatch[0].length;
// extract the complete tag (incl start and end tags and content). if the
// type is invalid (= not JS), skip this tag and continue
var tag = source.substring(i + startMatch.index, endIndex);
var type = getType(tag);
if (type && type !== "javascript" && type !== "text/javascript") {
return getCandidateScriptLocations(source, endIndex);
}
return [adjustForLineAndColumn(source, {
index: locIndex,
length: locLength,
source: source.substring(locIndex, locIndex + locLength)
})].concat(_toConsumableArray(getCandidateScriptLocations(source, endIndex)));
}
}
return [];
}
function parseScripts(locations, parser) {
return locations.map(parser);
}
function generateWhitespace(length) {
return Array.from(new Array(length + 1)).join(" ");
}
function calcLineAndColumn(source, index) {
var lines = source.substring(0, index).split(newLines);
var line = lines.length;
var column = lines.pop().length + 1;
return {
column: column,
line: line
};
}
function adjustForLineAndColumn(fullSource, location) {
var _calcLineAndColumn = calcLineAndColumn(fullSource, location.index),
column = _calcLineAndColumn.column,
line = _calcLineAndColumn.line;
return Object.assign({}, location, {
line: line,
column: column,
// prepend whitespace for scripts that do not start on the first column
source: generateWhitespace(column) + location.source
});
}
function parseScriptTags(source, parser) {
var scripts = parseScripts(getCandidateScriptLocations(source), parser).filter(types.isFile).reduce(function (main, script) {
return {
statements: main.statements.concat(script.program.body),
comments: main.comments.concat(script.comments),
tokens: main.tokens.concat(script.tokens)
};
}, {
statements: [],
comments: [],
tokens: []
});
var program = types.program(scripts.statements);
var file = types.file(program, scripts.comments, scripts.tokens);
var end = calcLineAndColumn(source, source.length);
file.start = program.start = 0;
file.end = program.end = source.length;
file.loc = program.loc = {
start: {
line: 1,
column: 0
},
end: end
};
return file;
}
exports.default = parseScriptTags;
exports.generateWhitespace = generateWhitespace;
exports.getCandidateScriptLocations = getCandidateScriptLocations;
exports.parseScripts = parseScripts;
exports.parseScriptTags = parseScriptTags;
/***/ }),
/* 1795 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var alphanum = /[a-z0-9\-]/i;
function parseToken(str, start) {
var i = start;
while (i < str.length && alphanum.test(str.charAt(i++))) {
continue;
}
if (i !== start) {
return {
token: str.substring(start, i - 1),
index: i
};
}
return null;
}
function parseAttributes(str, start) {
var i = start;
var attributes = {};
var attribute = null;
while (i < str.length) {
var c = str.charAt(i);
if (attribute === null && c == ">") {
break;
} else if (attribute === null && alphanum.test(c)) {
attribute = {
name: null,
value: true,
bool: true,
terminator: null
};
var attributeNameNode = parseToken(str, i);
if (attributeNameNode) {
attribute.name = attributeNameNode.token;
i = attributeNameNode.index - 2;
}
} else if (attribute !== null) {
if (c === "=") {
// once we've started an attribute, look for = to indicate
// it's a non-boolean attribute
attribute.bool = false;
if (attribute.value === true) {
attribute.value = "";
}
} else if (!attribute.bool && attribute.terminator === null && (c === '"' || c === "'")) {
// once we've determined it's non-boolean, look for a
// value terminator (", ')
attribute.terminator = c;
} else if (attribute.terminator) {
if (c === attribute.terminator) {
// if we had a terminator and found another, we've
// reach the end of the attribute
attributes[attribute.name] = attribute.value;
attribute = null;
} else {
// otherwise, append the character to the attribute value
attribute.value += c;
// check for an escaped terminator and push it as well
// to avoid terminating prematurely
if (c === "\\") {
var next = str.charAt(i + 1);
if (next === attribute.terminator) {
attribute.value += next;
i += 1;
}
}
}
} else if (!/\s/.test(c)) {
// if we've hit a non-space character and aren't processing a value,
// we're starting a new attribute so push the attribute and clear the
// local variable
attributes[attribute.name] = attribute.value;
attribute = null;
// move the cursor back to re-find the start of the attribute
i -= 1;
}
}
i++;
}
if (i !== start) {
return {
attributes: attributes,
index: i
};
}
return null;
}
function parseFragment(str) {
var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var tag = null;
var open = false;
var attributes = {};
var i = start;
while (i < str.length) {
var c = str.charAt(i++);
if (!open && !tag && c === "<") {
// Open Start Tag
open = true;
var tagNode = parseToken(str, i);
if (!tagNode) {
return null;
}
i = tagNode.index - 1;
tag = tagNode.token;
} else if (open && c === ">") {
// Close Start Tag
break;
} else if (open) {
// Attributes
var attributeNode = parseAttributes(str, i - 1);
if (attributeNode) {
i = attributeNode.index;
attributes = attributeNode.attributes || attributes;
}
}
}
if (tag) {
return {
tag: tag,
attributes: attributes
};
}
return null;
}
exports.default = parseFragment;
exports.parseFragment = parseFragment;
/***/ })
/******/ ]);
});

Просмотреть файл

@ -1,6 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- 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/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="M6.925 12.5l7.4-5-7.4-5v10zM6 12.5v-10c0-.785.8-1.264 1.415-.848l7.4 5c.58.392.58 1.304 0 1.696l-7.4 5C6.8 13.764 6 13.285 6 12.5z" fill-rule="evenodd"/>
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<path fill="black" id="svg_1" fill-rule="evenodd" d="m4.55195,12.97461l7.4,-5l-7.4,-5l0,10zm-0.925,0l0,-10c0,-0.785 0.8,-1.264 1.415,-0.848l7.4,5c0.58,0.392 0.58,1.304 0,1.696l-7.4,5c-0.615,0.416 -1.415,-0.063 -1.415,-0.848z"/>
</svg>

До

Ширина:  |  Высота:  |  Размер: 468 B

После

Ширина:  |  Высота:  |  Размер: 552 B

Просмотреть файл

@ -283,7 +283,7 @@ ConsoleAPIListener.prototype =
// a window.
let scope = message.ID;
if (!swm.shouldReportToWindow(this.window, scope)) {
if (!this.window.shouldReportForServiceWorkerScope(scope)) {
return false;
}
}

Просмотреть файл

@ -43,6 +43,7 @@
#include "mozilla/dom/WakeLock.h"
#include "mozilla/dom/power/PowerManagerService.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIDocumentLoader.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIPermissionManager.h"
#include "nsIScriptContext.h"
@ -2330,6 +2331,110 @@ nsPIDOMWindowInner::GetController() const
return Move(nsGlobalWindowInner::Cast(this)->GetController());
}
void
nsPIDOMWindowInner::NoteCalledRegisterForServiceWorkerScope(const nsACString& aScope)
{
nsGlobalWindowInner::Cast(this)->NoteCalledRegisterForServiceWorkerScope(aScope);
}
bool
nsGlobalWindowInner::ShouldReportForServiceWorkerScope(const nsAString& aScope)
{
bool result = false;
nsPIDOMWindowOuter* topOuter = GetScriptableTop();
NS_ENSURE_TRUE(topOuter, false);
nsGlobalWindowInner* topInner =
nsGlobalWindowInner::Cast(topOuter->GetCurrentInnerWindow());
NS_ENSURE_TRUE(topInner, false);
topInner->ShouldReportForServiceWorkerScopeInternal(NS_ConvertUTF16toUTF8(aScope),
&result);
return result;
}
nsGlobalWindowInner::CallState
nsGlobalWindowInner::ShouldReportForServiceWorkerScopeInternal(const nsACString& aScope,
bool* aResultOut)
{
MOZ_DIAGNOSTIC_ASSERT(aResultOut);
// First check to see if this window is controlled. If so, then we have
// found a match and are done.
const Maybe<ServiceWorkerDescriptor> swd = GetController();
if (swd.isSome() && swd.ref().Scope() == aScope) {
*aResultOut = true;
return CallState::Stop;
}
// Next, check to see if this window has called navigator.serviceWorker.register()
// for this scope. If so, then treat this as a match so console reports
// appear in the devtools console.
if (mClientSource && mClientSource->CalledRegisterForServiceWorkerScope(aScope)) {
*aResultOut = true;
return CallState::Stop;
}
// Finally check the current docshell nsILoadGroup to see if there are any
// outstanding navigation requests. If so, match the scope against the
// channel's URL. We want to show console reports during the FetchEvent
// intercepting the navigation itself.
nsCOMPtr<nsIDocumentLoader> loader(do_QueryInterface(GetDocShell()));
if (loader) {
nsCOMPtr<nsILoadGroup> loadgroup;
Unused << loader->GetLoadGroup(getter_AddRefs(loadgroup));
if (loadgroup) {
nsCOMPtr<nsISimpleEnumerator> iter;
Unused << loadgroup->GetRequests(getter_AddRefs(iter));
if (iter) {
nsCOMPtr<nsISupports> tmp;
bool hasMore = true;
// Check each network request in the load group.
while (NS_SUCCEEDED(iter->HasMoreElements(&hasMore)) && hasMore) {
iter->GetNext(getter_AddRefs(tmp));
nsCOMPtr<nsIChannel> loadingChannel(do_QueryInterface(tmp));
// Ignore subresource requests. Logging for a subresource
// FetchEvent should be handled above since the client is
// already controlled.
if (!loadingChannel ||
!nsContentUtils::IsNonSubresourceRequest(loadingChannel)) {
continue;
}
nsCOMPtr<nsIURI> loadingURL;
Unused << loadingChannel->GetURI(getter_AddRefs(loadingURL));
if (!loadingURL) {
continue;
}
nsAutoCString loadingSpec;
Unused << loadingURL->GetSpec(loadingSpec);
// Perform a simple substring comparison to match the scope
// against the channel URL.
if (StringBeginsWith(loadingSpec, aScope)) {
*aResultOut = true;
return CallState::Stop;
}
}
}
}
}
// The current window doesn't care about this service worker, but maybe
// one of our child frames does.
return CallOnChildren(&nsGlobalWindowInner::ShouldReportForServiceWorkerScopeInternal,
aScope, aResultOut);
}
void
nsGlobalWindowInner::NoteCalledRegisterForServiceWorkerScope(const nsACString& aScope)
{
if (!mClientSource) {
return;
}
mClientSource->NoteCalledRegisterForServiceWorkerScope(aScope);
}
void
nsGlobalWindowInner::UpdateTopInnerWindow()
{
@ -6114,16 +6219,18 @@ nsGlobalWindowInner::SyncStateFromParentWindow()
}
}
template<typename Method>
void
nsGlobalWindowInner::CallOnChildren(Method aMethod)
template<typename Method, typename... Args>
nsGlobalWindowInner::CallState
nsGlobalWindowInner::CallOnChildren(Method aMethod, Args& ...aArgs)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(IsCurrentInnerWindow());
CallState state = CallState::Continue;
nsCOMPtr<nsIDocShell> docShell = GetDocShell();
if (!docShell) {
return;
return state;
}
int32_t childCount = 0;
@ -6149,8 +6256,19 @@ nsGlobalWindowInner::CallOnChildren(Method aMethod)
continue;
}
(inner->*aMethod)();
// Call the child method using our helper CallChild() template method.
// This allows us to handle both void returning methods and methods
// that return CallState explicitly. For void returning methods we
// assume CallState::Continue.
typedef decltype((inner->*aMethod)(aArgs...)) returnType;
state = CallChild<returnType>(inner, aMethod, aArgs...);
if (state == CallState::Stop) {
return state;
}
}
return state;
}
Maybe<ClientInfo>

Просмотреть файл

@ -351,6 +351,8 @@ public:
mozilla::Maybe<mozilla::dom::ClientState> GetClientState() const;
mozilla::Maybe<mozilla::dom::ServiceWorkerDescriptor> GetController() const;
void NoteCalledRegisterForServiceWorkerScope(const nsACString& aScope);
virtual nsresult FireDelayedDOMEvents() override;
virtual nsresult SetNewDocument(nsIDocument *aDocument,
@ -971,6 +973,8 @@ public:
already_AddRefed<nsWindowRoot> GetWindowRoot(mozilla::ErrorResult& aError);
bool ShouldReportForServiceWorkerScope(const nsAString& aScope);
void UpdateTopInnerWindow();
virtual bool IsInSyncOperation() override
@ -1095,12 +1099,50 @@ public:
bool IsPopupSpamWindow();
private:
template<typename Method>
void CallOnChildren(Method aMethod);
// A type that methods called by CallOnChildren can return. If Stop
// is returned then CallOnChildren will stop calling further children.
// If Continue is returned then CallOnChildren will keep calling further
// children.
enum class CallState
{
Continue,
Stop,
};
// Call the given method on the immediate children of this window. The
// CallState returned by the last child method invocation is returned or
// CallState::Continue if the method returns void.
template<typename Method, typename... Args>
CallState CallOnChildren(Method aMethod, Args& ...aArgs);
// Helper to convert a void returning child method into an implicit
// CallState::Continue value.
template<typename Return, typename Method, typename... Args>
typename std::enable_if<std::is_void<Return>::value,
nsGlobalWindowInner::CallState>::type
CallChild(nsGlobalWindowInner* aWindow, Method aMethod, Args& ...aArgs)
{
(aWindow->*aMethod)(aArgs...);
return nsGlobalWindowInner::CallState::Continue;
}
// Helper that passes through the CallState value from a child method.
template<typename Return, typename Method, typename... Args>
typename std::enable_if<std::is_same<Return,
nsGlobalWindowInner::CallState>::value,
nsGlobalWindowInner::CallState>::type
CallChild(nsGlobalWindowInner* aWindow, Method aMethod, Args& ...aArgs)
{
return (aWindow->*aMethod)(aArgs...);
}
void FreezeInternal();
void ThawInternal();
CallState ShouldReportForServiceWorkerScopeInternal(const nsACString& aScope,
bool* aResultOut);
public:
// Timeout Functions
// |interval| is in milliseconds.

Просмотреть файл

@ -331,6 +331,8 @@ public:
mozilla::Maybe<mozilla::dom::ClientState> GetClientState() const;
mozilla::Maybe<mozilla::dom::ServiceWorkerDescriptor> GetController() const;
void NoteCalledRegisterForServiceWorkerScope(const nsACString& aScope);
mozilla::dom::TabGroup* TabGroup();
virtual nsPIDOMWindowOuter* GetPrivateRoot() = 0;

Просмотреть файл

@ -623,7 +623,6 @@ TexUnpackImage::TexOrSubImage(bool isSubImage, bool needsRespec, const char* fun
WebGLContext* webgl = tex->mContext;
gl::GLContext* gl = webgl->GL();
gl->MakeCurrent();
if (needsRespec) {
*out_error = DoTexOrSubImage(isSubImage, gl, target.get(), level, dui, xOffset,

Просмотреть файл

@ -83,7 +83,6 @@ WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
return;
}
gl->MakeCurrent();
const ScopedLazyBind readBind(gl, readTarget, readBuffer);
const ScopedLazyBind writeBind(gl, writeTarget, writeBuffer);
gl->fCopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
@ -128,7 +127,26 @@ WebGL2Context::GetBufferSubData(GLenum target, GLintptr srcByteOffset,
////
gl->MakeCurrent();
switch (buffer->mUsage) {
case LOCAL_GL_STATIC_READ:
case LOCAL_GL_STREAM_READ:
case LOCAL_GL_DYNAMIC_READ:
if (mCompletedFenceId < buffer->mLastUpdateFenceId) {
GeneratePerfWarning("%s: Reading from a buffer without checking for previous"
" command completion likely causes pipeline stalls."
" Please use FenceSync.",
funcName);
}
break;
default:
GeneratePerfWarning("%s: Reading from a buffer with usage other than *_READ"
" causes pipeline stalls. Copy through a STREAM_READ buffer.",
funcName);
break;
}
////
const ScopedLazyBind readBind(gl, target, buffer);
if (byteLen) {

Просмотреть файл

@ -166,8 +166,6 @@ WebGLContext::ValidateInvalidateFramebuffer(const char* funcName, GLenum target,
if (IsContextLost())
return false;
gl->MakeCurrent();
if (!ValidateFramebufferTarget(target, funcName))
return false;
@ -316,8 +314,6 @@ WebGL2Context::ReadBuffer(GLenum mode)
if (IsContextLost())
return;
gl->MakeCurrent();
if (mBoundReadFramebuffer) {
mBoundReadFramebuffer->ReadBuffer(funcName, mode);
return;

Просмотреть файл

@ -62,8 +62,6 @@ WebGL2Context::ValidateClearBuffer(const char* funcName, GLenum buffer, GLint dr
////
MakeContextCurrent();
const auto& fb = mBoundDrawFramebuffer;
if (fb) {
if (!fb->ValidateAndInitAttachments(funcName))

Просмотреть файл

@ -16,7 +16,6 @@ WebGL2Context::CreateSampler()
return nullptr;
GLuint sampler;
MakeContextCurrent();
gl->fGenSamplers(1, &sampler);
RefPtr<WebGLSampler> globj = new WebGLSampler(this, sampler);
@ -46,7 +45,6 @@ WebGL2Context::IsSampler(const WebGLSampler* sampler)
if (!ValidateIsObject("isSampler", sampler))
return false;
MakeContextCurrent();
return gl->fIsSampler(sampler->mGLName);
}
@ -64,7 +62,6 @@ WebGL2Context::BindSampler(GLuint unit, WebGLSampler* sampler)
////
gl->MakeCurrent();
gl->fBindSampler(unit, sampler ? sampler->mGLName : 0);
InvalidateResolveCacheForTextureWithTexUnit(unit);
@ -112,8 +109,6 @@ WebGL2Context::GetSamplerParameter(JSContext*, const WebGLSampler& sampler, GLen
////
gl->MakeCurrent();
switch (pname) {
case LOCAL_GL_TEXTURE_MIN_FILTER:
case LOCAL_GL_TEXTURE_MAG_FILTER:

Просмотреть файл

@ -27,8 +27,6 @@ WebGL2Context::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
if (IsContextLost())
return JS::NullValue();
MakeContextCurrent();
switch (pname) {
/* GLboolean */
case LOCAL_GL_RASTERIZER_DISCARD:

Просмотреть файл

@ -29,7 +29,6 @@ WebGL2Context::FenceSync(GLenum condition, GLbitfield flags)
return nullptr;
}
MakeContextCurrent();
RefPtr<WebGLSync> globj = new WebGLSync(this, condition, flags);
return globj.forget();
}
@ -73,8 +72,15 @@ WebGL2Context::ClientWaitSync(const WebGLSync& sync, GLbitfield flags, GLuint64
return LOCAL_GL_WAIT_FAILED;
}
MakeContextCurrent();
return gl->fClientWaitSync(sync.mGLName, flags, timeout);
const auto ret = gl->fClientWaitSync(sync.mGLName, flags, timeout);
if (ret == LOCAL_GL_CONDITION_SATISFIED ||
ret == LOCAL_GL_ALREADY_SIGNALED)
{
sync.MarkSignaled();
}
return ret;
}
void
@ -97,7 +103,6 @@ WebGL2Context::WaitSync(const WebGLSync& sync, GLbitfield flags, GLint64 timeout
return;
}
MakeContextCurrent();
gl->fWaitSync(sync.mGLName, flags, LOCAL_GL_TIMEOUT_IGNORED);
}
@ -115,8 +120,6 @@ WebGL2Context::GetSyncParameter(JSContext*, const WebGLSync& sync, GLenum pname,
////
gl->MakeCurrent();
GLint result = 0;
switch (pname) {
case LOCAL_GL_OBJECT_TYPE:
@ -124,6 +127,13 @@ WebGL2Context::GetSyncParameter(JSContext*, const WebGLSync& sync, GLenum pname,
case LOCAL_GL_SYNC_CONDITION:
case LOCAL_GL_SYNC_FLAGS:
gl->fGetSynciv(sync.mGLName, pname, 1, nullptr, &result);
if (pname == LOCAL_GL_SYNC_STATUS &&
result == LOCAL_GL_SIGNALED)
{
sync.MarkSignaled();
}
retval.set(JS::Int32Value(result));
return;

Просмотреть файл

@ -20,7 +20,6 @@ WebGL2Context::CreateTransformFeedback()
if (IsContextLost())
return nullptr;
MakeContextCurrent();
GLuint tf = 0;
gl->fGenTransformFeedbacks(1, &tf);
@ -53,7 +52,6 @@ WebGL2Context::IsTransformFeedback(const WebGLTransformFeedback* tf)
if (!ValidateIsObject("isTransformFeedback", tf))
return false;
MakeContextCurrent();
return gl->fIsTransformFeedback(tf->mGLName);
}
@ -87,7 +85,6 @@ WebGL2Context::BindTransformFeedback(GLenum target, WebGLTransformFeedback* tf)
mBoundTransformFeedback = (tf ? tf : mDefaultTransformFeedback);
MakeContextCurrent();
gl->fBindTransformFeedback(target, mBoundTransformFeedback->mGLName);
if (mBoundTransformFeedback) {

Просмотреть файл

@ -26,7 +26,6 @@ WebGLContext::Uniform1ui(WebGLUniformLocation* loc, GLuint v0)
if (!ValidateUniformSetter(loc, 1, LOCAL_GL_UNSIGNED_INT, "uniform1ui"))
return;
MakeContextCurrent();
gl->fUniform1ui(loc->mLoc, v0);
}
@ -36,7 +35,6 @@ WebGLContext::Uniform2ui(WebGLUniformLocation* loc, GLuint v0, GLuint v1)
if (!ValidateUniformSetter(loc, 2, LOCAL_GL_UNSIGNED_INT, "uniform2ui"))
return;
MakeContextCurrent();
gl->fUniform2ui(loc->mLoc, v0, v1);
}
@ -46,7 +44,6 @@ WebGLContext::Uniform3ui(WebGLUniformLocation* loc, GLuint v0, GLuint v1, GLuint
if (!ValidateUniformSetter(loc, 3, LOCAL_GL_UNSIGNED_INT, "uniform3ui"))
return;
MakeContextCurrent();
gl->fUniform3ui(loc->mLoc, v0, v1, v2);
}
@ -57,7 +54,6 @@ WebGLContext::Uniform4ui(WebGLUniformLocation* loc, GLuint v0, GLuint v1, GLuint
if (!ValidateUniformSetter(loc, 4, LOCAL_GL_UNSIGNED_INT, "uniform4ui"))
return;
MakeContextCurrent();
gl->fUniform4ui(loc->mLoc, v0, v1, v2, v3);
}
@ -194,7 +190,6 @@ WebGL2Context::GetActiveUniforms(JSContext* cx, const WebGLProgram& program,
}
retval.setObject(*array);
MakeContextCurrent();
gl->fGetActiveUniformsiv(program.mGLName, count, uniformIndices.Elements(), pname,
samples.get());
@ -252,8 +247,6 @@ WebGL2Context::GetActiveUniformBlockParameter(JSContext* cx, const WebGLProgram&
if (!ValidateObject("getActiveUniformBlockParameter: program", program))
return;
MakeContextCurrent();
switch(pname) {
case LOCAL_GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
case LOCAL_GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:

Просмотреть файл

@ -57,7 +57,6 @@ WebGLBuffer::SetContentAfterBind(GLenum target)
void
WebGLBuffer::Delete()
{
mContext->MakeContextCurrent();
mContext->gl->fDeleteBuffers(1, &mGLName);
mByteLength = 0;
@ -136,7 +135,6 @@ WebGLBuffer::BufferData(GLenum target, size_t size, const void* data, GLenum usa
}
const auto& gl = mContext->gl;
gl->MakeCurrent();
const ScopedLazyBind lazyBind(gl, target, this);
const bool sizeChanges = (size != ByteLength());
@ -196,7 +194,6 @@ WebGLBuffer::BufferSubData(GLenum target, size_t dstByteOffset, size_t dataLen,
////
const auto& gl = mContext->gl;
gl->MakeCurrent();
const ScopedLazyBind lazyBind(gl, target, this);
gl->fBufferSubData(target, dstByteOffset, dataLen, uploadData);

Просмотреть файл

@ -105,6 +105,7 @@ protected:
size_t mByteLength;
size_t mTFBindCount;
size_t mNonTFBindCount;
uint64_t mLastUpdateFenceId = 0;
struct IndexRange final {
GLenum type;

Просмотреть файл

@ -212,8 +212,6 @@ WebGLContext::DestroyResourcesAndContext()
if (!gl)
return;
gl->MakeCurrent();
mBound2DTextures.Clear();
mBoundCubeMapTextures.Clear();
mBound3DTextures.Clear();
@ -898,8 +896,6 @@ WebGLContext::SetDimensions(int32_t signedWidth, int32_t signedHeight)
if (IsContextLost())
return NS_OK;
MakeContextCurrent();
// If we've already drawn, we should commit the current buffer.
PresentScreenBuffer();
@ -1490,8 +1486,6 @@ WebGLContext::MozGetUnderlyingParamString(uint32_t pname, nsAString& retval)
retval.SetIsVoid(true);
MakeContextCurrent();
switch (pname) {
case LOCAL_GL_VENDOR:
case LOCAL_GL_RENDERER:
@ -1514,7 +1508,6 @@ WebGLContext::MozGetUnderlyingParamString(uint32_t pname, nsAString& retval)
void
WebGLContext::ClearScreen()
{
MakeContextCurrent();
ScopedBindFramebuffer autoFB(gl, 0);
const bool changeDrawBuffers = (mDefaultFB_DrawBuffer0 != LOCAL_GL_BACK);
@ -1539,8 +1532,6 @@ void
WebGLContext::ForceClearFramebufferWithDefaultValues(GLbitfield clearBits,
bool fakeNoAlpha)
{
MakeContextCurrent();
const bool initializeColorBuffer = bool(clearBits & LOCAL_GL_COLOR_BUFFER_BIT);
const bool initializeDepthBuffer = bool(clearBits & LOCAL_GL_DEPTH_BUFFER_BIT);
const bool initializeStencilBuffer = bool(clearBits & LOCAL_GL_STENCIL_BUFFER_BIT);
@ -1639,8 +1630,6 @@ WebGLContext::PresentScreenBuffer()
}
MOZ_ASSERT(!mBackbufferNeedsClear);
gl->MakeCurrent();
GLScreenBuffer* screen = gl->Screen();
MOZ_ASSERT(screen);
@ -1979,7 +1968,6 @@ WebGLContext::GetSurfaceSnapshot(gfxAlphaType* const out_alphaType)
if (NS_WARN_IF(!surf))
return nullptr;
gl->MakeCurrent();
{
ScopedBindFramebuffer autoFB(gl, 0);
ClearBackbufferIfNeeded();
@ -2442,7 +2430,6 @@ WebGLContext::ValidateArrayBufferView(const char* funcName,
void
WebGLContext::UpdateMaxDrawBuffers()
{
gl->MakeCurrent();
mGLMaxColorAttachments = gl->GetIntAs<uint32_t>(LOCAL_GL_MAX_COLOR_ATTACHMENTS);
mGLMaxDrawBuffers = gl->GetIntAs<uint32_t>(LOCAL_GL_MAX_DRAW_BUFFERS);

Просмотреть файл

@ -314,6 +314,9 @@ class WebGLContext
mutable uint64_t mNumPerfWarnings;
const uint32_t mMaxAcceptableFBStatusInvals;
uint64_t mNextFenceId = 1;
uint64_t mCompletedFenceId = 0;
public:
WebGLContext();
@ -1707,8 +1710,6 @@ protected:
void Invalidate();
void DestroyResourcesAndContext();
void MakeContextCurrent() const { } // MakeCurrent is implicit now.
// helpers
bool ConvertImage(size_t width, size_t height, size_t srcStride,

Просмотреть файл

@ -149,7 +149,6 @@ WebGLContext::BindBuffer(GLenum target, WebGLBuffer* buffer)
if (buffer && !buffer->ValidateCanBindToTarget(funcName, target))
return;
gl->MakeCurrent();
gl->fBindBuffer(target, buffer ? buffer->mGLName : 0);
WebGLBuffer::SetSlot(target, buffer, slot);
@ -216,7 +215,6 @@ WebGLContext::BindBufferBase(GLenum target, GLuint index, WebGLBuffer* buffer)
////
gl->MakeCurrent();
gl->fBindBufferBase(target, index, buffer ? buffer->mGLName : 0);
////
@ -266,8 +264,6 @@ WebGLContext::BindBufferRange(GLenum target, GLuint index, WebGLBuffer* buffer,
////
gl->MakeCurrent();
switch (target) {
case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER:
if (offset % 4 != 0 || size % 4 != 0) {
@ -448,7 +444,6 @@ WebGLContext::CreateBuffer()
return nullptr;
GLuint buf = 0;
MakeContextCurrent();
gl->fGenBuffers(1, &buf);
RefPtr<WebGLBuffer> globj = new WebGLBuffer(this, buf);
@ -509,7 +504,6 @@ WebGLContext::IsBuffer(WebGLBuffer* buffer)
if (!ValidateIsObject("isBuffer", buffer))
return false;
MakeContextCurrent();
return gl->fIsBuffer(buffer->mGLName);
}

Просмотреть файл

@ -521,8 +521,6 @@ WebGLContext::DrawArraysInstanced(GLenum mode, GLint first, GLsizei vertCount,
if (IsContextLost())
return;
MakeContextCurrent();
bool error = false;
ScopedResolveTexturesForDraw scopedResolve(this, funcName, &error);
if (error)
@ -679,8 +677,6 @@ WebGLContext::DrawElementsInstanced(GLenum mode, GLsizei indexCount, GLenum type
if (IsContextLost())
return;
MakeContextCurrent();
bool error = false;
ScopedResolveTexturesForDraw scopedResolve(this, funcName, &error);
if (error)
@ -999,7 +995,6 @@ WebGLContext::FakeBlackTexture::FakeBlackTexture(gl::GLContext* gl)
WebGLContext::FakeBlackTexture::~FakeBlackTexture()
{
mGL->MakeCurrent();
mGL->fDeleteTextures(1, &mGLName);
}

Просмотреть файл

@ -20,8 +20,6 @@ WebGLContext::Clear(GLbitfield mask)
if (IsContextLost())
return;
MakeContextCurrent();
uint32_t m = mask & (LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT | LOCAL_GL_STENCIL_BUFFER_BIT);
if (mask != m)
return ErrorInvalidValue("%s: invalid mask bits", funcName);
@ -79,8 +77,6 @@ WebGLContext::ClearColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
if (IsContextLost())
return;
MakeContextCurrent();
const bool supportsFloatColorBuffers = (IsExtensionEnabled(WebGLExtensionID::EXT_color_buffer_float) ||
IsExtensionEnabled(WebGLExtensionID::EXT_color_buffer_half_float) ||
IsExtensionEnabled(WebGLExtensionID::WEBGL_color_buffer_float));
@ -105,7 +101,6 @@ WebGLContext::ClearDepth(GLclampf v)
if (IsContextLost())
return;
MakeContextCurrent();
mDepthClearValue = GLClampFloat(v);
gl->fClearDepth(mDepthClearValue);
}
@ -116,7 +111,6 @@ WebGLContext::ClearStencil(GLint v)
if (IsContextLost())
return;
MakeContextCurrent();
mStencilClearValue = v;
gl->fClearStencil(v);
}
@ -127,7 +121,6 @@ WebGLContext::ColorMask(WebGLboolean r, WebGLboolean g, WebGLboolean b, WebGLboo
if (IsContextLost())
return;
MakeContextCurrent();
mColorWriteMask[0] = r;
mColorWriteMask[1] = g;
mColorWriteMask[2] = b;
@ -141,7 +134,6 @@ WebGLContext::DepthMask(WebGLboolean b)
if (IsContextLost())
return;
MakeContextCurrent();
mDepthWriteMask = b;
gl->fDepthMask(b);
}
@ -195,7 +187,6 @@ WebGLContext::StencilMask(GLuint mask)
mStencilWriteMaskFront = mask;
mStencilWriteMaskBack = mask;
MakeContextCurrent();
gl->fStencilMask(mask);
}
@ -221,7 +212,6 @@ WebGLContext::StencilMaskSeparate(GLenum face, GLuint mask)
break;
}
MakeContextCurrent();
gl->fStencilMaskSeparate(face, mask);
}

Просмотреть файл

@ -93,7 +93,6 @@ WebGLContext::ActiveTexture(GLenum texture)
texture, mGLMaxTextureUnits);
}
MakeContextCurrent();
mActiveTexture = texture - LOCAL_GL_TEXTURE0;
gl->fActiveTexture(texture);
}
@ -138,8 +137,6 @@ WebGLContext::BindFramebuffer(GLenum target, WebGLFramebuffer* wfb)
if (wfb && !ValidateObject("bindFramebuffer", *wfb))
return;
MakeContextCurrent();
if (!wfb) {
gl->fBindFramebuffer(target, 0);
} else {
@ -198,7 +195,6 @@ void WebGLContext::BlendEquation(GLenum mode)
if (!ValidateBlendEquationEnum(mode, "blendEquation: mode"))
return;
MakeContextCurrent();
gl->fBlendEquation(mode);
}
@ -211,7 +207,6 @@ void WebGLContext::BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
!ValidateBlendEquationEnum(modeAlpha, "blendEquationSeparate: modeAlpha"))
return;
MakeContextCurrent();
gl->fBlendEquationSeparate(modeRGB, modeAlpha);
}
@ -280,7 +275,6 @@ void WebGLContext::BlendFunc(GLenum sfactor, GLenum dfactor)
if (!ValidateBlendFuncEnumsCompatibility(sfactor, dfactor, "blendFuncSeparate: srcRGB and dstRGB"))
return;
MakeContextCurrent();
gl->fBlendFunc(sfactor, dfactor);
}
@ -299,7 +293,6 @@ WebGLContext::BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
if (!ValidateBlendFuncEnumsCompatibility(srcRGB, dstRGB, "blendFuncSeparate: srcRGB and dstRGB"))
return;
MakeContextCurrent();
gl->fBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
}
@ -369,7 +362,6 @@ WebGLContext::CullFace(GLenum face)
if (!ValidateFaceEnum(face, "cullFace"))
return;
MakeContextCurrent();
gl->fCullFace(face);
}
@ -489,7 +481,6 @@ WebGLContext::DepthFunc(GLenum func)
if (!ValidateComparisonEnum(func, "depthFunc"))
return;
MakeContextCurrent();
gl->fDepthFunc(func);
}
@ -502,7 +493,6 @@ WebGLContext::DepthRange(GLfloat zNear, GLfloat zFar)
if (zNear > zFar)
return ErrorInvalidOperation("depthRange: the near value is greater than the far value!");
MakeContextCurrent();
gl->fDepthRange(zNear, zFar);
}
@ -587,7 +577,6 @@ WebGLContext::FrontFace(GLenum mode)
return ErrorInvalidEnumInfo("frontFace: mode", mode);
}
MakeContextCurrent();
gl->fFrontFace(mode);
}
@ -701,8 +690,6 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
MOZ_CRASH("GFX: Bad target.");
}
MakeContextCurrent();
if (fb)
return fb->GetAttachmentParameter(funcName, cx, target, attachment, pname, &rv);
@ -841,8 +828,6 @@ WebGLContext::GetRenderbufferParameter(GLenum target, GLenum pname)
return JS::NullValue();
}
MakeContextCurrent();
switch (pname) {
case LOCAL_GL_RENDERBUFFER_SAMPLES:
if (!IsWebGL2())
@ -879,7 +864,6 @@ WebGLContext::CreateTexture()
return nullptr;
GLuint tex = 0;
MakeContextCurrent();
gl->fGenTextures(1, &tex);
RefPtr<WebGLTexture> globj = new WebGLTexture(this, tex);
@ -929,7 +913,6 @@ WebGLContext::GetError()
// Either no WebGL-side error, or it's already been cleared.
// UnderlyingGL-side errors, now.
MakeContextCurrent();
GetAndFlushUnderlyingGLErrors();
err = GetAndClearError(&mUnderlyingGLError);
@ -1024,7 +1007,6 @@ WebGLContext::Hint(GLenum target, GLenum mode)
if (!isValid)
return ErrorInvalidEnum("hint: invalid hint");
MakeContextCurrent();
gl->fHint(target, mode);
}
@ -1042,7 +1024,6 @@ WebGLContext::IsFramebuffer(const WebGLFramebuffer* fb)
}
#endif
MakeContextCurrent();
return gl->fIsFramebuffer(fb->mGLName);
}
@ -1149,7 +1130,6 @@ WebGLContext::PixelStorei(GLenum pname, GLint param)
return;
}
MakeContextCurrent();
gl->fPixelStorei(pname, param);
*pValueSlot = param;
return;
@ -1197,7 +1177,6 @@ WebGLContext::PixelStorei(GLenum pname, GLint param)
else if (pname == LOCAL_GL_UNPACK_ALIGNMENT)
mPixelStore_UnpackAlignment = param;
MakeContextCurrent();
gl->fPixelStorei(pname, param);
return;
@ -1441,7 +1420,6 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum
bytesAfterOffset = checkedBytesAfterOffset.value();
}
gl->MakeCurrent();
const ScopedLazyBind lazyBind(gl, LOCAL_GL_PIXEL_PACK_BUFFER, buffer);
ReadPixelsImpl(x, y, width, height, format, type, (void*)offset, bytesAfterOffset);
@ -1578,8 +1556,6 @@ WebGLContext::ReadPixelsImpl(GLint x, GLint y, GLsizei rawWidth, GLsizei rawHeig
//////
MakeContextCurrent();
const webgl::FormatUsageInfo* srcFormat;
uint32_t srcWidth;
uint32_t srcHeight;
@ -1732,7 +1708,6 @@ WebGLContext::Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
if (width < 0 || height < 0)
return ErrorInvalidValue("scissor: negative size");
MakeContextCurrent();
gl->fScissor(x, y, width, height);
}
@ -1750,7 +1725,6 @@ WebGLContext::StencilFunc(GLenum func, GLint ref, GLuint mask)
mStencilValueMaskFront = mask;
mStencilValueMaskBack = mask;
MakeContextCurrent();
gl->fStencilFunc(func, ref, mask);
}
@ -1781,7 +1755,6 @@ WebGLContext::StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint ma
break;
}
MakeContextCurrent();
gl->fStencilFuncSeparate(face, func, ref, mask);
}
@ -1796,7 +1769,6 @@ WebGLContext::StencilOp(GLenum sfail, GLenum dpfail, GLenum dppass)
!ValidateStencilOpEnum(dppass, "stencilOp: dppass"))
return;
MakeContextCurrent();
gl->fStencilOp(sfail, dpfail, dppass);
}
@ -1812,7 +1784,6 @@ WebGLContext::StencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum
!ValidateStencilOpEnum(dppass, "stencilOpSeparate: dppass"))
return;
MakeContextCurrent();
gl->fStencilOpSeparate(face, sfail, dpfail, dppass);
}
@ -1885,7 +1856,6 @@ WebGLContext::Uniform1i(WebGLUniformLocation* loc, GLint a1)
if (error)
return;
MakeContextCurrent();
gl->fUniform1i(loc->mLoc, a1);
}
@ -1896,7 +1866,6 @@ WebGLContext::Uniform2i(WebGLUniformLocation* loc, GLint a1, GLint a2)
if (!ValidateUniformSetter(loc, 2, LOCAL_GL_INT, funcName))
return;
MakeContextCurrent();
gl->fUniform2i(loc->mLoc, a1, a2);
}
@ -1907,7 +1876,6 @@ WebGLContext::Uniform3i(WebGLUniformLocation* loc, GLint a1, GLint a2, GLint a3)
if (!ValidateUniformSetter(loc, 3, LOCAL_GL_INT, funcName))
return;
MakeContextCurrent();
gl->fUniform3i(loc->mLoc, a1, a2, a3);
}
@ -1919,7 +1887,6 @@ WebGLContext::Uniform4i(WebGLUniformLocation* loc, GLint a1, GLint a2, GLint a3,
if (!ValidateUniformSetter(loc, 4, LOCAL_GL_INT, funcName))
return;
MakeContextCurrent();
gl->fUniform4i(loc->mLoc, a1, a2, a3, a4);
}
@ -1932,7 +1899,6 @@ WebGLContext::Uniform1f(WebGLUniformLocation* loc, GLfloat a1)
if (!ValidateUniformSetter(loc, 1, LOCAL_GL_FLOAT, funcName))
return;
MakeContextCurrent();
gl->fUniform1f(loc->mLoc, a1);
}
@ -1943,7 +1909,6 @@ WebGLContext::Uniform2f(WebGLUniformLocation* loc, GLfloat a1, GLfloat a2)
if (!ValidateUniformSetter(loc, 2, LOCAL_GL_FLOAT, funcName))
return;
MakeContextCurrent();
gl->fUniform2f(loc->mLoc, a1, a2);
}
@ -1955,7 +1920,6 @@ WebGLContext::Uniform3f(WebGLUniformLocation* loc, GLfloat a1, GLfloat a2,
if (!ValidateUniformSetter(loc, 3, LOCAL_GL_FLOAT, funcName))
return;
MakeContextCurrent();
gl->fUniform3f(loc->mLoc, a1, a2, a3);
}
@ -1967,7 +1931,6 @@ WebGLContext::Uniform4f(WebGLUniformLocation* loc, GLfloat a1, GLfloat a2,
if (!ValidateUniformSetter(loc, 4, LOCAL_GL_FLOAT, funcName))
return;
MakeContextCurrent();
gl->fUniform4f(loc->mLoc, a1, a2, a3, a4);
}
@ -2030,7 +1993,6 @@ WebGLContext::UniformNiv(const char* funcName, uint8_t N, WebGLUniformLocation*
};
const auto func = kFuncList[N-1];
MakeContextCurrent();
(gl->*func)(loc->mLoc, numElementsToUpload, elemBytes);
}
@ -2063,7 +2025,6 @@ WebGLContext::UniformNuiv(const char* funcName, uint8_t N, WebGLUniformLocation*
};
const auto func = kFuncList[N-1];
MakeContextCurrent();
(gl->*func)(loc->mLoc, numElementsToUpload, elemBytes);
}
@ -2096,7 +2057,6 @@ WebGLContext::UniformNfv(const char* funcName, uint8_t N, WebGLUniformLocation*
};
const auto func = kFuncList[N-1];
MakeContextCurrent();
(gl->*func)(loc->mLoc, numElementsToUpload, elemBytes);
}
@ -2184,7 +2144,6 @@ WebGLContext::UniformMatrixAxBfv(const char* funcName, uint8_t A, uint8_t B,
};
const auto func = kFuncList[3*(A-2) + (B-2)];
MakeContextCurrent();
(gl->*func)(loc->mLoc, numMatsToUpload, uploadTranspose, uploadBytes);
}
@ -2230,7 +2189,6 @@ WebGLContext::CreateFramebuffer()
return nullptr;
GLuint fbo = 0;
MakeContextCurrent();
gl->fGenFramebuffers(1, &fbo);
RefPtr<WebGLFramebuffer> globj = new WebGLFramebuffer(this, fbo);
@ -2243,7 +2201,6 @@ WebGLContext::CreateRenderbuffer()
if (IsContextLost())
return nullptr;
MakeContextCurrent();
RefPtr<WebGLRenderbuffer> globj = new WebGLRenderbuffer(this);
return globj.forget();
}
@ -2260,7 +2217,6 @@ WebGLContext::Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
width = std::min(width, (GLsizei)mGLMaxViewportDims[0]);
height = std::min(height, (GLsizei)mGLMaxViewportDims[1]);
MakeContextCurrent();
gl->fViewport(x, y, width, height);
mViewportX = x;
@ -2335,7 +2291,6 @@ WebGLContext::GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype)
return nullptr;
}
MakeContextCurrent();
GLint range[2], precision;
if (mDisableFragHighP &&
@ -2411,27 +2366,33 @@ WebGLContext::RestoreContext()
}
void
WebGLContext::BlendColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
WebGLContext::BlendColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
{
if (IsContextLost())
return;
MakeContextCurrent();
gl->fBlendColor(r, g, b, a);
}
void
WebGLContext::Flush() {
WebGLContext::Flush()
{
if (IsContextLost())
return;
MakeContextCurrent();
gl->fFlush();
}
void
WebGLContext::Finish() {
WebGLContext::Finish()
{
if (IsContextLost())
return;
MakeContextCurrent();
gl->fFinish();
mCompletedFenceId = mNextFenceId;
mNextFenceId += 1;
}
void
@ -2453,23 +2414,24 @@ WebGLContext::LineWidth(GLfloat width)
width = 1.0;
}
MakeContextCurrent();
gl->fLineWidth(width);
}
void
WebGLContext::PolygonOffset(GLfloat factor, GLfloat units) {
WebGLContext::PolygonOffset(GLfloat factor, GLfloat units)
{
if (IsContextLost())
return;
MakeContextCurrent();
gl->fPolygonOffset(factor, units);
}
void
WebGLContext::SampleCoverage(GLclampf value, WebGLboolean invert) {
WebGLContext::SampleCoverage(GLclampf value, WebGLboolean invert)
{
if (IsContextLost())
return;
MakeContextCurrent();
gl->fSampleCoverage(value, invert);
}

Просмотреть файл

@ -37,7 +37,6 @@ WebGLContext::Disable(GLenum cap)
*trackingSlot = 0;
}
MakeContextCurrent();
gl->fDisable(cap);
}
@ -57,7 +56,6 @@ WebGLContext::Enable(GLenum cap)
*trackingSlot = 1;
}
MakeContextCurrent();
gl->fEnable(cap);
}
@ -179,8 +177,6 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
if (IsContextLost())
return JS::NullValue();
MakeContextCurrent();
if (IsWebGL2() || IsExtensionEnabled(WebGLExtensionID::WEBGL_draw_buffers)) {
if (pname == LOCAL_GL_MAX_COLOR_ATTACHMENTS) {
return JS::Int32Value(mGLMaxColorAttachments);
@ -617,8 +613,6 @@ WebGLContext::GetParameterIndexed(JSContext* cx, GLenum pname, GLuint index,
return;
}
MakeContextCurrent();
switch (pname) {
case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
{
@ -648,7 +642,6 @@ WebGLContext::IsEnabled(GLenum cap)
if (!ValidateCapabilityEnum(cap, "isEnabled"))
return false;
MakeContextCurrent();
return gl->fIsEnabled(cap);
}

Просмотреть файл

@ -241,9 +241,6 @@ WebGLContext::BindTexture(GLenum rawTarget, WebGLTexture* newTex)
}
const TexTarget texTarget(rawTarget);
MakeContextCurrent();
if (newTex) {
if (!newTex->BindTexture(texTarget))
return;

Просмотреть файл

@ -742,8 +742,6 @@ void
WebGLContext::AssertCachedBindings()
{
#ifdef DEBUG
MakeContextCurrent();
GetAndFlushUnderlyingGLErrors();
if (IsWebGL2() || IsExtensionEnabled(WebGLExtensionID::OES_vertex_array_object)) {
@ -809,8 +807,6 @@ void
WebGLContext::AssertCachedGlobalState()
{
#ifdef DEBUG
MakeContextCurrent();
GetAndFlushUnderlyingGLErrors();
////////////////

Просмотреть файл

@ -486,8 +486,6 @@ WebGLContext::InitAndValidateGL(FailureReason* const out_failReason)
mBoundReadFramebuffer = nullptr;
mBoundRenderbuffer = nullptr;
MakeContextCurrent();
gl->GetUIntegerv(LOCAL_GL_MAX_VERTEX_ATTRIBS, &mGLMaxVertexAttribs);
if (mGLMaxVertexAttribs < 8) {

Просмотреть файл

@ -21,8 +21,6 @@ WebGLContext::BindVertexArray(WebGLVertexArray* array)
if (array && !ValidateObject("bindVertexArrayObject", *array))
return;
MakeContextCurrent();
if (mBoundVertexArray) {
mBoundVertexArray->AddBufferBindCounts(-1);
}
@ -47,7 +45,6 @@ WebGLContext::CreateVertexArray()
RefPtr<WebGLVertexArray> globj = CreateVertexArrayImpl();
MakeContextCurrent();
globj->GenVertexArray();
return globj.forget();
@ -77,7 +74,6 @@ WebGLContext::IsVertexArray(const WebGLVertexArray* array)
if (!ValidateIsObject("isVertexArray", array))
return false;
MakeContextCurrent();
return array->IsVertexArray();
}

Просмотреть файл

@ -74,7 +74,6 @@ WebGLContext::VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfl
////
gl->MakeCurrent();
if (index || !gl->IsCompatibilityProfile()) {
gl->fVertexAttrib4f(index, x, y, z, w);
}
@ -106,7 +105,6 @@ WebGL2Context::VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w,
////
gl->MakeCurrent();
if (index || !gl->IsCompatibilityProfile()) {
gl->fVertexAttribI4i(index, x, y, z, w);
}
@ -138,7 +136,6 @@ WebGL2Context::VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLui
////
gl->MakeCurrent();
if (index || !gl->IsCompatibilityProfile()) {
gl->fVertexAttribI4ui(index, x, y, z, w);
}
@ -165,8 +162,6 @@ WebGLContext::EnableVertexAttribArray(GLuint index)
if (!ValidateAttribIndex(index, "enableVertexAttribArray"))
return;
MakeContextCurrent();
gl->fEnableVertexAttribArray(index);
MOZ_ASSERT(mBoundVertexArray);
@ -183,8 +178,6 @@ WebGLContext::DisableVertexAttribArray(GLuint index)
if (!ValidateAttribIndex(index, "disableVertexAttribArray"))
return;
MakeContextCurrent();
if (index || !gl->IsCompatibilityProfile()) {
gl->fDisableVertexAttribArray(index);
}
@ -207,8 +200,6 @@ WebGLContext::GetVertexAttrib(JSContext* cx, GLuint index, GLenum pname,
MOZ_ASSERT(mBoundVertexArray);
MakeContextCurrent();
switch (pname) {
case LOCAL_GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
return WebGLObjectAsJSValue(cx, mBoundVertexArray->mAttribs[index].mBuf.get(), rv);
@ -417,7 +408,6 @@ WebGLContext::VertexAttribAnyPointer(const char* funcName, bool isFuncInt, GLuin
////
gl->MakeCurrent();
if (isFuncInt) {
gl->fVertexAttribIPointer(index, size, type, stride,
reinterpret_cast<void*>(byteOffset));
@ -446,8 +436,6 @@ WebGLContext::VertexAttribDivisor(GLuint index, GLuint divisor)
mBoundVertexArray->mAttribs[index].mDivisor = divisor;
mBoundVertexArray->InvalidateCaches();
MakeContextCurrent();
gl->fVertexAttribDivisor(index, divisor);
}

Просмотреть файл

@ -117,7 +117,6 @@ WebGLExtensionDisjointTimerQuery::GetQueryObjectEXT(JSContext* cx,
bool
WebGLExtensionDisjointTimerQuery::IsSupported(const WebGLContext* webgl)
{
webgl->MakeContextCurrent();
gl::GLContext* gl = webgl->GL();
return gl->IsSupported(gl::GLFeature::query_objects) &&
gl->IsSupported(gl::GLFeature::get_query_object_i64v) &&

Просмотреть файл

@ -27,7 +27,6 @@ WebGLExtensionMOZDebug::GetParameter(JSContext* cx, GLenum pname,
ErrorResult& er) const
{
const auto& gl = mContext->gl;
gl->MakeCurrent();
switch (pname) {
case LOCAL_GL_EXTENSIONS:

Просмотреть файл

@ -21,7 +21,6 @@ WebGLExtensionSRGB::WebGLExtensionSRGB(WebGLContext* webgl)
if (!gl->IsGLES()) {
// Desktop OpenGL requires the following to be enabled in order to
// support sRGB operations on framebuffers.
gl->MakeCurrent();
gl->fEnable(LOCAL_GL_FRAMEBUFFER_SRGB_EXT);
}

Просмотреть файл

@ -655,7 +655,6 @@ WebGLFramebuffer::Delete()
cur.Clear(funcName);
}
mContext->MakeContextCurrent();
mContext->gl->fDeleteFramebuffers(1, &mGLName);
LinkedListElement<WebGLFramebuffer>::removeFrom(mContext->mFramebuffers);
@ -1087,8 +1086,6 @@ WebGLFramebuffer::ResolveAttachmentData(const char* funcName) const
////
// Clear
mContext->MakeContextCurrent();
const bool hasDrawBuffers = mContext->HasDrawBuffers();
if (hasDrawBuffers) {
fnDrawBuffers(colorAttachmentsToClear);
@ -1203,7 +1200,6 @@ WebGLFramebuffer::CheckFramebufferStatus(const char* funcName)
// Looks good on our end. Let's ask the driver.
gl::GLContext* const gl = mContext->gl;
gl->MakeCurrent();
const ScopedFBRebinder autoFB(mContext);
gl->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, mGLName);
@ -1333,8 +1329,6 @@ WebGLFramebuffer::DrawBuffers(const char* funcName, const dom::Sequence<GLenum>&
////
mContext->MakeContextCurrent();
mColorDrawBuffers.swap(newColorDrawBuffers);
RefreshDrawBuffers(); // Calls glDrawBuffers.
RefreshResolvedData();
@ -1358,8 +1352,6 @@ WebGLFramebuffer::ReadBuffer(const char* funcName, GLenum attachPoint)
////
mContext->MakeContextCurrent();
mColorReadBuffer = attach;
RefreshReadBuffer(); // Calls glReadBuffer.
RefreshResolvedData();
@ -1936,7 +1928,6 @@ WebGLFramebuffer::BlitFramebuffer(WebGLContext* webgl,
////
gl->MakeCurrent();
webgl->OnBeforeReadCall();
WebGLContext::ScopedDrawCallWrapper wrapper(*webgl);
gl->fBlitFramebuffer(srcX0, srcY0, srcX1, srcY1,

Просмотреть файл

@ -560,16 +560,9 @@ webgl::LinkedProgramInfo::GetDrawFetchLimits(const char* const funcName) const
////////////////////////////////////////////////////////////////////////////////
// WebGLProgram
static GLuint
CreateProgram(gl::GLContext* gl)
{
gl->MakeCurrent();
return gl->fCreateProgram();
}
WebGLProgram::WebGLProgram(WebGLContext* webgl)
: WebGLRefCountedObject(webgl)
, mGLName(CreateProgram(webgl->GL()))
, mGLName(webgl->gl->fCreateProgram())
, mNumActiveTFOs(0)
, mNextLink_TransformFeedbackBufferMode(LOCAL_GL_INTERLEAVED_ATTRIBS)
{
@ -585,8 +578,6 @@ void
WebGLProgram::Delete()
{
gl::GLContext* gl = mContext->GL();
gl->MakeCurrent();
gl->fDeleteProgram(mGLName);
mVertShader = nullptr;
@ -628,7 +619,6 @@ WebGLProgram::AttachShader(WebGLShader* shader)
*shaderSlot = shader;
mContext->MakeContextCurrent();
mContext->gl->fAttachShader(mGLName, shader->mGLName);
}
@ -686,7 +676,6 @@ WebGLProgram::DetachShader(const WebGLShader* shader)
*shaderSlot = nullptr;
mContext->MakeContextCurrent();
mContext->gl->fDetachShader(mGLName, shader->mGLName);
}
@ -785,12 +774,9 @@ WebGLProgram::GetFragDataLocation(const nsAString& userName_wide) const
return -1;
}
const auto& gl = mContext->gl;
gl->MakeCurrent();
const NS_LossyConvertUTF16toASCII userName(userName_wide);
#ifdef XP_MACOSX
const auto& gl = mContext->gl;
if (gl->WorkAroundDriverBugs()) {
// OSX doesn't return locs for indexed names, just the base names.
// Indicated by failure in: conformance2/programs/gl-get-frag-data-location.html
@ -829,7 +815,6 @@ JS::Value
WebGLProgram::GetProgramParameter(GLenum pname) const
{
gl::GLContext* gl = mContext->gl;
gl->MakeCurrent();
if (mContext->IsWebGL2()) {
switch (pname) {
@ -912,7 +897,6 @@ WebGLProgram::GetUniformBlockIndex(const nsAString& userName_wide) const
const auto& mappedName = info->mMappedName;
gl::GLContext* gl = mContext->GL();
gl->MakeCurrent();
return gl->fGetUniformBlockIndex(mGLName, mappedName.BeginReading());
}
@ -1034,7 +1018,6 @@ WebGLProgram::GetUniformLocation(const nsAString& userName_wide) const
return nullptr;
gl::GLContext* gl = mContext->GL();
gl->MakeCurrent();
GLint loc = gl->fGetUniformLocation(mGLName, mappedName.BeginReading());
if (loc == -1)
@ -1059,7 +1042,6 @@ WebGLProgram::GetUniformIndices(const dom::Sequence<nsString>& uniformNames,
nsTArray<GLuint>& arr = retval.SetValue();
gl::GLContext* gl = mContext->GL();
gl->MakeCurrent();
for (size_t i = 0; i < count; i++) {
const NS_LossyConvertUTF16toASCII userName(uniformNames[i]);
@ -1108,7 +1090,6 @@ WebGLProgram::UniformBlockBinding(GLuint uniformBlockIndex,
////
gl::GLContext* gl = mContext->GL();
gl->MakeCurrent();
gl->fUniformBlockBinding(mGLName, uniformBlockIndex, uniformBlockBinding);
////
@ -1170,7 +1151,6 @@ WebGLProgram::LinkProgram()
return;
}
mContext->MakeContextCurrent();
// as some of the validation changes program state
mLinkLog.Truncate();
@ -1464,8 +1444,6 @@ WebGLProgram::UseProgram() const
return false;
}
mContext->MakeContextCurrent();
mContext->gl->fUseProgram(mGLName);
return true;
}
@ -1473,7 +1451,6 @@ WebGLProgram::UseProgram() const
void
WebGLProgram::ValidateProgram() const
{
mContext->MakeContextCurrent();
gl::GLContext* gl = mContext->gl;
#ifdef XP_MACOSX
@ -1562,7 +1539,6 @@ WebGLProgram::TransformFeedbackVaryings(const dom::Sequence<nsString>& varyings,
const char funcName[] = "transformFeedbackVaryings";
const auto& gl = mContext->gl;
gl->MakeCurrent();
switch (bufferMode) {
case LOCAL_GL_INTERLEAVED_ATTRIBS:

Просмотреть файл

@ -36,8 +36,6 @@ public:
static GLuint
GenQuery(gl::GLContext* gl)
{
gl->MakeCurrent();
GLuint ret = 0;
gl->fGenQueries(1, &ret);
return ret;
@ -56,7 +54,6 @@ WebGLQuery::WebGLQuery(WebGLContext* webgl)
void
WebGLQuery::Delete()
{
mContext->MakeContextCurrent();
mContext->gl->fDeleteQueries(1, &mGLName);
LinkedListElement<WebGLQuery>::removeFrom(mContext->mQueries);
}
@ -116,7 +113,6 @@ WebGLQuery::BeginQuery(GLenum target, WebGLRefPtr<WebGLQuery>& slot)
////
const auto& gl = mContext->gl;
gl->MakeCurrent();
const auto driverTarget = TargetForDriver(gl, mTarget);
gl->fBeginQuery(driverTarget, mGLName);
@ -132,7 +128,6 @@ WebGLQuery::EndQuery()
////
const auto& gl = mContext->gl;
gl->MakeCurrent();
const auto driverTarget = TargetForDriver(gl, mTarget);
gl->fEndQuery(driverTarget);
@ -178,7 +173,6 @@ WebGLQuery::GetQueryParameter(GLenum pname, JS::MutableHandleValue retval) const
}
const auto& gl = mContext->gl;
gl->MakeCurrent();
uint64_t val = 0;
switch (pname) {
@ -261,7 +255,6 @@ WebGLQuery::QueryCounter(const char* funcName, GLenum target)
mCanBeAvailable = false;
const auto& gl = mContext->gl;
gl->MakeCurrent();
gl->fQueryCounter(mGLName, mTarget);
DispatchAvailableRunnable(this);

Просмотреть файл

@ -62,8 +62,6 @@ WebGLRenderbuffer::WebGLRenderbuffer(WebGLContext* webgl)
void
WebGLRenderbuffer::Delete()
{
mContext->MakeContextCurrent();
mContext->gl->fDeleteRenderbuffers(1, &mPrimaryRB);
if (mSecondaryRB)
mContext->gl->fDeleteRenderbuffers(1, &mSecondaryRB);
@ -197,8 +195,6 @@ WebGLRenderbuffer::RenderbufferStorage(const char* funcName, uint32_t samples,
return;
}
mContext->MakeContextCurrent();
if (!usage->maxSamplesKnown) {
const_cast<webgl::FormatUsageInfo*>(usage)->ResolveMaxSamples(mContext->gl);
}

Просмотреть файл

@ -35,7 +35,6 @@ WebGLSampler::~WebGLSampler()
void
WebGLSampler::Delete()
{
mContext->MakeContextCurrent();
mContext->gl->fDeleteSamplers(1, &mGLName);
removeFrom(mContext->mSamplers);
@ -197,7 +196,6 @@ WebGLSampler::SamplerParameter(const char* funcName, GLenum pname,
////
mContext->gl->MakeCurrent();
if (param.isFloat) {
mContext->gl->fSamplerParameterf(mGLName, pname, param.f);
} else {

Просмотреть файл

@ -133,16 +133,9 @@ GetCompilationStatusAndLog(gl::GLContext* gl, GLuint shader, bool* const out_suc
////////////////////////////////////////////////////////////////////////////////
static GLuint
CreateShader(gl::GLContext* gl, GLenum type)
{
gl->MakeCurrent();
return gl->fCreateShader(type);
}
WebGLShader::WebGLShader(WebGLContext* webgl, GLenum type)
: WebGLRefCountedObject(webgl)
, mGLName(CreateShader(webgl->GL(), type))
, mGLName(webgl->gl->fCreateShader(type))
, mType(type)
, mTranslationSuccessful(false)
, mCompilationSuccessful(false)
@ -229,8 +222,6 @@ WebGLShader::CompileShader()
mTranslationSuccessful = true;
gl->MakeCurrent();
const char* const parts[] = {
mTranslatedSource.BeginReading()
};
@ -448,7 +439,6 @@ WebGLShader::Delete()
{
gl::GLContext* gl = mContext->GL();
gl->MakeCurrent();
gl->fDeleteShader(mGLName);
LinkedListElement<WebGLShader>::removeFrom(mContext->mShaders);

Просмотреть файл

@ -13,9 +13,11 @@ namespace mozilla {
WebGLSync::WebGLSync(WebGLContext* webgl, GLenum condition, GLbitfield flags)
: WebGLRefCountedObject(webgl)
, mGLName(mContext->gl->fFenceSync(condition, flags))
, mFenceId(mContext->mNextFenceId)
{
mContext->mSyncs.insertBack(this);
mGLName = mContext->gl->fFenceSync(condition, flags);
mContext->mNextFenceId += 1;
mContext->mSyncs.insertBack(this);
}
WebGLSync::~WebGLSync()
@ -26,9 +28,7 @@ WebGLSync::~WebGLSync()
void
WebGLSync::Delete()
{
mContext->MakeContextCurrent();
mContext->gl->fDeleteSync(mGLName);
mGLName = 0;
LinkedListElement<WebGLSync>::removeFrom(mContext->mSyncs);
}
@ -38,6 +38,14 @@ WebGLSync::GetParentObject() const
return mContext;
}
void
WebGLSync::MarkSignaled() const
{
if (mContext->mCompletedFenceId < mFenceId) {
mContext->mCompletedFenceId = mFenceId;
}
}
// -------------------------------------------------------------------------
// IMPLEMENT NS
JSObject*

Просмотреть файл

@ -19,6 +19,9 @@ class WebGLSync final
{
friend class WebGL2Context;
const GLsync mGLName;
const uint64_t mFenceId;
public:
WebGLSync(WebGLContext* webgl, GLenum condition, GLbitfield flags);
@ -30,10 +33,10 @@ public:
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLSync)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLSync)
void MarkSignaled() const;
private:
~WebGLSync();
GLsync mGLName;
};
} // namespace mozilla

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше