mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 09:54:42 +00:00
Merge inbound to m-c a=merge
MozReview-Commit-ID: DQDuEiYLWCO
This commit is contained in:
commit
5ce5528fb1
@ -1613,6 +1613,9 @@ pref("browser.formautofill.experimental", false);
|
||||
pref("browser.formautofill.enabled", false);
|
||||
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.
|
||||
#ifdef NIGHTLY_BUILD
|
||||
pref("urlclassifier.malwareTable", "goog-malware-shavar,goog-unwanted-shavar,goog-malware-proto,goog-unwanted-proto,test-malware-simple,test-unwanted-simple");
|
||||
|
@ -8219,8 +8219,8 @@ var MousePosTracker = {
|
||||
|
||||
handleEvent(event) {
|
||||
var fullZoom = this._windowUtils.fullZoom;
|
||||
this._x = event.clientX / fullZoom;
|
||||
this._y = event.clientY / fullZoom;
|
||||
this._x = event.screenX / fullZoom - window.mozInnerScreenX;
|
||||
this._y = event.screenY / fullZoom - window.mozInnerScreenY;
|
||||
|
||||
this._listeners.forEach(function(listener) {
|
||||
try {
|
||||
|
@ -2034,7 +2034,8 @@
|
||||
"addProgressListener", "removeProgressListener", "audioPlaybackStarted",
|
||||
"audioPlaybackStopped", "adjustPriority", "pauseMedia", "stopMedia",
|
||||
"blockMedia", "resumeMedia", "mute", "unmute", "blockedPopups", "lastURI",
|
||||
"purgeSessionHistory", "stopScroll", "startScroll"
|
||||
"purgeSessionHistory", "stopScroll", "startScroll",
|
||||
"userTypedValue", "userTypedClear"
|
||||
]</field>
|
||||
|
||||
<method name="_createLazyBrowser">
|
||||
@ -2052,11 +2053,51 @@
|
||||
switch (name) {
|
||||
case "permitUnload":
|
||||
getter = () => {
|
||||
return function() {
|
||||
return () => {
|
||||
return { permitUnload: true, timedOut: false };
|
||||
};
|
||||
};
|
||||
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:
|
||||
getter = () => {
|
||||
this._insertBrowser(aTab);
|
||||
@ -2084,9 +2125,8 @@
|
||||
<![CDATA[
|
||||
"use strict";
|
||||
|
||||
// If browser is already inserted, or aTab doesn't have a
|
||||
// browser, don't do anything.
|
||||
if (aTab.linkedPanel || !aTab.linkedBrowser) {
|
||||
// If browser is already inserted don't do anything.
|
||||
if (aTab.linkedPanel) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4876,7 +4916,8 @@
|
||||
tab.linkedBrowser &&
|
||||
tab.linkedBrowser.isRemoteBrowser) {
|
||||
label += " - e10s";
|
||||
if (Services.appinfo.maxWebProcessCount > 1) {
|
||||
if (tab.linkedBrowser.frameLoader &&
|
||||
Services.appinfo.maxWebProcessCount > 1) {
|
||||
label += " (" + tab.linkedBrowser.frameLoader.tabParent.osPid + ")";
|
||||
}
|
||||
}
|
||||
@ -7245,6 +7286,11 @@
|
||||
<parameter name="aMuteReason"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
// Do not attempt to toggle mute state if browser is lazy.
|
||||
if (!this.linkedPanel) {
|
||||
return;
|
||||
}
|
||||
|
||||
let tabContainer = this.parentNode;
|
||||
let browser = this.linkedBrowser;
|
||||
let modifiedAttrs = [];
|
||||
|
@ -334,6 +334,10 @@ this.SessionStore = {
|
||||
SessionStoreInternal.deleteTabValue(aTab, aKey);
|
||||
},
|
||||
|
||||
getLazyTabValue(aTab, aKey) {
|
||||
return SessionStoreInternal.getLazyTabValue(aTab, aKey);
|
||||
},
|
||||
|
||||
getGlobalValue: function ss_getGlobalValue(aKey) {
|
||||
return SessionStoreInternal.getGlobalValue(aKey);
|
||||
},
|
||||
@ -1871,6 +1875,15 @@ var SessionStoreInternal = {
|
||||
if (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) {
|
||||
return this._globalState.get(aKey);
|
||||
},
|
||||
@ -3272,6 +3298,9 @@ var SessionStoreInternal = {
|
||||
|
||||
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++) {
|
||||
// When trying to restore into existing tab, we also take the userContextId
|
||||
// into account if present.
|
||||
@ -3280,7 +3309,8 @@ var SessionStoreInternal = {
|
||||
(tabbrowser.tabs[t].getAttribute("usercontextid") == (userContextId || ""));
|
||||
let tab = reuseExisting ? this._maybeUpdateBrowserRemoteness(tabbrowser.tabs[t])
|
||||
: tabbrowser.addTab("about:blank",
|
||||
{ skipAnimation: true,
|
||||
{ createLazyBrowser,
|
||||
skipAnimation: true,
|
||||
userContextId,
|
||||
skipBackgroundNotify: true });
|
||||
|
||||
@ -3595,9 +3625,7 @@ var SessionStoreInternal = {
|
||||
tabbrowser.selectedBrowser == browser ||
|
||||
loadArguments;
|
||||
|
||||
if (!willRestoreImmediately && !forceOnDemand) {
|
||||
TabRestoreQueue.add(tab);
|
||||
}
|
||||
let isBrowserInserted = browser.isConnected;
|
||||
|
||||
// Increase the busy state counter before modifying the tab.
|
||||
this._setWindowStateBusy(window);
|
||||
@ -3665,14 +3693,6 @@ var SessionStoreInternal = {
|
||||
// Save the index in case we updated it above.
|
||||
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");
|
||||
tab.setAttribute("pending", "true");
|
||||
|
||||
@ -3700,26 +3720,57 @@ var SessionStoreInternal = {
|
||||
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.
|
||||
if ("attributes" in tabData) {
|
||||
TabAttributes.set(tab, tabData.attributes);
|
||||
}
|
||||
|
||||
// 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) {
|
||||
this.restoreNextTab();
|
||||
if (isBrowserInserted) {
|
||||
// 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);
|
||||
|
||||
// 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.
|
||||
this._setWindowStateReady(window);
|
||||
},
|
||||
|
@ -32,11 +32,27 @@ function test() {
|
||||
"We still know that no load is ongoing");
|
||||
is(gURLBar.value, "example.com",
|
||||
"Address bar's value correctly restored");
|
||||
// Change tabs to make sure address bar value gets updated
|
||||
gBrowser.selectedTab = gBrowser.tabContainer.getItemAtIndex(0);
|
||||
is(gURLBar.value, "about:mozilla",
|
||||
"Address bar's value correctly updated");
|
||||
runNextTest();
|
||||
|
||||
// Change tabs to make sure address bar value gets updated. If tab is
|
||||
// lazy, wait for SSTabRestored to ensure address bar has time to update.
|
||||
let tabToSelect = gBrowser.tabContainer.getItemAtIndex(0);
|
||||
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");
|
||||
is(browser.userTypedValue, "example.org",
|
||||
"userTypedValue was correctly restored");
|
||||
ok(!browser.didStartLoadSinceLastUserTyping(),
|
||||
"We still know that no load is ongoing");
|
||||
// didStartLoadSinceLastUserTyping does not exist on lazy tabs.
|
||||
if (browser.didStartLoadSinceLastUserTyping) {
|
||||
ok(!browser.didStartLoadSinceLastUserTyping(),
|
||||
"We still know that no load is ongoing");
|
||||
}
|
||||
is(gURLBar.value, "about:mozilla",
|
||||
"Address bar's value correctly restored");
|
||||
// Change tabs to make sure address bar value gets updated
|
||||
gBrowser.selectedTab = gBrowser.tabContainer.getItemAtIndex(1);
|
||||
is(gURLBar.value, "example.org",
|
||||
"Address bar's value correctly updated");
|
||||
runNextTest();
|
||||
|
||||
// Change tabs to make sure address bar value gets updated. If tab is
|
||||
// lazy, wait for SSTabRestored to ensure address bar has time to update.
|
||||
let tabToSelect = gBrowser.tabContainer.getItemAtIndex(1);
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,9 @@
|
||||
var stateBackup = ss.getBrowserState();
|
||||
|
||||
function cleanup() {
|
||||
// Reset the pref
|
||||
try {
|
||||
Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand");
|
||||
} catch (e) {}
|
||||
// Reset the prefs
|
||||
Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand");
|
||||
Services.prefs.clearUserPref("browser.sessionstore.restore_tabs_lazily");
|
||||
ss.setBrowserState(stateBackup);
|
||||
executeSoon(finish);
|
||||
}
|
||||
@ -20,6 +19,8 @@ function test() {
|
||||
// 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.
|
||||
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: [
|
||||
{ entries: [{ url: "http://example.org/#1", triggeringPrincipal_base64 }] },
|
||||
|
@ -9,6 +9,8 @@ add_task(function* () {
|
||||
// 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.
|
||||
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: [
|
||||
{ entries: [{ url: "http://example.org#1", triggeringPrincipal_base64 }], extData: { "uniq": r() } },
|
||||
@ -92,5 +94,7 @@ add_task(function* () {
|
||||
yield progressCallback();
|
||||
|
||||
// Cleanup.
|
||||
Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand");
|
||||
Services.prefs.clearUserPref("browser.sessionstore.restore_tabs_lazily");
|
||||
yield promiseBrowserState(stateBackup);
|
||||
});
|
||||
|
@ -97,22 +97,26 @@ function test_setTabState() {
|
||||
ss.setTabValue(tab, "baz", "qux");
|
||||
}
|
||||
|
||||
function onSSTabRestored(aEvent) {
|
||||
is(busyEventCount, 1);
|
||||
is(readyEventCount, 1);
|
||||
is(ss.getTabValue(tab, "baz"), "qux");
|
||||
is(tab.linkedBrowser.currentURI.spec, "http://example.org/");
|
||||
function onSSTabRestoring(aEvent) {
|
||||
if (aEvent.target == tab) {
|
||||
is(busyEventCount, 1);
|
||||
is(readyEventCount, 1);
|
||||
is(ss.getTabValue(tab, "baz"), "qux");
|
||||
is(tab.linkedBrowser.currentURI.spec, "http://example.org/");
|
||||
|
||||
window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy);
|
||||
window.removeEventListener("SSWindowStateReady", onSSWindowStateReady);
|
||||
gBrowser.tabContainer.removeEventListener("SSTabRestored", onSSTabRestored);
|
||||
window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy);
|
||||
window.removeEventListener("SSWindowStateReady", onSSWindowStateReady);
|
||||
gBrowser.tabContainer.removeEventListener("SSTabRestoring", onSSTabRestoring);
|
||||
|
||||
runNextTest();
|
||||
runNextTest();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("SSWindowStateBusy", onSSWindowStateBusy);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -137,23 +141,26 @@ function test_duplicateTab() {
|
||||
ss.setTabValue(newTab, "baz", "qux");
|
||||
}
|
||||
|
||||
function onSSTabRestored(aEvent) {
|
||||
is(busyEventCount, 1);
|
||||
is(readyEventCount, 1);
|
||||
is(ss.getTabValue(newTab, "baz"), "qux");
|
||||
is(newTab.linkedBrowser.currentURI.spec, "about:rights");
|
||||
function onSSTabRestoring(aEvent) {
|
||||
if (aEvent.target == newTab) {
|
||||
is(busyEventCount, 1);
|
||||
is(readyEventCount, 1);
|
||||
is(ss.getTabValue(newTab, "baz"), "qux");
|
||||
is(newTab.linkedBrowser.currentURI.spec, "about:rights");
|
||||
|
||||
window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy);
|
||||
window.removeEventListener("SSWindowStateReady", onSSWindowStateReady);
|
||||
gBrowser.tabContainer.removeEventListener("SSTabRestored", onSSTabRestored);
|
||||
window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy);
|
||||
window.removeEventListener("SSWindowStateReady", onSSWindowStateReady);
|
||||
gBrowser.tabContainer.removeEventListener("SSTabRestoring", onSSTabRestoring);
|
||||
|
||||
runNextTest();
|
||||
runNextTest();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("SSWindowStateBusy", onSSWindowStateBusy);
|
||||
window.addEventListener("SSWindowStateReady", onSSWindowStateReady);
|
||||
gBrowser.tabContainer.addEventListener("SSTabRestored", onSSTabRestored);
|
||||
gBrowser.tabContainer.addEventListener("SSTabRestoring", onSSTabRestoring);
|
||||
|
||||
gBrowser._insertBrowser(tab);
|
||||
newTab = ss.duplicateTab(window, tab);
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,6 @@ add_task(function* test_scroll_background_tabs() {
|
||||
|
||||
// The second tab should be the one we loaded URL at still
|
||||
tab = newWin.gBrowser.tabs[1];
|
||||
yield promiseTabRestoring(tab);
|
||||
|
||||
ok(tab.hasAttribute("pending"), "Tab should be pending");
|
||||
browser = tab.linkedBrowser;
|
||||
|
@ -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
|
||||
tab = newWin.gBrowser.tabs[1];
|
||||
yield promiseTabRestoring(tab);
|
||||
|
||||
ok(tab.hasAttribute("pending"), "Tab should be pending");
|
||||
browser = tab.linkedBrowser;
|
||||
|
@ -94,18 +94,24 @@ function waitForBrowserState(aState, aSetStateCallback) {
|
||||
let windowObserving = false;
|
||||
let restoreHiddenTabs = Services.prefs.getBoolPref(
|
||||
"browser.sessionstore.restore_hidden_tabs");
|
||||
let restoreTabsLazily = Services.prefs.getBoolPref(
|
||||
"browser.sessionstore.restore_tabs_lazily");
|
||||
|
||||
aState.windows.forEach(function(winState) {
|
||||
winState.tabs.forEach(function(tabState) {
|
||||
if (restoreHiddenTabs || !tabState.hidden)
|
||||
if (!restoreTabsLazily && (restoreHiddenTabs || !tabState.hidden))
|
||||
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.
|
||||
if (!expectedTabsRestored)
|
||||
// Otherwise if lazy tab restore there will only be one tab restored per window.
|
||||
if (!expectedTabsRestored) {
|
||||
expectedTabsRestored = 1;
|
||||
} else if (restoreTabsLazily) {
|
||||
expectedTabsRestored = aState.windows.length;
|
||||
}
|
||||
|
||||
function onSSTabRestored(aEvent) {
|
||||
if (++tabsRestored == expectedTabsRestored) {
|
||||
@ -376,11 +382,11 @@ var gProgressListener = {
|
||||
for (let win of BrowserWindowIterator()) {
|
||||
for (let i = 0; i < win.gBrowser.tabs.length; i++) {
|
||||
let browser = win.gBrowser.tabs[i].linkedBrowser;
|
||||
if (!browser.__SS_restoreState)
|
||||
if (browser.isConnected && !browser.__SS_restoreState)
|
||||
wasRestored++;
|
||||
else if (browser.__SS_restoreState == TAB_STATE_RESTORING)
|
||||
isRestoring++;
|
||||
else if (browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE)
|
||||
else if (browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE || !browser.isConnected)
|
||||
needsRestore++;
|
||||
}
|
||||
}
|
||||
|
@ -92,12 +92,22 @@ var BrowserHelper = {
|
||||
},
|
||||
|
||||
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);
|
||||
_priorityBackup.set(aBrowser.permanentKey,
|
||||
_priorityBackup.get(aBrowser.permanentKey) + PRIORITY_DELTA);
|
||||
},
|
||||
|
||||
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);
|
||||
_priorityBackup.set(aBrowser.permanentKey,
|
||||
_priorityBackup.get(aBrowser.permanentKey) - PRIORITY_DELTA);
|
||||
|
@ -34,6 +34,7 @@ run-if = crashreporter
|
||||
[browser_UsageTelemetry.js]
|
||||
[browser_UsageTelemetry_private_and_restore.js]
|
||||
[browser_UsageTelemetry_urlbar.js]
|
||||
skip-if = (os == 'linux' && bits == 32 && debug) # bug 1356758
|
||||
support-files =
|
||||
usageTelemetrySearchSuggestions.sjs
|
||||
usageTelemetrySearchSuggestions.xml
|
||||
|
@ -7,7 +7,7 @@ console.assert(false, "Failing mozscreenshots assertion");
|
||||
|
||||
console.group("Grouped Message");
|
||||
console.log("group message 1");
|
||||
console.groupEnd("Grouped Message");
|
||||
console.groupEnd();
|
||||
|
||||
console.count("counter");
|
||||
console.count("counter");
|
||||
|
@ -504,6 +504,13 @@ set_config('HAVE_64BIT_BUILD', have_64_bit)
|
||||
set_define('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
|
||||
@depends(host)
|
||||
|
4
config/external/nspr/pr/moz.build
vendored
4
config/external/nspr/pr/moz.build
vendored
@ -40,6 +40,10 @@ elif CONFIG['OS_TARGET'] in ('FreeBSD', 'OpenBSD', 'NetBSD'):
|
||||
SOURCES += ['/nsprpub/pr/src/md/unix/%s.c' % CONFIG['OS_TARGET'].lower()]
|
||||
elif CONFIG['OS_TARGET'] == 'Darwin':
|
||||
OS_LIBS += ['-framework CoreServices']
|
||||
if CONFIG['HOST_MAJOR_VERSION'] == '15':
|
||||
DEFINES.update(
|
||||
HAS_CONNECTX=True,
|
||||
)
|
||||
DEFINES.update(
|
||||
DARWIN=True,
|
||||
HAVE_BSD_FLOCK=True,
|
||||
|
@ -95,7 +95,7 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
|
||||
this._preferredSourceURL = null;
|
||||
this._unnamedSourceIndex = 0;
|
||||
this.emptyText = L10N.getStr("noSourcesText");
|
||||
this._blackBoxCheckboxTooltip = L10N.getStr("blackBoxCheckboxTooltip");
|
||||
this._blackBoxCheckboxTooltip = L10N.getStr("blackboxCheckboxTooltip2");
|
||||
|
||||
this._commandset = document.getElementById("debuggerCommands");
|
||||
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
@ -7,6 +7,6 @@ DevToolsModules(
|
||||
'debugger.css',
|
||||
'debugger.js',
|
||||
'panel.js',
|
||||
'parser-worker.js',
|
||||
'pretty-print-worker.js',
|
||||
'source-map-worker.js'
|
||||
)
|
||||
|
@ -4,7 +4,7 @@
|
||||
"use strict";
|
||||
|
||||
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";
|
||||
var L10N = new LocalizationHelper(DBG_STRINGS_URI);
|
||||
@ -16,38 +16,46 @@ function DebuggerPanel(iframeWindow, toolbox) {
|
||||
}
|
||||
|
||||
DebuggerPanel.prototype = {
|
||||
open: Task.async(function* () {
|
||||
open: async function() {
|
||||
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,
|
||||
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;
|
||||
return this;
|
||||
}),
|
||||
|
||||
_store: function () {
|
||||
return this.panelWin.Debugger.store;
|
||||
},
|
||||
|
||||
_getState: function () {
|
||||
return this._store().getState();
|
||||
getVarsForTests() {
|
||||
return {
|
||||
store: this._store,
|
||||
selectors: this._selectors,
|
||||
actions: this._actions,
|
||||
client: this._client
|
||||
};
|
||||
},
|
||||
|
||||
_actions: function () {
|
||||
return this.panelWin.Debugger.actions;
|
||||
_getState: function() {
|
||||
return this._store.getState();
|
||||
},
|
||||
|
||||
_selectors: function () {
|
||||
return this.panelWin.Debugger.selectors;
|
||||
},
|
||||
|
||||
getFrames: function () {
|
||||
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.
|
||||
if (!frames) {
|
||||
@ -58,7 +66,7 @@ DebuggerPanel.prototype = {
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
frames.forEach(frame => {
|
||||
@ -68,7 +76,15 @@ DebuggerPanel.prototype = {
|
||||
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.emit("destroyed");
|
||||
}
|
||||
|
29381
devtools/client/debugger/new/parser-worker.js
Normal file
29381
devtools/client/debugger/new/parser-worker.js
Normal file
File diff suppressed because one or more lines are too long
@ -55,7 +55,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
/***/ 0:
|
||||
/***/ 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:
|
||||
/***/ 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__));
|
||||
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 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
@ -42,6 +42,7 @@ support-files =
|
||||
[browser_dbg-breakpoints.js]
|
||||
[browser_dbg-breakpoints-cond.js]
|
||||
[browser_dbg-call-stack.js]
|
||||
[browser_dbg-expressions.js]
|
||||
[browser_dbg-scopes.js]
|
||||
[browser_dbg-chrome-create.js]
|
||||
[browser_dbg-chrome-debugging.js]
|
||||
|
@ -54,6 +54,6 @@ add_task(function* () {
|
||||
|
||||
button = toggleButton(dbg);
|
||||
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");
|
||||
});
|
||||
|
@ -18,7 +18,9 @@ add_task(function* () {
|
||||
// Wait for the source text to load and make sure we're in the right
|
||||
// place.
|
||||
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.
|
||||
yield selectSource(dbg, "long.js", 16);
|
||||
|
@ -50,5 +50,5 @@ add_task(function* () {
|
||||
invokeInTab("testModel");
|
||||
yield waitForPaused(dbg);
|
||||
assertPausedLocation(dbg, longSrc, 66);
|
||||
// ok(isElementVisible(dbg, "breakpoint"), "Breakpoint is visible");
|
||||
ok(isElementVisible(dbg, "breakpoint"), "Breakpoint is visible");
|
||||
});
|
||||
|
@ -1,12 +1,56 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const {
|
||||
setupTestRunner,
|
||||
expressions
|
||||
} = require("devtools/client/debugger/new/integration-tests");
|
||||
/**
|
||||
* tests the watch expressions component
|
||||
* 1. add watch expressions
|
||||
* 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*() {
|
||||
setupTestRunner(this);
|
||||
yield expressions(this);
|
||||
const dbg = yield initDebugger("doc-script-switching.html");
|
||||
|
||||
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);
|
||||
});
|
||||
|
@ -20,7 +20,6 @@ add_task(function* () {
|
||||
const dbg = yield initDebugger("doc-exceptions.html");
|
||||
|
||||
// test skipping an uncaught exception
|
||||
yield togglePauseOnExceptions(dbg, false, false);
|
||||
yield uncaughtException();
|
||||
ok(!isPaused(dbg));
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// Tests basic pretty-printing functionality.
|
||||
|
||||
add_task(function* () {
|
||||
add_task(function*() {
|
||||
const dbg = yield initDebugger("doc-minified.html");
|
||||
|
||||
yield selectSource(dbg, "math.min.js");
|
||||
|
@ -19,4 +19,13 @@ add_task(function* () {
|
||||
|
||||
is(getLabel(dbg, 1), "secondCall");
|
||||
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");
|
||||
});
|
||||
|
@ -4,7 +4,10 @@
|
||||
// Test that an error while loading a sourcemap does not break
|
||||
// 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 { selectors: { getSources }, getState } = dbg;
|
||||
|
||||
|
@ -4,7 +4,10 @@
|
||||
// Tests loading sourcemapped sources, setting breakpoints, and
|
||||
// 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 { selectors: { getBreakpoint, getBreakpoints }, getState } = dbg;
|
||||
|
||||
@ -13,21 +16,27 @@ add_task(function* () {
|
||||
const entrySrc = findSource(dbg, "entry.js");
|
||||
|
||||
yield selectSource(dbg, entrySrc);
|
||||
ok(dbg.win.cm.getValue().includes("window.keepMeAlive"),
|
||||
"Original source text loaded correctly");
|
||||
ok(
|
||||
dbg.win.cm.getValue().includes("window.keepMeAlive"),
|
||||
"Original source text loaded correctly"
|
||||
);
|
||||
|
||||
// Test that breakpoint sliding is not attempted. The breakpoint
|
||||
// should not move anywhere.
|
||||
yield addBreakpoint(dbg, entrySrc, 13);
|
||||
is(getBreakpoints(getState()).size, 1, "One breakpoint exists");
|
||||
ok(getBreakpoint(getState(), { sourceId: entrySrc.id, line: 13 }),
|
||||
"Breakpoint has correct line");
|
||||
ok(
|
||||
getBreakpoint(getState(), { sourceId: entrySrc.id, line: 13 }),
|
||||
"Breakpoint has correct line"
|
||||
);
|
||||
|
||||
// Test breaking on a breakpoint
|
||||
yield addBreakpoint(dbg, "entry.js", 15);
|
||||
is(getBreakpoints(getState()).size, 2, "Two breakpoints exist");
|
||||
ok(getBreakpoint(getState(), { sourceId: entrySrc.id, line: 15 }),
|
||||
"Breakpoint has correct line");
|
||||
ok(
|
||||
getBreakpoint(getState(), { sourceId: entrySrc.id, line: 15 }),
|
||||
"Breakpoint has correct line"
|
||||
);
|
||||
|
||||
invokeInTab("keepMeAlive");
|
||||
yield waitForPaused(dbg);
|
||||
|
@ -6,7 +6,10 @@
|
||||
|
||||
// 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 { selectors: { getBreakpoint, getBreakpoints }, getState } = dbg;
|
||||
|
||||
@ -20,8 +23,10 @@ add_task(function* () {
|
||||
// Test that breakpoint is not off by a line.
|
||||
yield addBreakpoint(dbg, mainSrc, 4);
|
||||
is(getBreakpoints(getState()).size, 1, "One breakpoint exists");
|
||||
ok(getBreakpoint(getState(), { sourceId: mainSrc.id, line: 4 }),
|
||||
"Breakpoint has correct line");
|
||||
ok(
|
||||
getBreakpoint(getState(), { sourceId: mainSrc.id, line: 4 }),
|
||||
"Breakpoint has correct line"
|
||||
);
|
||||
|
||||
invokeInTab("logMessage");
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
<body>
|
||||
<script>
|
||||
debugger;
|
||||
|
||||
// This inline script allows this HTML page to show up as a
|
||||
// source. It also needs to introduce a new global variable so
|
||||
// it's not immediately garbage collected.
|
||||
|
@ -33,13 +33,14 @@
|
||||
*/
|
||||
|
||||
// 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");
|
||||
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.clearUserPref("devtools.debugger.tabs")
|
||||
Services.prefs.clearUserPref("devtools.debugger.pending-selected-location")
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
|
||||
@ -76,9 +77,9 @@ function _afterDispatchDone(store, type) {
|
||||
type: "@@service/waitUntil",
|
||||
predicate: action => {
|
||||
if (action.type === type) {
|
||||
return action.status ?
|
||||
(action.status === "done" || action.status === "error") :
|
||||
true;
|
||||
return action.status
|
||||
? action.status === "done" || action.status === "error"
|
||||
: true;
|
||||
}
|
||||
},
|
||||
run: (dispatch, getState, action) => {
|
||||
@ -102,7 +103,7 @@ function _afterDispatchDone(store, type) {
|
||||
function waitForDispatch(dbg, type, eventRepeat = 1) {
|
||||
let count = 0;
|
||||
|
||||
return Task.spawn(function* () {
|
||||
return Task.spawn(function*() {
|
||||
info("Waiting for " + type + " to dispatch " + eventRepeat + " time(s)");
|
||||
while (count < eventRepeat) {
|
||||
yield _afterDispatchDone(dbg.store, type);
|
||||
@ -170,21 +171,23 @@ function waitForSources(dbg, ...sources) {
|
||||
|
||||
info("Waiting on sources: " + sources.join(", "));
|
||||
const { selectors: { getSources }, store } = dbg;
|
||||
return Promise.all(sources.map(url => {
|
||||
function sourceExists(state) {
|
||||
return getSources(state).some(s => {
|
||||
return s.get("url").includes(url);
|
||||
});
|
||||
}
|
||||
return Promise.all(
|
||||
sources.map(url => {
|
||||
function sourceExists(state) {
|
||||
return getSources(state).some(s => {
|
||||
return s.get("url").includes(url);
|
||||
});
|
||||
}
|
||||
|
||||
if (!sourceExists(store.getState())) {
|
||||
return waitForState(dbg, sourceExists);
|
||||
}
|
||||
}));
|
||||
if (!sourceExists(store.getState())) {
|
||||
return waitForState(dbg, sourceExists);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// Check the debug line
|
||||
ok(dbg.win.cm.lineInfo(line - 1).wrapClass.includes("debug-line"),
|
||||
"Line is highlighted as paused");
|
||||
ok(
|
||||
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
|
||||
const lineEl = findElement(dbg, "highlightLine");
|
||||
ok(lineEl, "Line is highlighted");
|
||||
// ok(isVisibleWithin(findElement(dbg, "codeMirror"), lineEl),
|
||||
// "Highlighted line is visible");
|
||||
ok(dbg.win.cm.lineInfo(line - 1).wrapClass.includes("highlight-line"),
|
||||
"Line is highlighted");
|
||||
ok(
|
||||
isVisibleWithin(findElement(dbg, "codeMirror"), lineEl),
|
||||
"Highlighted line is visible"
|
||||
);
|
||||
ok(
|
||||
dbg.win.cm.lineInfo(line - 1).wrapClass.includes("highlight-line"),
|
||||
"Line is highlighted"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -258,12 +267,11 @@ function isPaused(dbg) {
|
||||
* @static
|
||||
*/
|
||||
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
|
||||
// that the state is fully populated. The client may do some more
|
||||
// work (call other client methods) before populating the state.
|
||||
yield waitForThreadEvents(dbg, "paused"),
|
||||
yield waitForState(dbg, state => {
|
||||
yield waitForThreadEvents(dbg, "paused"), yield waitForState(dbg, state => {
|
||||
const pause = dbg.selectors.getPause(state);
|
||||
// Make sure we have the paused state.
|
||||
if (!pause) {
|
||||
@ -279,15 +287,16 @@ function waitForPaused(dbg) {
|
||||
}
|
||||
|
||||
function createDebuggerContext(toolbox) {
|
||||
const win = toolbox.getPanel("jsdebugger").panelWin;
|
||||
const store = win.Debugger.store;
|
||||
const panel = toolbox.getPanel("jsdebugger");
|
||||
const win = panel.panelWin;
|
||||
const { store, client, selectors, actions } = panel.getVarsForTests();
|
||||
|
||||
return {
|
||||
actions: win.Debugger.actions,
|
||||
selectors: win.Debugger.selectors,
|
||||
actions: actions,
|
||||
selectors: selectors,
|
||||
getState: store.getState,
|
||||
store: store,
|
||||
client: win.Debugger.client,
|
||||
client: client,
|
||||
toolbox: toolbox,
|
||||
win: win
|
||||
};
|
||||
@ -303,9 +312,13 @@ function createDebuggerContext(toolbox) {
|
||||
* @static
|
||||
*/
|
||||
function initDebugger(url, ...sources) {
|
||||
return Task.spawn(function* () {
|
||||
Services.prefs.clearUserPref("devtools.debugger.tabs")
|
||||
Services.prefs.clearUserPref("devtools.debugger.pending-selected-location")
|
||||
return Task.spawn(function*() {
|
||||
Services.prefs.clearUserPref("devtools.debugger.pause-on-exceptions");
|
||||
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");
|
||||
return createDebuggerContext(toolbox);
|
||||
});
|
||||
@ -429,6 +442,11 @@ function resume(dbg) {
|
||||
return waitForThreadEvents(dbg, "resumed");
|
||||
}
|
||||
|
||||
function deleteExpression(dbg, input) {
|
||||
info("Resuming");
|
||||
return dbg.actions.deleteExpression({ input });
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads the debuggee.
|
||||
*
|
||||
@ -500,8 +518,11 @@ function removeBreakpoint(dbg, sourceId, line, col) {
|
||||
* @return {Promise}
|
||||
* @static
|
||||
*/
|
||||
function togglePauseOnExceptions(dbg,
|
||||
pauseOnExceptions, ignoreCaughtExceptions) {
|
||||
function togglePauseOnExceptions(
|
||||
dbg,
|
||||
pauseOnExceptions,
|
||||
ignoreCaughtExceptions
|
||||
) {
|
||||
const command = dbg.actions.pauseOnExceptions(
|
||||
pauseOnExceptions,
|
||||
ignoreCaughtExceptions
|
||||
@ -526,7 +547,7 @@ function togglePauseOnExceptions(dbg,
|
||||
*/
|
||||
function invokeInTab(fnc) {
|
||||
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
|
||||
});
|
||||
}
|
||||
@ -534,18 +555,21 @@ function invokeInTab(fnc) {
|
||||
const isLinux = Services.appinfo.OS === "Linux";
|
||||
const cmdOrCtrl = isLinux ? { ctrlKey: true } : { metaKey: true };
|
||||
const keyMappings = {
|
||||
sourceSearch: { code: "p", modifiers: cmdOrCtrl},
|
||||
fileSearch: { code: "f", modifiers: cmdOrCtrl},
|
||||
"Enter": { code: "VK_RETURN" },
|
||||
"Up": { code: "VK_UP" },
|
||||
"Down": { code: "VK_DOWN" },
|
||||
"Tab": { code: "VK_TAB" },
|
||||
"Escape": { code: "VK_ESCAPE" },
|
||||
sourceSearch: { code: "p", modifiers: cmdOrCtrl },
|
||||
fileSearch: { code: "f", modifiers: cmdOrCtrl },
|
||||
Enter: { code: "VK_RETURN" },
|
||||
Up: { code: "VK_UP" },
|
||||
Down: { code: "VK_DOWN" },
|
||||
Tab: { code: "VK_TAB" },
|
||||
Escape: { code: "VK_ESCAPE" },
|
||||
pauseKey: { code: "VK_F8" },
|
||||
resumeKey: { code: "VK_F8" },
|
||||
stepOverKey: { code: "VK_F10" },
|
||||
stepInKey: { code: "VK_F11", modifiers: { ctrlKey: isLinux }},
|
||||
stepOutKey: { code: "VK_F11", modifiers: { ctrlKey: isLinux, shiftKey: true }}
|
||||
stepInKey: { code: "VK_F11", modifiers: { ctrlKey: isLinux } },
|
||||
stepOutKey: {
|
||||
code: "VK_F11",
|
||||
modifiers: { ctrlKey: isLinux, shiftKey: true }
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -561,11 +585,7 @@ function pressKey(dbg, keyName) {
|
||||
let keyEvent = keyMappings[keyName];
|
||||
|
||||
const { code, modifiers } = keyEvent;
|
||||
return EventUtils.synthesizeKey(
|
||||
code,
|
||||
modifiers || {},
|
||||
dbg.win
|
||||
);
|
||||
return EventUtils.synthesizeKey(code, modifiers || {}, dbg.win);
|
||||
}
|
||||
|
||||
function type(dbg, string) {
|
||||
@ -577,14 +597,19 @@ function type(dbg, string) {
|
||||
function isVisibleWithin(outerEl, innerEl) {
|
||||
const innerRect = innerEl.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 = {
|
||||
callStackHeader: ".call-stack-pane ._header",
|
||||
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",
|
||||
breakpointItem: i => `.breakpoints-list .breakpoint:nth-child(${i})`,
|
||||
scopeNode: i => `.scopes-list .tree-node:nth-child(${i}) .object-label`,
|
||||
@ -605,7 +630,7 @@ const selectors = {
|
||||
sourceFooter: ".source-footer",
|
||||
sourceNode: i => `.sources-list .tree-node:nth-child(${i})`,
|
||||
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) {
|
||||
@ -647,6 +672,9 @@ function findAllElements(dbg, elementName, ...args) {
|
||||
*/
|
||||
function clickElement(dbg, elementName, ...args) {
|
||||
const selector = getSelector(elementName, ...args);
|
||||
const el = findElement(dbg, elementName, ...args);
|
||||
el.scrollIntoView();
|
||||
|
||||
return EventUtils.synthesizeMouseAtCenter(
|
||||
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) {
|
||||
const selector = getSelector(elementName, ...args);
|
||||
const doc = dbg.win.document;
|
||||
return EventUtils.synthesizeMouseAtCenter(
|
||||
doc.querySelector(selector),
|
||||
{type: "contextmenu"},
|
||||
{ type: "contextmenu" },
|
||||
dbg.win
|
||||
);
|
||||
}
|
||||
@ -669,10 +707,10 @@ function selectMenuItem(dbg, index) {
|
||||
const doc = dbg.toolbox.win.document;
|
||||
|
||||
// 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})`);
|
||||
return EventUtils.synthesizeMouseAtCenter(item, {}, dbg.toolbox.win );
|
||||
return EventUtils.synthesizeMouseAtCenter(item, {}, dbg.toolbox.win);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,15 +115,19 @@ timeEvents=Time
|
||||
touchEvents=Touch
|
||||
otherEvents=Other
|
||||
|
||||
# LOCALIZATION NOTE (blackBoxCheckboxTooltip): The tooltip text to display when
|
||||
# the user hovers over the checkbox used to toggle black boxing its associated
|
||||
# LOCALIZATION NOTE (blackboxCheckboxTooltip2): The tooltip text to display when
|
||||
# the user hovers over the checkbox used to toggle blackboxing its associated
|
||||
# source.
|
||||
blackBoxCheckboxTooltip=Toggle black boxing
|
||||
blackboxCheckboxTooltip2=Toggle blackboxing
|
||||
|
||||
# LOCALIZATION NOTE (sources.search.key): Key shortcut to open the search for
|
||||
# searching all the source files the debugger has seen.
|
||||
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
|
||||
# the search for searching all the source files the debugger has seen.
|
||||
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.
|
||||
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
|
||||
# for when no results found.
|
||||
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
|
||||
# for adding a breakpoint on a line.
|
||||
editor.addBreakpoint=Add Breakpoint
|
||||
@ -341,6 +352,22 @@ sourceTabs.prettyPrint=Pretty Print Source
|
||||
# the editor context menu.
|
||||
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
|
||||
# for close tab button in source tabs.
|
||||
sourceTabs.closeTabButtonTooltip=Close tab
|
||||
@ -393,10 +420,6 @@ sourceSearch.search=Search Sources…
|
||||
# message when the query did not match any of the sources.
|
||||
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
|
||||
# when the debugger will not pause on 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
|
||||
# and its real name (if available).
|
||||
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
|
||||
# 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
|
||||
# listener breakpoint set
|
||||
whyPaused.other=Debugger paused
|
||||
|
||||
# LOCALIZATION NOTE (ctrl): The text that is used for documenting
|
||||
# keyboard shortcuts that use the control key
|
||||
ctrl=Ctrl
|
||||
|
@ -1,7 +1,5 @@
|
||||
# -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
#ifdef RELEASE_OR_BETA
|
||||
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-timeout", 20000);
|
||||
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.client-source-maps-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.tabs", "[]");
|
||||
pref("devtools.debugger.pending-selected-location", "{}");
|
||||
|
||||
pref("devtools.debugger.pending-breakpoints", "[]");
|
||||
pref("devtools.debugger.expressions", "[]");
|
||||
|
@ -59,10 +59,10 @@ exports.viewSourceInDebugger = Task.async(function* (toolbox, sourceURL, sourceL
|
||||
|
||||
// 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) {
|
||||
yield toolbox.selectTool("jsdebugger");
|
||||
dbg._actions().selectSourceURL(sourceURL, { line: sourceLine });
|
||||
dbg.selectSource(sourceURL, sourceLine);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -59,14 +59,14 @@ consoleApi.set("console.group('bar')", {
|
||||
keys: ["console.group('bar')", "console.groupEnd('bar')"],
|
||||
code: `
|
||||
console.group("bar");
|
||||
console.groupEnd("bar");
|
||||
console.groupEnd();
|
||||
`});
|
||||
|
||||
consoleApi.set("console.groupCollapsed('foo')", {
|
||||
keys: ["console.groupCollapsed('foo')", "console.groupEnd('foo')"],
|
||||
code: `
|
||||
console.groupCollapsed("foo");
|
||||
console.groupEnd("foo");
|
||||
console.groupEnd();
|
||||
`});
|
||||
|
||||
consoleApi.set("console.group()", {
|
||||
|
@ -546,13 +546,13 @@ stubPreparedMessages.set("console.groupEnd('bar')", new ConsoleMessage({
|
||||
"id": "1",
|
||||
"allowRepeating": true,
|
||||
"source": "console-api",
|
||||
"timeStamp": 1479159914987,
|
||||
"timeStamp": 1492540770051,
|
||||
"type": "endGroup",
|
||||
"level": "log",
|
||||
"messageText": null,
|
||||
"parameters": null,
|
||||
"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,
|
||||
"frame": {
|
||||
"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",
|
||||
"allowRepeating": true,
|
||||
"source": "console-api",
|
||||
"timeStamp": 1479159916155,
|
||||
"timeStamp": 1492540770585,
|
||||
"type": "endGroup",
|
||||
"level": "log",
|
||||
"messageText": null,
|
||||
"parameters": null,
|
||||
"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,
|
||||
"frame": {
|
||||
"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",
|
||||
"allowRepeating": true,
|
||||
"source": "console-api",
|
||||
"timeStamp": 1479159917526,
|
||||
"timeStamp": 1491902018685,
|
||||
"type": "endGroup",
|
||||
"level": "log",
|
||||
"messageText": null,
|
||||
"parameters": null,
|
||||
"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,
|
||||
"frame": {
|
||||
"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",
|
||||
"allowRepeating": true,
|
||||
"source": "console-api",
|
||||
"timeStamp": 1491902018671,
|
||||
"timeStamp": 1492540772083,
|
||||
"type": "endGroup",
|
||||
"level": "log",
|
||||
"messageText": null,
|
||||
"parameters": null,
|
||||
"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,
|
||||
"frame": {
|
||||
"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",
|
||||
"allowRepeating": true,
|
||||
"source": "console-api",
|
||||
"timeStamp": 1491902018685,
|
||||
"timeStamp": 1492540772669,
|
||||
"type": "endGroup",
|
||||
"level": "log",
|
||||
"messageText": null,
|
||||
"parameters": null,
|
||||
"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,
|
||||
"frame": {
|
||||
"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')", {
|
||||
"from": "server1.conn16.child1/consoleActor2",
|
||||
"from": "server1.conn0.child1/consoleActor2",
|
||||
"type": "consoleAPICall",
|
||||
"message": {
|
||||
"addonId": "",
|
||||
"arguments": [
|
||||
"bar"
|
||||
],
|
||||
"arguments": [],
|
||||
"columnNumber": 1,
|
||||
"counter": null,
|
||||
"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",
|
||||
"lineNumber": 3,
|
||||
"private": false,
|
||||
"styles": [],
|
||||
"timeStamp": 1479159914987,
|
||||
"timeStamp": 1492540770051,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"styles": [],
|
||||
"category": "webdev"
|
||||
}
|
||||
});
|
||||
@ -1368,13 +1366,11 @@ stubPackets.set("console.groupCollapsed('foo')", {
|
||||
});
|
||||
|
||||
stubPackets.set("console.groupEnd('foo')", {
|
||||
"from": "server1.conn17.child1/consoleActor2",
|
||||
"from": "server1.conn0.child1/consoleActor2",
|
||||
"type": "consoleAPICall",
|
||||
"message": {
|
||||
"addonId": "",
|
||||
"arguments": [
|
||||
"foo"
|
||||
],
|
||||
"arguments": [],
|
||||
"columnNumber": 1,
|
||||
"counter": null,
|
||||
"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",
|
||||
"lineNumber": 3,
|
||||
"private": false,
|
||||
"styles": [],
|
||||
"timeStamp": 1479159916155,
|
||||
"timeStamp": 1492540770585,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"styles": [],
|
||||
"category": "webdev"
|
||||
}
|
||||
});
|
||||
@ -1414,7 +1410,7 @@ stubPackets.set("console.group()", {
|
||||
});
|
||||
|
||||
stubPackets.set("console.groupEnd()", {
|
||||
"from": "server1.conn18.child1/consoleActor2",
|
||||
"from": "server1.conn0.child1/consoleActor2",
|
||||
"type": "consoleAPICall",
|
||||
"message": {
|
||||
"addonId": "",
|
||||
@ -1427,10 +1423,10 @@ stubPackets.set("console.groupEnd()", {
|
||||
"level": "groupEnd",
|
||||
"lineNumber": 3,
|
||||
"private": false,
|
||||
"styles": [],
|
||||
"timeStamp": 1479159917526,
|
||||
"timeStamp": 1491902018685,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"styles": [],
|
||||
"category": "webdev"
|
||||
}
|
||||
});
|
||||
@ -1501,14 +1497,14 @@ stubPackets.set("console.groupEnd(%cfoo%cbar)", {
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html",
|
||||
"functionName": "triggerPacket",
|
||||
"groupName": "",
|
||||
"groupName": "foo bar",
|
||||
"level": "groupEnd",
|
||||
"lineNumber": 6,
|
||||
"private": false,
|
||||
"styles": [],
|
||||
"timeStamp": 1491902018671,
|
||||
"timeStamp": 1492540772083,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"styles": [],
|
||||
"category": "webdev"
|
||||
}
|
||||
});
|
||||
@ -1551,14 +1547,14 @@ stubPackets.set("console.groupEnd(%cfoo%cbaz)", {
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html",
|
||||
"functionName": "triggerPacket",
|
||||
"groupName": "",
|
||||
"groupName": "foo baz",
|
||||
"level": "groupEnd",
|
||||
"lineNumber": 6,
|
||||
"private": false,
|
||||
"styles": [],
|
||||
"timeStamp": 1491902018685,
|
||||
"timeStamp": 1492540772669,
|
||||
"timer": null,
|
||||
"workerType": "none",
|
||||
"styles": [],
|
||||
"category": "webdev"
|
||||
}
|
||||
});
|
||||
|
@ -67,7 +67,7 @@ function* checkClickOnNode(hud, toolbox, frameLinkNode) {
|
||||
|
||||
let dbg = toolbox.getPanel("jsdebugger");
|
||||
is(
|
||||
dbg._selectors().getSelectedSource(dbg._getState()).get("url"),
|
||||
dbg._selectors.getSelectedSource(dbg._getState()).get("url"),
|
||||
url,
|
||||
"expected source url"
|
||||
);
|
||||
|
@ -56,7 +56,7 @@ function* checkClickOnNode(hud, toolbox, frameLinkNode) {
|
||||
let url = frameLinkNode.getAttribute("data-url");
|
||||
let dbg = toolbox.getPanel("jsdebugger");
|
||||
is(
|
||||
dbg._selectors().getSelectedSource(dbg._getState()).get("url"),
|
||||
dbg._selectors.getSelectedSource(dbg._getState()).get("url"),
|
||||
url,
|
||||
`Debugger is opened at expected source url (${url})`
|
||||
);
|
||||
|
@ -15,13 +15,13 @@
|
||||
console.log("log-1");
|
||||
console.group("group-2");
|
||||
console.log("log-2");
|
||||
console.groupEnd("group-2");
|
||||
console.groupEnd();
|
||||
console.log("log-3");
|
||||
console.groupEnd("group-1");
|
||||
console.groupEnd();
|
||||
console.log("log-4");
|
||||
console.groupCollapsed("group-3");
|
||||
console.log("log-5");
|
||||
console.groupEnd("group-3");
|
||||
console.groupEnd();
|
||||
console.log("log-6");
|
||||
}
|
||||
</script>
|
||||
|
@ -294,7 +294,7 @@ describe("Message reducer:", () => {
|
||||
currentGroup = getCurrentGroup(getState());
|
||||
expect(currentGroup).toBe(messages.first().id);
|
||||
|
||||
const endBarPacket = stubPackets.get("console.groupEnd('foo')");
|
||||
const endBarPacket = stubPackets.get("console.groupEnd('bar')");
|
||||
dispatch(actions.messageAdd(endBarPacket));
|
||||
messages = getAllMessages(getState());
|
||||
currentGroup = getCurrentGroup(getState());
|
||||
|
@ -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 waitForMessages({
|
||||
|
@ -81,7 +81,7 @@ function test() {
|
||||
|
||||
let toolbox = yield gDevTools.getToolbox(hud.target);
|
||||
let dbg = toolbox.getPanel("jsdebugger");
|
||||
is(dbg._selectors().getSelectedSource(dbg._getState()).get("url"),
|
||||
is(dbg._selectors.getSelectedSource(dbg._getState()).get("url"),
|
||||
url,
|
||||
"expected source url");
|
||||
}
|
||||
|
@ -21,7 +21,8 @@ function test() {
|
||||
let messages = [];
|
||||
[
|
||||
"start",
|
||||
"<no label>: 2",
|
||||
"default: 1",
|
||||
"default: 2",
|
||||
"console.count() testcounter: 1",
|
||||
"console.count() testcounter: 2",
|
||||
"console.count() testcounter: 3",
|
||||
@ -34,13 +35,6 @@ function test() {
|
||||
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({
|
||||
webconsole: hud,
|
||||
messages: messages
|
||||
@ -54,6 +48,8 @@ function test() {
|
||||
"start",
|
||||
"console.count() testcounter: 5",
|
||||
"console.count() testcounter: 6",
|
||||
"default: 3",
|
||||
"default: 4",
|
||||
"end"
|
||||
].forEach(function (msg) {
|
||||
messages.push({
|
||||
@ -62,13 +58,6 @@ function test() {
|
||||
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({
|
||||
webconsole: hud,
|
||||
messages: messages
|
||||
|
@ -17,10 +17,6 @@
|
||||
function counterNoLabel() {
|
||||
console.count();
|
||||
}
|
||||
function countersWithoutLabel() {
|
||||
console.count();
|
||||
console.count();
|
||||
}
|
||||
function counterWithLabel() {
|
||||
console.count("console.count() testcounter");
|
||||
}
|
||||
@ -28,7 +24,6 @@
|
||||
console.log("start");
|
||||
counterNoLabel();
|
||||
counterNoLabel();
|
||||
countersWithoutLabel();
|
||||
counterWithLabel();
|
||||
counterWithLabel();
|
||||
counterSeperateScriptTag();
|
||||
|
@ -355,7 +355,8 @@ BrowserTabList.prototype.getTab = function ({ outerWindowID, tabId }) {
|
||||
} else if (typeof tabId == "number") {
|
||||
// Tabs OOP
|
||||
for (let browser of this._getBrowsers()) {
|
||||
if (browser.frameLoader.tabParent &&
|
||||
if (browser.frameLoader &&
|
||||
browser.frameLoader.tabParent &&
|
||||
browser.frameLoader.tabParent.tabId === tabId) {
|
||||
return this._getActorForBrowser(browser);
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ NS_INTERFACE_MAP_END
|
||||
/* static */ bool
|
||||
CustomElementRegistry::IsCustomElementEnabled(JSContext* aCx, JSObject* aObject)
|
||||
{
|
||||
return Preferences::GetBool("dom.webcomponents.customelements.enabled") ||
|
||||
return nsContentUtils::IsCustomElementsEnabled() ||
|
||||
nsContentUtils::IsWebComponentsEnabled();
|
||||
}
|
||||
|
||||
|
@ -291,6 +291,7 @@ bool nsContentUtils::sIsResourceTimingEnabled = false;
|
||||
bool nsContentUtils::sIsUserTimingLoggingEnabled = false;
|
||||
bool nsContentUtils::sIsExperimentalAutocompleteEnabled = false;
|
||||
bool nsContentUtils::sIsWebComponentsEnabled = false;
|
||||
bool nsContentUtils::sIsCustomElementsEnabled = false;
|
||||
bool nsContentUtils::sPrivacyResistFingerprinting = false;
|
||||
bool nsContentUtils::sSendPerformanceTimingNotifications = false;
|
||||
bool nsContentUtils::sUseActivityCursor = false;
|
||||
@ -596,6 +597,9 @@ nsContentUtils::Init()
|
||||
Preferences::AddBoolVarCache(&sIsWebComponentsEnabled,
|
||||
"dom.webcomponents.enabled", false);
|
||||
|
||||
Preferences::AddBoolVarCache(&sIsCustomElementsEnabled,
|
||||
"dom.webcomponents.customelements.enabled", false);
|
||||
|
||||
Preferences::AddBoolVarCache(&sPrivacyResistFingerprinting,
|
||||
"privacy.resistFingerprinting", false);
|
||||
|
||||
|
@ -2870,6 +2870,9 @@ public:
|
||||
static bool
|
||||
IsLocalRefURL(const nsString& aString);
|
||||
|
||||
static bool
|
||||
IsCustomElementsEnabled() { return sIsCustomElementsEnabled; }
|
||||
|
||||
private:
|
||||
static bool InitializeEventTable();
|
||||
|
||||
@ -2987,6 +2990,7 @@ private:
|
||||
static bool sIsFrameTimingPrefEnabled;
|
||||
static bool sIsExperimentalAutocompleteEnabled;
|
||||
static bool sIsWebComponentsEnabled;
|
||||
static bool sIsCustomElementsEnabled;
|
||||
static bool sPrivacyResistFingerprinting;
|
||||
static bool sSendPerformanceTimingNotifications;
|
||||
static bool sUseActivityCursor;
|
||||
|
@ -105,7 +105,6 @@ GK_ATOM(any, "any")
|
||||
GK_ATOM(applet, "applet")
|
||||
GK_ATOM(applyImports, "apply-imports")
|
||||
GK_ATOM(applyTemplates, "apply-templates")
|
||||
GK_ATOM(mozapptype, "mozapptype")
|
||||
GK_ATOM(archive, "archive")
|
||||
GK_ATOM(area, "area")
|
||||
GK_ATOM(arrow, "arrow")
|
||||
|
@ -9331,11 +9331,13 @@ nsGlobalWindow::ReallyCloseWindow()
|
||||
from the list of browsers) (and has an unload handler
|
||||
that closes the window). */
|
||||
// XXXbz now that we have mHavePendingClose, is this needed?
|
||||
bool isTab = false;
|
||||
bool isTab;
|
||||
if (rootWin == AsOuter() ||
|
||||
!bwin || (bwin->IsTabContentWindow(GetOuterWindowInternal(),
|
||||
&isTab), isTab))
|
||||
!bwin ||
|
||||
(NS_SUCCEEDED(bwin->IsTabContentWindow(GetOuterWindowInternal(),
|
||||
&isTab)) && isTab)) {
|
||||
treeOwnerAsWin->Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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>
|
@ -2,7 +2,6 @@
|
||||
# Good luck running these tests on anything but desktop Linux.
|
||||
run-if = os == 'linux' && buildapp == 'browser' && !e10s
|
||||
support-files =
|
||||
file_HighPriority.html
|
||||
silence.ogg
|
||||
!/dom/browser-element/mochitest/browserElementTestHelpers.js
|
||||
!/dom/browser-element/mochitest/file_empty.html
|
||||
@ -12,6 +11,5 @@ support-files =
|
||||
# much sense.
|
||||
|
||||
[test_Simple.html]
|
||||
[test_HighPriority.html]
|
||||
[test_WebGLContextLost.html]
|
||||
disabled = bug 865844
|
||||
|
@ -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>
|
@ -960,13 +960,13 @@ METHOD(Error, "error")
|
||||
METHOD(Exception, "exception")
|
||||
METHOD(Debug, "debug")
|
||||
METHOD(Table, "table")
|
||||
METHOD(Clear, "clear")
|
||||
METHOD(Trace, "trace")
|
||||
|
||||
/* static */ void
|
||||
Console::Trace(const GlobalObject& aGlobal)
|
||||
Console::Clear(const GlobalObject& aGlobal)
|
||||
{
|
||||
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.
|
||||
@ -975,36 +975,47 @@ METHOD(Dirxml, "dirxml");
|
||||
|
||||
METHOD(Group, "group")
|
||||
METHOD(GroupCollapsed, "groupCollapsed")
|
||||
METHOD(GroupEnd, "groupEnd")
|
||||
|
||||
/* static */ void
|
||||
Console::Time(const GlobalObject& aGlobal, const JS::Handle<JS::Value> aTime)
|
||||
Console::GroupEnd(const GlobalObject& aGlobal)
|
||||
{
|
||||
JSContext* cx = aGlobal.Context();
|
||||
|
||||
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);
|
||||
const Sequence<JS::Value> data;
|
||||
Method(aGlobal, MethodGroupEnd, NS_LITERAL_STRING("groupEnd"), data);
|
||||
}
|
||||
|
||||
/* 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();
|
||||
|
||||
ClearException ce(cx);
|
||||
|
||||
Sequence<JS::Value> 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;
|
||||
}
|
||||
|
||||
Method(aGlobal, MethodTimeEnd, NS_LITERAL_STRING("timeEnd"), data);
|
||||
if (!data.AppendElement(value, fallible)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Method(aGlobal, aMethodName, aMethodString, data);
|
||||
}
|
||||
|
||||
/* 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
|
||||
Console::NoopMethod(const GlobalObject& aGlobal)
|
||||
@ -1364,13 +1379,10 @@ Console::MethodInternal(JSContext* aCx, MethodName aMethodName,
|
||||
}
|
||||
|
||||
else if (aMethodName == MethodCount) {
|
||||
ConsoleStackEntry frame;
|
||||
if (callData->mTopStackFrame) {
|
||||
frame = *callData->mTopStackFrame;
|
||||
callData->mCountValue = IncreaseCounter(aCx, aData, callData->mCountLabel);
|
||||
if (!callData->mCountValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
callData->mCountValue = IncreaseCounter(aCx, frame, aData,
|
||||
callData->mCountLabel);
|
||||
}
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
@ -1500,7 +1512,7 @@ Console::PopulateConsoleNotificationInTheTargetScope(JSContext* aCx,
|
||||
const Sequence<JS::Value>& aArguments,
|
||||
JSObject* aTargetScope,
|
||||
JS::MutableHandle<JS::Value> aEventValue,
|
||||
ConsoleCallData* aData) const
|
||||
ConsoleCallData* aData)
|
||||
{
|
||||
MOZ_ASSERT(aCx);
|
||||
MOZ_ASSERT(aData);
|
||||
@ -1573,7 +1585,6 @@ Console::PopulateConsoleNotificationInTheTargetScope(JSContext* aCx,
|
||||
case MethodAssert:
|
||||
case MethodGroup:
|
||||
case MethodGroupCollapsed:
|
||||
case MethodGroupEnd:
|
||||
event.mArguments.Construct();
|
||||
event.mStyles.Construct();
|
||||
if (NS_WARN_IF(!ProcessArguments(aCx, aArguments,
|
||||
@ -1593,9 +1604,14 @@ Console::PopulateConsoleNotificationInTheTargetScope(JSContext* aCx,
|
||||
}
|
||||
|
||||
if (aData->mMethodName == MethodGroup ||
|
||||
aData->mMethodName == MethodGroupCollapsed ||
|
||||
aData->mMethodName == MethodGroupEnd) {
|
||||
ComposeGroupName(aCx, event.mArguments.Value(), event.mGroupName);
|
||||
aData->mMethodName == MethodGroupCollapsed) {
|
||||
ComposeAndStoreGroupName(aCx, event.mArguments.Value(), event.mGroupName);
|
||||
}
|
||||
|
||||
else if (aData->mMethodName == MethodGroupEnd) {
|
||||
if (!UnstoreGroupName(event.mGroupName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
else if (aData->mMethodName == MethodTime && !aArguments.IsEmpty()) {
|
||||
@ -1962,9 +1978,9 @@ Console::MakeFormatString(nsCString& aFormat, int32_t aInteger,
|
||||
}
|
||||
|
||||
void
|
||||
Console::ComposeGroupName(JSContext* aCx,
|
||||
const Sequence<JS::Value>& aData,
|
||||
nsAString& aName) const
|
||||
Console::ComposeAndStoreGroupName(JSContext* aCx,
|
||||
const Sequence<JS::Value>& aData,
|
||||
nsAString& aName)
|
||||
{
|
||||
for (uint32_t i = 0; i < aData.Length(); ++i) {
|
||||
if (i != 0) {
|
||||
@ -1984,6 +2000,21 @@ Console::ComposeGroupName(JSContext* aCx,
|
||||
|
||||
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
|
||||
@ -2119,44 +2150,36 @@ Console::ArgumentsToValueList(const Sequence<JS::Value>& aData,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Console::IncreaseCounter(JSContext* aCx, const ConsoleStackEntry& aFrame,
|
||||
const Sequence<JS::Value>& aArguments,
|
||||
Console::IncreaseCounter(JSContext* aCx, const Sequence<JS::Value>& aArguments,
|
||||
nsAString& aCountLabel)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
ClearException ce(aCx);
|
||||
|
||||
nsAutoString key;
|
||||
nsAutoString label;
|
||||
MOZ_ASSERT(!aArguments.IsEmpty());
|
||||
|
||||
if (!aArguments.IsEmpty()) {
|
||||
JS::Rooted<JS::Value> labelValue(aCx, aArguments[0]);
|
||||
JS::Rooted<JSString*> jsString(aCx, JS::ToString(aCx, labelValue));
|
||||
|
||||
nsAutoJSString string;
|
||||
if (jsString && string.init(aCx, jsString)) {
|
||||
label = string;
|
||||
key = string;
|
||||
}
|
||||
JS::Rooted<JS::Value> labelValue(aCx, aArguments[0]);
|
||||
JS::Rooted<JSString*> jsString(aCx, JS::ToString(aCx, labelValue));
|
||||
if (!jsString) {
|
||||
return 0; // We cannot continue.
|
||||
}
|
||||
|
||||
if (key.IsEmpty()) {
|
||||
key.Append(aFrame.mFilename);
|
||||
key.Append(':');
|
||||
key.AppendInt(aFrame.mLineNumber);
|
||||
nsAutoJSString string;
|
||||
if (!string.init(aCx, jsString)) {
|
||||
return 0; // We cannot continue.
|
||||
}
|
||||
|
||||
aCountLabel = string;
|
||||
|
||||
uint32_t count = 0;
|
||||
if (!mCounterRegistry.Get(key, &count) &&
|
||||
if (!mCounterRegistry.Get(aCountLabel, &count) &&
|
||||
mCounterRegistry.Count() >= MAX_PAGE_COUNTERS) {
|
||||
return MAX_PAGE_COUNTERS;
|
||||
}
|
||||
|
||||
++count;
|
||||
mCounterRegistry.Put(key, count);
|
||||
|
||||
aCountLabel = label;
|
||||
mCounterRegistry.Put(aCountLabel, count);
|
||||
return count;
|
||||
}
|
||||
|
||||
@ -2279,7 +2302,7 @@ Console::ReleaseCallData(ConsoleCallData* aCallData)
|
||||
|
||||
void
|
||||
Console::NotifyHandler(JSContext* aCx, const Sequence<JS::Value>& aArguments,
|
||||
ConsoleCallData* aCallData) const
|
||||
ConsoleCallData* aCallData)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
Table(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData);
|
||||
|
||||
static void
|
||||
Trace(const GlobalObject& aGlobal);
|
||||
Trace(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData);
|
||||
|
||||
static void
|
||||
Dir(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData);
|
||||
@ -85,13 +85,13 @@ public:
|
||||
GroupCollapsed(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData);
|
||||
|
||||
static void
|
||||
GroupEnd(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData);
|
||||
GroupEnd(const GlobalObject& aGlobal);
|
||||
|
||||
static void
|
||||
Time(const GlobalObject& aGlobal, const JS::Handle<JS::Value> aTime);
|
||||
Time(const GlobalObject& aGlobal, const nsAString& aLabel);
|
||||
|
||||
static void
|
||||
TimeEnd(const GlobalObject& aGlobal, const JS::Handle<JS::Value> aTime);
|
||||
TimeEnd(const GlobalObject& aGlobal, const nsAString& aLabel);
|
||||
|
||||
static void
|
||||
TimeStamp(const GlobalObject& aGlobal, const JS::Handle<JS::Value> aData);
|
||||
@ -107,10 +107,10 @@ public:
|
||||
const Sequence<JS::Value>& aData);
|
||||
|
||||
static void
|
||||
Count(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData);
|
||||
Count(const GlobalObject& aGlobal, const nsAString& aLabel);
|
||||
|
||||
static void
|
||||
Clear(const GlobalObject& aGlobal, const Sequence<JS::Value>& aData);
|
||||
Clear(const GlobalObject& aGlobal);
|
||||
|
||||
static void
|
||||
NoopMethod(const GlobalObject& aGlobal);
|
||||
@ -178,7 +178,11 @@ private:
|
||||
|
||||
void
|
||||
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.
|
||||
void
|
||||
@ -200,7 +204,7 @@ private:
|
||||
void
|
||||
NotifyHandler(JSContext* aCx,
|
||||
const Sequence<JS::Value>& aArguments,
|
||||
ConsoleCallData* aData) const;
|
||||
ConsoleCallData* aData);
|
||||
|
||||
// PopulateConsoleNotificationInTheTargetScope receives aCx and aArguments in
|
||||
// the same JS compartment and populates the ConsoleEvent object (aValue) in
|
||||
@ -218,7 +222,7 @@ private:
|
||||
const Sequence<JS::Value>& aArguments,
|
||||
JSObject* aTargetScope,
|
||||
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
|
||||
// format a string. The supported sequences are:
|
||||
@ -248,10 +252,15 @@ private:
|
||||
char aCh) const;
|
||||
|
||||
// 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
|
||||
ComposeGroupName(JSContext* aCx, const Sequence<JS::Value>& aData,
|
||||
nsAString& aName) const;
|
||||
ComposeAndStoreGroupName(JSContext* aCx, const Sequence<JS::Value>& aData,
|
||||
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
|
||||
// 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
|
||||
// thread and populate aCountLabel, used by CreateCounterValue. Returns
|
||||
// MAX_PAGE_COUNTERS in case of error, otherwise the incremented counter
|
||||
// value.
|
||||
// 3 possible values:
|
||||
// * 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.
|
||||
// * aFrame - the first frame of ConsoleCallData.
|
||||
// * aData - the arguments received by the console.count() method.
|
||||
// * aCountLabel - the label that will be populated by this method.
|
||||
uint32_t
|
||||
IncreaseCounter(JSContext* aCx, const ConsoleStackEntry& aFrame,
|
||||
const Sequence<JS::Value>& aData,
|
||||
IncreaseCounter(JSContext* aCx, const Sequence<JS::Value>& aData,
|
||||
nsAString& aCountLabel);
|
||||
|
||||
// This method generates a ConsoleCounter dictionary as JS::Value. If
|
||||
@ -375,6 +385,9 @@ private:
|
||||
|
||||
RefPtr<AnyCallback> mConsoleEventNotifier;
|
||||
|
||||
// This is the stack for groupping.
|
||||
nsTArray<nsString> mGroupStack;
|
||||
|
||||
#ifdef DEBUG
|
||||
PRThread* mOwningThread;
|
||||
#endif
|
||||
|
@ -54,6 +54,21 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=659625
|
||||
"2 new console events registered for 2 count calls");
|
||||
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.log("group-log");
|
||||
ok(storage.getEvents().length === 3,
|
||||
|
@ -173,16 +173,8 @@ HTMLButtonElement::ParseAttribute(int32_t aNamespaceID,
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::type) {
|
||||
// XXX ARG!! This is major evilness. ParseAttribute
|
||||
// shouldn't set members. Override SetAttr instead
|
||||
bool success = aResult.ParseEnumValue(aValue, kButtonTypeTable, false);
|
||||
if (success) {
|
||||
mType = aResult.GetEnumValue();
|
||||
} else {
|
||||
mType = kButtonDefaultType->value;
|
||||
}
|
||||
|
||||
return success;
|
||||
return aResult.ParseEnumValue(aValue, kButtonTypeTable, false,
|
||||
kButtonDefaultType);
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::formmethod) {
|
||||
@ -440,7 +432,9 @@ HTMLButtonElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
{
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::type) {
|
||||
if (!aValue) {
|
||||
if (aValue) {
|
||||
mType = aValue->GetEnumValue();
|
||||
} else {
|
||||
mType = kButtonDefaultType->value;
|
||||
}
|
||||
}
|
||||
|
@ -113,6 +113,21 @@ HTMLMenuElement::Build(nsIMenuBuilder* 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
|
||||
HTMLMenuElement::ParseAttribute(int32_t aNamespaceID,
|
||||
@ -121,15 +136,8 @@ HTMLMenuElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::type) {
|
||||
bool success = aResult.ParseEnumValue(aValue, kMenuTypeTable,
|
||||
false);
|
||||
if (success) {
|
||||
mType = aResult.GetEnumValue();
|
||||
} else {
|
||||
mType = kMenuDefaultType->value;
|
||||
}
|
||||
|
||||
return success;
|
||||
return aResult.ParseEnumValue(aValue, kMenuTypeTable, false,
|
||||
kMenuDefaultType);
|
||||
}
|
||||
|
||||
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
||||
|
@ -30,6 +30,8 @@ public:
|
||||
// nsIDOMHTMLMenuElement
|
||||
NS_DECL_NSIDOMHTMLMENUELEMENT
|
||||
|
||||
nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
|
@ -336,15 +336,8 @@ HTMLMenuItemElement::ParseAttribute(int32_t aNamespaceID,
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::type) {
|
||||
bool success = aResult.ParseEnumValue(aValue, kMenuItemTypeTable,
|
||||
false);
|
||||
if (success) {
|
||||
mType = aResult.GetEnumValue();
|
||||
} else {
|
||||
mType = kMenuItemDefaultType->value;
|
||||
}
|
||||
|
||||
return success;
|
||||
return aResult.ParseEnumValue(aValue, kMenuItemTypeTable, false,
|
||||
kMenuItemDefaultType);
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::radiogroup) {
|
||||
@ -383,6 +376,16 @@ HTMLMenuItemElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify)
|
||||
{
|
||||
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) &&
|
||||
mType == CMD_TYPE_RADIO &&
|
||||
!mParserCreating) {
|
||||
|
@ -263,7 +263,8 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (isCustomElementName || aIs) {
|
||||
if (CustomElementRegistry::IsCustomElementEnabled() &&
|
||||
(isCustomElementName || aIs)) {
|
||||
nsContentUtils::SetupCustomElement(*aResult, aIs);
|
||||
}
|
||||
|
||||
|
@ -871,11 +871,6 @@ ContentParent::GetInitialProcessPriority(Element* aFrameElement)
|
||||
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);
|
||||
if (!browserFrame) {
|
||||
return PROCESS_PRIORITY_FOREGROUND;
|
||||
|
@ -64,6 +64,7 @@ const char* mozilla::dom::ContentPrefs::gInitPrefs[] = {
|
||||
"dom.vibrator.enabled",
|
||||
"dom.vibrator.max_vibrate_list_len",
|
||||
"dom.vibrator.max_vibrate_ms",
|
||||
"dom.webcomponents.customelements.enabled",
|
||||
"dom.webcomponents.enabled",
|
||||
"focusmanager.testmode",
|
||||
"font.size.inflation.disabledInMasterProcess",
|
||||
|
@ -313,7 +313,6 @@ public:
|
||||
*/
|
||||
const nsAutoCString& NameWithComma();
|
||||
|
||||
bool HasAppType(const char* aAppType);
|
||||
bool IsExpectingSystemMessage();
|
||||
|
||||
void OnAudioChannelProcessChanged(nsISupports* aSubject);
|
||||
@ -1001,22 +1000,6 @@ ParticularProcessPriorityManager::Notify(nsITimer* aTimer)
|
||||
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
|
||||
ParticularProcessPriorityManager::IsExpectingSystemMessage()
|
||||
{
|
||||
@ -1042,11 +1025,6 @@ ParticularProcessPriorityManager::CurrentPriority()
|
||||
ProcessPriority
|
||||
ParticularProcessPriorityManager::ComputePriority()
|
||||
{
|
||||
if ((mHoldsCPUWakeLock || mHoldsHighPriorityWakeLock) &&
|
||||
HasAppType("critical")) {
|
||||
return PROCESS_PRIORITY_FOREGROUND_HIGH;
|
||||
}
|
||||
|
||||
bool isVisible = false;
|
||||
const ManagedContainer<PBrowserParent>& browsers =
|
||||
mContentParent->ManagedPBrowserParent();
|
||||
|
@ -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
|
||||
TabParent::IsVisible() const
|
||||
{
|
||||
|
@ -118,11 +118,6 @@ public:
|
||||
|
||||
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.
|
||||
*
|
||||
|
@ -13,7 +13,8 @@
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [["dom.storageManager.enabled", true],
|
||||
["dom.storageManager.prompt.testing", false],
|
||||
["dom.storageManager.prompt.testing.allow", false]]
|
||||
["dom.storageManager.prompt.testing.allow", false],
|
||||
["browser.storageManager.enabled", true]]
|
||||
}, continueToNextStep);
|
||||
yield undefined;
|
||||
|
||||
|
@ -40,6 +40,19 @@ function* testHarnessSteps()
|
||||
|
||||
yield undefined;
|
||||
|
||||
info("Pushing preferences");
|
||||
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{
|
||||
"set": [
|
||||
["dom.storageManager.enabled", true],
|
||||
["dom.storageManager.prompt.testing", true],
|
||||
]
|
||||
},
|
||||
nextTestHarnessStep
|
||||
);
|
||||
yield undefined;
|
||||
|
||||
info("Clearing old databases");
|
||||
|
||||
clearAllDatabases(nextTestHarnessStep);
|
||||
|
@ -4,9 +4,7 @@ var testGenerator = testSteps();
|
||||
function* testSteps()
|
||||
{
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [["dom.storageManager.enabled", true],
|
||||
["dom.storageManager.prompt.testing", true],
|
||||
["dom.storageManager.prompt.testing.allow", true]]
|
||||
"set": [["dom.storageManager.prompt.testing.allow", true]]
|
||||
}, continueToNextStep);
|
||||
yield undefined;
|
||||
|
||||
|
@ -4,9 +4,7 @@ var testGenerator = testSteps();
|
||||
function* testSteps()
|
||||
{
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [["dom.storageManager.enabled", true],
|
||||
["dom.storageManager.prompt.testing", true],
|
||||
["dom.storageManager.prompt.testing.allow", false]]
|
||||
"set": [["dom.storageManager.prompt.testing.allow", false]]
|
||||
}, continueToNextStep);
|
||||
yield undefined;
|
||||
|
||||
|
@ -114,7 +114,10 @@ public:
|
||||
return mType != NONE;
|
||||
}
|
||||
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;
|
||||
}
|
||||
Rect AsRect() const {
|
||||
@ -125,7 +128,10 @@ public:
|
||||
return mType == RECT;
|
||||
}
|
||||
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;
|
||||
}
|
||||
Point Point1() const {
|
||||
|
@ -348,8 +348,6 @@ function testConsoleGroup(aMessageObject) {
|
||||
is(aMessageObject.arguments[1], "group", "group arguments[1] matches");
|
||||
}
|
||||
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");
|
||||
}
|
||||
|
||||
@ -503,8 +501,9 @@ function testEmptyTimer(aMessageObject) {
|
||||
|
||||
ok(aMessageObject.level == "time" || aMessageObject.level == "timeEnd",
|
||||
"expected level received");
|
||||
is(aMessageObject.arguments.length, 0, "we don't have arguments");
|
||||
ok(!aMessageObject.timer, "we don't have a timer");
|
||||
is(aMessageObject.arguments.length, 1, "we have the default argument");
|
||||
is(aMessageObject.arguments[0], "default", "we have the default argument");
|
||||
ok(aMessageObject.timer, "we have a timer");
|
||||
|
||||
is(aMessageObject.functionName, "namelessTimer", "functionName matches");
|
||||
ok(aMessageObject.lineNumber == 31 || aMessageObject.lineNumber == 32,
|
||||
|
@ -47,7 +47,7 @@
|
||||
function testGroups() {
|
||||
console.groupCollapsed("a", "group");
|
||||
console.group("b", "group");
|
||||
console.groupEnd("b", "group");
|
||||
console.groupEnd();
|
||||
}
|
||||
|
||||
function nativeCallback() {
|
||||
|
@ -2,36 +2,47 @@
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
* 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),
|
||||
ClassString="Console",
|
||||
ProtoObjectHack]
|
||||
namespace console {
|
||||
void log(any... data);
|
||||
void info(any... data);
|
||||
void warn(any... data);
|
||||
void error(any... data);
|
||||
void _exception(any... data);
|
||||
// Logging
|
||||
void assert(optional boolean condition = false, any... data);
|
||||
void clear();
|
||||
void count(optional DOMString label = "default");
|
||||
void debug(any... data);
|
||||
void table(any... data);
|
||||
void trace();
|
||||
void dir(any... data);
|
||||
void error(any... data);
|
||||
void info(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);
|
||||
|
||||
// Grouping
|
||||
void group(any... data);
|
||||
void groupCollapsed(any... data);
|
||||
void groupEnd(any... data);
|
||||
void time(optional any time);
|
||||
void timeEnd(optional any time);
|
||||
void groupEnd();
|
||||
|
||||
// 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 clear(any... data);
|
||||
|
||||
void profile(any... data);
|
||||
void profileEnd(any... data);
|
||||
|
||||
void assert(boolean condition, any... data);
|
||||
void count(any... data);
|
||||
|
||||
// No-op methods for compatibility with other browsers.
|
||||
[BinaryName="noopMethod"]
|
||||
void markTimeline();
|
||||
|
@ -58,7 +58,7 @@ onmessage = function(event) {
|
||||
function testGroups() {
|
||||
console.groupCollapsed("a", "group");
|
||||
console.group("b", "group");
|
||||
console.groupEnd("b", "group");
|
||||
console.groupEnd();
|
||||
}
|
||||
|
||||
foobar585956a('omg');
|
||||
|
@ -106,7 +106,7 @@ function register() {
|
||||
})
|
||||
}
|
||||
|
||||
function verifyServiceWorkTime(aSWRInfo) {
|
||||
function verifyServiceWorkTime(aSWRInfo, resolve) {
|
||||
let expectedResult = expectedResults.shift();
|
||||
ok(!!expectedResult, "We should be able to get test from expectedResults");
|
||||
|
||||
@ -123,7 +123,7 @@ function verifyServiceWorkTime(aSWRInfo) {
|
||||
|
||||
if (!swInfo) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -147,6 +147,9 @@ function verifyServiceWorkTime(aSWRInfo) {
|
||||
// We need to hold sw to avoid losing it since we'll unregister the swr later.
|
||||
if (expectedResult.state === State.ACTIVATED) {
|
||||
astrayServiceWorkerInfo = aSWRInfo.activeWorker;
|
||||
|
||||
// Resolve the promise for testServiceWorkerInfo after sw is activated.
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,16 +159,9 @@ function testServiceWorkerInfo() {
|
||||
let promise_resolve;
|
||||
let promise = new Promise(aResolve => promise_resolve = aResolve);
|
||||
|
||||
let counter = 0;
|
||||
swrlistener = {
|
||||
onChange: () => {
|
||||
verifyServiceWorkTime(registrationInfo)
|
||||
counter++;
|
||||
|
||||
// Resolve the promise after sw is activated.
|
||||
if (counter >= State.ACTIVATED) {
|
||||
promise_resolve();
|
||||
}
|
||||
verifyServiceWorkTime(registrationInfo, promise_resolve);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -158,7 +158,7 @@ onmessage = function(message) {
|
||||
expectedTestCount++;
|
||||
|
||||
r = new FileReader();
|
||||
r.onload = getLoadHandler(convertToDataURL(""), 0, "empt binary string reading");
|
||||
r.onload = getLoadHandler(convertToDataURL(""), 0, "empty binary string reading");
|
||||
r.readAsDataURL(emptyFile);
|
||||
expectedTestCount++;
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXMLContentSink.h"
|
||||
#include "nsIFragmentContentSink.h"
|
||||
@ -224,7 +225,7 @@ nsXMLFragmentContentSink::CloseElement(nsIContent* aContent)
|
||||
{
|
||||
// don't do fancy stuff in nsXMLContentSink
|
||||
if (mPreventScriptExecution &&
|
||||
(aContent->IsHTMLElement(nsGkAtoms::script),
|
||||
(aContent->IsHTMLElement(nsGkAtoms::script) ||
|
||||
aContent->IsSVGElement(nsGkAtoms::script))) {
|
||||
nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(aContent);
|
||||
if (sele) {
|
||||
|
@ -3,7 +3,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
#include "mozSpellChecker.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "mozISpellI18NManager.h"
|
||||
@ -552,7 +551,8 @@ mozSpellChecker::GetEngineList(nsCOMArray<mozISpellCheckingEngine>* aSpellChecki
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
while (catEntries->HasMoreElements(&hasMoreEngines), hasMoreEngines){
|
||||
while (NS_SUCCEEDED(catEntries->HasMoreElements(&hasMoreEngines)) &&
|
||||
hasMoreEngines) {
|
||||
nsCOMPtr<nsISupports> elem;
|
||||
rv = catEntries->GetNext(getter_AddRefs(elem));
|
||||
|
||||
|
@ -1925,19 +1925,19 @@ DumpTransform(layerscope::LayersPacket::Layer::Matrix* aLayerMatrix, const Matri
|
||||
Matrix m = aMatrix.As2D();
|
||||
aLayerMatrix->set_isid(m.IsIdentity());
|
||||
if (!m.IsIdentity()) {
|
||||
aLayerMatrix->add_m(m._11), aLayerMatrix->add_m(m._12);
|
||||
aLayerMatrix->add_m(m._21), aLayerMatrix->add_m(m._22);
|
||||
aLayerMatrix->add_m(m._31), aLayerMatrix->add_m(m._32);
|
||||
aLayerMatrix->add_m(m._11); aLayerMatrix->add_m(m._12);
|
||||
aLayerMatrix->add_m(m._21); aLayerMatrix->add_m(m._22);
|
||||
aLayerMatrix->add_m(m._31); aLayerMatrix->add_m(m._32);
|
||||
}
|
||||
} else {
|
||||
aLayerMatrix->add_m(aMatrix._11), aLayerMatrix->add_m(aMatrix._12);
|
||||
aLayerMatrix->add_m(aMatrix._13), aLayerMatrix->add_m(aMatrix._14);
|
||||
aLayerMatrix->add_m(aMatrix._21), aLayerMatrix->add_m(aMatrix._22);
|
||||
aLayerMatrix->add_m(aMatrix._23), aLayerMatrix->add_m(aMatrix._24);
|
||||
aLayerMatrix->add_m(aMatrix._31), aLayerMatrix->add_m(aMatrix._32);
|
||||
aLayerMatrix->add_m(aMatrix._33), aLayerMatrix->add_m(aMatrix._34);
|
||||
aLayerMatrix->add_m(aMatrix._41), aLayerMatrix->add_m(aMatrix._42);
|
||||
aLayerMatrix->add_m(aMatrix._43), aLayerMatrix->add_m(aMatrix._44);
|
||||
aLayerMatrix->add_m(aMatrix._11); aLayerMatrix->add_m(aMatrix._12);
|
||||
aLayerMatrix->add_m(aMatrix._13); aLayerMatrix->add_m(aMatrix._14);
|
||||
aLayerMatrix->add_m(aMatrix._21); aLayerMatrix->add_m(aMatrix._22);
|
||||
aLayerMatrix->add_m(aMatrix._23); aLayerMatrix->add_m(aMatrix._24);
|
||||
aLayerMatrix->add_m(aMatrix._31); aLayerMatrix->add_m(aMatrix._32);
|
||||
aLayerMatrix->add_m(aMatrix._33); aLayerMatrix->add_m(aMatrix._34);
|
||||
aLayerMatrix->add_m(aMatrix._41); aLayerMatrix->add_m(aMatrix._42);
|
||||
aLayerMatrix->add_m(aMatrix._43); aLayerMatrix->add_m(aMatrix._44);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -549,7 +549,7 @@ nsTableEncoderSupport::nsTableEncoderSupport(uScanClassID aScanClass,
|
||||
: nsEncoderSupport(aMaxLengthFactor)
|
||||
{
|
||||
mScanClass = aScanClass;
|
||||
mShiftOutTable = aShiftOutTable,
|
||||
mShiftOutTable = aShiftOutTable;
|
||||
mMappingTable = aMappingTable;
|
||||
}
|
||||
|
||||
|
@ -3652,7 +3652,7 @@ ContainerState::NewPaintedLayerData(nsDisplayItem* aItem,
|
||||
PaintedLayerData data;
|
||||
data.mAnimatedGeometryRoot = aAnimatedGeometryRoot;
|
||||
data.mASR = aASR;
|
||||
data.mClipChain = aClipChain,
|
||||
data.mClipChain = aClipChain;
|
||||
data.mAnimatedGeometryRootOffset = aTopLeft;
|
||||
data.mReferenceFrame = aItem->ReferenceFrame();
|
||||
data.mBackfaceHidden = aItem->Frame()->In3DContextAndBackfaceIsHidden();
|
||||
@ -3662,7 +3662,7 @@ ContainerState::NewPaintedLayerData(nsDisplayItem* aItem,
|
||||
newLayerEntry->mAnimatedGeometryRoot = aAnimatedGeometryRoot;
|
||||
newLayerEntry->mASR = aASR;
|
||||
newLayerEntry->mScrollMetadataASR = aScrollMetadataASR;
|
||||
newLayerEntry->mClipChain = aClipChain,
|
||||
newLayerEntry->mClipChain = aClipChain;
|
||||
// newLayerEntry->mOpaqueRegion is filled in later from
|
||||
// paintedLayerData->mOpaqueRegion, if necessary.
|
||||
|
||||
|
@ -3333,8 +3333,8 @@ nsCSSBorderRenderer::DrawBorders()
|
||||
if (allBordersSame && mCompositeColors[0] != nullptr && !mNoBorderRadius)
|
||||
forceSeparateCorners = true;
|
||||
|
||||
PrintAsString(" mOuterRect: "), PrintAsString(mOuterRect), PrintAsStringNewline();
|
||||
PrintAsString(" mInnerRect: "), PrintAsString(mInnerRect), PrintAsStringNewline();
|
||||
PrintAsString(" mOuterRect: "); PrintAsString(mOuterRect); 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]);
|
||||
|
||||
// if conditioning the outside rect failed, then bail -- the outside
|
||||
|
@ -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-1b.html insert-rule-1b.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
|
||||
HTTP(..) == media-query-add-1-ref.html media-query-add-1-ref.html
|
||||
|
||||
|
@ -800,17 +800,26 @@ Declaration::GetPropertyValueInternal(
|
||||
MOZ_ASSERT(StringEndsWith(nsCSSProps::GetStringValue(subprops[2]),
|
||||
NS_LITERAL_CSTRING("-color")),
|
||||
"third subprop must be the color property");
|
||||
const nsCSSValue *colorValue = data->ValueFor(subprops[2]);
|
||||
bool isCurrentColor =
|
||||
colorValue->GetUnit() == eCSSUnit_EnumColor &&
|
||||
colorValue->GetIntValue() == NS_COLOR_CURRENTCOLOR;
|
||||
if (!AppendValueToString(subprops[0], aValue, aSerialization) ||
|
||||
!(aValue.Append(char16_t(' ')),
|
||||
AppendValueToString(subprops[1], aValue, aSerialization)) ||
|
||||
|
||||
bool ok = AppendValueToString(subprops[0], aValue, aSerialization);
|
||||
if (ok) {
|
||||
aValue.Append(u' ');
|
||||
ok = AppendValueToString(subprops[1], aValue, aSerialization);
|
||||
if (ok) {
|
||||
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.
|
||||
!(isCurrentColor ||
|
||||
(aValue.Append(char16_t(' ')),
|
||||
AppendValueToString(subprops[2], aValue, aSerialization)))) {
|
||||
if (!isCurrentColor) {
|
||||
aValue.Append(u' ');
|
||||
ok = AppendValueToString(subprops[2], aValue, aSerialization);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
aValue.Truncate();
|
||||
}
|
||||
break;
|
||||
|
@ -1116,8 +1116,12 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(const nsAString& aFamilyName,
|
||||
|
||||
face->mLocalName.Truncate();
|
||||
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());
|
||||
if (valueString.LowerCaseEqualsASCII("woff")) {
|
||||
face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_WOFF;
|
||||
@ -1350,7 +1354,6 @@ FontFaceSet::CheckFontLoad(const gfxFontFaceSrc* aFontFaceSrc,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// @arg aPrincipal: generally this is mDocument->NodePrincipal() but
|
||||
// might also be the original principal which enables user stylesheets
|
||||
// to load font files via @font-face rules.
|
||||
|
@ -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 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)
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <memory>
|
||||
#include <string.h>
|
||||
#include "cubeb/cubeb.h"
|
||||
#include "common.h"
|
||||
@ -75,20 +76,6 @@ long data_cb(cubeb_stream * /*stream*/, void * user, const void * /*inputbuffer*
|
||||
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*/)
|
||||
{
|
||||
}
|
||||
@ -100,12 +87,6 @@ int supports_float32(string backend_id)
|
||||
&& 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. */
|
||||
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");
|
||||
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);
|
||||
|
||||
if ((is_float && !supports_float32(backend_id)) ||
|
||||
(!is_float && !supports_int16(backend_id)) ||
|
||||
!supports_channel_count(backend_id, num_channels)) {
|
||||
/* don't treat this as a test failure. */
|
||||
return CUBEB_OK;
|
||||
@ -153,7 +134,8 @@ int run_test(int num_channels, layout_info layout, int sampling_rate, int is_flo
|
||||
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);
|
||||
delay(200);
|
||||
@ -174,12 +156,12 @@ int run_panning_volume_test(int is_float)
|
||||
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);
|
||||
|
||||
if ((is_float && !supports_float32(backend_id)) ||
|
||||
(!is_float && !supports_int16(backend_id))) {
|
||||
if ((is_float && !supports_float32(backend_id))) {
|
||||
/* don't treat this as a test failure. */
|
||||
return CUBEB_OK;
|
||||
}
|
||||
@ -201,7 +183,8 @@ int run_panning_volume_test(int is_float)
|
||||
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");
|
||||
for(int i=0;i <= 4; ++i)
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <memory>
|
||||
#include "cubeb/cubeb.h"
|
||||
|
||||
static void
|
||||
@ -110,10 +111,10 @@ TEST(cubeb, enumerate_devices)
|
||||
cubeb_device_collection * collection = NULL;
|
||||
|
||||
r = cubeb_init(&ctx, "Cubeb audio test", NULL);
|
||||
if (r != CUBEB_OK) {
|
||||
fprintf(stderr, "Error initializing cubeb library\n");
|
||||
ASSERT_EQ(r, CUBEB_OK);
|
||||
}
|
||||
ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library";
|
||||
|
||||
std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
|
||||
cleanup_cubeb_at_exit(ctx, cubeb_destroy);
|
||||
|
||||
fprintf(stdout, "Enumerating input devices for backend %s\n",
|
||||
cubeb_get_backend_id(ctx));
|
||||
@ -123,12 +124,8 @@ TEST(cubeb, enumerate_devices)
|
||||
fprintf(stderr, "Device enumeration not supported"
|
||||
" for this backend, skipping this test.\n");
|
||||
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);
|
||||
print_device_collection(collection, stdout);
|
||||
@ -138,17 +135,9 @@ TEST(cubeb, enumerate_devices)
|
||||
cubeb_get_backend_id(ctx));
|
||||
|
||||
r = cubeb_enumerate_devices(ctx, CUBEB_DEVICE_TYPE_OUTPUT, &collection);
|
||||
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 output devices\n", collection->count);
|
||||
print_device_collection(collection, stdout);
|
||||
cubeb_device_collection_destroy(collection);
|
||||
|
||||
cleanup:
|
||||
cubeb_destroy(ctx);
|
||||
ASSERT_EQ(r, CUBEB_OK);
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <memory>
|
||||
#include "cubeb/cubeb.h"
|
||||
#include "common.h"
|
||||
|
||||
@ -60,13 +61,13 @@ void state_cb_duplex(cubeb_stream * stream, void * /*user*/, cubeb_state state)
|
||||
|
||||
switch (state) {
|
||||
case CUBEB_STATE_STARTED:
|
||||
printf("stream started\n"); break;
|
||||
fprintf(stderr, "stream started\n"); break;
|
||||
case CUBEB_STATE_STOPPED:
|
||||
printf("stream stopped\n"); break;
|
||||
fprintf(stderr, "stream stopped\n"); break;
|
||||
case CUBEB_STATE_DRAINED:
|
||||
printf("stream drained\n"); break;
|
||||
fprintf(stderr, "stream drained\n"); break;
|
||||
default:
|
||||
printf("unknown stream state %d\n", state);
|
||||
fprintf(stderr, "unknown stream state %d\n", state);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -83,10 +84,10 @@ TEST(cubeb, duplex)
|
||||
uint32_t latency_frames = 0;
|
||||
|
||||
r = cubeb_init(&ctx, "Cubeb duplex example", NULL);
|
||||
if (r != CUBEB_OK) {
|
||||
fprintf(stderr, "Error initializing cubeb library\n");
|
||||
ASSERT_EQ(r, CUBEB_OK);
|
||||
}
|
||||
ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library";
|
||||
|
||||
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
|
||||
* have one. */
|
||||
@ -105,26 +106,19 @@ TEST(cubeb, duplex)
|
||||
output_params.layout = CUBEB_LAYOUT_STEREO;
|
||||
|
||||
r = cubeb_get_min_latency(ctx, output_params, &latency_frames);
|
||||
|
||||
if (r != CUBEB_OK) {
|
||||
fprintf(stderr, "Could not get minimal latency\n");
|
||||
ASSERT_EQ(r, CUBEB_OK);
|
||||
}
|
||||
ASSERT_EQ(r, CUBEB_OK) << "Could not get minimal latency";
|
||||
|
||||
r = cubeb_stream_init(ctx, &stream, "Cubeb duplex",
|
||||
NULL, &input_params, NULL, &output_params,
|
||||
latency_frames, data_cb_duplex, state_cb_duplex, &stream_state);
|
||||
if (r != CUBEB_OK) {
|
||||
fprintf(stderr, "Error initializing cubeb stream\n");
|
||||
ASSERT_EQ(r, CUBEB_OK);
|
||||
}
|
||||
ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb stream";
|
||||
|
||||
std::unique_ptr<cubeb_stream, decltype(&cubeb_stream_destroy)>
|
||||
cleanup_stream_at_exit(stream, cubeb_stream_destroy);
|
||||
|
||||
cubeb_stream_start(stream);
|
||||
delay(500);
|
||||
cubeb_stream_stop(stream);
|
||||
|
||||
cubeb_stream_destroy(stream);
|
||||
cubeb_destroy(ctx);
|
||||
|
||||
ASSERT_TRUE(stream_state.seen_audio);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include <stdlib.h>
|
||||
#include <memory>
|
||||
#include "cubeb/cubeb.h"
|
||||
|
||||
TEST(cubeb, latency)
|
||||
@ -14,6 +15,9 @@ TEST(cubeb, latency)
|
||||
r = cubeb_init(&ctx, "Cubeb audio test", NULL);
|
||||
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);
|
||||
ASSERT_TRUE(r == CUBEB_OK || r == CUBEB_ERROR_NOT_SUPPORTED);
|
||||
if (r == CUBEB_OK) {
|
||||
@ -44,6 +48,4 @@ TEST(cubeb, latency)
|
||||
if (r == CUBEB_OK) {
|
||||
ASSERT_GT(latency_frames, 0u);
|
||||
}
|
||||
|
||||
cubeb_destroy(ctx);
|
||||
}
|
||||
|
@ -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) {
|
||||
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]);
|
||||
ASSERT_EQ(out[index], downmix_results[index]);
|
||||
ASSERT_EQ(downmix_results[index], out[index]);
|
||||
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) {
|
||||
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]);
|
||||
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;
|
||||
}
|
||||
|
||||
// downmix_fallback
|
||||
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 (unsigned int j = 0 ; j < ARRAY_LENGTH(layout_infos) ; ++j) {
|
||||
downmix_test(audio_inputs[i].data, audio_inputs[i].layout, layout_infos[j].layout);
|
||||
for (auto audio_input : audio_inputs) {
|
||||
for (auto audio_output : layout_infos) {
|
||||
downmix_test(audio_input.data, audio_input.layout, audio_output.layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,16 +12,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <memory>
|
||||
#include <atomic>
|
||||
#include "cubeb/cubeb.h"
|
||||
#include "common.h"
|
||||
|
||||
#define SAMPLE_FREQUENCY 48000
|
||||
#if (defined(_WIN32) || defined(__WIN32__))
|
||||
#define STREAM_FORMAT CUBEB_SAMPLE_FLOAT32LE
|
||||
#else
|
||||
#define STREAM_FORMAT CUBEB_SAMPLE_S16LE
|
||||
#endif
|
||||
|
||||
std::atomic<bool> load_callback{ false };
|
||||
|
||||
@ -64,6 +61,9 @@ TEST(cubeb, overload_callback)
|
||||
r = cubeb_init(&ctx, "Cubeb callback overload", NULL);
|
||||
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.rate = 48000;
|
||||
output_params.channels = 2;
|
||||
@ -77,13 +77,13 @@ TEST(cubeb, overload_callback)
|
||||
latency_frames, data_cb, state_cb, NULL);
|
||||
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);
|
||||
delay(500);
|
||||
// This causes the callback to sleep for a large number of seconds.
|
||||
load_callback = true;
|
||||
delay(500);
|
||||
cubeb_stream_stop(stream);
|
||||
|
||||
cubeb_stream_destroy(stream);
|
||||
cubeb_destroy(ctx);
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <memory>
|
||||
#include "cubeb/cubeb.h"
|
||||
#include "common.h"
|
||||
|
||||
@ -53,13 +54,13 @@ void state_cb_record(cubeb_stream * stream, void * /*user*/, cubeb_state state)
|
||||
|
||||
switch (state) {
|
||||
case CUBEB_STATE_STARTED:
|
||||
printf("stream started\n"); break;
|
||||
fprintf(stderr, "stream started\n"); break;
|
||||
case CUBEB_STATE_STOPPED:
|
||||
printf("stream stopped\n"); break;
|
||||
fprintf(stderr, "stream stopped\n"); break;
|
||||
case CUBEB_STATE_DRAINED:
|
||||
printf("stream drained\n"); break;
|
||||
fprintf(stderr, "stream drained\n"); break;
|
||||
default:
|
||||
printf("unknown stream state %d\n", state);
|
||||
fprintf(stderr, "unknown stream state %d\n", state);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -68,7 +69,7 @@ void state_cb_record(cubeb_stream * stream, void * /*user*/, cubeb_state state)
|
||||
TEST(cubeb, record)
|
||||
{
|
||||
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_stream *stream;
|
||||
@ -77,10 +78,10 @@ TEST(cubeb, record)
|
||||
user_state_record stream_state = { false };
|
||||
|
||||
r = cubeb_init(&ctx, "Cubeb record example", NULL);
|
||||
if (r != CUBEB_OK) {
|
||||
fprintf(stderr, "Error initializing cubeb library\n");
|
||||
ASSERT_EQ(r, CUBEB_OK);
|
||||
}
|
||||
ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library";
|
||||
|
||||
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
|
||||
* have one. */
|
||||
@ -95,21 +96,18 @@ TEST(cubeb, record)
|
||||
|
||||
r = cubeb_stream_init(ctx, &stream, "Cubeb record (mono)", NULL, ¶ms, NULL, nullptr,
|
||||
4096, data_cb_record, state_cb_record, &stream_state);
|
||||
if (r != CUBEB_OK) {
|
||||
fprintf(stderr, "Error initializing cubeb stream\n");
|
||||
ASSERT_EQ(r, CUBEB_OK);
|
||||
}
|
||||
ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb stream";
|
||||
|
||||
std::unique_ptr<cubeb_stream, decltype(&cubeb_stream_destroy)>
|
||||
cleanup_stream_at_exit(stream, cubeb_stream_destroy);
|
||||
|
||||
cubeb_stream_start(stream);
|
||||
delay(500);
|
||||
cubeb_stream_stop(stream);
|
||||
|
||||
cubeb_stream_destroy(stream);
|
||||
cubeb_destroy(ctx);
|
||||
|
||||
#ifdef __linux__
|
||||
// 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
|
||||
ASSERT_TRUE(stream_state.seen_audio);
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user