Merge inbound to m-c a=merge

MozReview-Commit-ID: DQDuEiYLWCO
This commit is contained in:
Wes Kocher 2017-04-20 15:30:43 -07:00
commit 5ce5528fb1
1312 changed files with 107956 additions and 66775 deletions

View File

@ -1613,6 +1613,9 @@ pref("browser.formautofill.experimental", false);
pref("browser.formautofill.enabled", false); pref("browser.formautofill.enabled", false);
pref("browser.formautofill.loglevel", "Warn"); pref("browser.formautofill.loglevel", "Warn");
// Whether or not to restore a session with lazy-browser tabs.
pref("browser.sessionstore.restore_tabs_lazily", true);
// Enable safebrowsing v4 tables (suffixed by "-proto") update. // Enable safebrowsing v4 tables (suffixed by "-proto") update.
#ifdef NIGHTLY_BUILD #ifdef NIGHTLY_BUILD
pref("urlclassifier.malwareTable", "goog-malware-shavar,goog-unwanted-shavar,goog-malware-proto,goog-unwanted-proto,test-malware-simple,test-unwanted-simple"); pref("urlclassifier.malwareTable", "goog-malware-shavar,goog-unwanted-shavar,goog-malware-proto,goog-unwanted-proto,test-malware-simple,test-unwanted-simple");

View File

@ -8219,8 +8219,8 @@ var MousePosTracker = {
handleEvent(event) { handleEvent(event) {
var fullZoom = this._windowUtils.fullZoom; var fullZoom = this._windowUtils.fullZoom;
this._x = event.clientX / fullZoom; this._x = event.screenX / fullZoom - window.mozInnerScreenX;
this._y = event.clientY / fullZoom; this._y = event.screenY / fullZoom - window.mozInnerScreenY;
this._listeners.forEach(function(listener) { this._listeners.forEach(function(listener) {
try { try {

View File

@ -2034,7 +2034,8 @@
"addProgressListener", "removeProgressListener", "audioPlaybackStarted", "addProgressListener", "removeProgressListener", "audioPlaybackStarted",
"audioPlaybackStopped", "adjustPriority", "pauseMedia", "stopMedia", "audioPlaybackStopped", "adjustPriority", "pauseMedia", "stopMedia",
"blockMedia", "resumeMedia", "mute", "unmute", "blockedPopups", "lastURI", "blockMedia", "resumeMedia", "mute", "unmute", "blockedPopups", "lastURI",
"purgeSessionHistory", "stopScroll", "startScroll" "purgeSessionHistory", "stopScroll", "startScroll",
"userTypedValue", "userTypedClear"
]</field> ]</field>
<method name="_createLazyBrowser"> <method name="_createLazyBrowser">
@ -2052,11 +2053,51 @@
switch (name) { switch (name) {
case "permitUnload": case "permitUnload":
getter = () => { getter = () => {
return function() { return () => {
return { permitUnload: true, timedOut: false }; return { permitUnload: true, timedOut: false };
}; };
}; };
break; break;
case "reload":
case "reloadWithFlags":
getter = () => {
return (params) => {
// Wait for load handler to be instantiated before
// initializing the reload.
aTab.addEventListener("SSTabRestoring", () => {
browser[name](params);
}, { once: true });
gBrowser._insertBrowser(aTab);
};
};
break;
case "isRemoteBrowser":
getter = () => {
return browser.getAttribute("remote") == "true";
};
break;
case "audioMuted":
getter = () => {
return false;
};
break;
case "currentURI":
getter = () => {
let url = SessionStore.getLazyTabValue(aTab, "url");
return Services.io.newURI(url);
};
break;
case "contentTitle":
getter = () => {
return SessionStore.getLazyTabValue(aTab, "title");
};
break;
case "userTypedValue":
case "userTypedClear":
getter = () => {
return SessionStore.getLazyTabValue(aTab, name);
};
break;
default: default:
getter = () => { getter = () => {
this._insertBrowser(aTab); this._insertBrowser(aTab);
@ -2084,9 +2125,8 @@
<![CDATA[ <![CDATA[
"use strict"; "use strict";
// If browser is already inserted, or aTab doesn't have a // If browser is already inserted don't do anything.
// browser, don't do anything. if (aTab.linkedPanel) {
if (aTab.linkedPanel || !aTab.linkedBrowser) {
return; return;
} }
@ -4876,7 +4916,8 @@
tab.linkedBrowser && tab.linkedBrowser &&
tab.linkedBrowser.isRemoteBrowser) { tab.linkedBrowser.isRemoteBrowser) {
label += " - e10s"; label += " - e10s";
if (Services.appinfo.maxWebProcessCount > 1) { if (tab.linkedBrowser.frameLoader &&
Services.appinfo.maxWebProcessCount > 1) {
label += " (" + tab.linkedBrowser.frameLoader.tabParent.osPid + ")"; label += " (" + tab.linkedBrowser.frameLoader.tabParent.osPid + ")";
} }
} }
@ -7245,6 +7286,11 @@
<parameter name="aMuteReason"/> <parameter name="aMuteReason"/>
<body> <body>
<![CDATA[ <![CDATA[
// Do not attempt to toggle mute state if browser is lazy.
if (!this.linkedPanel) {
return;
}
let tabContainer = this.parentNode; let tabContainer = this.parentNode;
let browser = this.linkedBrowser; let browser = this.linkedBrowser;
let modifiedAttrs = []; let modifiedAttrs = [];

View File

@ -334,6 +334,10 @@ this.SessionStore = {
SessionStoreInternal.deleteTabValue(aTab, aKey); SessionStoreInternal.deleteTabValue(aTab, aKey);
}, },
getLazyTabValue(aTab, aKey) {
return SessionStoreInternal.getLazyTabValue(aTab, aKey);
},
getGlobalValue: function ss_getGlobalValue(aKey) { getGlobalValue: function ss_getGlobalValue(aKey) {
return SessionStoreInternal.getGlobalValue(aKey); return SessionStoreInternal.getGlobalValue(aKey);
}, },
@ -1871,6 +1875,15 @@ var SessionStoreInternal = {
if (browser.frameLoader) { if (browser.frameLoader) {
this._lastKnownFrameLoader.set(browser.permanentKey, browser.frameLoader); this._lastKnownFrameLoader.set(browser.permanentKey, browser.frameLoader);
} }
// Only restore if browser has been lazy.
if (aTab.__SS_lazyData && !browser.__SS_restoreState && TabStateCache.get(browser)) {
let tabState = TabState.clone(aTab);
this.restoreTab(aTab, tabState);
}
// The browser has been inserted now, so lazy data is no longer relevant.
delete aTab.__SS_lazyData;
}, },
/** /**
@ -2545,6 +2558,19 @@ var SessionStoreInternal = {
} }
}, },
/**
* Retrieves data specific to lazy-browser tabs. If tab is not lazy,
* will return undefined.
*
* @param aTab (xul:tab)
* The tabbrowser-tab the data is for.
* @param aKey (string)
* The key which maps to the desired data.
*/
getLazyTabValue(aTab, aKey) {
return (aTab.__SS_lazyData || {})[aKey];
},
getGlobalValue: function ssi_getGlobalValue(aKey) { getGlobalValue: function ssi_getGlobalValue(aKey) {
return this._globalState.get(aKey); return this._globalState.get(aKey);
}, },
@ -3272,6 +3298,9 @@ var SessionStoreInternal = {
let numVisibleTabs = 0; let numVisibleTabs = 0;
let createLazyBrowser = this._prefBranch.getBoolPref("sessionstore.restore_tabs_lazily") &&
this._prefBranch.getBoolPref("sessionstore.restore_on_demand");
for (var t = 0; t < newTabCount; t++) { for (var t = 0; t < newTabCount; t++) {
// When trying to restore into existing tab, we also take the userContextId // When trying to restore into existing tab, we also take the userContextId
// into account if present. // into account if present.
@ -3280,7 +3309,8 @@ var SessionStoreInternal = {
(tabbrowser.tabs[t].getAttribute("usercontextid") == (userContextId || "")); (tabbrowser.tabs[t].getAttribute("usercontextid") == (userContextId || ""));
let tab = reuseExisting ? this._maybeUpdateBrowserRemoteness(tabbrowser.tabs[t]) let tab = reuseExisting ? this._maybeUpdateBrowserRemoteness(tabbrowser.tabs[t])
: tabbrowser.addTab("about:blank", : tabbrowser.addTab("about:blank",
{ skipAnimation: true, { createLazyBrowser,
skipAnimation: true,
userContextId, userContextId,
skipBackgroundNotify: true }); skipBackgroundNotify: true });
@ -3595,9 +3625,7 @@ var SessionStoreInternal = {
tabbrowser.selectedBrowser == browser || tabbrowser.selectedBrowser == browser ||
loadArguments; loadArguments;
if (!willRestoreImmediately && !forceOnDemand) { let isBrowserInserted = browser.isConnected;
TabRestoreQueue.add(tab);
}
// Increase the busy state counter before modifying the tab. // Increase the busy state counter before modifying the tab.
this._setWindowStateBusy(window); this._setWindowStateBusy(window);
@ -3665,14 +3693,6 @@ var SessionStoreInternal = {
// Save the index in case we updated it above. // Save the index in case we updated it above.
tabData.index = activeIndex + 1; tabData.index = activeIndex + 1;
// Start a new epoch to discard all frame script messages relating to a
// previous epoch. All async messages that are still on their way to chrome
// will be ignored and don't override any tab data set when restoring.
let epoch = this.startNextEpoch(browser);
// keep the data around to prevent dataloss in case
// a tab gets closed before it's been properly restored
browser.__SS_restoreState = TAB_STATE_NEEDS_RESTORE;
browser.setAttribute("pending", "true"); browser.setAttribute("pending", "true");
tab.setAttribute("pending", "true"); tab.setAttribute("pending", "true");
@ -3700,26 +3720,57 @@ var SessionStoreInternal = {
userTypedClear: tabData.userTypedClear || 0 userTypedClear: tabData.userTypedClear || 0
}); });
this._sendRestoreHistory(browser, {tabData, epoch, loadArguments});
// Update tab label and icon to show something
// while we wait for the messages to be processed.
this.updateTabLabelAndIcon(tab, tabData);
// Restore tab attributes. // Restore tab attributes.
if ("attributes" in tabData) { if ("attributes" in tabData) {
TabAttributes.set(tab, tabData.attributes); TabAttributes.set(tab, tabData.attributes);
} }
// This could cause us to ignore MAX_CONCURRENT_TAB_RESTORES a bit, but if (isBrowserInserted) {
// it ensures each window will have its selected tab loaded. // Start a new epoch to discard all frame script messages relating to a
if (willRestoreImmediately) { // previous epoch. All async messages that are still on their way to chrome
this.restoreTabContent(tab, loadArguments, reloadInFreshProcess, // will be ignored and don't override any tab data set when restoring.
restoreContentReason); let epoch = this.startNextEpoch(browser);
} else if (!forceOnDemand) {
this.restoreNextTab(); // Ensure that the tab will get properly restored in the event the tab
// crashes while restoring. But don't set this on lazy browsers as
// restoreTab will get called again when the browser is instantiated.
browser.__SS_restoreState = TAB_STATE_NEEDS_RESTORE;
this._sendRestoreHistory(browser, {tabData, epoch, loadArguments});
// This could cause us to ignore MAX_CONCURRENT_TAB_RESTORES a bit, but
// it ensures each window will have its selected tab loaded.
if (willRestoreImmediately) {
this.restoreTabContent(tab, loadArguments, reloadInFreshProcess,
restoreContentReason);
} else if (!forceOnDemand) {
TabRestoreQueue.add(tab);
this.restoreNextTab();
}
} else {
// __SS_lazyData holds data for lazy-browser tabs to proxy for
// data unobtainable from the unbound browser. This only applies to lazy
// browsers and will be removed once the browser is inserted in the document.
// This must preceed `updateTabLabelAndIcon` call for required data to be present.
let url = "about:blank";
let title = "";
if (activeIndex in tabData.entries) {
url = tabData.entries[activeIndex].url;
title = tabData.entries[activeIndex].title || url;
}
tab.__SS_lazyData = {
url,
title,
userTypedValue: tabData.userTypedValue || "",
userTypedClear: tabData.userTypedClear || 0
};
} }
// Update tab label and icon to show something
// while we wait for the messages to be processed.
this.updateTabLabelAndIcon(tab, tabData);
// Decrease the busy state counter after we're done. // Decrease the busy state counter after we're done.
this._setWindowStateReady(window); this._setWindowStateReady(window);
}, },

View File

@ -32,11 +32,27 @@ function test() {
"We still know that no load is ongoing"); "We still know that no load is ongoing");
is(gURLBar.value, "example.com", is(gURLBar.value, "example.com",
"Address bar's value correctly restored"); "Address bar's value correctly restored");
// Change tabs to make sure address bar value gets updated
gBrowser.selectedTab = gBrowser.tabContainer.getItemAtIndex(0); // Change tabs to make sure address bar value gets updated. If tab is
is(gURLBar.value, "about:mozilla", // lazy, wait for SSTabRestored to ensure address bar has time to update.
"Address bar's value correctly updated"); let tabToSelect = gBrowser.tabContainer.getItemAtIndex(0);
runNextTest(); if (tabToSelect.linkedBrowser.isConnected) {
gBrowser.selectedTab = tabToSelect;
is(gURLBar.value, "about:mozilla",
"Address bar's value correctly updated");
runNextTest();
} else {
gBrowser.tabContainer.addEventListener("SSTabRestored",
function SSTabRestored(event) {
if (event.target == tabToSelect) {
gBrowser.tabContainer.removeEventListener("SSTabRestored", SSTabRestored, true);
is(gURLBar.value, "about:mozilla",
"Address bar's value correctly updated");
runNextTest();
}
}, true);
gBrowser.selectedTab = tabToSelect;
}
}); });
} }
@ -60,15 +76,34 @@ function test() {
"No history entries still sets currentURI to about:blank"); "No history entries still sets currentURI to about:blank");
is(browser.userTypedValue, "example.org", is(browser.userTypedValue, "example.org",
"userTypedValue was correctly restored"); "userTypedValue was correctly restored");
ok(!browser.didStartLoadSinceLastUserTyping(), // didStartLoadSinceLastUserTyping does not exist on lazy tabs.
"We still know that no load is ongoing"); if (browser.didStartLoadSinceLastUserTyping) {
ok(!browser.didStartLoadSinceLastUserTyping(),
"We still know that no load is ongoing");
}
is(gURLBar.value, "about:mozilla", is(gURLBar.value, "about:mozilla",
"Address bar's value correctly restored"); "Address bar's value correctly restored");
// Change tabs to make sure address bar value gets updated
gBrowser.selectedTab = gBrowser.tabContainer.getItemAtIndex(1); // Change tabs to make sure address bar value gets updated. If tab is
is(gURLBar.value, "example.org", // lazy, wait for SSTabRestored to ensure address bar has time to update.
"Address bar's value correctly updated"); let tabToSelect = gBrowser.tabContainer.getItemAtIndex(1);
runNextTest(); if (tabToSelect.linkedBrowser.isConnected) {
gBrowser.selectedTab = tabToSelect;
is(gURLBar.value, "example.org",
"Address bar's value correctly updated");
runNextTest();
} else {
gBrowser.tabContainer.addEventListener("SSTabRestored",
function SSTabRestored(event) {
if (event.target == tabToSelect) {
gBrowser.tabContainer.removeEventListener("SSTabRestored", SSTabRestored, true);
is(gURLBar.value, "example.org",
"Address bar's value correctly updated");
runNextTest();
}
}, true);
gBrowser.selectedTab = tabToSelect;
}
}); });
} }

View File

@ -5,10 +5,9 @@
var stateBackup = ss.getBrowserState(); var stateBackup = ss.getBrowserState();
function cleanup() { function cleanup() {
// Reset the pref // Reset the prefs
try { Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand");
Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand"); Services.prefs.clearUserPref("browser.sessionstore.restore_tabs_lazily");
} catch (e) {}
ss.setBrowserState(stateBackup); ss.setBrowserState(stateBackup);
executeSoon(finish); executeSoon(finish);
} }
@ -20,6 +19,8 @@ function test() {
// Set the pref to true so we know exactly how many tabs should be restoring at // Set the pref to true so we know exactly how many tabs should be restoring at
// any given time. This guarantees that a finishing load won't start another. // any given time. This guarantees that a finishing load won't start another.
Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", true); Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", true);
// Don't restore tabs lazily.
Services.prefs.setBoolPref("browser.sessionstore.restore_tabs_lazily", false);
let state = { windows: [{ tabs: [ let state = { windows: [{ tabs: [
{ entries: [{ url: "http://example.org/#1", triggeringPrincipal_base64 }] }, { entries: [{ url: "http://example.org/#1", triggeringPrincipal_base64 }] },

View File

@ -9,6 +9,8 @@ add_task(function* () {
// Set the pref to true so we know exactly how many tabs should be restoring at // Set the pref to true so we know exactly how many tabs should be restoring at
// any given time. This guarantees that a finishing load won't start another. // any given time. This guarantees that a finishing load won't start another.
Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", true); Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", true);
// Don't restore tabs lazily.
Services.prefs.setBoolPref("browser.sessionstore.restore_tabs_lazily", false);
let state = { windows: [{ tabs: [ let state = { windows: [{ tabs: [
{ entries: [{ url: "http://example.org#1", triggeringPrincipal_base64 }], extData: { "uniq": r() } }, { entries: [{ url: "http://example.org#1", triggeringPrincipal_base64 }], extData: { "uniq": r() } },
@ -92,5 +94,7 @@ add_task(function* () {
yield progressCallback(); yield progressCallback();
// Cleanup. // Cleanup.
Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand");
Services.prefs.clearUserPref("browser.sessionstore.restore_tabs_lazily");
yield promiseBrowserState(stateBackup); yield promiseBrowserState(stateBackup);
}); });

View File

@ -97,22 +97,26 @@ function test_setTabState() {
ss.setTabValue(tab, "baz", "qux"); ss.setTabValue(tab, "baz", "qux");
} }
function onSSTabRestored(aEvent) { function onSSTabRestoring(aEvent) {
is(busyEventCount, 1); if (aEvent.target == tab) {
is(readyEventCount, 1); is(busyEventCount, 1);
is(ss.getTabValue(tab, "baz"), "qux"); is(readyEventCount, 1);
is(tab.linkedBrowser.currentURI.spec, "http://example.org/"); is(ss.getTabValue(tab, "baz"), "qux");
is(tab.linkedBrowser.currentURI.spec, "http://example.org/");
window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy); window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy);
window.removeEventListener("SSWindowStateReady", onSSWindowStateReady); window.removeEventListener("SSWindowStateReady", onSSWindowStateReady);
gBrowser.tabContainer.removeEventListener("SSTabRestored", onSSTabRestored); gBrowser.tabContainer.removeEventListener("SSTabRestoring", onSSTabRestoring);
runNextTest(); runNextTest();
}
} }
window.addEventListener("SSWindowStateBusy", onSSWindowStateBusy); window.addEventListener("SSWindowStateBusy", onSSWindowStateBusy);
window.addEventListener("SSWindowStateReady", onSSWindowStateReady); window.addEventListener("SSWindowStateReady", onSSWindowStateReady);
gBrowser.tabContainer.addEventListener("SSTabRestored", onSSTabRestored); gBrowser.tabContainer.addEventListener("SSTabRestoring", onSSTabRestoring);
// Browser must be inserted in order to restore.
gBrowser._insertBrowser(tab);
ss.setTabState(tab, newTabState); ss.setTabState(tab, newTabState);
} }
@ -137,23 +141,26 @@ function test_duplicateTab() {
ss.setTabValue(newTab, "baz", "qux"); ss.setTabValue(newTab, "baz", "qux");
} }
function onSSTabRestored(aEvent) { function onSSTabRestoring(aEvent) {
is(busyEventCount, 1); if (aEvent.target == newTab) {
is(readyEventCount, 1); is(busyEventCount, 1);
is(ss.getTabValue(newTab, "baz"), "qux"); is(readyEventCount, 1);
is(newTab.linkedBrowser.currentURI.spec, "about:rights"); is(ss.getTabValue(newTab, "baz"), "qux");
is(newTab.linkedBrowser.currentURI.spec, "about:rights");
window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy); window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy);
window.removeEventListener("SSWindowStateReady", onSSWindowStateReady); window.removeEventListener("SSWindowStateReady", onSSWindowStateReady);
gBrowser.tabContainer.removeEventListener("SSTabRestored", onSSTabRestored); gBrowser.tabContainer.removeEventListener("SSTabRestoring", onSSTabRestoring);
runNextTest(); runNextTest();
}
} }
window.addEventListener("SSWindowStateBusy", onSSWindowStateBusy); window.addEventListener("SSWindowStateBusy", onSSWindowStateBusy);
window.addEventListener("SSWindowStateReady", onSSWindowStateReady); window.addEventListener("SSWindowStateReady", onSSWindowStateReady);
gBrowser.tabContainer.addEventListener("SSTabRestored", onSSTabRestored); gBrowser.tabContainer.addEventListener("SSTabRestoring", onSSTabRestoring);
gBrowser._insertBrowser(tab);
newTab = ss.duplicateTab(window, tab); newTab = ss.duplicateTab(window, tab);
} }

View File

@ -147,7 +147,6 @@ add_task(function* test_scroll_background_tabs() {
// The second tab should be the one we loaded URL at still // The second tab should be the one we loaded URL at still
tab = newWin.gBrowser.tabs[1]; tab = newWin.gBrowser.tabs[1];
yield promiseTabRestoring(tab);
ok(tab.hasAttribute("pending"), "Tab should be pending"); ok(tab.hasAttribute("pending"), "Tab should be pending");
browser = tab.linkedBrowser; browser = tab.linkedBrowser;

View File

@ -47,7 +47,6 @@ add_task(function* test_scroll_background_about_reader_tabs() {
// The second tab should be the one we loaded URL at still // The second tab should be the one we loaded URL at still
tab = newWin.gBrowser.tabs[1]; tab = newWin.gBrowser.tabs[1];
yield promiseTabRestoring(tab);
ok(tab.hasAttribute("pending"), "Tab should be pending"); ok(tab.hasAttribute("pending"), "Tab should be pending");
browser = tab.linkedBrowser; browser = tab.linkedBrowser;

View File

@ -94,18 +94,24 @@ function waitForBrowserState(aState, aSetStateCallback) {
let windowObserving = false; let windowObserving = false;
let restoreHiddenTabs = Services.prefs.getBoolPref( let restoreHiddenTabs = Services.prefs.getBoolPref(
"browser.sessionstore.restore_hidden_tabs"); "browser.sessionstore.restore_hidden_tabs");
let restoreTabsLazily = Services.prefs.getBoolPref(
"browser.sessionstore.restore_tabs_lazily");
aState.windows.forEach(function(winState) { aState.windows.forEach(function(winState) {
winState.tabs.forEach(function(tabState) { winState.tabs.forEach(function(tabState) {
if (restoreHiddenTabs || !tabState.hidden) if (!restoreTabsLazily && (restoreHiddenTabs || !tabState.hidden))
expectedTabsRestored++; expectedTabsRestored++;
}); });
}); });
// There must be only hidden tabs and restoreHiddenTabs = false. We still // If there are only hidden tabs and restoreHiddenTabs = false, we still
// expect one of them to be restored because it gets shown automatically. // expect one of them to be restored because it gets shown automatically.
if (!expectedTabsRestored) // Otherwise if lazy tab restore there will only be one tab restored per window.
if (!expectedTabsRestored) {
expectedTabsRestored = 1; expectedTabsRestored = 1;
} else if (restoreTabsLazily) {
expectedTabsRestored = aState.windows.length;
}
function onSSTabRestored(aEvent) { function onSSTabRestored(aEvent) {
if (++tabsRestored == expectedTabsRestored) { if (++tabsRestored == expectedTabsRestored) {
@ -376,11 +382,11 @@ var gProgressListener = {
for (let win of BrowserWindowIterator()) { for (let win of BrowserWindowIterator()) {
for (let i = 0; i < win.gBrowser.tabs.length; i++) { for (let i = 0; i < win.gBrowser.tabs.length; i++) {
let browser = win.gBrowser.tabs[i].linkedBrowser; let browser = win.gBrowser.tabs[i].linkedBrowser;
if (!browser.__SS_restoreState) if (browser.isConnected && !browser.__SS_restoreState)
wasRestored++; wasRestored++;
else if (browser.__SS_restoreState == TAB_STATE_RESTORING) else if (browser.__SS_restoreState == TAB_STATE_RESTORING)
isRestoring++; isRestoring++;
else if (browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) else if (browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE || !browser.isConnected)
needsRestore++; needsRestore++;
} }
} }

View File

@ -92,12 +92,22 @@ var BrowserHelper = {
}, },
increasePriority: function NP_BH_increasePriority(aBrowser) { increasePriority: function NP_BH_increasePriority(aBrowser) {
// Ignore if browser is lazy. Once the browser is instantiated, this will
// get taken care of by TabBrowserInserted and TabSelect handlers.
if (!aBrowser.isConnected) {
return;
}
aBrowser.adjustPriority(PRIORITY_DELTA); aBrowser.adjustPriority(PRIORITY_DELTA);
_priorityBackup.set(aBrowser.permanentKey, _priorityBackup.set(aBrowser.permanentKey,
_priorityBackup.get(aBrowser.permanentKey) + PRIORITY_DELTA); _priorityBackup.get(aBrowser.permanentKey) + PRIORITY_DELTA);
}, },
decreasePriority: function NP_BH_decreasePriority(aBrowser) { decreasePriority: function NP_BH_decreasePriority(aBrowser) {
// Ignore if browser is lazy. Once the browser is instantiated, this will
// get taken care of by TabBrowserInserted and TabSelect handlers.
if (!aBrowser.isConnected) {
return;
}
aBrowser.adjustPriority(PRIORITY_DELTA * -1); aBrowser.adjustPriority(PRIORITY_DELTA * -1);
_priorityBackup.set(aBrowser.permanentKey, _priorityBackup.set(aBrowser.permanentKey,
_priorityBackup.get(aBrowser.permanentKey) - PRIORITY_DELTA); _priorityBackup.get(aBrowser.permanentKey) - PRIORITY_DELTA);

View File

@ -34,6 +34,7 @@ run-if = crashreporter
[browser_UsageTelemetry.js] [browser_UsageTelemetry.js]
[browser_UsageTelemetry_private_and_restore.js] [browser_UsageTelemetry_private_and_restore.js]
[browser_UsageTelemetry_urlbar.js] [browser_UsageTelemetry_urlbar.js]
skip-if = (os == 'linux' && bits == 32 && debug) # bug 1356758
support-files = support-files =
usageTelemetrySearchSuggestions.sjs usageTelemetrySearchSuggestions.sjs
usageTelemetrySearchSuggestions.xml usageTelemetrySearchSuggestions.xml

View File

@ -7,7 +7,7 @@ console.assert(false, "Failing mozscreenshots assertion");
console.group("Grouped Message"); console.group("Grouped Message");
console.log("group message 1"); console.log("group message 1");
console.groupEnd("Grouped Message"); console.groupEnd();
console.count("counter"); console.count("counter");
console.count("counter"); console.count("counter");

View File

@ -504,6 +504,13 @@ set_config('HAVE_64BIT_BUILD', have_64_bit)
set_define('HAVE_64BIT_BUILD', have_64_bit) set_define('HAVE_64BIT_BUILD', have_64_bit)
add_old_configure_assignment('HAVE_64BIT_BUILD', have_64_bit) add_old_configure_assignment('HAVE_64BIT_BUILD', have_64_bit)
@depends(host)
def host_os_kernel_major_version(host):
versions = host.raw_os.split('.')
version = ''.join(x for x in versions[0] if x.isdigit())
return version
set_config('HOST_MAJOR_VERSION', host_os_kernel_major_version)
# Autoconf needs these set # Autoconf needs these set
@depends(host) @depends(host)

View File

@ -40,6 +40,10 @@ elif CONFIG['OS_TARGET'] in ('FreeBSD', 'OpenBSD', 'NetBSD'):
SOURCES += ['/nsprpub/pr/src/md/unix/%s.c' % CONFIG['OS_TARGET'].lower()] SOURCES += ['/nsprpub/pr/src/md/unix/%s.c' % CONFIG['OS_TARGET'].lower()]
elif CONFIG['OS_TARGET'] == 'Darwin': elif CONFIG['OS_TARGET'] == 'Darwin':
OS_LIBS += ['-framework CoreServices'] OS_LIBS += ['-framework CoreServices']
if CONFIG['HOST_MAJOR_VERSION'] == '15':
DEFINES.update(
HAS_CONNECTX=True,
)
DEFINES.update( DEFINES.update(
DARWIN=True, DARWIN=True,
HAVE_BSD_FLOCK=True, HAVE_BSD_FLOCK=True,

View File

@ -95,7 +95,7 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
this._preferredSourceURL = null; this._preferredSourceURL = null;
this._unnamedSourceIndex = 0; this._unnamedSourceIndex = 0;
this.emptyText = L10N.getStr("noSourcesText"); this.emptyText = L10N.getStr("noSourcesText");
this._blackBoxCheckboxTooltip = L10N.getStr("blackBoxCheckboxTooltip"); this._blackBoxCheckboxTooltip = L10N.getStr("blackboxCheckboxTooltip2");
this._commandset = document.getElementById("debuggerCommands"); this._commandset = document.getElementById("debuggerCommands");
this._popupset = document.getElementById("debuggerPopupset"); this._popupset = document.getElementById("debuggerPopupset");

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -7,6 +7,6 @@ DevToolsModules(
'debugger.css', 'debugger.css',
'debugger.js', 'debugger.js',
'panel.js', 'panel.js',
'parser-worker.js',
'pretty-print-worker.js', 'pretty-print-worker.js',
'source-map-worker.js'
) )

View File

@ -4,7 +4,7 @@
"use strict"; "use strict";
const { Task } = require("devtools/shared/task"); const { Task } = require("devtools/shared/task");
var {LocalizationHelper} = require("devtools/shared/l10n"); var { LocalizationHelper } = require("devtools/shared/l10n");
const DBG_STRINGS_URI = "devtools/client/locales/debugger.properties"; const DBG_STRINGS_URI = "devtools/client/locales/debugger.properties";
var L10N = new LocalizationHelper(DBG_STRINGS_URI); var L10N = new LocalizationHelper(DBG_STRINGS_URI);
@ -16,38 +16,46 @@ function DebuggerPanel(iframeWindow, toolbox) {
} }
DebuggerPanel.prototype = { DebuggerPanel.prototype = {
open: Task.async(function* () { open: async function() {
if (!this.toolbox.target.isRemote) { if (!this.toolbox.target.isRemote) {
yield this.toolbox.target.makeRemote(); await this.toolbox.target.makeRemote();
} }
yield this.panelWin.Debugger.bootstrap({ const {
actions,
store,
selectors,
client
} = await this.panelWin.Debugger.bootstrap({
threadClient: this.toolbox.threadClient, threadClient: this.toolbox.threadClient,
tabTarget: this.toolbox.target tabTarget: this.toolbox.target,
debuggerClient: this.toolbox.target._client,
sourceMaps: this.toolbox.sourceMapService
}); });
this._actions = actions;
this._store = store;
this._selectors = selectors;
this._client = client;
this.isReady = true; this.isReady = true;
return this; return this;
}),
_store: function () {
return this.panelWin.Debugger.store;
}, },
_getState: function () { getVarsForTests() {
return this._store().getState(); return {
store: this._store,
selectors: this._selectors,
actions: this._actions,
client: this._client
};
}, },
_actions: function () { _getState: function() {
return this.panelWin.Debugger.actions; return this._store.getState();
}, },
_selectors: function () { getFrames: function() {
return this.panelWin.Debugger.selectors; let frames = this._selectors.getFrames(this._getState());
},
getFrames: function () {
let frames = this._selectors().getFrames(this._getState());
// Frames is null when the debugger is not paused. // Frames is null when the debugger is not paused.
if (!frames) { if (!frames) {
@ -58,7 +66,7 @@ DebuggerPanel.prototype = {
} }
frames = frames.toJS(); frames = frames.toJS();
const selectedFrame = this._selectors().getSelectedFrame(this._getState()); const selectedFrame = this._selectors.getSelectedFrame(this._getState());
const selected = frames.findIndex(frame => frame.id == selectedFrame.id); const selected = frames.findIndex(frame => frame.id == selectedFrame.id);
frames.forEach(frame => { frames.forEach(frame => {
@ -68,7 +76,15 @@ DebuggerPanel.prototype = {
return { frames, selected }; return { frames, selected };
}, },
destroy: function () { selectSource(sourceURL, sourceLine) {
this._actions.selectSourceURL(sourceURL, { line: sourceLine });
},
getSource(sourceURL) {
return this._selectors.getSourceByURL(this._getState(), sourceURL);
},
destroy: function() {
this.panelWin.Debugger.destroy(); this.panelWin.Debugger.destroy();
this.emit("destroyed"); this.emit("destroyed");
} }

File diff suppressed because one or more lines are too long

View File

@ -55,7 +55,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ 0: /***/ 0:
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(801); module.exports = __webpack_require__(964);
/***/ }, /***/ },
@ -75,76 +75,6 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/***/ 801:
/***/ function(module, exports, __webpack_require__) {
"use strict";
var prettyFast = __webpack_require__(802);
var assert = __webpack_require__(223);
function prettyPrint(_ref) {
var url = _ref.url,
indent = _ref.indent,
source = _ref.source;
try {
var prettified = prettyFast(source, {
url: url,
indent: " ".repeat(indent)
});
return {
code: prettified.code,
mappings: prettified.map._mappings
};
} catch (e) {
throw new Error(`${e.message}\n${e.stack}`);
}
}
function invertMappings(mappings) {
return mappings._array.map(m => {
var mapping = {
generated: {
line: m.originalLine,
column: m.originalColumn
}
};
if (m.source) {
mapping.source = m.source;
mapping.original = {
line: m.generatedLine,
column: m.generatedColumn
};
mapping.name = m.name;
}
return mapping;
});
}
self.onmessage = function (msg) {
var _msg$data = msg.data,
id = _msg$data.id,
args = _msg$data.args;
assert(msg.data.method === "prettyPrint", "Method must be `prettyPrint`");
try {
var _prettyPrint = prettyPrint(args[0]),
code = _prettyPrint.code,
mappings = _prettyPrint.mappings;
self.postMessage({ id, response: {
code, mappings: invertMappings(mappings)
} });
} catch (e) {
self.postMessage({ id, error: e });
}
};
/***/ },
/***/ 802: /***/ 802:
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
@ -5918,6 +5848,80 @@ return /******/ (function(modules) { // webpackBootstrap
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
/***/ },
/***/ 964:
/***/ function(module, exports, __webpack_require__) {
"use strict";
var prettyFast = __webpack_require__(802);
var assert = __webpack_require__(223);
function prettyPrint(_ref) {
var url = _ref.url,
indent = _ref.indent,
source = _ref.source;
try {
var prettified = prettyFast(source, {
url: url,
indent: " ".repeat(indent)
});
return {
code: prettified.code,
mappings: prettified.map._mappings
};
} catch (e) {
throw new Error(`${e.message}\n${e.stack}`);
}
}
function invertMappings(mappings) {
return mappings._array.map(m => {
var mapping = {
generated: {
line: m.originalLine,
column: m.originalColumn
}
};
if (m.source) {
mapping.source = m.source;
mapping.original = {
line: m.generatedLine,
column: m.generatedColumn
};
mapping.name = m.name;
}
return mapping;
});
}
self.onmessage = function (msg) {
var _msg$data = msg.data,
id = _msg$data.id,
args = _msg$data.args;
assert(msg.data.method === "prettyPrint", "Method must be `prettyPrint`");
try {
var _prettyPrint = prettyPrint(args[0]),
code = _prettyPrint.code,
mappings = _prettyPrint.mappings;
self.postMessage({
id,
response: {
code,
mappings: invertMappings(mappings)
}
});
} catch (e) {
self.postMessage({ id, error: e });
}
};
/***/ } /***/ }
/******/ }) /******/ })

File diff suppressed because it is too large Load Diff

View File

@ -42,6 +42,7 @@ support-files =
[browser_dbg-breakpoints.js] [browser_dbg-breakpoints.js]
[browser_dbg-breakpoints-cond.js] [browser_dbg-breakpoints-cond.js]
[browser_dbg-call-stack.js] [browser_dbg-call-stack.js]
[browser_dbg-expressions.js]
[browser_dbg-scopes.js] [browser_dbg-scopes.js]
[browser_dbg-chrome-create.js] [browser_dbg-chrome-create.js]
[browser_dbg-chrome-debugging.js] [browser_dbg-chrome-debugging.js]

View File

@ -54,6 +54,6 @@ add_task(function* () {
button = toggleButton(dbg); button = toggleButton(dbg);
frames = findAllElements(dbg, "frames"); frames = findAllElements(dbg, "frames");
is(button.innerText, "Collapse Rows", "toggle button should be collapse"); is(button.innerText, "Collapse Rows", "toggle button should be collapsed");
is(frames.length, 22, "All of the frames should be shown"); is(frames.length, 22, "All of the frames should be shown");
}); });

View File

@ -18,7 +18,9 @@ add_task(function* () {
// Wait for the source text to load and make sure we're in the right // Wait for the source text to load and make sure we're in the right
// place. // place.
yield waitForDispatch(dbg, "LOAD_SOURCE_TEXT"); yield waitForDispatch(dbg, "LOAD_SOURCE_TEXT");
assertHighlightLocation(dbg, "long.js", 66);
// TODO: revisit highlighting lines when the debugger opens
//assertHighlightLocation(dbg, "long.js", 66);
// Jump to line 16 and make sure the editor scrolled. // Jump to line 16 and make sure the editor scrolled.
yield selectSource(dbg, "long.js", 16); yield selectSource(dbg, "long.js", 16);

View File

@ -50,5 +50,5 @@ add_task(function* () {
invokeInTab("testModel"); invokeInTab("testModel");
yield waitForPaused(dbg); yield waitForPaused(dbg);
assertPausedLocation(dbg, longSrc, 66); assertPausedLocation(dbg, longSrc, 66);
// ok(isElementVisible(dbg, "breakpoint"), "Breakpoint is visible"); ok(isElementVisible(dbg, "breakpoint"), "Breakpoint is visible");
}); });

View File

@ -1,12 +1,56 @@
/* Any copyright is dedicated to the Public Domain. /* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */ * http://creativecommons.org/publicdomain/zero/1.0/ */
const { /**
setupTestRunner, * tests the watch expressions component
expressions * 1. add watch expressions
} = require("devtools/client/debugger/new/integration-tests"); * 2. edit watch expressions
* 3. delete watch expressions
*/
const expressionSelectors = {
input: "input.input-expression"
};
function getLabel(dbg, index) {
return findElement(dbg, "expressionNode", index).innerText;
}
function getValue(dbg, index) {
return findElement(dbg, "expressionValue", index).innerText;
}
async function addExpression(dbg, input) {
info("Adding an expression");
findElementWithSelector(dbg, expressionSelectors.input).focus();
type(dbg, input);
pressKey(dbg, "Enter");
await waitForDispatch(dbg, "EVALUATE_EXPRESSION");
}
async function editExpression(dbg, input) {
info("updating the expression");
dblClickElement(dbg, "expressionNode", 1);
type(dbg, input);
pressKey(dbg, "Enter");
await waitForDispatch(dbg, "EVALUATE_EXPRESSION");
}
add_task(function*() { add_task(function*() {
setupTestRunner(this); const dbg = yield initDebugger("doc-script-switching.html");
yield expressions(this);
invokeInTab("firstCall");
yield waitForPaused(dbg);
yield addExpression(dbg, "f");
is(getLabel(dbg, 1), "f");
is(getValue(dbg, 1), "ReferenceError");
yield editExpression(dbg, "oo");
is(getLabel(dbg, 1), "foo()");
is(getValue(dbg, 1), "");
yield deleteExpression(dbg, "foo");
is(findAllElements(dbg, "expressionNodes").length, 0);
}); });

View File

@ -20,7 +20,6 @@ add_task(function* () {
const dbg = yield initDebugger("doc-exceptions.html"); const dbg = yield initDebugger("doc-exceptions.html");
// test skipping an uncaught exception // test skipping an uncaught exception
yield togglePauseOnExceptions(dbg, false, false);
yield uncaughtException(); yield uncaughtException();
ok(!isPaused(dbg)); ok(!isPaused(dbg));

View File

@ -3,7 +3,7 @@
// Tests basic pretty-printing functionality. // Tests basic pretty-printing functionality.
add_task(function* () { add_task(function*() {
const dbg = yield initDebugger("doc-minified.html"); const dbg = yield initDebugger("doc-minified.html");
yield selectSource(dbg, "math.min.js"); yield selectSource(dbg, "math.min.js");

View File

@ -19,4 +19,13 @@ add_task(function* () {
is(getLabel(dbg, 1), "secondCall"); is(getLabel(dbg, 1), "secondCall");
is(getLabel(dbg, 2), "<this>"); is(getLabel(dbg, 2), "<this>");
is(getLabel(dbg, 4), "foo()");
toggleNode(dbg, 4);
yield waitForDispatch(dbg, "LOAD_OBJECT_PROPERTIES");
is(getLabel(dbg, 5), "prototype");
yield stepOver(dbg);
is(getLabel(dbg, 4), "foo()");
is(getLabel(dbg, 5), "prototype");
}); });

View File

@ -4,7 +4,10 @@
// Test that an error while loading a sourcemap does not break // Test that an error while loading a sourcemap does not break
// debugging. // debugging.
add_task(function* () { add_task(function*() {
// NOTE: the CORS call makes the test run times inconsistent
requestLongerTimeout(2);
const dbg = yield initDebugger("doc-sourcemap-bogus.html"); const dbg = yield initDebugger("doc-sourcemap-bogus.html");
const { selectors: { getSources }, getState } = dbg; const { selectors: { getSources }, getState } = dbg;

View File

@ -4,7 +4,10 @@
// Tests loading sourcemapped sources, setting breakpoints, and // Tests loading sourcemapped sources, setting breakpoints, and
// stepping in them. // stepping in them.
add_task(function* () { add_task(function*() {
// NOTE: the CORS call makes the test run times inconsistent
requestLongerTimeout(2);
const dbg = yield initDebugger("doc-sourcemaps.html"); const dbg = yield initDebugger("doc-sourcemaps.html");
const { selectors: { getBreakpoint, getBreakpoints }, getState } = dbg; const { selectors: { getBreakpoint, getBreakpoints }, getState } = dbg;
@ -13,21 +16,27 @@ add_task(function* () {
const entrySrc = findSource(dbg, "entry.js"); const entrySrc = findSource(dbg, "entry.js");
yield selectSource(dbg, entrySrc); yield selectSource(dbg, entrySrc);
ok(dbg.win.cm.getValue().includes("window.keepMeAlive"), ok(
"Original source text loaded correctly"); dbg.win.cm.getValue().includes("window.keepMeAlive"),
"Original source text loaded correctly"
);
// Test that breakpoint sliding is not attempted. The breakpoint // Test that breakpoint sliding is not attempted. The breakpoint
// should not move anywhere. // should not move anywhere.
yield addBreakpoint(dbg, entrySrc, 13); yield addBreakpoint(dbg, entrySrc, 13);
is(getBreakpoints(getState()).size, 1, "One breakpoint exists"); is(getBreakpoints(getState()).size, 1, "One breakpoint exists");
ok(getBreakpoint(getState(), { sourceId: entrySrc.id, line: 13 }), ok(
"Breakpoint has correct line"); getBreakpoint(getState(), { sourceId: entrySrc.id, line: 13 }),
"Breakpoint has correct line"
);
// Test breaking on a breakpoint // Test breaking on a breakpoint
yield addBreakpoint(dbg, "entry.js", 15); yield addBreakpoint(dbg, "entry.js", 15);
is(getBreakpoints(getState()).size, 2, "Two breakpoints exist"); is(getBreakpoints(getState()).size, 2, "Two breakpoints exist");
ok(getBreakpoint(getState(), { sourceId: entrySrc.id, line: 15 }), ok(
"Breakpoint has correct line"); getBreakpoint(getState(), { sourceId: entrySrc.id, line: 15 }),
"Breakpoint has correct line"
);
invokeInTab("keepMeAlive"); invokeInTab("keepMeAlive");
yield waitForPaused(dbg); yield waitForPaused(dbg);

View File

@ -6,7 +6,10 @@
// This source map does not have source contents, so it's fetched separately // This source map does not have source contents, so it's fetched separately
add_task(function* () { add_task(function*() {
// NOTE: the CORS call makes the test run times inconsistent
requestLongerTimeout(2);
const dbg = yield initDebugger("doc-sourcemaps2.html"); const dbg = yield initDebugger("doc-sourcemaps2.html");
const { selectors: { getBreakpoint, getBreakpoints }, getState } = dbg; const { selectors: { getBreakpoint, getBreakpoints }, getState } = dbg;
@ -20,8 +23,10 @@ add_task(function* () {
// Test that breakpoint is not off by a line. // Test that breakpoint is not off by a line.
yield addBreakpoint(dbg, mainSrc, 4); yield addBreakpoint(dbg, mainSrc, 4);
is(getBreakpoints(getState()).size, 1, "One breakpoint exists"); is(getBreakpoints(getState()).size, 1, "One breakpoint exists");
ok(getBreakpoint(getState(), { sourceId: mainSrc.id, line: 4 }), ok(
"Breakpoint has correct line"); getBreakpoint(getState(), { sourceId: mainSrc.id, line: 4 }),
"Breakpoint has correct line"
);
invokeInTab("logMessage"); invokeInTab("logMessage");

View File

@ -6,6 +6,7 @@
<body> <body>
<script> <script>
debugger; debugger;
// This inline script allows this HTML page to show up as a // This inline script allows this HTML page to show up as a
// source. It also needs to introduce a new global variable so // source. It also needs to introduce a new global variable so
// it's not immediately garbage collected. // it's not immediately garbage collected.

View File

@ -33,13 +33,14 @@
*/ */
// shared-head.js handles imports, constants, and utility functions // shared-head.js handles imports, constants, and utility functions
Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/client/framework/test/shared-head.js", this); Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/framework/test/shared-head.js",
this
);
var { Toolbox } = require("devtools/client/framework/toolbox"); var { Toolbox } = require("devtools/client/framework/toolbox");
const EXAMPLE_URL = "http://example.com/browser/devtools/client/debugger/new/test/mochitest/examples/"; const EXAMPLE_URL = "http://example.com/browser/devtools/client/debugger/new/test/mochitest/examples/";
Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", true); Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", true);
Services.prefs.clearUserPref("devtools.debugger.tabs")
Services.prefs.clearUserPref("devtools.debugger.pending-selected-location")
registerCleanupFunction(() => { registerCleanupFunction(() => {
Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend"); Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
@ -76,9 +77,9 @@ function _afterDispatchDone(store, type) {
type: "@@service/waitUntil", type: "@@service/waitUntil",
predicate: action => { predicate: action => {
if (action.type === type) { if (action.type === type) {
return action.status ? return action.status
(action.status === "done" || action.status === "error") : ? action.status === "done" || action.status === "error"
true; : true;
} }
}, },
run: (dispatch, getState, action) => { run: (dispatch, getState, action) => {
@ -102,7 +103,7 @@ function _afterDispatchDone(store, type) {
function waitForDispatch(dbg, type, eventRepeat = 1) { function waitForDispatch(dbg, type, eventRepeat = 1) {
let count = 0; let count = 0;
return Task.spawn(function* () { return Task.spawn(function*() {
info("Waiting for " + type + " to dispatch " + eventRepeat + " time(s)"); info("Waiting for " + type + " to dispatch " + eventRepeat + " time(s)");
while (count < eventRepeat) { while (count < eventRepeat) {
yield _afterDispatchDone(dbg.store, type); yield _afterDispatchDone(dbg.store, type);
@ -170,21 +171,23 @@ function waitForSources(dbg, ...sources) {
info("Waiting on sources: " + sources.join(", ")); info("Waiting on sources: " + sources.join(", "));
const { selectors: { getSources }, store } = dbg; const { selectors: { getSources }, store } = dbg;
return Promise.all(sources.map(url => { return Promise.all(
function sourceExists(state) { sources.map(url => {
return getSources(state).some(s => { function sourceExists(state) {
return s.get("url").includes(url); return getSources(state).some(s => {
}); return s.get("url").includes(url);
} });
}
if (!sourceExists(store.getState())) { if (!sourceExists(store.getState())) {
return waitForState(dbg, sourceExists); return waitForState(dbg, sourceExists);
} }
})); })
);
} }
function waitForElement(dbg, selector) { function waitForElement(dbg, selector) {
return waitUntil(() => findElementWithSelector(dbg, selector)) return waitUntil(() => findElementWithSelector(dbg, selector));
} }
/** /**
@ -209,8 +212,10 @@ function assertPausedLocation(dbg, source, line) {
is(location.get("line"), line); is(location.get("line"), line);
// Check the debug line // Check the debug line
ok(dbg.win.cm.lineInfo(line - 1).wrapClass.includes("debug-line"), ok(
"Line is highlighted as paused"); dbg.win.cm.lineInfo(line - 1).wrapClass.includes("debug-line"),
"Line is highlighted as paused"
);
} }
/** /**
@ -232,10 +237,14 @@ function assertHighlightLocation(dbg, source, line) {
// Check the highlight line // Check the highlight line
const lineEl = findElement(dbg, "highlightLine"); const lineEl = findElement(dbg, "highlightLine");
ok(lineEl, "Line is highlighted"); ok(lineEl, "Line is highlighted");
// ok(isVisibleWithin(findElement(dbg, "codeMirror"), lineEl), ok(
// "Highlighted line is visible"); isVisibleWithin(findElement(dbg, "codeMirror"), lineEl),
ok(dbg.win.cm.lineInfo(line - 1).wrapClass.includes("highlight-line"), "Highlighted line is visible"
"Line is highlighted"); );
ok(
dbg.win.cm.lineInfo(line - 1).wrapClass.includes("highlight-line"),
"Line is highlighted"
);
} }
/** /**
@ -258,12 +267,11 @@ function isPaused(dbg) {
* @static * @static
*/ */
function waitForPaused(dbg) { function waitForPaused(dbg) {
return Task.spawn(function* () { return Task.spawn(function*() {
// We want to make sure that we get both a real paused event and // We want to make sure that we get both a real paused event and
// that the state is fully populated. The client may do some more // that the state is fully populated. The client may do some more
// work (call other client methods) before populating the state. // work (call other client methods) before populating the state.
yield waitForThreadEvents(dbg, "paused"), yield waitForThreadEvents(dbg, "paused"), yield waitForState(dbg, state => {
yield waitForState(dbg, state => {
const pause = dbg.selectors.getPause(state); const pause = dbg.selectors.getPause(state);
// Make sure we have the paused state. // Make sure we have the paused state.
if (!pause) { if (!pause) {
@ -279,15 +287,16 @@ function waitForPaused(dbg) {
} }
function createDebuggerContext(toolbox) { function createDebuggerContext(toolbox) {
const win = toolbox.getPanel("jsdebugger").panelWin; const panel = toolbox.getPanel("jsdebugger");
const store = win.Debugger.store; const win = panel.panelWin;
const { store, client, selectors, actions } = panel.getVarsForTests();
return { return {
actions: win.Debugger.actions, actions: actions,
selectors: win.Debugger.selectors, selectors: selectors,
getState: store.getState, getState: store.getState,
store: store, store: store,
client: win.Debugger.client, client: client,
toolbox: toolbox, toolbox: toolbox,
win: win win: win
}; };
@ -303,9 +312,13 @@ function createDebuggerContext(toolbox) {
* @static * @static
*/ */
function initDebugger(url, ...sources) { function initDebugger(url, ...sources) {
return Task.spawn(function* () { return Task.spawn(function*() {
Services.prefs.clearUserPref("devtools.debugger.tabs") Services.prefs.clearUserPref("devtools.debugger.pause-on-exceptions");
Services.prefs.clearUserPref("devtools.debugger.pending-selected-location") Services.prefs.clearUserPref("devtools.debugger.ignore-caught-exceptions");
Services.prefs.clearUserPref("devtools.debugger.tabs");
Services.prefs.clearUserPref("devtools.debugger.pending-selected-location");
Services.prefs.clearUserPref("devtools.debugger.pending-breakpoints");
Services.prefs.clearUserPref("devtools.debugger.expressions");
const toolbox = yield openNewTabAndToolbox(EXAMPLE_URL + url, "jsdebugger"); const toolbox = yield openNewTabAndToolbox(EXAMPLE_URL + url, "jsdebugger");
return createDebuggerContext(toolbox); return createDebuggerContext(toolbox);
}); });
@ -429,6 +442,11 @@ function resume(dbg) {
return waitForThreadEvents(dbg, "resumed"); return waitForThreadEvents(dbg, "resumed");
} }
function deleteExpression(dbg, input) {
info("Resuming");
return dbg.actions.deleteExpression({ input });
}
/** /**
* Reloads the debuggee. * Reloads the debuggee.
* *
@ -500,8 +518,11 @@ function removeBreakpoint(dbg, sourceId, line, col) {
* @return {Promise} * @return {Promise}
* @static * @static
*/ */
function togglePauseOnExceptions(dbg, function togglePauseOnExceptions(
pauseOnExceptions, ignoreCaughtExceptions) { dbg,
pauseOnExceptions,
ignoreCaughtExceptions
) {
const command = dbg.actions.pauseOnExceptions( const command = dbg.actions.pauseOnExceptions(
pauseOnExceptions, pauseOnExceptions,
ignoreCaughtExceptions ignoreCaughtExceptions
@ -526,7 +547,7 @@ function togglePauseOnExceptions(dbg,
*/ */
function invokeInTab(fnc) { function invokeInTab(fnc) {
info(`Invoking function ${fnc} in tab`); info(`Invoking function ${fnc} in tab`);
return ContentTask.spawn(gBrowser.selectedBrowser, fnc, function* (fnc) { return ContentTask.spawn(gBrowser.selectedBrowser, fnc, function*(fnc) {
content.wrappedJSObject[fnc](); // eslint-disable-line mozilla/no-cpows-in-tests, max-len content.wrappedJSObject[fnc](); // eslint-disable-line mozilla/no-cpows-in-tests, max-len
}); });
} }
@ -534,18 +555,21 @@ function invokeInTab(fnc) {
const isLinux = Services.appinfo.OS === "Linux"; const isLinux = Services.appinfo.OS === "Linux";
const cmdOrCtrl = isLinux ? { ctrlKey: true } : { metaKey: true }; const cmdOrCtrl = isLinux ? { ctrlKey: true } : { metaKey: true };
const keyMappings = { const keyMappings = {
sourceSearch: { code: "p", modifiers: cmdOrCtrl}, sourceSearch: { code: "p", modifiers: cmdOrCtrl },
fileSearch: { code: "f", modifiers: cmdOrCtrl}, fileSearch: { code: "f", modifiers: cmdOrCtrl },
"Enter": { code: "VK_RETURN" }, Enter: { code: "VK_RETURN" },
"Up": { code: "VK_UP" }, Up: { code: "VK_UP" },
"Down": { code: "VK_DOWN" }, Down: { code: "VK_DOWN" },
"Tab": { code: "VK_TAB" }, Tab: { code: "VK_TAB" },
"Escape": { code: "VK_ESCAPE" }, Escape: { code: "VK_ESCAPE" },
pauseKey: { code: "VK_F8" }, pauseKey: { code: "VK_F8" },
resumeKey: { code: "VK_F8" }, resumeKey: { code: "VK_F8" },
stepOverKey: { code: "VK_F10" }, stepOverKey: { code: "VK_F10" },
stepInKey: { code: "VK_F11", modifiers: { ctrlKey: isLinux }}, stepInKey: { code: "VK_F11", modifiers: { ctrlKey: isLinux } },
stepOutKey: { code: "VK_F11", modifiers: { ctrlKey: isLinux, shiftKey: true }} stepOutKey: {
code: "VK_F11",
modifiers: { ctrlKey: isLinux, shiftKey: true }
}
}; };
/** /**
@ -561,11 +585,7 @@ function pressKey(dbg, keyName) {
let keyEvent = keyMappings[keyName]; let keyEvent = keyMappings[keyName];
const { code, modifiers } = keyEvent; const { code, modifiers } = keyEvent;
return EventUtils.synthesizeKey( return EventUtils.synthesizeKey(code, modifiers || {}, dbg.win);
code,
modifiers || {},
dbg.win
);
} }
function type(dbg, string) { function type(dbg, string) {
@ -577,14 +597,19 @@ function type(dbg, string) {
function isVisibleWithin(outerEl, innerEl) { function isVisibleWithin(outerEl, innerEl) {
const innerRect = innerEl.getBoundingClientRect(); const innerRect = innerEl.getBoundingClientRect();
const outerRect = outerEl.getBoundingClientRect(); const outerRect = outerEl.getBoundingClientRect();
return innerRect.top > outerRect.top && innerRect.bottom < outerRect.bottom;
return innerRect.top > outerRect.top &&
innerRect.bottom < outerRect.bottom;
} }
const selectors = { const selectors = {
callStackHeader: ".call-stack-pane ._header", callStackHeader: ".call-stack-pane ._header",
callStackBody: ".call-stack-pane .pane", callStackBody: ".call-stack-pane .pane",
expressionNode: i =>
`.expressions-list .tree-node:nth-child(${i}) .object-label`,
expressionValue: i =>
`.expressions-list .tree-node:nth-child(${i}) .object-value`,
expressionClose: i =>
`.expressions-list .expression-container:nth-child(${i}) .close`,
expressionNodes: ".expressions-list .tree-node",
scopesHeader: ".scopes-pane ._header", scopesHeader: ".scopes-pane ._header",
breakpointItem: i => `.breakpoints-list .breakpoint:nth-child(${i})`, breakpointItem: i => `.breakpoints-list .breakpoint:nth-child(${i})`,
scopeNode: i => `.scopes-list .tree-node:nth-child(${i}) .object-label`, scopeNode: i => `.scopes-list .tree-node:nth-child(${i}) .object-label`,
@ -605,7 +630,7 @@ const selectors = {
sourceFooter: ".source-footer", sourceFooter: ".source-footer",
sourceNode: i => `.sources-list .tree-node:nth-child(${i})`, sourceNode: i => `.sources-list .tree-node:nth-child(${i})`,
sourceNodes: ".sources-list .tree-node", sourceNodes: ".sources-list .tree-node",
sourceArrow: i => `.sources-list .tree-node:nth-child(${i}) .arrow`, sourceArrow: i => `.sources-list .tree-node:nth-child(${i}) .arrow`
}; };
function getSelector(elementName, ...args) { function getSelector(elementName, ...args) {
@ -647,6 +672,9 @@ function findAllElements(dbg, elementName, ...args) {
*/ */
function clickElement(dbg, elementName, ...args) { function clickElement(dbg, elementName, ...args) {
const selector = getSelector(elementName, ...args); const selector = getSelector(elementName, ...args);
const el = findElement(dbg, elementName, ...args);
el.scrollIntoView();
return EventUtils.synthesizeMouseAtCenter( return EventUtils.synthesizeMouseAtCenter(
findElementWithSelector(dbg, selector), findElementWithSelector(dbg, selector),
{}, {},
@ -654,12 +682,22 @@ function clickElement(dbg, elementName, ...args) {
); );
} }
function dblClickElement(dbg, elementName, ...args) {
const selector = getSelector(elementName, ...args);
return EventUtils.synthesizeMouseAtCenter(
findElementWithSelector(dbg, selector),
{ clickCount: 2 },
dbg.win
);
}
function rightClickElement(dbg, elementName, ...args) { function rightClickElement(dbg, elementName, ...args) {
const selector = getSelector(elementName, ...args); const selector = getSelector(elementName, ...args);
const doc = dbg.win.document; const doc = dbg.win.document;
return EventUtils.synthesizeMouseAtCenter( return EventUtils.synthesizeMouseAtCenter(
doc.querySelector(selector), doc.querySelector(selector),
{type: "contextmenu"}, { type: "contextmenu" },
dbg.win dbg.win
); );
} }
@ -669,10 +707,10 @@ function selectMenuItem(dbg, index) {
const doc = dbg.toolbox.win.document; const doc = dbg.toolbox.win.document;
// there are several context menus, we want the one with the menu-api // there are several context menus, we want the one with the menu-api
const popup = doc.querySelector("menupopup[menu-api=\"true\"]"); const popup = doc.querySelector('menupopup[menu-api="true"]');
const item = popup.querySelector(`menuitem:nth-child(${index})`); const item = popup.querySelector(`menuitem:nth-child(${index})`);
return EventUtils.synthesizeMouseAtCenter(item, {}, dbg.toolbox.win ); return EventUtils.synthesizeMouseAtCenter(item, {}, dbg.toolbox.win);
} }
/** /**

View File

@ -115,15 +115,19 @@ timeEvents=Time
touchEvents=Touch touchEvents=Touch
otherEvents=Other otherEvents=Other
# LOCALIZATION NOTE (blackBoxCheckboxTooltip): The tooltip text to display when # LOCALIZATION NOTE (blackboxCheckboxTooltip2): The tooltip text to display when
# the user hovers over the checkbox used to toggle black boxing its associated # the user hovers over the checkbox used to toggle blackboxing its associated
# source. # source.
blackBoxCheckboxTooltip=Toggle black boxing blackboxCheckboxTooltip2=Toggle blackboxing
# LOCALIZATION NOTE (sources.search.key): Key shortcut to open the search for # LOCALIZATION NOTE (sources.search.key): Key shortcut to open the search for
# searching all the source files the debugger has seen. # searching all the source files the debugger has seen.
sources.search.key=P sources.search.key=P
# LOCALIZATION NOTE (sources.noSourcesAvailable): Text shown when the debugger
# does not have any sources.
sources.noSourcesAvailable=This page has no sources
# LOCALIZATION NOTE (sources.searchAlt.key): Alternate key shortcut to open # LOCALIZATION NOTE (sources.searchAlt.key): Alternate key shortcut to open
# the search for searching all the source files the debugger has seen. # the search for searching all the source files the debugger has seen.
sources.searchAlt.key=O sources.searchAlt.key=O
@ -235,10 +239,17 @@ callStack.expand=Expand Rows
# for the summarizing the selected search result. e.g. 5 of 10 results. # for the summarizing the selected search result. e.g. 5 of 10 results.
editor.searchResults=%d of %d results editor.searchResults=%d of %d results
# LOCALIZATION NOTE (sourceSearch.singleResult): Copy shown when there is one result.
editor.singleResult=1 result
# LOCALIZATION NOTE (editor.noResults): Editor Search bar message # LOCALIZATION NOTE (editor.noResults): Editor Search bar message
# for when no results found. # for when no results found.
editor.noResults=no results editor.noResults=no results
# LOCALIZATION NOTE (editor.searchTypeToggleTitle): Search bar title for
# toggling search type buttons(function search, variable search)
editor.searchTypeToggleTitle=Search for:
# LOCALIZATION NOTE (editor.addBreakpoint): Editor gutter context menu item # LOCALIZATION NOTE (editor.addBreakpoint): Editor gutter context menu item
# for adding a breakpoint on a line. # for adding a breakpoint on a line.
editor.addBreakpoint=Add Breakpoint editor.addBreakpoint=Add Breakpoint
@ -341,6 +352,22 @@ sourceTabs.prettyPrint=Pretty Print Source
# the editor context menu. # the editor context menu.
sourceTabs.prettyPrint.accesskey=p sourceTabs.prettyPrint.accesskey=p
# LOCALIZATION NOTE (sourceFooter.blackbox): Tooltip text associated
# with the blackbox button
sourceFooter.blackbox=Blackbox Source
# LOCALIZATION NOTE (sourceFooter.unblackbox): Tooltip text associated
# with the blackbox button
sourceFooter.unblackbox=Unblackbox Source
# LOCALIZATION NOTE (sourceFooter.blackbox.accesskey): Access key to blackbox
# an associated source
sourceFooter.blackbox.accesskey=b
# LOCALIZATION NOTE (sourceFooter.blackboxed): Text associated
# with a blackboxed source
sourceFooter.blackboxed=Blackboxed Source
# LOCALIZATION NOTE (sourceTabs.closeTabButtonTooltip): The tooltip that is displayed # LOCALIZATION NOTE (sourceTabs.closeTabButtonTooltip): The tooltip that is displayed
# for close tab button in source tabs. # for close tab button in source tabs.
sourceTabs.closeTabButtonTooltip=Close tab sourceTabs.closeTabButtonTooltip=Close tab
@ -393,10 +420,6 @@ sourceSearch.search=Search Sources…
# message when the query did not match any of the sources. # message when the query did not match any of the sources.
sourceSearch.noResults=No files matching %S found sourceSearch.noResults=No files matching %S found
# LOCALIZATION NOTE (sourceFooter.debugBtnTooltip): Tooltip text associated
# with the pretty-print button
sourceFooter.debugBtnTooltip=Prettify Source
# LOCALIZATION NOTE (ignoreExceptions): The pause on exceptions button tooltip # LOCALIZATION NOTE (ignoreExceptions): The pause on exceptions button tooltip
# when the debugger will not pause on exceptions. # when the debugger will not pause on exceptions.
ignoreExceptions=Ignore exceptions. Click to pause on uncaught exceptions ignoreExceptions=Ignore exceptions. Click to pause on uncaught exceptions
@ -508,8 +531,30 @@ watchExpressionsSeparatorLabel2=\u0020→
# in the functions search panel as a separator between function's inferred name # in the functions search panel as a separator between function's inferred name
# and its real name (if available). # and its real name (if available).
functionSearchSeparatorLabel= functionSearchSeparatorLabel=
functionSearch.search.placeholder=Search Functions…
functionSearch.search.key=O # LOCALIZATION NOTE(symbolSearch.search.functionsPlaceholder): The placeholder
# text displayed when the user searches for functions in a file
symbolSearch.search.functionsPlaceholder=Search functions…
# LOCALIZATION NOTE(symbolSearch.search.variablesPlaceholder): The placeholder
# text displayed when the user searches for variables in a file
symbolSearch.search.variablesPlaceholder=Search variables…
# LOCALIZATION NOTE(symbolSearch.search.key): The shortcut (cmd+shift+o) for
# searching for a function or variable
symbolSearch.search.key=O
# LOCALIZATION NOTE(symbolSearch.searchModifier.regex): A search option
# when searching text in a file
symbolSearch.searchModifier.regex=Regex
# LOCALIZATION NOTE(symbolSearch.searchModifier.caseSensitive): A search option
# when searching text in a file
symbolSearch.searchModifier.caseSensitive=Case sensitive
# LOCALIZATION NOTE(symbolSearch.searchModifier.wholeWord): A search option
# when searching text in a file
symbolSearch.searchModifier.wholeWord=Whole word
# LOCALIZATION NOTE (resumptionOrderPanelTitle): This is the text that appears # LOCALIZATION NOTE (resumptionOrderPanelTitle): This is the text that appears
# as a description in the notification panel popup, when multiple debuggers are # as a description in the notification panel popup, when multiple debuggers are
@ -577,3 +622,7 @@ whyPaused.debugCommand=Paused on debugged function
# in a info block explaining how the debugger is currently paused on an event # in a info block explaining how the debugger is currently paused on an event
# listener breakpoint set # listener breakpoint set
whyPaused.other=Debugger paused whyPaused.other=Debugger paused
# LOCALIZATION NOTE (ctrl): The text that is used for documenting
# keyboard shortcuts that use the control key
ctrl=Ctrl

View File

@ -1,7 +1,5 @@
# -*- indent-tabs-mode: nil; js-indent-level: 2 -*- /* Any copyright is dedicated to the Public Domain.
# This Source Code Form is subject to the terms of the Mozilla Public * http://creativecommons.org/publicdomain/zero/1.0/ */
# 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/.
#ifdef RELEASE_OR_BETA #ifdef RELEASE_OR_BETA
pref("devtools.debugger.new-debugger-frontend", false); pref("devtools.debugger.new-debugger-frontend", false);
@ -17,7 +15,7 @@ pref("devtools.debugger.chrome-debugging-websocket", false);
pref("devtools.debugger.remote-host", "localhost"); pref("devtools.debugger.remote-host", "localhost");
pref("devtools.debugger.remote-timeout", 20000); pref("devtools.debugger.remote-timeout", 20000);
pref("devtools.debugger.pause-on-exceptions", false); pref("devtools.debugger.pause-on-exceptions", false);
pref("devtools.debugger.ignore-caught-exceptions", true); pref("devtools.debugger.ignore-caught-exceptions", false);
pref("devtools.debugger.source-maps-enabled", true); pref("devtools.debugger.source-maps-enabled", true);
pref("devtools.debugger.client-source-maps-enabled", true); pref("devtools.debugger.client-source-maps-enabled", true);
pref("devtools.debugger.pretty-print-enabled", true); pref("devtools.debugger.pretty-print-enabled", true);
@ -38,4 +36,5 @@ pref("devtools.debugger.start-panel-collapsed", false);
pref("devtools.debugger.end-panel-collapsed", false); pref("devtools.debugger.end-panel-collapsed", false);
pref("devtools.debugger.tabs", "[]"); pref("devtools.debugger.tabs", "[]");
pref("devtools.debugger.pending-selected-location", "{}"); pref("devtools.debugger.pending-selected-location", "{}");
pref("devtools.debugger.pending-breakpoints", "[]");
pref("devtools.debugger.expressions", "[]");

View File

@ -59,10 +59,10 @@ exports.viewSourceInDebugger = Task.async(function* (toolbox, sourceURL, sourceL
// New debugger frontend // New debugger frontend
if (Services.prefs.getBoolPref("devtools.debugger.new-debugger-frontend")) { if (Services.prefs.getBoolPref("devtools.debugger.new-debugger-frontend")) {
const source = dbg._selectors().getSourceByURL(dbg._getState(), sourceURL); const source = dbg.getSource(sourceURL);
if (source) { if (source) {
yield toolbox.selectTool("jsdebugger"); yield toolbox.selectTool("jsdebugger");
dbg._actions().selectSourceURL(sourceURL, { line: sourceLine }); dbg.selectSource(sourceURL, sourceLine);
return true; return true;
} }

View File

@ -59,14 +59,14 @@ consoleApi.set("console.group('bar')", {
keys: ["console.group('bar')", "console.groupEnd('bar')"], keys: ["console.group('bar')", "console.groupEnd('bar')"],
code: ` code: `
console.group("bar"); console.group("bar");
console.groupEnd("bar"); console.groupEnd();
`}); `});
consoleApi.set("console.groupCollapsed('foo')", { consoleApi.set("console.groupCollapsed('foo')", {
keys: ["console.groupCollapsed('foo')", "console.groupEnd('foo')"], keys: ["console.groupCollapsed('foo')", "console.groupEnd('foo')"],
code: ` code: `
console.groupCollapsed("foo"); console.groupCollapsed("foo");
console.groupEnd("foo"); console.groupEnd();
`}); `});
consoleApi.set("console.group()", { consoleApi.set("console.group()", {

View File

@ -546,13 +546,13 @@ stubPreparedMessages.set("console.groupEnd('bar')", new ConsoleMessage({
"id": "1", "id": "1",
"allowRepeating": true, "allowRepeating": true,
"source": "console-api", "source": "console-api",
"timeStamp": 1479159914987, "timeStamp": 1492540770051,
"type": "endGroup", "type": "endGroup",
"level": "log", "level": "log",
"messageText": null, "messageText": null,
"parameters": null, "parameters": null,
"repeat": 1, "repeat": 1,
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"timeStamp\":1479159914987,\"type\":\"endGroup\",\"level\":\"log\",\"messageText\":null,\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html\",\"line\":3,\"column\":1},\"groupId\":null,\"exceptionDocURL\":null,\"userProvidedStyles\":[],\"notes\":null}", "repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"timeStamp\":1492540770051,\"type\":\"endGroup\",\"level\":\"log\",\"messageText\":null,\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html\",\"line\":3,\"column\":1},\"groupId\":null,\"exceptionDocURL\":null,\"userProvidedStyles\":[],\"notes\":null}",
"stacktrace": null, "stacktrace": null,
"frame": { "frame": {
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html", "source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html",
@ -594,13 +594,13 @@ stubPreparedMessages.set("console.groupEnd('foo')", new ConsoleMessage({
"id": "1", "id": "1",
"allowRepeating": true, "allowRepeating": true,
"source": "console-api", "source": "console-api",
"timeStamp": 1479159916155, "timeStamp": 1492540770585,
"type": "endGroup", "type": "endGroup",
"level": "log", "level": "log",
"messageText": null, "messageText": null,
"parameters": null, "parameters": null,
"repeat": 1, "repeat": 1,
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"timeStamp\":1479159916155,\"type\":\"endGroup\",\"level\":\"log\",\"messageText\":null,\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html\",\"line\":3,\"column\":1},\"groupId\":null,\"exceptionDocURL\":null,\"userProvidedStyles\":[],\"notes\":null}", "repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"timeStamp\":1492540770585,\"type\":\"endGroup\",\"level\":\"log\",\"messageText\":null,\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html\",\"line\":3,\"column\":1},\"groupId\":null,\"exceptionDocURL\":null,\"userProvidedStyles\":[],\"notes\":null}",
"stacktrace": null, "stacktrace": null,
"frame": { "frame": {
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html", "source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html",
@ -642,13 +642,13 @@ stubPreparedMessages.set("console.groupEnd()", new ConsoleMessage({
"id": "1", "id": "1",
"allowRepeating": true, "allowRepeating": true,
"source": "console-api", "source": "console-api",
"timeStamp": 1479159917526, "timeStamp": 1491902018685,
"type": "endGroup", "type": "endGroup",
"level": "log", "level": "log",
"messageText": null, "messageText": null,
"parameters": null, "parameters": null,
"repeat": 1, "repeat": 1,
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"timeStamp\":1479159917526,\"type\":\"endGroup\",\"level\":\"log\",\"messageText\":null,\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html\",\"line\":3,\"column\":1},\"groupId\":null,\"exceptionDocURL\":null,\"userProvidedStyles\":[],\"notes\":null}", "repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"timeStamp\":1491902018685,\"type\":\"endGroup\",\"level\":\"log\",\"messageText\":null,\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html\",\"line\":3,\"column\":1},\"groupId\":null,\"exceptionDocURL\":null,\"userProvidedStyles\":[],\"notes\":null}",
"stacktrace": null, "stacktrace": null,
"frame": { "frame": {
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html", "source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html",
@ -723,13 +723,13 @@ stubPreparedMessages.set("console.groupEnd(%cfoo%cbar)", new ConsoleMessage({
"id": "1", "id": "1",
"allowRepeating": true, "allowRepeating": true,
"source": "console-api", "source": "console-api",
"timeStamp": 1491902018671, "timeStamp": 1492540772083,
"type": "endGroup", "type": "endGroup",
"level": "log", "level": "log",
"messageText": null, "messageText": null,
"parameters": null, "parameters": null,
"repeat": 1, "repeat": 1,
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"timeStamp\":1491902018671,\"type\":\"endGroup\",\"level\":\"log\",\"messageText\":null,\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html\",\"line\":6,\"column\":1},\"groupId\":null,\"exceptionDocURL\":null,\"userProvidedStyles\":[],\"notes\":null}", "repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"timeStamp\":1492540772083,\"type\":\"endGroup\",\"level\":\"log\",\"messageText\":null,\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html\",\"line\":6,\"column\":1},\"groupId\":null,\"exceptionDocURL\":null,\"userProvidedStyles\":[],\"notes\":null}",
"stacktrace": null, "stacktrace": null,
"frame": { "frame": {
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html", "source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html",
@ -775,13 +775,13 @@ stubPreparedMessages.set("console.groupEnd(%cfoo%cbaz)", new ConsoleMessage({
"id": "1", "id": "1",
"allowRepeating": true, "allowRepeating": true,
"source": "console-api", "source": "console-api",
"timeStamp": 1491902018685, "timeStamp": 1492540772669,
"type": "endGroup", "type": "endGroup",
"level": "log", "level": "log",
"messageText": null, "messageText": null,
"parameters": null, "parameters": null,
"repeat": 1, "repeat": 1,
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"timeStamp\":1491902018685,\"type\":\"endGroup\",\"level\":\"log\",\"messageText\":null,\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html\",\"line\":6,\"column\":1},\"groupId\":null,\"exceptionDocURL\":null,\"userProvidedStyles\":[],\"notes\":null}", "repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"timeStamp\":1492540772669,\"type\":\"endGroup\",\"level\":\"log\",\"messageText\":null,\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html\",\"line\":6,\"column\":1},\"groupId\":null,\"exceptionDocURL\":null,\"userProvidedStyles\":[],\"notes\":null}",
"stacktrace": null, "stacktrace": null,
"frame": { "frame": {
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html", "source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html",
@ -1320,13 +1320,11 @@ stubPackets.set("console.group('bar')", {
}); });
stubPackets.set("console.groupEnd('bar')", { stubPackets.set("console.groupEnd('bar')", {
"from": "server1.conn16.child1/consoleActor2", "from": "server1.conn0.child1/consoleActor2",
"type": "consoleAPICall", "type": "consoleAPICall",
"message": { "message": {
"addonId": "", "addonId": "",
"arguments": [ "arguments": [],
"bar"
],
"columnNumber": 1, "columnNumber": 1,
"counter": null, "counter": null,
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html", "filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html",
@ -1335,10 +1333,10 @@ stubPackets.set("console.groupEnd('bar')", {
"level": "groupEnd", "level": "groupEnd",
"lineNumber": 3, "lineNumber": 3,
"private": false, "private": false,
"styles": [], "timeStamp": 1492540770051,
"timeStamp": 1479159914987,
"timer": null, "timer": null,
"workerType": "none", "workerType": "none",
"styles": [],
"category": "webdev" "category": "webdev"
} }
}); });
@ -1368,13 +1366,11 @@ stubPackets.set("console.groupCollapsed('foo')", {
}); });
stubPackets.set("console.groupEnd('foo')", { stubPackets.set("console.groupEnd('foo')", {
"from": "server1.conn17.child1/consoleActor2", "from": "server1.conn0.child1/consoleActor2",
"type": "consoleAPICall", "type": "consoleAPICall",
"message": { "message": {
"addonId": "", "addonId": "",
"arguments": [ "arguments": [],
"foo"
],
"columnNumber": 1, "columnNumber": 1,
"counter": null, "counter": null,
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html", "filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html",
@ -1383,10 +1379,10 @@ stubPackets.set("console.groupEnd('foo')", {
"level": "groupEnd", "level": "groupEnd",
"lineNumber": 3, "lineNumber": 3,
"private": false, "private": false,
"styles": [], "timeStamp": 1492540770585,
"timeStamp": 1479159916155,
"timer": null, "timer": null,
"workerType": "none", "workerType": "none",
"styles": [],
"category": "webdev" "category": "webdev"
} }
}); });
@ -1414,7 +1410,7 @@ stubPackets.set("console.group()", {
}); });
stubPackets.set("console.groupEnd()", { stubPackets.set("console.groupEnd()", {
"from": "server1.conn18.child1/consoleActor2", "from": "server1.conn0.child1/consoleActor2",
"type": "consoleAPICall", "type": "consoleAPICall",
"message": { "message": {
"addonId": "", "addonId": "",
@ -1427,10 +1423,10 @@ stubPackets.set("console.groupEnd()", {
"level": "groupEnd", "level": "groupEnd",
"lineNumber": 3, "lineNumber": 3,
"private": false, "private": false,
"styles": [], "timeStamp": 1491902018685,
"timeStamp": 1479159917526,
"timer": null, "timer": null,
"workerType": "none", "workerType": "none",
"styles": [],
"category": "webdev" "category": "webdev"
} }
}); });
@ -1501,14 +1497,14 @@ stubPackets.set("console.groupEnd(%cfoo%cbar)", {
"counter": null, "counter": null,
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html", "filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html",
"functionName": "triggerPacket", "functionName": "triggerPacket",
"groupName": "", "groupName": "foo bar",
"level": "groupEnd", "level": "groupEnd",
"lineNumber": 6, "lineNumber": 6,
"private": false, "private": false,
"styles": [], "timeStamp": 1492540772083,
"timeStamp": 1491902018671,
"timer": null, "timer": null,
"workerType": "none", "workerType": "none",
"styles": [],
"category": "webdev" "category": "webdev"
} }
}); });
@ -1551,14 +1547,14 @@ stubPackets.set("console.groupEnd(%cfoo%cbaz)", {
"counter": null, "counter": null,
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html", "filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html",
"functionName": "triggerPacket", "functionName": "triggerPacket",
"groupName": "", "groupName": "foo baz",
"level": "groupEnd", "level": "groupEnd",
"lineNumber": 6, "lineNumber": 6,
"private": false, "private": false,
"styles": [], "timeStamp": 1492540772669,
"timeStamp": 1491902018685,
"timer": null, "timer": null,
"workerType": "none", "workerType": "none",
"styles": [],
"category": "webdev" "category": "webdev"
} }
}); });

View File

@ -67,7 +67,7 @@ function* checkClickOnNode(hud, toolbox, frameLinkNode) {
let dbg = toolbox.getPanel("jsdebugger"); let dbg = toolbox.getPanel("jsdebugger");
is( is(
dbg._selectors().getSelectedSource(dbg._getState()).get("url"), dbg._selectors.getSelectedSource(dbg._getState()).get("url"),
url, url,
"expected source url" "expected source url"
); );

View File

@ -56,7 +56,7 @@ function* checkClickOnNode(hud, toolbox, frameLinkNode) {
let url = frameLinkNode.getAttribute("data-url"); let url = frameLinkNode.getAttribute("data-url");
let dbg = toolbox.getPanel("jsdebugger"); let dbg = toolbox.getPanel("jsdebugger");
is( is(
dbg._selectors().getSelectedSource(dbg._getState()).get("url"), dbg._selectors.getSelectedSource(dbg._getState()).get("url"),
url, url,
`Debugger is opened at expected source url (${url})` `Debugger is opened at expected source url (${url})`
); );

View File

@ -15,13 +15,13 @@
console.log("log-1"); console.log("log-1");
console.group("group-2"); console.group("group-2");
console.log("log-2"); console.log("log-2");
console.groupEnd("group-2"); console.groupEnd();
console.log("log-3"); console.log("log-3");
console.groupEnd("group-1"); console.groupEnd();
console.log("log-4"); console.log("log-4");
console.groupCollapsed("group-3"); console.groupCollapsed("group-3");
console.log("log-5"); console.log("log-5");
console.groupEnd("group-3"); console.groupEnd();
console.log("log-6"); console.log("log-6");
} }
</script> </script>

View File

@ -294,7 +294,7 @@ describe("Message reducer:", () => {
currentGroup = getCurrentGroup(getState()); currentGroup = getCurrentGroup(getState());
expect(currentGroup).toBe(messages.first().id); expect(currentGroup).toBe(messages.first().id);
const endBarPacket = stubPackets.get("console.groupEnd('foo')"); const endBarPacket = stubPackets.get("console.groupEnd('bar')");
dispatch(actions.messageAdd(endBarPacket)); dispatch(actions.messageAdd(endBarPacket));
messages = getAllMessages(getState()); messages = getAllMessages(getState());
currentGroup = getCurrentGroup(getState()); currentGroup = getCurrentGroup(getState());

View File

@ -40,7 +40,7 @@ add_task(function* () {
}], }],
}); });
yield jsterm.execute('console.groupEnd("bug664131a")'); yield jsterm.execute('console.groupEnd()');
yield jsterm.execute('console.log("bug664131-outside")'); yield jsterm.execute('console.log("bug664131-outside")');
yield waitForMessages({ yield waitForMessages({

View File

@ -81,7 +81,7 @@ function test() {
let toolbox = yield gDevTools.getToolbox(hud.target); let toolbox = yield gDevTools.getToolbox(hud.target);
let dbg = toolbox.getPanel("jsdebugger"); let dbg = toolbox.getPanel("jsdebugger");
is(dbg._selectors().getSelectedSource(dbg._getState()).get("url"), is(dbg._selectors.getSelectedSource(dbg._getState()).get("url"),
url, url,
"expected source url"); "expected source url");
} }

View File

@ -21,7 +21,8 @@ function test() {
let messages = []; let messages = [];
[ [
"start", "start",
"<no label>: 2", "default: 1",
"default: 2",
"console.count() testcounter: 1", "console.count() testcounter: 1",
"console.count() testcounter: 2", "console.count() testcounter: 2",
"console.count() testcounter: 3", "console.count() testcounter: 3",
@ -34,13 +35,6 @@ function test() {
severity: SEVERITY_LOG severity: SEVERITY_LOG
}); });
}); });
messages.push({
name: "Three local counts with no label and count=1",
text: "<no label>: 1",
category: CATEGORY_WEBDEV,
severity: SEVERITY_LOG,
count: 3
});
yield waitForMessages({ yield waitForMessages({
webconsole: hud, webconsole: hud,
messages: messages messages: messages
@ -54,6 +48,8 @@ function test() {
"start", "start",
"console.count() testcounter: 5", "console.count() testcounter: 5",
"console.count() testcounter: 6", "console.count() testcounter: 6",
"default: 3",
"default: 4",
"end" "end"
].forEach(function (msg) { ].forEach(function (msg) {
messages.push({ messages.push({
@ -62,13 +58,6 @@ function test() {
severity: SEVERITY_LOG severity: SEVERITY_LOG
}); });
}); });
messages.push({
name: "Two external counts with no label and count=1",
text: "<no label>: 1",
category: CATEGORY_WEBDEV,
severity: SEVERITY_LOG,
count: 2
});
yield waitForMessages({ yield waitForMessages({
webconsole: hud, webconsole: hud,
messages: messages messages: messages

View File

@ -17,10 +17,6 @@
function counterNoLabel() { function counterNoLabel() {
console.count(); console.count();
} }
function countersWithoutLabel() {
console.count();
console.count();
}
function counterWithLabel() { function counterWithLabel() {
console.count("console.count() testcounter"); console.count("console.count() testcounter");
} }
@ -28,7 +24,6 @@
console.log("start"); console.log("start");
counterNoLabel(); counterNoLabel();
counterNoLabel(); counterNoLabel();
countersWithoutLabel();
counterWithLabel(); counterWithLabel();
counterWithLabel(); counterWithLabel();
counterSeperateScriptTag(); counterSeperateScriptTag();

View File

@ -355,7 +355,8 @@ BrowserTabList.prototype.getTab = function ({ outerWindowID, tabId }) {
} else if (typeof tabId == "number") { } else if (typeof tabId == "number") {
// Tabs OOP // Tabs OOP
for (let browser of this._getBrowsers()) { for (let browser of this._getBrowsers()) {
if (browser.frameLoader.tabParent && if (browser.frameLoader &&
browser.frameLoader.tabParent &&
browser.frameLoader.tabParent.tabId === tabId) { browser.frameLoader.tabParent.tabId === tabId) {
return this._getActorForBrowser(browser); return this._getActorForBrowser(browser);
} }

View File

@ -172,7 +172,7 @@ NS_INTERFACE_MAP_END
/* static */ bool /* static */ bool
CustomElementRegistry::IsCustomElementEnabled(JSContext* aCx, JSObject* aObject) CustomElementRegistry::IsCustomElementEnabled(JSContext* aCx, JSObject* aObject)
{ {
return Preferences::GetBool("dom.webcomponents.customelements.enabled") || return nsContentUtils::IsCustomElementsEnabled() ||
nsContentUtils::IsWebComponentsEnabled(); nsContentUtils::IsWebComponentsEnabled();
} }

View File

@ -291,6 +291,7 @@ bool nsContentUtils::sIsResourceTimingEnabled = false;
bool nsContentUtils::sIsUserTimingLoggingEnabled = false; bool nsContentUtils::sIsUserTimingLoggingEnabled = false;
bool nsContentUtils::sIsExperimentalAutocompleteEnabled = false; bool nsContentUtils::sIsExperimentalAutocompleteEnabled = false;
bool nsContentUtils::sIsWebComponentsEnabled = false; bool nsContentUtils::sIsWebComponentsEnabled = false;
bool nsContentUtils::sIsCustomElementsEnabled = false;
bool nsContentUtils::sPrivacyResistFingerprinting = false; bool nsContentUtils::sPrivacyResistFingerprinting = false;
bool nsContentUtils::sSendPerformanceTimingNotifications = false; bool nsContentUtils::sSendPerformanceTimingNotifications = false;
bool nsContentUtils::sUseActivityCursor = false; bool nsContentUtils::sUseActivityCursor = false;
@ -596,6 +597,9 @@ nsContentUtils::Init()
Preferences::AddBoolVarCache(&sIsWebComponentsEnabled, Preferences::AddBoolVarCache(&sIsWebComponentsEnabled,
"dom.webcomponents.enabled", false); "dom.webcomponents.enabled", false);
Preferences::AddBoolVarCache(&sIsCustomElementsEnabled,
"dom.webcomponents.customelements.enabled", false);
Preferences::AddBoolVarCache(&sPrivacyResistFingerprinting, Preferences::AddBoolVarCache(&sPrivacyResistFingerprinting,
"privacy.resistFingerprinting", false); "privacy.resistFingerprinting", false);

View File

@ -2870,6 +2870,9 @@ public:
static bool static bool
IsLocalRefURL(const nsString& aString); IsLocalRefURL(const nsString& aString);
static bool
IsCustomElementsEnabled() { return sIsCustomElementsEnabled; }
private: private:
static bool InitializeEventTable(); static bool InitializeEventTable();
@ -2987,6 +2990,7 @@ private:
static bool sIsFrameTimingPrefEnabled; static bool sIsFrameTimingPrefEnabled;
static bool sIsExperimentalAutocompleteEnabled; static bool sIsExperimentalAutocompleteEnabled;
static bool sIsWebComponentsEnabled; static bool sIsWebComponentsEnabled;
static bool sIsCustomElementsEnabled;
static bool sPrivacyResistFingerprinting; static bool sPrivacyResistFingerprinting;
static bool sSendPerformanceTimingNotifications; static bool sSendPerformanceTimingNotifications;
static bool sUseActivityCursor; static bool sUseActivityCursor;

View File

@ -105,7 +105,6 @@ GK_ATOM(any, "any")
GK_ATOM(applet, "applet") GK_ATOM(applet, "applet")
GK_ATOM(applyImports, "apply-imports") GK_ATOM(applyImports, "apply-imports")
GK_ATOM(applyTemplates, "apply-templates") GK_ATOM(applyTemplates, "apply-templates")
GK_ATOM(mozapptype, "mozapptype")
GK_ATOM(archive, "archive") GK_ATOM(archive, "archive")
GK_ATOM(area, "area") GK_ATOM(area, "area")
GK_ATOM(arrow, "arrow") GK_ATOM(arrow, "arrow")

View File

@ -9331,11 +9331,13 @@ nsGlobalWindow::ReallyCloseWindow()
from the list of browsers) (and has an unload handler from the list of browsers) (and has an unload handler
that closes the window). */ that closes the window). */
// XXXbz now that we have mHavePendingClose, is this needed? // XXXbz now that we have mHavePendingClose, is this needed?
bool isTab = false; bool isTab;
if (rootWin == AsOuter() || if (rootWin == AsOuter() ||
!bwin || (bwin->IsTabContentWindow(GetOuterWindowInternal(), !bwin ||
&isTab), isTab)) (NS_SUCCEEDED(bwin->IsTabContentWindow(GetOuterWindowInternal(),
&isTab)) && isTab)) {
treeOwnerAsWin->Destroy(); treeOwnerAsWin->Destroy();
}
} }
} }

View File

@ -1,20 +0,0 @@
<!DOCTYPE HTML>
<html>
<body>
<script>
var lock = navigator.requestWakeLock('high-priority');
alert('step0');
lock.unlock();
alert('step1');
lock = navigator.requestWakeLock('cpu');
alert('step2');
lock.unlock();
alert('step3');
</script>
</body>
</html>

View File

@ -2,7 +2,6 @@
# Good luck running these tests on anything but desktop Linux. # Good luck running these tests on anything but desktop Linux.
run-if = os == 'linux' && buildapp == 'browser' && !e10s run-if = os == 'linux' && buildapp == 'browser' && !e10s
support-files = support-files =
file_HighPriority.html
silence.ogg silence.ogg
!/dom/browser-element/mochitest/browserElementTestHelpers.js !/dom/browser-element/mochitest/browserElementTestHelpers.js
!/dom/browser-element/mochitest/file_empty.html !/dom/browser-element/mochitest/file_empty.html
@ -12,6 +11,5 @@ support-files =
# much sense. # much sense.
[test_Simple.html] [test_Simple.html]
[test_HighPriority.html]
[test_WebGLContextLost.html] [test_WebGLContextLost.html]
disabled = bug 865844 disabled = bug 865844

View File

@ -1,132 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
Test that frames with mozapptype=critical which hold the "high-priority" or
"cpu" wake locks get elevated process priority.
-->
<head>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="../browserElementTestHelpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript">
"use strict";
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
browserElementTestHelpers.enableProcessPriorityManager();
function runTest() {
// To test bug 870480, run this test while holding the CPU and high-priority
// wake locks. Without the fix for bug 870480, we won't set the priority of
// the child process if the main process holds these wake locks and the test
// will hang.
navigator.requestWakeLock('cpu');
navigator.requestWakeLock('high-priority');
var iframe = document.createElement('iframe');
iframe.setAttribute('mozbrowser', true);
iframe.setAttribute('mozapptype', 'critical');
iframe.src = 'file_HighPriority.html';
// We expect the following to happen:
//
// - Process is created.
// - Its priority is set to FOREGROUND (when the process starts).
// - wait_alert('step0', FOREGROUND_HIGH)
// - wait_alert('step1', FOREGROUND)
// - wait_alert('step2', FOREGROUND_HIGH)
//
// Where wait_alert(M, P) means that we expect the subprocess to
// * do alert(M) and
// * be set to priority P
// in some order. If the alert occurs before the priority change, we block
// the alert until we observe the priority change. So the subprocess only
// has to do
//
// // set priority to FOREGROUND_HIGH
// alert('step0');
// // set priority to FOREGROUND
// alert('step1');
//
// etc.
var childID = null;
var alertTimes = [];
// Return a promise that's resolved once the child process calls alert() and
// we get a priority change, in some order.
//
// We check that the text of the alert is |"step" + index|.
//
// If gracePeriod is given, we check that the priority change occurred at
// least gracePeriod ms since the alert from the previous step (with a fudge
// factor to account for inaccurate timers).
function expectAlertAndPriorityChange(index, priority, /* optional */ gracePeriod) {
function checkAlertInfo(e) {
is(e.detail.message, 'step' + index, 'alert() number ' + index);
alertTimes.push(new Date());
// Block the alert; we'll unblock it by calling e.detail.unblock() later.
e.preventDefault();
return Promise.resolve(e.detail.unblock);
}
function checkGracePeriod() {
if (gracePeriod) {
var msSinceLastAlert = (new Date()) - alertTimes[index - 1];
// 50ms fudge factor. This test is set up so that, if nsITimers are
// accurate, we don't need any fudge factor. Unfortunately our timers
// are not accurate! There's little we can do here except fudge.
// Thankfully all we're trying to test is that we get /some/ delay; the
// exact amount of delay isn't so important.
ok(msSinceLastAlert + 50 >= gracePeriod,
msSinceLastAlert + "ms since last alert >= (" + gracePeriod + " - 50ms)");
}
}
return Promise.all([
new Promise(function(resolve, reject) {
iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
resolve(checkAlertInfo(e));
}, {once: true});
}),
expectPriorityChange(childID, priority).then(checkGracePeriod)
]).then(function(results) {
// checkAlertInfo returns the function to call to unblock the alert.
// It comes to us as the first element of the results array.
results[0]();
});
}
expectProcessCreated('FOREGROUND').then(function(chid) {
childID = chid;
}).then(function() {
return expectAlertAndPriorityChange(0, 'FOREGROUND_HIGH');
}).then(function() {
return expectAlertAndPriorityChange(1, 'FOREGROUND', priorityChangeGracePeriod);
}).then(function() {
return expectAlertAndPriorityChange(2, 'FOREGROUND_HIGH');
}).then(function() {
return expectAlertAndPriorityChange(3, 'FOREGROUND', priorityChangeGracePeriod);
}).then(SimpleTest.finish);
document.body.appendChild(iframe);
}
const priorityChangeGracePeriod = 100;
addEventListener('testready', function() {
SpecialPowers.pushPrefEnv(
{set: [['dom.ipc.processPriorityManager.backgroundGracePeriodMS',
priorityChangeGracePeriod],
['dom.wakelock.enabled', true]]},
runTest);
});
</script>
</body>
</html>

View File

@ -960,13 +960,13 @@ METHOD(Error, "error")
METHOD(Exception, "exception") METHOD(Exception, "exception")
METHOD(Debug, "debug") METHOD(Debug, "debug")
METHOD(Table, "table") METHOD(Table, "table")
METHOD(Clear, "clear") METHOD(Trace, "trace")
/* static */ void /* static */ void
Console::Trace(const GlobalObject& aGlobal) Console::Clear(const GlobalObject& aGlobal)
{ {
const Sequence<JS::Value> data; const Sequence<JS::Value> data;
Method(aGlobal, MethodTrace, NS_LITERAL_STRING("trace"), data); Method(aGlobal, MethodClear, NS_LITERAL_STRING("clear"), data);
} }
// Displays an interactive listing of all the properties of an object. // Displays an interactive listing of all the properties of an object.
@ -975,36 +975,47 @@ METHOD(Dirxml, "dirxml");
METHOD(Group, "group") METHOD(Group, "group")
METHOD(GroupCollapsed, "groupCollapsed") METHOD(GroupCollapsed, "groupCollapsed")
METHOD(GroupEnd, "groupEnd")
/* static */ void /* static */ void
Console::Time(const GlobalObject& aGlobal, const JS::Handle<JS::Value> aTime) Console::GroupEnd(const GlobalObject& aGlobal)
{ {
JSContext* cx = aGlobal.Context(); const Sequence<JS::Value> data;
Method(aGlobal, MethodGroupEnd, NS_LITERAL_STRING("groupEnd"), data);
Sequence<JS::Value> data;
SequenceRooter<JS::Value> rooter(cx, &data);
if (!aTime.isUndefined() && !data.AppendElement(aTime, fallible)) {
return;
}
Method(aGlobal, MethodTime, NS_LITERAL_STRING("time"), data);
} }
/* static */ void /* static */ void
Console::TimeEnd(const GlobalObject& aGlobal, const JS::Handle<JS::Value> aTime) Console::Time(const GlobalObject& aGlobal, const nsAString& aLabel)
{
StringMethod(aGlobal, aLabel, MethodTime, NS_LITERAL_STRING("time"));
}
/* static */ void
Console::TimeEnd(const GlobalObject& aGlobal, const nsAString& aLabel)
{
StringMethod(aGlobal, aLabel, MethodTimeEnd, NS_LITERAL_STRING("timeEnd"));
}
/* static */ void
Console::StringMethod(const GlobalObject& aGlobal, const nsAString& aLabel,
MethodName aMethodName, const nsAString& aMethodString)
{ {
JSContext* cx = aGlobal.Context(); JSContext* cx = aGlobal.Context();
ClearException ce(cx);
Sequence<JS::Value> data; Sequence<JS::Value> data;
SequenceRooter<JS::Value> rooter(cx, &data); SequenceRooter<JS::Value> rooter(cx, &data);
if (!aTime.isUndefined() && !data.AppendElement(aTime, fallible)) { JS::Rooted<JS::Value> value(cx);
if (!dom::ToJSValue(cx, aLabel, &value)) {
return; return;
} }
Method(aGlobal, MethodTimeEnd, NS_LITERAL_STRING("timeEnd"), data); if (!data.AppendElement(value, fallible)) {
return;
}
Method(aGlobal, aMethodName, aMethodString, data);
} }
/* static */ void /* static */ void
@ -1114,7 +1125,11 @@ Console::Assert(const GlobalObject& aGlobal, bool aCondition,
} }
} }
METHOD(Count, "count") /* static */ void
Console::Count(const GlobalObject& aGlobal, const nsAString& aLabel)
{
StringMethod(aGlobal, aLabel, MethodCount, NS_LITERAL_STRING("count"));
}
/* static */ void /* static */ void
Console::NoopMethod(const GlobalObject& aGlobal) Console::NoopMethod(const GlobalObject& aGlobal)
@ -1364,13 +1379,10 @@ Console::MethodInternal(JSContext* aCx, MethodName aMethodName,
} }
else if (aMethodName == MethodCount) { else if (aMethodName == MethodCount) {
ConsoleStackEntry frame; callData->mCountValue = IncreaseCounter(aCx, aData, callData->mCountLabel);
if (callData->mTopStackFrame) { if (!callData->mCountValue) {
frame = *callData->mTopStackFrame; return;
} }
callData->mCountValue = IncreaseCounter(aCx, frame, aData,
callData->mCountLabel);
} }
if (NS_IsMainThread()) { if (NS_IsMainThread()) {
@ -1500,7 +1512,7 @@ Console::PopulateConsoleNotificationInTheTargetScope(JSContext* aCx,
const Sequence<JS::Value>& aArguments, const Sequence<JS::Value>& aArguments,
JSObject* aTargetScope, JSObject* aTargetScope,
JS::MutableHandle<JS::Value> aEventValue, JS::MutableHandle<JS::Value> aEventValue,
ConsoleCallData* aData) const ConsoleCallData* aData)
{ {
MOZ_ASSERT(aCx); MOZ_ASSERT(aCx);
MOZ_ASSERT(aData); MOZ_ASSERT(aData);
@ -1573,7 +1585,6 @@ Console::PopulateConsoleNotificationInTheTargetScope(JSContext* aCx,
case MethodAssert: case MethodAssert:
case MethodGroup: case MethodGroup:
case MethodGroupCollapsed: case MethodGroupCollapsed:
case MethodGroupEnd:
event.mArguments.Construct(); event.mArguments.Construct();
event.mStyles.Construct(); event.mStyles.Construct();
if (NS_WARN_IF(!ProcessArguments(aCx, aArguments, if (NS_WARN_IF(!ProcessArguments(aCx, aArguments,
@ -1593,9 +1604,14 @@ Console::PopulateConsoleNotificationInTheTargetScope(JSContext* aCx,
} }
if (aData->mMethodName == MethodGroup || if (aData->mMethodName == MethodGroup ||
aData->mMethodName == MethodGroupCollapsed || aData->mMethodName == MethodGroupCollapsed) {
aData->mMethodName == MethodGroupEnd) { ComposeAndStoreGroupName(aCx, event.mArguments.Value(), event.mGroupName);
ComposeGroupName(aCx, event.mArguments.Value(), event.mGroupName); }
else if (aData->mMethodName == MethodGroupEnd) {
if (!UnstoreGroupName(event.mGroupName)) {
return false;
}
} }
else if (aData->mMethodName == MethodTime && !aArguments.IsEmpty()) { else if (aData->mMethodName == MethodTime && !aArguments.IsEmpty()) {
@ -1962,9 +1978,9 @@ Console::MakeFormatString(nsCString& aFormat, int32_t aInteger,
} }
void void
Console::ComposeGroupName(JSContext* aCx, Console::ComposeAndStoreGroupName(JSContext* aCx,
const Sequence<JS::Value>& aData, const Sequence<JS::Value>& aData,
nsAString& aName) const nsAString& aName)
{ {
for (uint32_t i = 0; i < aData.Length(); ++i) { for (uint32_t i = 0; i < aData.Length(); ++i) {
if (i != 0) { if (i != 0) {
@ -1984,6 +2000,21 @@ Console::ComposeGroupName(JSContext* aCx,
aName.Append(string); aName.Append(string);
} }
mGroupStack.AppendElement(aName);
}
bool
Console::UnstoreGroupName(nsAString& aName)
{
if (mGroupStack.IsEmpty()) {
return false;
}
uint32_t pos = mGroupStack.Length() - 1;
aName = mGroupStack[pos];
mGroupStack.RemoveElementAt(pos);
return true;
} }
bool bool
@ -2119,44 +2150,36 @@ Console::ArgumentsToValueList(const Sequence<JS::Value>& aData,
} }
uint32_t uint32_t
Console::IncreaseCounter(JSContext* aCx, const ConsoleStackEntry& aFrame, Console::IncreaseCounter(JSContext* aCx, const Sequence<JS::Value>& aArguments,
const Sequence<JS::Value>& aArguments,
nsAString& aCountLabel) nsAString& aCountLabel)
{ {
AssertIsOnOwningThread(); AssertIsOnOwningThread();
ClearException ce(aCx); ClearException ce(aCx);
nsAutoString key; MOZ_ASSERT(!aArguments.IsEmpty());
nsAutoString label;
if (!aArguments.IsEmpty()) { JS::Rooted<JS::Value> labelValue(aCx, aArguments[0]);
JS::Rooted<JS::Value> labelValue(aCx, aArguments[0]); JS::Rooted<JSString*> jsString(aCx, JS::ToString(aCx, labelValue));
JS::Rooted<JSString*> jsString(aCx, JS::ToString(aCx, labelValue)); if (!jsString) {
return 0; // We cannot continue.
nsAutoJSString string;
if (jsString && string.init(aCx, jsString)) {
label = string;
key = string;
}
} }
if (key.IsEmpty()) { nsAutoJSString string;
key.Append(aFrame.mFilename); if (!string.init(aCx, jsString)) {
key.Append(':'); return 0; // We cannot continue.
key.AppendInt(aFrame.mLineNumber);
} }
aCountLabel = string;
uint32_t count = 0; uint32_t count = 0;
if (!mCounterRegistry.Get(key, &count) && if (!mCounterRegistry.Get(aCountLabel, &count) &&
mCounterRegistry.Count() >= MAX_PAGE_COUNTERS) { mCounterRegistry.Count() >= MAX_PAGE_COUNTERS) {
return MAX_PAGE_COUNTERS; return MAX_PAGE_COUNTERS;
} }
++count; ++count;
mCounterRegistry.Put(key, count); mCounterRegistry.Put(aCountLabel, count);
aCountLabel = label;
return count; return count;
} }
@ -2279,7 +2302,7 @@ Console::ReleaseCallData(ConsoleCallData* aCallData)
void void
Console::NotifyHandler(JSContext* aCx, const Sequence<JS::Value>& aArguments, Console::NotifyHandler(JSContext* aCx, const Sequence<JS::Value>& aArguments,
ConsoleCallData* aCallData) const ConsoleCallData* aCallData)
{ {
AssertIsOnOwningThread(); AssertIsOnOwningThread();
MOZ_ASSERT(!NS_IsMainThread()); MOZ_ASSERT(!NS_IsMainThread());

View File

@ -70,7 +70,7 @@ public:
Table(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData); Table(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData);
static void static void
Trace(const GlobalObject& aGlobal); Trace(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData);
static void static void
Dir(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData); Dir(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData);
@ -85,13 +85,13 @@ public:
GroupCollapsed(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData); GroupCollapsed(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData);
static void static void
GroupEnd(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData); GroupEnd(const GlobalObject& aGlobal);
static void static void
Time(const GlobalObject& aGlobal, const JS::Handle<JS::Value> aTime); Time(const GlobalObject& aGlobal, const nsAString& aLabel);
static void static void
TimeEnd(const GlobalObject& aGlobal, const JS::Handle<JS::Value> aTime); TimeEnd(const GlobalObject& aGlobal, const nsAString& aLabel);
static void static void
TimeStamp(const GlobalObject& aGlobal, const JS::Handle<JS::Value> aData); TimeStamp(const GlobalObject& aGlobal, const JS::Handle<JS::Value> aData);
@ -107,10 +107,10 @@ public:
const Sequence<JS::Value>& aData); const Sequence<JS::Value>& aData);
static void static void
Count(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData); Count(const GlobalObject& aGlobal, const nsAString& aLabel);
static void static void
Clear(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData); Clear(const GlobalObject& aGlobal);
static void static void
NoopMethod(const GlobalObject& aGlobal); NoopMethod(const GlobalObject& aGlobal);
@ -178,7 +178,11 @@ private:
void void
MethodInternal(JSContext* aCx, MethodName aName, MethodInternal(JSContext* aCx, MethodName aName,
const nsAString& aString, const Sequence<JS::Value>& aData); const nsAString& aString, const Sequence<JS::Value>& aData);
static void
StringMethod(const GlobalObject& aGlobal, const nsAString& aLabel,
MethodName aMethodName, const nsAString& aMethodString);
// This method must receive aCx and aArguments in the same JSCompartment. // This method must receive aCx and aArguments in the same JSCompartment.
void void
@ -200,7 +204,7 @@ private:
void void
NotifyHandler(JSContext* aCx, NotifyHandler(JSContext* aCx,
const Sequence<JS::Value>& aArguments, const Sequence<JS::Value>& aArguments,
ConsoleCallData* aData) const; ConsoleCallData* aData);
// PopulateConsoleNotificationInTheTargetScope receives aCx and aArguments in // PopulateConsoleNotificationInTheTargetScope receives aCx and aArguments in
// the same JS compartment and populates the ConsoleEvent object (aValue) in // the same JS compartment and populates the ConsoleEvent object (aValue) in
@ -218,7 +222,7 @@ private:
const Sequence<JS::Value>& aArguments, const Sequence<JS::Value>& aArguments,
JSObject* aTargetScope, JSObject* aTargetScope,
JS::MutableHandle<JS::Value> aValue, JS::MutableHandle<JS::Value> aValue,
ConsoleCallData* aData) const; ConsoleCallData* aData);
// If the first JS::Value of the array is a string, this method uses it to // If the first JS::Value of the array is a string, this method uses it to
// format a string. The supported sequences are: // format a string. The supported sequences are:
@ -248,10 +252,15 @@ private:
char aCh) const; char aCh) const;
// Stringify and Concat all the JS::Value in a single string using ' ' as // Stringify and Concat all the JS::Value in a single string using ' ' as
// separator. // separator. The new group name will be stored in mGroupStack array.
void void
ComposeGroupName(JSContext* aCx, const Sequence<JS::Value>& aData, ComposeAndStoreGroupName(JSContext* aCx, const Sequence<JS::Value>& aData,
nsAString& aName) const; nsAString& aName);
// Remove the last group name and return that name. It returns false if
// mGroupStack is empty.
bool
UnstoreGroupName(nsAString& aName);
// StartTimer is called on the owning thread and populates aTimerLabel and // StartTimer is called on the owning thread and populates aTimerLabel and
// aTimerValue. It returns false if a JS exception is thrown or if // aTimerValue. It returns false if a JS exception is thrown or if
@ -317,15 +326,16 @@ private:
// This method follows the same pattern as StartTimer: its runs on the owning // This method follows the same pattern as StartTimer: its runs on the owning
// thread and populate aCountLabel, used by CreateCounterValue. Returns // thread and populate aCountLabel, used by CreateCounterValue. Returns
// MAX_PAGE_COUNTERS in case of error, otherwise the incremented counter // 3 possible values:
// value. // * MAX_PAGE_COUNTERS in case of error that has to be reported;
// * 0 in case of a CX exception. The operation cannot continue;
// * the incremented counter value.
// Params:
// * aCx - the JSContext rooting aData. // * aCx - the JSContext rooting aData.
// * aFrame - the first frame of ConsoleCallData.
// * aData - the arguments received by the console.count() method. // * aData - the arguments received by the console.count() method.
// * aCountLabel - the label that will be populated by this method. // * aCountLabel - the label that will be populated by this method.
uint32_t uint32_t
IncreaseCounter(JSContext* aCx, const ConsoleStackEntry& aFrame, IncreaseCounter(JSContext* aCx, const Sequence<JS::Value>& aData,
const Sequence<JS::Value>& aData,
nsAString& aCountLabel); nsAString& aCountLabel);
// This method generates a ConsoleCounter dictionary as JS::Value. If // This method generates a ConsoleCounter dictionary as JS::Value. If
@ -375,6 +385,9 @@ private:
RefPtr<AnyCallback> mConsoleEventNotifier; RefPtr<AnyCallback> mConsoleEventNotifier;
// This is the stack for groupping.
nsTArray<nsString> mGroupStack;
#ifdef DEBUG #ifdef DEBUG
PRThread* mOwningThread; PRThread* mOwningThread;
#endif #endif

View File

@ -54,6 +54,21 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=659625
"2 new console events registered for 2 count calls"); "2 new console events registered for 2 count calls");
clearAndCheckStorage(); clearAndCheckStorage();
// For bug 1346326.
console.count("default");
console.count();
console.count(undefined);
let events = storage.getEvents();
// Drop the event from the previous "clear".
events.splice(0, 1);
is(events.length, 3,
"3 new console events registered for 3 'default' count calls");
for (let i = 0; i < events.length; ++i) {
is(events[i].counter.count, i + 1, "check counter for event " + i);
is(events[i].counter.label, "default", "check label for event " + i);
}
clearAndCheckStorage();
console.group("group-label") console.group("group-label")
console.log("group-log"); console.log("group-log");
ok(storage.getEvents().length === 3, ok(storage.getEvents().length === 3,

View File

@ -173,16 +173,8 @@ HTMLButtonElement::ParseAttribute(int32_t aNamespaceID,
{ {
if (aNamespaceID == kNameSpaceID_None) { if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::type) { if (aAttribute == nsGkAtoms::type) {
// XXX ARG!! This is major evilness. ParseAttribute return aResult.ParseEnumValue(aValue, kButtonTypeTable, false,
// shouldn't set members. Override SetAttr instead kButtonDefaultType);
bool success = aResult.ParseEnumValue(aValue, kButtonTypeTable, false);
if (success) {
mType = aResult.GetEnumValue();
} else {
mType = kButtonDefaultType->value;
}
return success;
} }
if (aAttribute == nsGkAtoms::formmethod) { if (aAttribute == nsGkAtoms::formmethod) {
@ -440,7 +432,9 @@ HTMLButtonElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
{ {
if (aNameSpaceID == kNameSpaceID_None) { if (aNameSpaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::type) { if (aName == nsGkAtoms::type) {
if (!aValue) { if (aValue) {
mType = aValue->GetEnumValue();
} else {
mType = kButtonDefaultType->value; mType = kButtonDefaultType->value;
} }
} }

View File

@ -113,6 +113,21 @@ HTMLMenuElement::Build(nsIMenuBuilder* aBuilder)
BuildSubmenu(EmptyString(), this, aBuilder); BuildSubmenu(EmptyString(), this, aBuilder);
} }
nsresult
HTMLMenuElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue, bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::type) {
if (aValue) {
mType = aValue->GetEnumValue();
} else {
mType = kMenuDefaultType->value;
}
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aNotify);
}
bool bool
HTMLMenuElement::ParseAttribute(int32_t aNamespaceID, HTMLMenuElement::ParseAttribute(int32_t aNamespaceID,
@ -121,15 +136,8 @@ HTMLMenuElement::ParseAttribute(int32_t aNamespaceID,
nsAttrValue& aResult) nsAttrValue& aResult)
{ {
if (aNamespaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::type) { if (aNamespaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::type) {
bool success = aResult.ParseEnumValue(aValue, kMenuTypeTable, return aResult.ParseEnumValue(aValue, kMenuTypeTable, false,
false); kMenuDefaultType);
if (success) {
mType = aResult.GetEnumValue();
} else {
mType = kMenuDefaultType->value;
}
return success;
} }
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue, return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,

View File

@ -30,6 +30,8 @@ public:
// nsIDOMHTMLMenuElement // nsIDOMHTMLMenuElement
NS_DECL_NSIDOMHTMLMENUELEMENT NS_DECL_NSIDOMHTMLMENUELEMENT
nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue, bool aNotify) override;
virtual bool ParseAttribute(int32_t aNamespaceID, virtual bool ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
const nsAString& aValue, const nsAString& aValue,

View File

@ -336,15 +336,8 @@ HTMLMenuItemElement::ParseAttribute(int32_t aNamespaceID,
{ {
if (aNamespaceID == kNameSpaceID_None) { if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::type) { if (aAttribute == nsGkAtoms::type) {
bool success = aResult.ParseEnumValue(aValue, kMenuItemTypeTable, return aResult.ParseEnumValue(aValue, kMenuItemTypeTable, false,
false); kMenuItemDefaultType);
if (success) {
mType = aResult.GetEnumValue();
} else {
mType = kMenuItemDefaultType->value;
}
return success;
} }
if (aAttribute == nsGkAtoms::radiogroup) { if (aAttribute == nsGkAtoms::radiogroup) {
@ -383,6 +376,16 @@ HTMLMenuItemElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue, bool aNotify) const nsAttrValue* aValue, bool aNotify)
{ {
if (aNameSpaceID == kNameSpaceID_None) { if (aNameSpaceID == kNameSpaceID_None) {
// Handle type changes first, since some of the later conditions in this
// method look at mType and want to see the new value.
if (aName == nsGkAtoms::type) {
if (aValue) {
mType = aValue->GetEnumValue();
} else {
mType = kMenuItemDefaultType->value;
}
}
if ((aName == nsGkAtoms::radiogroup || aName == nsGkAtoms::type) && if ((aName == nsGkAtoms::radiogroup || aName == nsGkAtoms::type) &&
mType == CMD_TYPE_RADIO && mType == CMD_TYPE_RADIO &&
!mParserCreating) { !mParserCreating) {

View File

@ -263,7 +263,8 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
} }
if (isCustomElementName || aIs) { if (CustomElementRegistry::IsCustomElementEnabled() &&
(isCustomElementName || aIs)) {
nsContentUtils::SetupCustomElement(*aResult, aIs); nsContentUtils::SetupCustomElement(*aResult, aIs);
} }

View File

@ -871,11 +871,6 @@ ContentParent::GetInitialProcessPriority(Element* aFrameElement)
return PROCESS_PRIORITY_FOREGROUND; return PROCESS_PRIORITY_FOREGROUND;
} }
if (!aFrameElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::mozapptype,
NS_LITERAL_STRING("critical"), eCaseMatters)) {
return PROCESS_PRIORITY_FOREGROUND;
}
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(aFrameElement); nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(aFrameElement);
if (!browserFrame) { if (!browserFrame) {
return PROCESS_PRIORITY_FOREGROUND; return PROCESS_PRIORITY_FOREGROUND;

View File

@ -64,6 +64,7 @@ const char* mozilla::dom::ContentPrefs::gInitPrefs[] = {
"dom.vibrator.enabled", "dom.vibrator.enabled",
"dom.vibrator.max_vibrate_list_len", "dom.vibrator.max_vibrate_list_len",
"dom.vibrator.max_vibrate_ms", "dom.vibrator.max_vibrate_ms",
"dom.webcomponents.customelements.enabled",
"dom.webcomponents.enabled", "dom.webcomponents.enabled",
"focusmanager.testmode", "focusmanager.testmode",
"font.size.inflation.disabledInMasterProcess", "font.size.inflation.disabledInMasterProcess",

View File

@ -313,7 +313,6 @@ public:
*/ */
const nsAutoCString& NameWithComma(); const nsAutoCString& NameWithComma();
bool HasAppType(const char* aAppType);
bool IsExpectingSystemMessage(); bool IsExpectingSystemMessage();
void OnAudioChannelProcessChanged(nsISupports* aSubject); void OnAudioChannelProcessChanged(nsISupports* aSubject);
@ -1001,22 +1000,6 @@ ParticularProcessPriorityManager::Notify(nsITimer* aTimer)
return NS_OK; return NS_OK;
} }
bool
ParticularProcessPriorityManager::HasAppType(const char* aAppType)
{
const ManagedContainer<PBrowserParent>& browsers =
mContentParent->ManagedPBrowserParent();
for (auto iter = browsers.ConstIter(); !iter.Done(); iter.Next()) {
nsAutoString appType;
TabParent::GetFrom(iter.Get()->GetKey())->GetAppType(appType);
if (appType.EqualsASCII(aAppType)) {
return true;
}
}
return false;
}
bool bool
ParticularProcessPriorityManager::IsExpectingSystemMessage() ParticularProcessPriorityManager::IsExpectingSystemMessage()
{ {
@ -1042,11 +1025,6 @@ ParticularProcessPriorityManager::CurrentPriority()
ProcessPriority ProcessPriority
ParticularProcessPriorityManager::ComputePriority() ParticularProcessPriorityManager::ComputePriority()
{ {
if ((mHoldsCPUWakeLock || mHoldsHighPriorityWakeLock) &&
HasAppType("critical")) {
return PROCESS_PRIORITY_FOREGROUND_HIGH;
}
bool isVisible = false; bool isVisible = false;
const ManagedContainer<PBrowserParent>& browsers = const ManagedContainer<PBrowserParent>& browsers =
mContentParent->ManagedPBrowserParent(); mContentParent->ManagedPBrowserParent();

View File

@ -329,18 +329,6 @@ TabParent::RemoveWindowListeners()
} }
} }
void
TabParent::GetAppType(nsAString& aOut)
{
aOut.Truncate();
nsCOMPtr<Element> elem = do_QueryInterface(mFrameElement);
if (!elem) {
return;
}
elem->GetAttr(kNameSpaceID_None, nsGkAtoms::mozapptype, aOut);
}
bool bool
TabParent::IsVisible() const TabParent::IsVisible() const
{ {

View File

@ -118,11 +118,6 @@ public:
void CacheFrameLoader(nsFrameLoader* aFrameLoader); void CacheFrameLoader(nsFrameLoader* aFrameLoader);
/**
* Get the mozapptype attribute from this TabParent's owner DOM element.
*/
void GetAppType(nsAString& aOut);
/** /**
* Returns true iff this TabParent's nsIFrameLoader is visible. * Returns true iff this TabParent's nsIFrameLoader is visible.
* *

View File

@ -13,7 +13,8 @@
SpecialPowers.pushPrefEnv({ SpecialPowers.pushPrefEnv({
"set": [["dom.storageManager.enabled", true], "set": [["dom.storageManager.enabled", true],
["dom.storageManager.prompt.testing", false], ["dom.storageManager.prompt.testing", false],
["dom.storageManager.prompt.testing.allow", false]] ["dom.storageManager.prompt.testing.allow", false],
["browser.storageManager.enabled", true]]
}, continueToNextStep); }, continueToNextStep);
yield undefined; yield undefined;

View File

@ -40,6 +40,19 @@ function* testHarnessSteps()
yield undefined; yield undefined;
info("Pushing preferences");
SpecialPowers.pushPrefEnv(
{
"set": [
["dom.storageManager.enabled", true],
["dom.storageManager.prompt.testing", true],
]
},
nextTestHarnessStep
);
yield undefined;
info("Clearing old databases"); info("Clearing old databases");
clearAllDatabases(nextTestHarnessStep); clearAllDatabases(nextTestHarnessStep);

View File

@ -4,9 +4,7 @@ var testGenerator = testSteps();
function* testSteps() function* testSteps()
{ {
SpecialPowers.pushPrefEnv({ SpecialPowers.pushPrefEnv({
"set": [["dom.storageManager.enabled", true], "set": [["dom.storageManager.prompt.testing.allow", true]]
["dom.storageManager.prompt.testing", true],
["dom.storageManager.prompt.testing.allow", true]]
}, continueToNextStep); }, continueToNextStep);
yield undefined; yield undefined;

View File

@ -4,9 +4,7 @@ var testGenerator = testSteps();
function* testSteps() function* testSteps()
{ {
SpecialPowers.pushPrefEnv({ SpecialPowers.pushPrefEnv({
"set": [["dom.storageManager.enabled", true], "set": [["dom.storageManager.prompt.testing.allow", false]]
["dom.storageManager.prompt.testing", true],
["dom.storageManager.prompt.testing.allow", false]]
}, continueToNextStep); }, continueToNextStep);
yield undefined; yield undefined;

View File

@ -114,7 +114,10 @@ public:
return mType != NONE; return mType != NONE;
} }
void SetRect(Float x, Float y, Float width, Float height) { void SetRect(Float x, Float y, Float width, Float height) {
mX = x; mY = y, mWidthOrX2 = width, mHeightOrY2 = height; mX = x;
mY = y;
mWidthOrX2 = width;
mHeightOrY2 = height;
mType = RECT; mType = RECT;
} }
Rect AsRect() const { Rect AsRect() const {
@ -125,7 +128,10 @@ public:
return mType == RECT; return mType == RECT;
} }
void SetLine(Float x1, Float y1, Float x2, Float y2) { void SetLine(Float x1, Float y1, Float x2, Float y2) {
mX = x1, mY = y1, mWidthOrX2 = x2, mHeightOrY2 = y2; mX = x1;
mY = y1;
mWidthOrX2 = x2;
mHeightOrY2 = y2;
mType = LINE; mType = LINE;
} }
Point Point1() const { Point Point1() const {

View File

@ -348,8 +348,6 @@ function testConsoleGroup(aMessageObject) {
is(aMessageObject.arguments[1], "group", "group arguments[1] matches"); is(aMessageObject.arguments[1], "group", "group arguments[1] matches");
} }
else if (aMessageObject.level == "groupEnd") { else if (aMessageObject.level == "groupEnd") {
let groupName = Array.prototype.join.call(aMessageObject.arguments, " ");
is(groupName,"b group", "groupEnd arguments matches");
is(aMessageObject.groupName, "b group", "groupEnd groupName matches"); is(aMessageObject.groupName, "b group", "groupEnd groupName matches");
} }
@ -503,8 +501,9 @@ function testEmptyTimer(aMessageObject) {
ok(aMessageObject.level == "time" || aMessageObject.level == "timeEnd", ok(aMessageObject.level == "time" || aMessageObject.level == "timeEnd",
"expected level received"); "expected level received");
is(aMessageObject.arguments.length, 0, "we don't have arguments"); is(aMessageObject.arguments.length, 1, "we have the default argument");
ok(!aMessageObject.timer, "we don't have a timer"); is(aMessageObject.arguments[0], "default", "we have the default argument");
ok(aMessageObject.timer, "we have a timer");
is(aMessageObject.functionName, "namelessTimer", "functionName matches"); is(aMessageObject.functionName, "namelessTimer", "functionName matches");
ok(aMessageObject.lineNumber == 31 || aMessageObject.lineNumber == 32, ok(aMessageObject.lineNumber == 31 || aMessageObject.lineNumber == 32,

View File

@ -47,7 +47,7 @@
function testGroups() { function testGroups() {
console.groupCollapsed("a", "group"); console.groupCollapsed("a", "group");
console.group("b", "group"); console.group("b", "group");
console.groupEnd("b", "group"); console.groupEnd();
} }
function nativeCallback() { function nativeCallback() {

View File

@ -2,36 +2,47 @@
/* vim: set ts=2 et sw=2 tw=80: */ /* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* For more information on this interface, please see
* https://console.spec.whatwg.org/#console-namespace
*/
[Exposed=(Window,Worker,WorkerDebugger,Worklet), [Exposed=(Window,Worker,WorkerDebugger,Worklet),
ClassString="Console", ClassString="Console",
ProtoObjectHack] ProtoObjectHack]
namespace console { namespace console {
void log(any... data); // Logging
void info(any... data); void assert(optional boolean condition = false, any... data);
void warn(any... data); void clear();
void error(any... data); void count(optional DOMString label = "default");
void _exception(any... data);
void debug(any... data); void debug(any... data);
void table(any... data); void error(any... data);
void trace(); void info(any... data);
void dir(any... data); void log(any... data);
void table(any... data); // FIXME: The spec is still unclear about this.
void trace(any... data);
void warn(any... data);
void dir(any... data); // FIXME: This doesn't follow the spec yet.
void dirxml(any... data); void dirxml(any... data);
// Grouping
void group(any... data); void group(any... data);
void groupCollapsed(any... data); void groupCollapsed(any... data);
void groupEnd(any... data); void groupEnd();
void time(optional any time);
void timeEnd(optional any time); // Timing
void time(optional DOMString label = "default");
void timeEnd(optional DOMString label = "default");
// Mozilla only or Webcompat methods
void _exception(any... data);
void timeStamp(optional any data); void timeStamp(optional any data);
void clear(any... data);
void profile(any... data); void profile(any... data);
void profileEnd(any... data); void profileEnd(any... data);
void assert(boolean condition, any... data);
void count(any... data);
// No-op methods for compatibility with other browsers. // No-op methods for compatibility with other browsers.
[BinaryName="noopMethod"] [BinaryName="noopMethod"]
void markTimeline(); void markTimeline();

View File

@ -58,7 +58,7 @@ onmessage = function(event) {
function testGroups() { function testGroups() {
console.groupCollapsed("a", "group"); console.groupCollapsed("a", "group");
console.group("b", "group"); console.group("b", "group");
console.groupEnd("b", "group"); console.groupEnd();
} }
foobar585956a('omg'); foobar585956a('omg');

View File

@ -106,7 +106,7 @@ function register() {
}) })
} }
function verifyServiceWorkTime(aSWRInfo) { function verifyServiceWorkTime(aSWRInfo, resolve) {
let expectedResult = expectedResults.shift(); let expectedResult = expectedResults.shift();
ok(!!expectedResult, "We should be able to get test from expectedResults"); ok(!!expectedResult, "We should be able to get test from expectedResults");
@ -123,7 +123,7 @@ function verifyServiceWorkTime(aSWRInfo) {
if (!swInfo) { if (!swInfo) {
is(expectedResult.state, State.BYTECHECK, is(expectedResult.state, State.BYTECHECK,
"We shouldn't get sw when we are notified for frist time updating"); "We shouldn't get sw when we are notified for first time updating");
return; return;
} }
@ -147,6 +147,9 @@ function verifyServiceWorkTime(aSWRInfo) {
// We need to hold sw to avoid losing it since we'll unregister the swr later. // We need to hold sw to avoid losing it since we'll unregister the swr later.
if (expectedResult.state === State.ACTIVATED) { if (expectedResult.state === State.ACTIVATED) {
astrayServiceWorkerInfo = aSWRInfo.activeWorker; astrayServiceWorkerInfo = aSWRInfo.activeWorker;
// Resolve the promise for testServiceWorkerInfo after sw is activated.
resolve();
} }
} }
@ -156,16 +159,9 @@ function testServiceWorkerInfo() {
let promise_resolve; let promise_resolve;
let promise = new Promise(aResolve => promise_resolve = aResolve); let promise = new Promise(aResolve => promise_resolve = aResolve);
let counter = 0;
swrlistener = { swrlistener = {
onChange: () => { onChange: () => {
verifyServiceWorkTime(registrationInfo) verifyServiceWorkTime(registrationInfo, promise_resolve);
counter++;
// Resolve the promise after sw is activated.
if (counter >= State.ACTIVATED) {
promise_resolve();
}
} }
}; };

View File

@ -158,7 +158,7 @@ onmessage = function(message) {
expectedTestCount++; expectedTestCount++;
r = new FileReader(); r = new FileReader();
r.onload = getLoadHandler(convertToDataURL(""), 0, "empt binary string reading"); r.onload = getLoadHandler(convertToDataURL(""), 0, "empty binary string reading");
r.readAsDataURL(emptyFile); r.readAsDataURL(emptyFile);
expectedTestCount++; expectedTestCount++;

View File

@ -3,6 +3,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsXMLContentSink.h" #include "nsXMLContentSink.h"
#include "nsIFragmentContentSink.h" #include "nsIFragmentContentSink.h"
@ -224,7 +225,7 @@ nsXMLFragmentContentSink::CloseElement(nsIContent* aContent)
{ {
// don't do fancy stuff in nsXMLContentSink // don't do fancy stuff in nsXMLContentSink
if (mPreventScriptExecution && if (mPreventScriptExecution &&
(aContent->IsHTMLElement(nsGkAtoms::script), (aContent->IsHTMLElement(nsGkAtoms::script) ||
aContent->IsSVGElement(nsGkAtoms::script))) { aContent->IsSVGElement(nsGkAtoms::script))) {
nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(aContent); nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(aContent);
if (sele) { if (sele) {

View File

@ -3,7 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozSpellChecker.h" #include "mozSpellChecker.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "mozISpellI18NManager.h" #include "mozISpellI18NManager.h"
@ -552,7 +551,8 @@ mozSpellChecker::GetEngineList(nsCOMArray<mozISpellCheckingEngine>* aSpellChecki
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return rv; return rv;
while (catEntries->HasMoreElements(&hasMoreEngines), hasMoreEngines){ while (NS_SUCCEEDED(catEntries->HasMoreElements(&hasMoreEngines)) &&
hasMoreEngines) {
nsCOMPtr<nsISupports> elem; nsCOMPtr<nsISupports> elem;
rv = catEntries->GetNext(getter_AddRefs(elem)); rv = catEntries->GetNext(getter_AddRefs(elem));

View File

@ -1925,19 +1925,19 @@ DumpTransform(layerscope::LayersPacket::Layer::Matrix* aLayerMatrix, const Matri
Matrix m = aMatrix.As2D(); Matrix m = aMatrix.As2D();
aLayerMatrix->set_isid(m.IsIdentity()); aLayerMatrix->set_isid(m.IsIdentity());
if (!m.IsIdentity()) { if (!m.IsIdentity()) {
aLayerMatrix->add_m(m._11), aLayerMatrix->add_m(m._12); aLayerMatrix->add_m(m._11); aLayerMatrix->add_m(m._12);
aLayerMatrix->add_m(m._21), aLayerMatrix->add_m(m._22); aLayerMatrix->add_m(m._21); aLayerMatrix->add_m(m._22);
aLayerMatrix->add_m(m._31), aLayerMatrix->add_m(m._32); aLayerMatrix->add_m(m._31); aLayerMatrix->add_m(m._32);
} }
} else { } else {
aLayerMatrix->add_m(aMatrix._11), aLayerMatrix->add_m(aMatrix._12); aLayerMatrix->add_m(aMatrix._11); aLayerMatrix->add_m(aMatrix._12);
aLayerMatrix->add_m(aMatrix._13), aLayerMatrix->add_m(aMatrix._14); aLayerMatrix->add_m(aMatrix._13); aLayerMatrix->add_m(aMatrix._14);
aLayerMatrix->add_m(aMatrix._21), aLayerMatrix->add_m(aMatrix._22); aLayerMatrix->add_m(aMatrix._21); aLayerMatrix->add_m(aMatrix._22);
aLayerMatrix->add_m(aMatrix._23), aLayerMatrix->add_m(aMatrix._24); aLayerMatrix->add_m(aMatrix._23); aLayerMatrix->add_m(aMatrix._24);
aLayerMatrix->add_m(aMatrix._31), aLayerMatrix->add_m(aMatrix._32); aLayerMatrix->add_m(aMatrix._31); aLayerMatrix->add_m(aMatrix._32);
aLayerMatrix->add_m(aMatrix._33), aLayerMatrix->add_m(aMatrix._34); aLayerMatrix->add_m(aMatrix._33); aLayerMatrix->add_m(aMatrix._34);
aLayerMatrix->add_m(aMatrix._41), aLayerMatrix->add_m(aMatrix._42); aLayerMatrix->add_m(aMatrix._41); aLayerMatrix->add_m(aMatrix._42);
aLayerMatrix->add_m(aMatrix._43), aLayerMatrix->add_m(aMatrix._44); aLayerMatrix->add_m(aMatrix._43); aLayerMatrix->add_m(aMatrix._44);
} }
} }

View File

@ -549,7 +549,7 @@ nsTableEncoderSupport::nsTableEncoderSupport(uScanClassID aScanClass,
: nsEncoderSupport(aMaxLengthFactor) : nsEncoderSupport(aMaxLengthFactor)
{ {
mScanClass = aScanClass; mScanClass = aScanClass;
mShiftOutTable = aShiftOutTable, mShiftOutTable = aShiftOutTable;
mMappingTable = aMappingTable; mMappingTable = aMappingTable;
} }

View File

@ -3652,7 +3652,7 @@ ContainerState::NewPaintedLayerData(nsDisplayItem* aItem,
PaintedLayerData data; PaintedLayerData data;
data.mAnimatedGeometryRoot = aAnimatedGeometryRoot; data.mAnimatedGeometryRoot = aAnimatedGeometryRoot;
data.mASR = aASR; data.mASR = aASR;
data.mClipChain = aClipChain, data.mClipChain = aClipChain;
data.mAnimatedGeometryRootOffset = aTopLeft; data.mAnimatedGeometryRootOffset = aTopLeft;
data.mReferenceFrame = aItem->ReferenceFrame(); data.mReferenceFrame = aItem->ReferenceFrame();
data.mBackfaceHidden = aItem->Frame()->In3DContextAndBackfaceIsHidden(); data.mBackfaceHidden = aItem->Frame()->In3DContextAndBackfaceIsHidden();
@ -3662,7 +3662,7 @@ ContainerState::NewPaintedLayerData(nsDisplayItem* aItem,
newLayerEntry->mAnimatedGeometryRoot = aAnimatedGeometryRoot; newLayerEntry->mAnimatedGeometryRoot = aAnimatedGeometryRoot;
newLayerEntry->mASR = aASR; newLayerEntry->mASR = aASR;
newLayerEntry->mScrollMetadataASR = aScrollMetadataASR; newLayerEntry->mScrollMetadataASR = aScrollMetadataASR;
newLayerEntry->mClipChain = aClipChain, newLayerEntry->mClipChain = aClipChain;
// newLayerEntry->mOpaqueRegion is filled in later from // newLayerEntry->mOpaqueRegion is filled in later from
// paintedLayerData->mOpaqueRegion, if necessary. // paintedLayerData->mOpaqueRegion, if necessary.

View File

@ -3333,8 +3333,8 @@ nsCSSBorderRenderer::DrawBorders()
if (allBordersSame && mCompositeColors[0] != nullptr && !mNoBorderRadius) if (allBordersSame && mCompositeColors[0] != nullptr && !mNoBorderRadius)
forceSeparateCorners = true; forceSeparateCorners = true;
PrintAsString(" mOuterRect: "), PrintAsString(mOuterRect), PrintAsStringNewline(); PrintAsString(" mOuterRect: "); PrintAsString(mOuterRect); PrintAsStringNewline();
PrintAsString(" mInnerRect: "), PrintAsString(mInnerRect), PrintAsStringNewline(); PrintAsString(" mInnerRect: "); PrintAsString(mInnerRect); PrintAsStringNewline();
PrintAsFormatString(" mBorderColors: 0x%08x 0x%08x 0x%08x 0x%08x\n", mBorderColors[0], mBorderColors[1], mBorderColors[2], mBorderColors[3]); PrintAsFormatString(" mBorderColors: 0x%08x 0x%08x 0x%08x 0x%08x\n", mBorderColors[0], mBorderColors[1], mBorderColors[2], mBorderColors[3]);
// if conditioning the outside rect failed, then bail -- the outside // if conditioning the outside rect failed, then bail -- the outside

View File

@ -87,7 +87,7 @@ skip-if(stylo) == sheet-set-switch-1.html sheet-set-switch-1.html # times out?
skip-if(stylo) HTTP(..) == insert-rule-1a.html insert-rule-1a.html # Bug 1290237 skip-if(stylo) HTTP(..) == insert-rule-1a.html insert-rule-1a.html # Bug 1290237
skip-if(stylo) HTTP(..) == insert-rule-1b.html insert-rule-1b.html # Bug 1290237 skip-if(stylo) HTTP(..) == insert-rule-1b.html insert-rule-1b.html # Bug 1290237
skip-if(stylo) HTTP(..) == delete-rule-1.html delete-rule-1.html # Bug 1290237 skip-if(stylo) HTTP(..) == delete-rule-1.html delete-rule-1.html # Bug 1290237
HTTP(..) == media-query-add-1.html media-query-add-1.html skip-if(stylo) HTTP(..) == media-query-add-1.html media-query-add-1.html
fails HTTP(..) == media-query-remove-1.html media-query-remove-1.html fails HTTP(..) == media-query-remove-1.html media-query-remove-1.html
HTTP(..) == media-query-add-1-ref.html media-query-add-1-ref.html HTTP(..) == media-query-add-1-ref.html media-query-add-1-ref.html

View File

@ -800,17 +800,26 @@ Declaration::GetPropertyValueInternal(
MOZ_ASSERT(StringEndsWith(nsCSSProps::GetStringValue(subprops[2]), MOZ_ASSERT(StringEndsWith(nsCSSProps::GetStringValue(subprops[2]),
NS_LITERAL_CSTRING("-color")), NS_LITERAL_CSTRING("-color")),
"third subprop must be the color property"); "third subprop must be the color property");
const nsCSSValue *colorValue = data->ValueFor(subprops[2]);
bool isCurrentColor = bool ok = AppendValueToString(subprops[0], aValue, aSerialization);
colorValue->GetUnit() == eCSSUnit_EnumColor && if (ok) {
colorValue->GetIntValue() == NS_COLOR_CURRENTCOLOR; aValue.Append(u' ');
if (!AppendValueToString(subprops[0], aValue, aSerialization) || ok = AppendValueToString(subprops[1], aValue, aSerialization);
!(aValue.Append(char16_t(' ')), if (ok) {
AppendValueToString(subprops[1], aValue, aSerialization)) || const nsCSSValue *colorValue = data->ValueFor(subprops[2]);
bool isCurrentColor =
colorValue->GetUnit() == eCSSUnit_EnumColor &&
colorValue->GetIntValue() == NS_COLOR_CURRENTCOLOR;
// Don't output a third value when it's currentcolor. // Don't output a third value when it's currentcolor.
!(isCurrentColor || if (!isCurrentColor) {
(aValue.Append(char16_t(' ')), aValue.Append(u' ');
AppendValueToString(subprops[2], aValue, aSerialization)))) { ok = AppendValueToString(subprops[2], aValue, aSerialization);
}
}
}
if (!ok) {
aValue.Truncate(); aValue.Truncate();
} }
break; break;

View File

@ -1116,8 +1116,12 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(const nsAString& aFamilyName,
face->mLocalName.Truncate(); face->mLocalName.Truncate();
face->mFormatFlags = 0; face->mFormatFlags = 0;
while (i + 1 < numSrc && (val = srcArr->Item(i+1),
val.GetUnit() == eCSSUnit_Font_Format)) { while (i + 1 < numSrc) {
val = srcArr->Item(i + 1);
if (val.GetUnit() != eCSSUnit_Font_Format)
break;
nsDependentString valueString(val.GetStringBufferValue()); nsDependentString valueString(val.GetStringBufferValue());
if (valueString.LowerCaseEqualsASCII("woff")) { if (valueString.LowerCaseEqualsASCII("woff")) {
face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_WOFF; face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_WOFF;
@ -1350,7 +1354,6 @@ FontFaceSet::CheckFontLoad(const gfxFontFaceSrc* aFontFaceSrc,
return NS_OK; return NS_OK;
} }
// @arg aPrincipal: generally this is mDocument->NodePrincipal() but // @arg aPrincipal: generally this is mDocument->NodePrincipal() but
// might also be the original principal which enables user stylesheets // might also be the original principal which enables user stylesheets
// to load font files via @font-face rules. // to load font files via @font-face rules.

View File

@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla build system.
The cubeb git repository is: git://github.com/kinetiknz/cubeb.git The cubeb git repository is: git://github.com/kinetiknz/cubeb.git
The git commit ID used was 04826edb13c23a2b53732d63b09b24e05ca83d87 (2017-03-31 09:05:07 -0700) The git commit ID used was 6e52314f24bba463d6ca97951f7d9fcc677d76a4 (2017-04-18 17:28:50 +0200)

View File

@ -14,6 +14,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <memory>
#include <string.h> #include <string.h>
#include "cubeb/cubeb.h" #include "cubeb/cubeb.h"
#include "common.h" #include "common.h"
@ -75,20 +76,6 @@ long data_cb(cubeb_stream * /*stream*/, void * user, const void * /*inputbuffer*
return nframes; return nframes;
} }
struct CubebCleaner
{
CubebCleaner(cubeb* ctx_) : ctx(ctx_) {}
~CubebCleaner() { cubeb_destroy(ctx); }
cubeb* ctx;
};
struct CubebStreamCleaner
{
CubebStreamCleaner(cubeb_stream* ctx_) : ctx(ctx_) {}
~CubebStreamCleaner() { cubeb_stream_destroy(ctx); }
cubeb_stream* ctx;
};
void state_cb_audio(cubeb_stream * /*stream*/, void * /*user*/, cubeb_state /*state*/) void state_cb_audio(cubeb_stream * /*stream*/, void * /*user*/, cubeb_state /*state*/)
{ {
} }
@ -100,12 +87,6 @@ int supports_float32(string backend_id)
&& backend_id != "audiotrack"; && backend_id != "audiotrack";
} }
/* The WASAPI backend only supports float. */
int supports_int16(string backend_id)
{
return backend_id != "wasapi";
}
/* Some backends don't have code to deal with more than mono or stereo. */ /* Some backends don't have code to deal with more than mono or stereo. */
int supports_channel_count(string backend_id, int nchannels) int supports_channel_count(string backend_id, int nchannels)
{ {
@ -124,12 +105,12 @@ int run_test(int num_channels, layout_info layout, int sampling_rate, int is_flo
fprintf(stderr, "Error initializing cubeb library\n"); fprintf(stderr, "Error initializing cubeb library\n");
return r; return r;
} }
CubebCleaner cleanup_cubeb_at_exit(ctx); std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
cleanup_cubeb_at_exit(ctx, cubeb_destroy);
const char * backend_id = cubeb_get_backend_id(ctx); const char * backend_id = cubeb_get_backend_id(ctx);
if ((is_float && !supports_float32(backend_id)) || if ((is_float && !supports_float32(backend_id)) ||
(!is_float && !supports_int16(backend_id)) ||
!supports_channel_count(backend_id, num_channels)) { !supports_channel_count(backend_id, num_channels)) {
/* don't treat this as a test failure. */ /* don't treat this as a test failure. */
return CUBEB_OK; return CUBEB_OK;
@ -153,7 +134,8 @@ int run_test(int num_channels, layout_info layout, int sampling_rate, int is_flo
return r; return r;
} }
CubebStreamCleaner cleanup_stream_at_exit(stream); std::unique_ptr<cubeb_stream, decltype(&cubeb_stream_destroy)>
cleanup_stream_at_exit(stream, cubeb_stream_destroy);
cubeb_stream_start(stream); cubeb_stream_start(stream);
delay(200); delay(200);
@ -174,12 +156,12 @@ int run_panning_volume_test(int is_float)
return r; return r;
} }
CubebCleaner cleanup_cubeb_at_exit(ctx); std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
cleanup_cubeb_at_exit(ctx, cubeb_destroy);
const char * backend_id = cubeb_get_backend_id(ctx); const char * backend_id = cubeb_get_backend_id(ctx);
if ((is_float && !supports_float32(backend_id)) || if ((is_float && !supports_float32(backend_id))) {
(!is_float && !supports_int16(backend_id))) {
/* don't treat this as a test failure. */ /* don't treat this as a test failure. */
return CUBEB_OK; return CUBEB_OK;
} }
@ -201,7 +183,8 @@ int run_panning_volume_test(int is_float)
return r; return r;
} }
CubebStreamCleaner cleanup_stream_at_exit(stream); std::unique_ptr<cubeb_stream, decltype(&cubeb_stream_destroy)>
cleanup_stream_at_exit(stream, cubeb_stream_destroy);
fprintf(stderr, "Testing: volume\n"); fprintf(stderr, "Testing: volume\n");
for(int i=0;i <= 4; ++i) for(int i=0;i <= 4; ++i)

View File

@ -11,6 +11,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <memory>
#include "cubeb/cubeb.h" #include "cubeb/cubeb.h"
static void static void
@ -110,10 +111,10 @@ TEST(cubeb, enumerate_devices)
cubeb_device_collection * collection = NULL; cubeb_device_collection * collection = NULL;
r = cubeb_init(&ctx, "Cubeb audio test", NULL); r = cubeb_init(&ctx, "Cubeb audio test", NULL);
if (r != CUBEB_OK) { ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library";
fprintf(stderr, "Error initializing cubeb library\n");
ASSERT_EQ(r, CUBEB_OK); std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
} cleanup_cubeb_at_exit(ctx, cubeb_destroy);
fprintf(stdout, "Enumerating input devices for backend %s\n", fprintf(stdout, "Enumerating input devices for backend %s\n",
cubeb_get_backend_id(ctx)); cubeb_get_backend_id(ctx));
@ -123,12 +124,8 @@ TEST(cubeb, enumerate_devices)
fprintf(stderr, "Device enumeration not supported" fprintf(stderr, "Device enumeration not supported"
" for this backend, skipping this test.\n"); " for this backend, skipping this test.\n");
r = CUBEB_OK; r = CUBEB_OK;
goto cleanup;
}
if (r != CUBEB_OK) {
fprintf(stderr, "Error enumerating devices %d\n", r);
goto cleanup;
} }
ASSERT_EQ(r, CUBEB_OK) << "Error enumerating devices " << r;
fprintf(stdout, "Found %u input devices\n", collection->count); fprintf(stdout, "Found %u input devices\n", collection->count);
print_device_collection(collection, stdout); print_device_collection(collection, stdout);
@ -138,17 +135,9 @@ TEST(cubeb, enumerate_devices)
cubeb_get_backend_id(ctx)); cubeb_get_backend_id(ctx));
r = cubeb_enumerate_devices(ctx, CUBEB_DEVICE_TYPE_OUTPUT, &collection); r = cubeb_enumerate_devices(ctx, CUBEB_DEVICE_TYPE_OUTPUT, &collection);
if (r != CUBEB_OK) { ASSERT_EQ(r, CUBEB_OK) << "Error enumerating devices " << r;
fprintf(stderr, "Error enumerating devices %d\n", r);
goto cleanup;
}
fprintf(stdout, "Found %u output devices\n", collection->count); fprintf(stdout, "Found %u output devices\n", collection->count);
print_device_collection(collection, stdout); print_device_collection(collection, stdout);
cubeb_device_collection_destroy(collection); cubeb_device_collection_destroy(collection);
cleanup:
cubeb_destroy(ctx);
ASSERT_EQ(r, CUBEB_OK);
} }

View File

@ -14,6 +14,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <memory>
#include "cubeb/cubeb.h" #include "cubeb/cubeb.h"
#include "common.h" #include "common.h"
@ -60,13 +61,13 @@ void state_cb_duplex(cubeb_stream * stream, void * /*user*/, cubeb_state state)
switch (state) { switch (state) {
case CUBEB_STATE_STARTED: case CUBEB_STATE_STARTED:
printf("stream started\n"); break; fprintf(stderr, "stream started\n"); break;
case CUBEB_STATE_STOPPED: case CUBEB_STATE_STOPPED:
printf("stream stopped\n"); break; fprintf(stderr, "stream stopped\n"); break;
case CUBEB_STATE_DRAINED: case CUBEB_STATE_DRAINED:
printf("stream drained\n"); break; fprintf(stderr, "stream drained\n"); break;
default: default:
printf("unknown stream state %d\n", state); fprintf(stderr, "unknown stream state %d\n", state);
} }
return; return;
@ -83,10 +84,10 @@ TEST(cubeb, duplex)
uint32_t latency_frames = 0; uint32_t latency_frames = 0;
r = cubeb_init(&ctx, "Cubeb duplex example", NULL); r = cubeb_init(&ctx, "Cubeb duplex example", NULL);
if (r != CUBEB_OK) { ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library";
fprintf(stderr, "Error initializing cubeb library\n");
ASSERT_EQ(r, CUBEB_OK); std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
} cleanup_cubeb_at_exit(ctx, cubeb_destroy);
/* This test needs an available input device, skip it if this host does not /* This test needs an available input device, skip it if this host does not
* have one. */ * have one. */
@ -105,26 +106,19 @@ TEST(cubeb, duplex)
output_params.layout = CUBEB_LAYOUT_STEREO; output_params.layout = CUBEB_LAYOUT_STEREO;
r = cubeb_get_min_latency(ctx, output_params, &latency_frames); r = cubeb_get_min_latency(ctx, output_params, &latency_frames);
ASSERT_EQ(r, CUBEB_OK) << "Could not get minimal latency";
if (r != CUBEB_OK) {
fprintf(stderr, "Could not get minimal latency\n");
ASSERT_EQ(r, CUBEB_OK);
}
r = cubeb_stream_init(ctx, &stream, "Cubeb duplex", r = cubeb_stream_init(ctx, &stream, "Cubeb duplex",
NULL, &input_params, NULL, &output_params, NULL, &input_params, NULL, &output_params,
latency_frames, data_cb_duplex, state_cb_duplex, &stream_state); latency_frames, data_cb_duplex, state_cb_duplex, &stream_state);
if (r != CUBEB_OK) { ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb stream";
fprintf(stderr, "Error initializing cubeb stream\n");
ASSERT_EQ(r, CUBEB_OK); std::unique_ptr<cubeb_stream, decltype(&cubeb_stream_destroy)>
} cleanup_stream_at_exit(stream, cubeb_stream_destroy);
cubeb_stream_start(stream); cubeb_stream_start(stream);
delay(500); delay(500);
cubeb_stream_stop(stream); cubeb_stream_stop(stream);
cubeb_stream_destroy(stream);
cubeb_destroy(ctx);
ASSERT_TRUE(stream_state.seen_audio); ASSERT_TRUE(stream_state.seen_audio);
} }

View File

@ -1,5 +1,6 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include <stdlib.h> #include <stdlib.h>
#include <memory>
#include "cubeb/cubeb.h" #include "cubeb/cubeb.h"
TEST(cubeb, latency) TEST(cubeb, latency)
@ -14,6 +15,9 @@ TEST(cubeb, latency)
r = cubeb_init(&ctx, "Cubeb audio test", NULL); r = cubeb_init(&ctx, "Cubeb audio test", NULL);
ASSERT_EQ(r, CUBEB_OK); ASSERT_EQ(r, CUBEB_OK);
std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
cleanup_cubeb_at_exit(ctx, cubeb_destroy);
r = cubeb_get_max_channel_count(ctx, &max_channels); r = cubeb_get_max_channel_count(ctx, &max_channels);
ASSERT_TRUE(r == CUBEB_OK || r == CUBEB_ERROR_NOT_SUPPORTED); ASSERT_TRUE(r == CUBEB_OK || r == CUBEB_ERROR_NOT_SUPPORTED);
if (r == CUBEB_OK) { if (r == CUBEB_OK) {
@ -44,6 +48,4 @@ TEST(cubeb, latency)
if (r == CUBEB_OK) { if (r == CUBEB_OK) {
ASSERT_GT(latency_frames, 0u); ASSERT_GT(latency_frames, 0u);
} }
cubeb_destroy(ctx);
} }

View File

@ -153,7 +153,7 @@ downmix_test(float const * data, cubeb_channel_layout in_layout, cubeb_channel_l
out_layout >= CUBEB_LAYOUT_MONO && out_layout <= CUBEB_LAYOUT_2F2_LFE) { out_layout >= CUBEB_LAYOUT_MONO && out_layout <= CUBEB_LAYOUT_2F2_LFE) {
auto & downmix_results = DOWNMIX_3F2_RESULTS[in_layout - CUBEB_LAYOUT_3F2][out_layout - CUBEB_LAYOUT_MONO]; auto & downmix_results = DOWNMIX_3F2_RESULTS[in_layout - CUBEB_LAYOUT_3F2][out_layout - CUBEB_LAYOUT_MONO];
fprintf(stderr, "[3f2] Expect: %lf, Get: %lf\n", downmix_results[index], out[index]); fprintf(stderr, "[3f2] Expect: %lf, Get: %lf\n", downmix_results[index], out[index]);
ASSERT_EQ(out[index], downmix_results[index]); ASSERT_EQ(downmix_results[index], out[index]);
continue; continue;
} }
@ -161,21 +161,21 @@ downmix_test(float const * data, cubeb_channel_layout in_layout, cubeb_channel_l
if (out_layout_mask & in_layout_mask) { if (out_layout_mask & in_layout_mask) {
uint32_t mask = 1 << CHANNEL_INDEX_TO_ORDER[out_layout][index]; uint32_t mask = 1 << CHANNEL_INDEX_TO_ORDER[out_layout][index];
fprintf(stderr, "[map channels] Expect: %lf, Get: %lf\n", (mask & in_layout_mask) ? audio_inputs[out_layout].data[index] : 0, out[index]); fprintf(stderr, "[map channels] Expect: %lf, Get: %lf\n", (mask & in_layout_mask) ? audio_inputs[out_layout].data[index] : 0, out[index]);
ASSERT_EQ(out[index], (mask & in_layout_mask) ? audio_inputs[out_layout].data[index] : 0); ASSERT_EQ((mask & in_layout_mask) ? audio_inputs[out_layout].data[index] : 0, out[index]);
continue; continue;
} }
// downmix_fallback // downmix_fallback
fprintf(stderr, "[fallback] Expect: %lf, Get: %lf\n", audio_inputs[in_layout].data[index], out[index]); fprintf(stderr, "[fallback] Expect: %lf, Get: %lf\n", audio_inputs[in_layout].data[index], out[index]);
ASSERT_EQ(out[index], audio_inputs[in_layout].data[index]); ASSERT_EQ(audio_inputs[in_layout].data[index], out[index]);
} }
} }
TEST(cubeb, run_mixing_test) TEST(cubeb, mixer)
{ {
for (unsigned int i = 0 ; i < ARRAY_LENGTH(audio_inputs) ; ++i) { for (auto audio_input : audio_inputs) {
for (unsigned int j = 0 ; j < ARRAY_LENGTH(layout_infos) ; ++j) { for (auto audio_output : layout_infos) {
downmix_test(audio_inputs[i].data, audio_inputs[i].layout, layout_infos[j].layout); downmix_test(audio_input.data, audio_input.layout, audio_output.layout);
} }
} }
} }

View File

@ -12,16 +12,13 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <memory>
#include <atomic> #include <atomic>
#include "cubeb/cubeb.h" #include "cubeb/cubeb.h"
#include "common.h" #include "common.h"
#define SAMPLE_FREQUENCY 48000 #define SAMPLE_FREQUENCY 48000
#if (defined(_WIN32) || defined(__WIN32__))
#define STREAM_FORMAT CUBEB_SAMPLE_FLOAT32LE
#else
#define STREAM_FORMAT CUBEB_SAMPLE_S16LE #define STREAM_FORMAT CUBEB_SAMPLE_S16LE
#endif
std::atomic<bool> load_callback{ false }; std::atomic<bool> load_callback{ false };
@ -64,6 +61,9 @@ TEST(cubeb, overload_callback)
r = cubeb_init(&ctx, "Cubeb callback overload", NULL); r = cubeb_init(&ctx, "Cubeb callback overload", NULL);
ASSERT_EQ(r, CUBEB_OK); ASSERT_EQ(r, CUBEB_OK);
std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
cleanup_cubeb_at_exit(ctx, cubeb_destroy);
output_params.format = STREAM_FORMAT; output_params.format = STREAM_FORMAT;
output_params.rate = 48000; output_params.rate = 48000;
output_params.channels = 2; output_params.channels = 2;
@ -77,13 +77,13 @@ TEST(cubeb, overload_callback)
latency_frames, data_cb, state_cb, NULL); latency_frames, data_cb, state_cb, NULL);
ASSERT_EQ(r, CUBEB_OK); ASSERT_EQ(r, CUBEB_OK);
std::unique_ptr<cubeb_stream, decltype(&cubeb_stream_destroy)>
cleanup_stream_at_exit(stream, cubeb_stream_destroy);
cubeb_stream_start(stream); cubeb_stream_start(stream);
delay(500); delay(500);
// This causes the callback to sleep for a large number of seconds. // This causes the callback to sleep for a large number of seconds.
load_callback = true; load_callback = true;
delay(500); delay(500);
cubeb_stream_stop(stream); cubeb_stream_stop(stream);
cubeb_stream_destroy(stream);
cubeb_destroy(ctx);
} }

View File

@ -13,6 +13,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <memory>
#include "cubeb/cubeb.h" #include "cubeb/cubeb.h"
#include "common.h" #include "common.h"
@ -53,13 +54,13 @@ void state_cb_record(cubeb_stream * stream, void * /*user*/, cubeb_state state)
switch (state) { switch (state) {
case CUBEB_STATE_STARTED: case CUBEB_STATE_STARTED:
printf("stream started\n"); break; fprintf(stderr, "stream started\n"); break;
case CUBEB_STATE_STOPPED: case CUBEB_STATE_STOPPED:
printf("stream stopped\n"); break; fprintf(stderr, "stream stopped\n"); break;
case CUBEB_STATE_DRAINED: case CUBEB_STATE_DRAINED:
printf("stream drained\n"); break; fprintf(stderr, "stream drained\n"); break;
default: default:
printf("unknown stream state %d\n", state); fprintf(stderr, "unknown stream state %d\n", state);
} }
return; return;
@ -68,7 +69,7 @@ void state_cb_record(cubeb_stream * stream, void * /*user*/, cubeb_state state)
TEST(cubeb, record) TEST(cubeb, record)
{ {
if (cubeb_set_log_callback(CUBEB_LOG_DISABLED, nullptr /*print_log*/) != CUBEB_OK) { if (cubeb_set_log_callback(CUBEB_LOG_DISABLED, nullptr /*print_log*/) != CUBEB_OK) {
printf("Set log callback failed\n"); fprintf(stderr, "Set log callback failed\n");
} }
cubeb *ctx; cubeb *ctx;
cubeb_stream *stream; cubeb_stream *stream;
@ -77,10 +78,10 @@ TEST(cubeb, record)
user_state_record stream_state = { false }; user_state_record stream_state = { false };
r = cubeb_init(&ctx, "Cubeb record example", NULL); r = cubeb_init(&ctx, "Cubeb record example", NULL);
if (r != CUBEB_OK) { ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library";
fprintf(stderr, "Error initializing cubeb library\n");
ASSERT_EQ(r, CUBEB_OK); std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
} cleanup_cubeb_at_exit(ctx, cubeb_destroy);
/* This test needs an available input device, skip it if this host does not /* This test needs an available input device, skip it if this host does not
* have one. */ * have one. */
@ -95,21 +96,18 @@ TEST(cubeb, record)
r = cubeb_stream_init(ctx, &stream, "Cubeb record (mono)", NULL, &params, NULL, nullptr, r = cubeb_stream_init(ctx, &stream, "Cubeb record (mono)", NULL, &params, NULL, nullptr,
4096, data_cb_record, state_cb_record, &stream_state); 4096, data_cb_record, state_cb_record, &stream_state);
if (r != CUBEB_OK) { ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb stream";
fprintf(stderr, "Error initializing cubeb stream\n");
ASSERT_EQ(r, CUBEB_OK); std::unique_ptr<cubeb_stream, decltype(&cubeb_stream_destroy)>
} cleanup_stream_at_exit(stream, cubeb_stream_destroy);
cubeb_stream_start(stream); cubeb_stream_start(stream);
delay(500); delay(500);
cubeb_stream_stop(stream); cubeb_stream_stop(stream);
cubeb_stream_destroy(stream);
cubeb_destroy(ctx);
#ifdef __linux__ #ifdef __linux__
// user callback does not arrive in Linux, silence the error // user callback does not arrive in Linux, silence the error
printf("Check is disabled in Linux\n"); fprintf(stderr, "Check is disabled in Linux\n");
#else #else
ASSERT_TRUE(stream_state.seen_audio); ASSERT_TRUE(stream_state.seen_audio);
#endif #endif

Some files were not shown because too many files have changed in this diff Show More