зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1454696 - Run eslint --fix for prefer-const;r=yulia
MozReview-Commit-ID: F6xUXCgdRE4 --HG-- extra : rebase_source : 65de1b0aba412d9044b5196115f74276caa058f2
This commit is contained in:
Родитель
822bc87c3d
Коммит
640fe52298
|
@ -89,10 +89,10 @@ class AboutDebuggingApp extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let { client, connect } = this.props;
|
||||
let { selectedPanelId } = this.state;
|
||||
let selectPanel = this.selectPanel;
|
||||
let selectedPanel = panels.find(p => p.id == selectedPanelId);
|
||||
const { client, connect } = this.props;
|
||||
const { selectedPanelId } = this.state;
|
||||
const selectPanel = this.selectPanel;
|
||||
const selectedPanel = panels.find(p => p.id == selectedPanelId);
|
||||
let panel;
|
||||
|
||||
if (selectedPanel) {
|
||||
|
|
|
@ -17,7 +17,7 @@ class PanelHeader extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let { name, id } = this.props;
|
||||
const { name, id } = this.props;
|
||||
|
||||
return dom.div({ className: "header" },
|
||||
dom.h1({ id, className: "header-name" }, name));
|
||||
|
|
|
@ -24,9 +24,9 @@ class PanelMenu extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let { panels, selectedPanelId, selectPanel } = this.props;
|
||||
let panelLinks = panels.map(({ id, name, icon }) => {
|
||||
let selected = id == selectedPanelId;
|
||||
const { panels, selectedPanelId, selectPanel } = this.props;
|
||||
const panelLinks = panels.map(({ id, name, icon }) => {
|
||||
const selected = id == selectedPanelId;
|
||||
return PanelMenuEntry({
|
||||
id,
|
||||
name,
|
||||
|
|
|
@ -29,11 +29,11 @@ class PanelMenuEntry extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let { id, name, icon, selected } = this.props;
|
||||
const { id, name, icon, selected } = this.props;
|
||||
|
||||
// Here .category, .category-icon, .category-name classnames are used to
|
||||
// apply common styles defined.
|
||||
let className = "category" + (selected ? " selected" : "");
|
||||
const className = "category" + (selected ? " selected" : "");
|
||||
return dom.button({
|
||||
"aria-selected": selected,
|
||||
"aria-controls": id + "-panel",
|
||||
|
|
|
@ -44,14 +44,14 @@ class AddonsControls extends Component {
|
|||
}
|
||||
|
||||
onEnableAddonDebuggingChange(event) {
|
||||
let enabled = event.target.checked;
|
||||
const enabled = event.target.checked;
|
||||
Services.prefs.setBoolPref("devtools.chrome.enabled", enabled);
|
||||
Services.prefs.setBoolPref("devtools.debugger.remote-enabled", enabled);
|
||||
}
|
||||
|
||||
loadAddonFromFile() {
|
||||
this.setState({ installError: null });
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
const fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
fp.init(window,
|
||||
Strings.GetStringFromName("selectAddonFromFile2"),
|
||||
Ci.nsIFilePicker.modeOpen);
|
||||
|
@ -88,7 +88,7 @@ class AddonsControls extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let { debugDisabled } = this.props;
|
||||
const { debugDisabled } = this.props;
|
||||
|
||||
return dom.div({ className: "addons-top" },
|
||||
dom.div({ className: "addons-controls" },
|
||||
|
|
|
@ -26,7 +26,7 @@ class AddonsInstallError extends Component {
|
|||
if (!this.props.error) {
|
||||
return null;
|
||||
}
|
||||
let text = Strings.formatStringFromName("addonInstallError", [this.props.error], 1);
|
||||
const text = Strings.formatStringFromName("addonInstallError", [this.props.error], 1);
|
||||
return dom.div(
|
||||
{ className: "addons-install-error" },
|
||||
dom.span(
|
||||
|
|
|
@ -79,7 +79,7 @@ class AddonsPanel extends Component {
|
|||
}
|
||||
|
||||
updateDebugStatus() {
|
||||
let debugDisabled =
|
||||
const debugDisabled =
|
||||
!Services.prefs.getBoolPref(CHROME_ENABLED_PREF) ||
|
||||
!Services.prefs.getBoolPref(REMOTE_ENABLED_PREF);
|
||||
|
||||
|
@ -89,7 +89,7 @@ class AddonsPanel extends Component {
|
|||
updateAddonsList() {
|
||||
this.props.client.listAddons()
|
||||
.then(({addons}) => {
|
||||
let extensions = addons.filter(addon => addon.debuggable).map(addon => {
|
||||
const extensions = addons.filter(addon => addon.debuggable).map(addon => {
|
||||
return {
|
||||
addonActor: addon.actor,
|
||||
addonID: addon.id,
|
||||
|
@ -139,11 +139,11 @@ class AddonsPanel extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let { client, connect, id } = this.props;
|
||||
let { debugDisabled, extensions: targets } = this.state;
|
||||
let installedName = Strings.GetStringFromName("extensions");
|
||||
let temporaryName = Strings.GetStringFromName("temporaryExtensions");
|
||||
let targetClass = AddonTarget;
|
||||
const { client, connect, id } = this.props;
|
||||
const { debugDisabled, extensions: targets } = this.state;
|
||||
const installedName = Strings.GetStringFromName("extensions");
|
||||
const temporaryName = Strings.GetStringFromName("temporaryExtensions");
|
||||
const targetClass = AddonTarget;
|
||||
|
||||
const installedTargets = targets.filter((target) => !target.temporarilyInstalled);
|
||||
const temporaryTargets = targets.filter((target) => target.temporarilyInstalled);
|
||||
|
|
|
@ -34,7 +34,7 @@ function filePathForTarget(target) {
|
|||
if (!target.temporarilyInstalled || !target.url || !target.url.startsWith("file://")) {
|
||||
return [];
|
||||
}
|
||||
let path = parseFileUri(target.url);
|
||||
const path = parseFileUri(target.url);
|
||||
return [
|
||||
dom.dt(
|
||||
{ className: "addon-target-info-label" },
|
||||
|
@ -69,7 +69,7 @@ function internalIDForTarget(target) {
|
|||
return [];
|
||||
}
|
||||
// Strip off the protocol and rest, leaving us with just the UUID.
|
||||
let uuid = /moz-extension:\/\/([^/]*)/.exec(target.manifestURL)[1];
|
||||
const uuid = /moz-extension:\/\/([^/]*)/.exec(target.manifestURL)[1];
|
||||
return [
|
||||
dom.dt(
|
||||
{ className: "addon-target-info-label" },
|
||||
|
@ -139,7 +139,7 @@ function warningMessages(target) {
|
|||
));
|
||||
}
|
||||
|
||||
let warnings = target.warnings || [];
|
||||
const warnings = target.warnings || [];
|
||||
messages = messages.concat(warnings.map((warning) => {
|
||||
return dom.li(
|
||||
{ className: "addon-target-warning-message addon-target-message" },
|
||||
|
@ -176,7 +176,7 @@ class AddonTarget extends Component {
|
|||
}
|
||||
|
||||
debug() {
|
||||
let { client, connect, target } = this.props;
|
||||
const { client, connect, target } = this.props;
|
||||
|
||||
if (connect.type === "REMOTE") {
|
||||
debugRemoteAddon(target.form, client);
|
||||
|
@ -186,13 +186,13 @@ class AddonTarget extends Component {
|
|||
}
|
||||
|
||||
uninstall() {
|
||||
let { target } = this.props;
|
||||
const { target } = this.props;
|
||||
uninstallAddon(target.addonID);
|
||||
}
|
||||
|
||||
async reload() {
|
||||
let { client, target } = this.props;
|
||||
let { AboutDebugging } = window;
|
||||
const { client, target } = this.props;
|
||||
const { AboutDebugging } = window;
|
||||
try {
|
||||
await client.request({
|
||||
to: target.addonActor,
|
||||
|
@ -205,7 +205,7 @@ class AddonTarget extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let { target, debugDisabled } = this.props;
|
||||
const { target, debugDisabled } = this.props;
|
||||
|
||||
return dom.li(
|
||||
{ className: "addon-target-container", "data-addon-id": target.addonID },
|
||||
|
|
|
@ -41,13 +41,13 @@ class TabsPanel extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
let { client } = this.props;
|
||||
const { client } = this.props;
|
||||
client.addListener("tabListChanged", this.update);
|
||||
this.update();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
let { client } = this.props;
|
||||
const { client } = this.props;
|
||||
client.removeListener("tabListChanged", this.update);
|
||||
}
|
||||
|
||||
|
@ -57,9 +57,9 @@ class TabsPanel extends Component {
|
|||
// Filter out closed tabs (represented as `null`).
|
||||
tabs = tabs.filter(tab => !!tab);
|
||||
|
||||
for (let tab of tabs) {
|
||||
for (const tab of tabs) {
|
||||
if (tab.favicon) {
|
||||
let base64Favicon = btoa(String.fromCharCode.apply(String, tab.favicon));
|
||||
const base64Favicon = btoa(String.fromCharCode.apply(String, tab.favicon));
|
||||
tab.icon = "data:image/png;base64," + base64Favicon;
|
||||
} else {
|
||||
tab.icon = "chrome://devtools/skin/images/globe.svg";
|
||||
|
@ -70,8 +70,8 @@ class TabsPanel extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let { client, connect, id } = this.props;
|
||||
let { tabs } = this.state;
|
||||
const { client, connect, id } = this.props;
|
||||
const { tabs } = this.state;
|
||||
|
||||
return dom.div({
|
||||
id: id + "-panel",
|
||||
|
|
|
@ -34,17 +34,17 @@ class TabTarget extends Component {
|
|||
}
|
||||
|
||||
debug() {
|
||||
let { target, connect } = this.props;
|
||||
const { target, connect } = this.props;
|
||||
let url = "about:devtools-toolbox?type=tab&id=" + target.outerWindowID;
|
||||
if (connect.type == "REMOTE") {
|
||||
let {host, port} = connect.params;
|
||||
const {host, port} = connect.params;
|
||||
url += `&host=${encodeURIComponent(host)}&port=${encodeURIComponent(port)}`;
|
||||
}
|
||||
window.open(url);
|
||||
}
|
||||
|
||||
render() {
|
||||
let { target } = this.props;
|
||||
const { target } = this.props;
|
||||
|
||||
return dom.div({ className: "target-container" },
|
||||
dom.img({
|
||||
|
|
|
@ -21,7 +21,7 @@ class multiE10SWarning extends Component {
|
|||
}
|
||||
|
||||
onUpdatePreferenceClick() {
|
||||
let message = Strings.GetStringFromName("multiProcessWarningConfirmUpdate2");
|
||||
const message = Strings.GetStringFromName("multiProcessWarningConfirmUpdate2");
|
||||
if (window.confirm(message)) {
|
||||
// Disable multi until at least the next experiment.
|
||||
Services.prefs.setIntPref(MULTI_OPT_OUT_PREF,
|
||||
|
|
|
@ -53,7 +53,7 @@ class WorkersPanel extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
let client = this.props.client;
|
||||
const client = this.props.client;
|
||||
client.addListener("workerListChanged", this.updateWorkers);
|
||||
client.addListener("serviceWorkerRegistrationListChanged", this.updateWorkers);
|
||||
client.addListener("processListChanged", this.updateWorkers);
|
||||
|
@ -79,7 +79,7 @@ class WorkersPanel extends Component {
|
|||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
let client = this.props.client;
|
||||
const client = this.props.client;
|
||||
client.removeListener("processListChanged", this.updateWorkers);
|
||||
client.removeListener("serviceWorkerRegistrationListChanged", this.updateWorkers);
|
||||
client.removeListener("workerListChanged", this.updateWorkers);
|
||||
|
@ -103,12 +103,12 @@ class WorkersPanel extends Component {
|
|||
updateMultiE10S() {
|
||||
// We watch the pref but set the state based on
|
||||
// nsIXULRuntime.maxWebProcessCount.
|
||||
let processCount = Services.appinfo.maxWebProcessCount;
|
||||
const processCount = Services.appinfo.maxWebProcessCount;
|
||||
this.setState({ processCount });
|
||||
}
|
||||
|
||||
updateWorkers() {
|
||||
let workers = this.initialState.workers;
|
||||
const workers = this.initialState.workers;
|
||||
|
||||
this.props.client.mainRoot.listAllWorkers().then(({service, other, shared}) => {
|
||||
workers.service = service.map(f => Object.assign({ icon: WorkerIcon }, f));
|
||||
|
@ -128,12 +128,12 @@ class WorkersPanel extends Component {
|
|||
}
|
||||
|
||||
renderServiceWorkersError() {
|
||||
let isWindowPrivate = PrivateBrowsingUtils.isContentWindowPrivate(window);
|
||||
let isPrivateBrowsingMode = PrivateBrowsingUtils.permanentPrivateBrowsing;
|
||||
let isServiceWorkerDisabled = !Services.prefs
|
||||
const isWindowPrivate = PrivateBrowsingUtils.isContentWindowPrivate(window);
|
||||
const isPrivateBrowsingMode = PrivateBrowsingUtils.permanentPrivateBrowsing;
|
||||
const isServiceWorkerDisabled = !Services.prefs
|
||||
.getBoolPref("dom.serviceWorkers.enabled");
|
||||
|
||||
let isDisabled = isWindowPrivate || isPrivateBrowsingMode || isServiceWorkerDisabled;
|
||||
const isDisabled = isWindowPrivate || isPrivateBrowsingMode || isServiceWorkerDisabled;
|
||||
if (!isDisabled) {
|
||||
return "";
|
||||
}
|
||||
|
@ -159,11 +159,11 @@ class WorkersPanel extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let { client, id } = this.props;
|
||||
let { workers, processCount } = this.state;
|
||||
const { client, id } = this.props;
|
||||
const { workers, processCount } = this.state;
|
||||
|
||||
let isE10S = Services.appinfo.browserTabsRemoteAutostart;
|
||||
let isMultiE10S = isE10S && processCount > 1;
|
||||
const isE10S = Services.appinfo.browserTabsRemoteAutostart;
|
||||
const isMultiE10S = isE10S && processCount > 1;
|
||||
|
||||
return dom.div(
|
||||
{
|
||||
|
|
|
@ -59,13 +59,13 @@ class ServiceWorkerTarget extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
let { client } = this.props;
|
||||
const { client } = this.props;
|
||||
client.addListener("push-subscription-modified", this.onPushSubscriptionModified);
|
||||
this.updatePushSubscription();
|
||||
}
|
||||
|
||||
componentDidUpdate(oldProps, oldState) {
|
||||
let wasActive = oldProps.target.active;
|
||||
const wasActive = oldProps.target.active;
|
||||
if (!wasActive && this.isActive()) {
|
||||
// While the service worker isn't active, any calls to `updatePushSubscription`
|
||||
// won't succeed. If we just became active, make sure we didn't miss a push
|
||||
|
@ -75,7 +75,7 @@ class ServiceWorkerTarget extends Component {
|
|||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
let { client } = this.props;
|
||||
const { client } = this.props;
|
||||
client.removeListener("push-subscription-modified", this.onPushSubscriptionModified);
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ class ServiceWorkerTarget extends Component {
|
|||
return;
|
||||
}
|
||||
|
||||
let { client, target } = this.props;
|
||||
const { client, target } = this.props;
|
||||
gDevToolsBrowser.openWorkerToolbox(client, target.workerActor);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ class ServiceWorkerTarget extends Component {
|
|||
return;
|
||||
}
|
||||
|
||||
let { client, target } = this.props;
|
||||
const { client, target } = this.props;
|
||||
client.request({
|
||||
to: target.workerActor,
|
||||
type: "push"
|
||||
|
@ -110,7 +110,7 @@ class ServiceWorkerTarget extends Component {
|
|||
return;
|
||||
}
|
||||
|
||||
let { client, target } = this.props;
|
||||
const { client, target } = this.props;
|
||||
client.request({
|
||||
to: target.registrationActor,
|
||||
type: "start"
|
||||
|
@ -118,7 +118,7 @@ class ServiceWorkerTarget extends Component {
|
|||
}
|
||||
|
||||
unregister() {
|
||||
let { client, target } = this.props;
|
||||
const { client, target } = this.props;
|
||||
client.request({
|
||||
to: target.registrationActor,
|
||||
type: "unregister"
|
||||
|
@ -126,7 +126,7 @@ class ServiceWorkerTarget extends Component {
|
|||
}
|
||||
|
||||
onPushSubscriptionModified(type, data) {
|
||||
let { target } = this.props;
|
||||
const { target } = this.props;
|
||||
if (data.from === target.registrationActor) {
|
||||
this.updatePushSubscription();
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ class ServiceWorkerTarget extends Component {
|
|||
return;
|
||||
}
|
||||
|
||||
let { client, target } = this.props;
|
||||
const { client, target } = this.props;
|
||||
client.request({
|
||||
to: target.registrationActor,
|
||||
type: "getPushSubscription"
|
||||
|
@ -169,19 +169,19 @@ class ServiceWorkerTarget extends Component {
|
|||
}
|
||||
|
||||
renderButtons() {
|
||||
let pushButton = dom.button({
|
||||
const pushButton = dom.button({
|
||||
className: "push-button",
|
||||
onClick: this.push,
|
||||
disabled: this.props.debugDisabled
|
||||
}, Strings.GetStringFromName("push"));
|
||||
|
||||
let debugButton = dom.button({
|
||||
const debugButton = dom.button({
|
||||
className: "debug-button",
|
||||
onClick: this.debug,
|
||||
disabled: this.props.debugDisabled
|
||||
}, Strings.GetStringFromName("debug"));
|
||||
|
||||
let startButton = dom.button({
|
||||
const startButton = dom.button({
|
||||
className: "start-button",
|
||||
onClick: this.start,
|
||||
disabled: this.props.debugDisabled
|
||||
|
@ -210,11 +210,11 @@ class ServiceWorkerTarget extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let { target } = this.props;
|
||||
let { pushSubscription } = this.state;
|
||||
let status = this.getServiceWorkerStatus();
|
||||
const { target } = this.props;
|
||||
const { pushSubscription } = this.state;
|
||||
const status = this.getServiceWorkerStatus();
|
||||
|
||||
let fetch = target.fetch ? Strings.GetStringFromName("listeningForFetchEvents") :
|
||||
const fetch = target.fetch ? Strings.GetStringFromName("listeningForFetchEvents") :
|
||||
Strings.GetStringFromName("notListeningForFetchEvents");
|
||||
|
||||
return dom.div({ className: "target-container" },
|
||||
|
|
|
@ -38,12 +38,12 @@ class WorkerTarget extends Component {
|
|||
}
|
||||
|
||||
debug() {
|
||||
let { client, target } = this.props;
|
||||
const { client, target } = this.props;
|
||||
gDevToolsBrowser.openWorkerToolbox(client, target.workerActor);
|
||||
}
|
||||
|
||||
render() {
|
||||
let { target, debugDisabled } = this.props;
|
||||
const { target, debugDisabled } = this.props;
|
||||
|
||||
return dom.li({ className: "target-container" },
|
||||
dom.img({
|
||||
|
|
|
@ -37,12 +37,12 @@ var AboutDebugging = {
|
|||
return;
|
||||
}
|
||||
|
||||
let {connect, client} = await createClient();
|
||||
const {connect, client} = await createClient();
|
||||
|
||||
this.client = client;
|
||||
await this.client.connect();
|
||||
|
||||
let telemetry = new Telemetry();
|
||||
const telemetry = new Telemetry();
|
||||
|
||||
render(AboutDebuggingApp({ client, connect, telemetry }),
|
||||
document.querySelector("#body"));
|
||||
|
|
|
@ -56,16 +56,16 @@ exports.debugRemoteAddon = async function(addonForm, client) {
|
|||
// Close previous addon debugging toolbox.
|
||||
closeToolbox();
|
||||
|
||||
let options = {
|
||||
const options = {
|
||||
form: addonForm,
|
||||
chrome: true,
|
||||
client,
|
||||
isTabActor: addonForm.isWebExtension
|
||||
};
|
||||
|
||||
let target = await TargetFactory.forRemoteTab(options);
|
||||
const target = await TargetFactory.forRemoteTab(options);
|
||||
|
||||
let hostType = Toolbox.HostType.WINDOW;
|
||||
const hostType = Toolbox.HostType.WINDOW;
|
||||
remoteAddonToolbox = await gDevTools.showToolbox(target, null, hostType);
|
||||
remoteAddonToolbox.once("destroy", () => {
|
||||
remoteAddonToolbox = null;
|
||||
|
@ -73,7 +73,7 @@ exports.debugRemoteAddon = async function(addonForm, client) {
|
|||
};
|
||||
|
||||
exports.uninstallAddon = async function(addonID) {
|
||||
let addon = await AddonManager.getAddonByID(addonID);
|
||||
const addon = await AddonManager.getAddonByID(addonID);
|
||||
return addon && addon.uninstall();
|
||||
};
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ const TYPE = {
|
|||
* - if type === "REMOTE", {host: {String}, port: {String}}
|
||||
*/
|
||||
function createDescriptorFromURL(url) {
|
||||
let params = url.searchParams;
|
||||
const params = url.searchParams;
|
||||
|
||||
let host = params.get("host");
|
||||
let port = params.get("port");
|
||||
const host = params.get("host");
|
||||
const port = params.get("port");
|
||||
|
||||
let descriptor;
|
||||
if (host && port) {
|
||||
|
@ -63,11 +63,11 @@ function createDescriptorFromURL(url) {
|
|||
* - connect: a connection descriptor, see doc for createDescriptorFromURL(url).
|
||||
*/
|
||||
exports.createClient = async function() {
|
||||
let href = window.location.href;
|
||||
let url = new window.URL(href.replace("about:", "http://"));
|
||||
const href = window.location.href;
|
||||
const url = new window.URL(href.replace("about:", "http://"));
|
||||
|
||||
let connect = createDescriptorFromURL(url);
|
||||
let client = await clientFromURL(url);
|
||||
const connect = createDescriptorFromURL(url);
|
||||
const client = await clientFromURL(url);
|
||||
|
||||
DebuggerServer.allowChromeProcess = true;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ const { BrowserToolboxProcess } = ChromeUtils.import("resource://devtools/client
|
|||
|
||||
add_task(async function() {
|
||||
await new Promise(resolve => {
|
||||
let options = {"set": [
|
||||
const options = {"set": [
|
||||
// Force enabling of addons debugging
|
||||
["devtools.chrome.enabled", true],
|
||||
["devtools.debugger.remote-enabled", true],
|
||||
|
@ -29,7 +29,7 @@ add_task(async function() {
|
|||
SpecialPowers.pushPrefEnv(options, resolve);
|
||||
});
|
||||
|
||||
let { tab, document } = await openAboutDebugging("addons");
|
||||
const { tab, document } = await openAboutDebugging("addons");
|
||||
await waitForInitialAddonList(document);
|
||||
await installAddon({
|
||||
document,
|
||||
|
@ -38,16 +38,16 @@ add_task(async function() {
|
|||
});
|
||||
|
||||
// Retrieve the DEBUG button for the addon
|
||||
let names = getInstalledAddonNames(document);
|
||||
let name = names.filter(element => element.textContent === ADDON_NAME)[0];
|
||||
const names = getInstalledAddonNames(document);
|
||||
const name = names.filter(element => element.textContent === ADDON_NAME)[0];
|
||||
ok(name, "Found the addon in the list");
|
||||
let targetElement = name.parentNode.parentNode;
|
||||
let debugBtn = targetElement.querySelector(".debug-button");
|
||||
const targetElement = name.parentNode.parentNode;
|
||||
const debugBtn = targetElement.querySelector(".debug-button");
|
||||
ok(debugBtn, "Found its debug button");
|
||||
|
||||
// Wait for a notification sent by a script evaluated the test addon via
|
||||
// the web console.
|
||||
let onCustomMessage = new Promise(done => {
|
||||
const onCustomMessage = new Promise(done => {
|
||||
Services.obs.addObserver(function listener() {
|
||||
Services.obs.removeObserver(listener, "addon-console-works");
|
||||
done();
|
||||
|
@ -56,13 +56,13 @@ add_task(async function() {
|
|||
|
||||
// Be careful, this JS function is going to be executed in the addon toolbox,
|
||||
// which lives in another process. So do not try to use any scope variable!
|
||||
let env = Cc["@mozilla.org/process/environment;1"]
|
||||
const env = Cc["@mozilla.org/process/environment;1"]
|
||||
.getService(Ci.nsIEnvironment);
|
||||
let testScript = function() {
|
||||
const testScript = function() {
|
||||
/* eslint-disable no-undef */
|
||||
toolbox.selectTool("webconsole")
|
||||
.then(console => {
|
||||
let { jsterm } = console.hud;
|
||||
const { jsterm } = console.hud;
|
||||
return jsterm.execute("myBootstrapAddonFunction()");
|
||||
})
|
||||
.then(() => toolbox.destroy());
|
||||
|
@ -73,7 +73,7 @@ add_task(async function() {
|
|||
env.set("MOZ_TOOLBOX_TEST_SCRIPT", "");
|
||||
});
|
||||
|
||||
let onToolboxClose = BrowserToolboxProcess.once("close");
|
||||
const onToolboxClose = BrowserToolboxProcess.once("close");
|
||||
|
||||
debugBtn.click();
|
||||
|
||||
|
|
|
@ -4,16 +4,16 @@ const UUID_REGEX = /^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{1
|
|||
|
||||
function testFilePath(container, expectedFilePath) {
|
||||
// Verify that the path to the install location is shown next to its label.
|
||||
let filePath = container.querySelector(".file-path");
|
||||
const filePath = container.querySelector(".file-path");
|
||||
ok(filePath, "file path is in DOM");
|
||||
ok(filePath.textContent.endsWith(expectedFilePath), "file path is set correctly");
|
||||
is(filePath.previousElementSibling.textContent, "Location", "file path has label");
|
||||
}
|
||||
|
||||
add_task(async function testLegacyAddon() {
|
||||
let addonId = "test-devtools@mozilla.org";
|
||||
let addonName = "test-devtools";
|
||||
let { tab, document } = await openAboutDebugging("addons");
|
||||
const addonId = "test-devtools@mozilla.org";
|
||||
const addonName = "test-devtools";
|
||||
const { tab, document } = await openAboutDebugging("addons");
|
||||
await waitForInitialAddonList(document);
|
||||
|
||||
await installAddon({
|
||||
|
@ -22,7 +22,7 @@ add_task(async function testLegacyAddon() {
|
|||
name: addonName,
|
||||
});
|
||||
|
||||
let container = document.querySelector(`[data-addon-id="${addonId}"]`);
|
||||
const container = document.querySelector(`[data-addon-id="${addonId}"]`);
|
||||
testFilePath(container, "browser/devtools/client/aboutdebugging/test/addons/unpacked/");
|
||||
|
||||
await uninstallAddon({document, id: addonId, name: addonName});
|
||||
|
@ -31,9 +31,9 @@ add_task(async function testLegacyAddon() {
|
|||
});
|
||||
|
||||
add_task(async function testWebExtension() {
|
||||
let addonId = "test-devtools-webextension-nobg@mozilla.org";
|
||||
let addonName = "test-devtools-webextension-nobg";
|
||||
let { tab, document } = await openAboutDebugging("addons");
|
||||
const addonId = "test-devtools-webextension-nobg@mozilla.org";
|
||||
const addonName = "test-devtools-webextension-nobg";
|
||||
const { tab, document } = await openAboutDebugging("addons");
|
||||
|
||||
await waitForInitialAddonList(document);
|
||||
await installAddon({
|
||||
|
@ -43,16 +43,16 @@ add_task(async function testWebExtension() {
|
|||
isWebExtension: true
|
||||
});
|
||||
|
||||
let container = document.querySelector(`[data-addon-id="${addonId}"]`);
|
||||
const container = document.querySelector(`[data-addon-id="${addonId}"]`);
|
||||
testFilePath(container, "/test/addons/test-devtools-webextension-nobg/");
|
||||
|
||||
let extensionID = container.querySelector(".extension-id span");
|
||||
const extensionID = container.querySelector(".extension-id span");
|
||||
ok(extensionID.textContent === "test-devtools-webextension-nobg@mozilla.org");
|
||||
|
||||
let internalUUID = container.querySelector(".internal-uuid span");
|
||||
const internalUUID = container.querySelector(".internal-uuid span");
|
||||
ok(internalUUID.textContent.match(UUID_REGEX), "internalUUID is correct");
|
||||
|
||||
let manifestURL = container.querySelector(".manifest-url");
|
||||
const manifestURL = container.querySelector(".manifest-url");
|
||||
ok(manifestURL.href.startsWith("moz-extension://"), "href for manifestURL exists");
|
||||
|
||||
await uninstallAddon({document, id: addonId, name: addonName});
|
||||
|
@ -61,8 +61,8 @@ add_task(async function testWebExtension() {
|
|||
});
|
||||
|
||||
add_task(async function testTemporaryWebExtension() {
|
||||
let addonName = "test-devtools-webextension-noid";
|
||||
let { tab, document } = await openAboutDebugging("addons");
|
||||
const addonName = "test-devtools-webextension-noid";
|
||||
const { tab, document } = await openAboutDebugging("addons");
|
||||
|
||||
await waitForInitialAddonList(document);
|
||||
await installAddon({
|
||||
|
@ -72,15 +72,15 @@ add_task(async function testTemporaryWebExtension() {
|
|||
isWebExtension: true
|
||||
});
|
||||
|
||||
let addons = document.querySelectorAll("#temporary-extensions .addon-target-container");
|
||||
const addons = document.querySelectorAll("#temporary-extensions .addon-target-container");
|
||||
// Assuming that our temporary add-on is now at the top.
|
||||
let container = addons[addons.length - 1];
|
||||
let addonId = container.dataset.addonId;
|
||||
const container = addons[addons.length - 1];
|
||||
const addonId = container.dataset.addonId;
|
||||
|
||||
let extensionID = container.querySelector(".extension-id span");
|
||||
const extensionID = container.querySelector(".extension-id span");
|
||||
ok(extensionID.textContent.endsWith("@temporary-addon"));
|
||||
|
||||
let temporaryID = container.querySelector(".temporary-id-url");
|
||||
const temporaryID = container.querySelector(".temporary-id-url");
|
||||
ok(temporaryID, "Temporary ID message does appear");
|
||||
|
||||
await uninstallAddon({document, id: addonId, name: addonName});
|
||||
|
@ -89,9 +89,9 @@ add_task(async function testTemporaryWebExtension() {
|
|||
});
|
||||
|
||||
add_task(async function testUnknownManifestProperty() {
|
||||
let addonId = "test-devtools-webextension-unknown-prop@mozilla.org";
|
||||
let addonName = "test-devtools-webextension-unknown-prop";
|
||||
let { tab, document } = await openAboutDebugging("addons");
|
||||
const addonId = "test-devtools-webextension-unknown-prop@mozilla.org";
|
||||
const addonName = "test-devtools-webextension-unknown-prop";
|
||||
const { tab, document } = await openAboutDebugging("addons");
|
||||
|
||||
await waitForInitialAddonList(document);
|
||||
await installAddon({
|
||||
|
@ -102,12 +102,12 @@ add_task(async function testUnknownManifestProperty() {
|
|||
});
|
||||
|
||||
info("Wait until the addon appears in about:debugging");
|
||||
let container = await waitUntilAddonContainer(addonName, document);
|
||||
const container = await waitUntilAddonContainer(addonName, document);
|
||||
|
||||
info("Wait until the installation message appears for the new addon");
|
||||
await waitUntilElement(".addon-target-messages", container);
|
||||
|
||||
let messages = container.querySelectorAll(".addon-target-message");
|
||||
const messages = container.querySelectorAll(".addon-target-message");
|
||||
ok(messages.length === 1, "there is one message");
|
||||
ok(messages[0].textContent.match(/Error processing browser_actions/),
|
||||
"the message is helpful");
|
||||
|
|
|
@ -25,15 +25,15 @@ const {
|
|||
* has a working webconsole with the background page as default target;
|
||||
*/
|
||||
add_task(async function testWebExtensionsToolboxWebConsole() {
|
||||
let {
|
||||
const {
|
||||
tab, document, debugBtn,
|
||||
} = await setupTestAboutDebuggingWebExtension(ADDON_NAME, ADDON_MANIFEST_PATH);
|
||||
|
||||
// Be careful, this JS function is going to be executed in the addon toolbox,
|
||||
// which lives in another process. So do not try to use any scope variable!
|
||||
let env = Cc["@mozilla.org/process/environment;1"]
|
||||
const env = Cc["@mozilla.org/process/environment;1"]
|
||||
.getService(Ci.nsIEnvironment);
|
||||
let testScript = function() {
|
||||
const testScript = function() {
|
||||
/* eslint-disable no-undef */
|
||||
function findMessages(hud, text, selector = ".message") {
|
||||
const messages = hud.ui.outputNode.querySelectorAll(selector);
|
||||
|
@ -52,9 +52,9 @@ add_task(async function testWebExtensionsToolboxWebConsole() {
|
|||
|
||||
toolbox.selectTool("webconsole")
|
||||
.then(async console => {
|
||||
let { hud } = console;
|
||||
let { jsterm } = hud;
|
||||
let onMessage = waitFor(() => {
|
||||
const { hud } = console;
|
||||
const { jsterm } = hud;
|
||||
const onMessage = waitFor(() => {
|
||||
return findMessages(hud, "Background page function called").length > 0;
|
||||
});
|
||||
await jsterm.execute("myWebExtensionAddonFunction()");
|
||||
|
@ -69,7 +69,7 @@ add_task(async function testWebExtensionsToolboxWebConsole() {
|
|||
env.set("MOZ_TOOLBOX_TEST_SCRIPT", "");
|
||||
});
|
||||
|
||||
let onToolboxClose = BrowserToolboxProcess.once("close");
|
||||
const onToolboxClose = BrowserToolboxProcess.once("close");
|
||||
|
||||
debugBtn.click();
|
||||
|
||||
|
|
|
@ -24,15 +24,15 @@ const {
|
|||
* background page as default target;
|
||||
*/
|
||||
add_task(async function testWebExtensionsToolboxInspector() {
|
||||
let {
|
||||
const {
|
||||
tab, document, debugBtn,
|
||||
} = await setupTestAboutDebuggingWebExtension(ADDON_NAME, ADDON_PATH);
|
||||
|
||||
// Be careful, this JS function is going to be executed in the addon toolbox,
|
||||
// which lives in another process. So do not try to use any scope variable!
|
||||
let env = Cc["@mozilla.org/process/environment;1"]
|
||||
const env = Cc["@mozilla.org/process/environment;1"]
|
||||
.getService(Ci.nsIEnvironment);
|
||||
let testScript = function() {
|
||||
const testScript = function() {
|
||||
/* eslint-disable no-undef */
|
||||
toolbox.selectTool("inspector")
|
||||
.then(inspector => {
|
||||
|
@ -51,8 +51,8 @@ add_task(async function testWebExtensionsToolboxInspector() {
|
|||
|
||||
dump("Got a nodeActor with an inline text child\n");
|
||||
|
||||
let expectedValue = "Background Page Body Test Content";
|
||||
let actualValue = nodeActor.inlineTextChild._form.nodeValue;
|
||||
const expectedValue = "Background Page Body Test Content";
|
||||
const actualValue = nodeActor.inlineTextChild._form.nodeValue;
|
||||
|
||||
if (String(actualValue).trim() !== String(expectedValue).trim()) {
|
||||
throw new Error(
|
||||
|
@ -76,7 +76,7 @@ add_task(async function testWebExtensionsToolboxInspector() {
|
|||
env.set("MOZ_TOOLBOX_TEST_SCRIPT", "");
|
||||
});
|
||||
|
||||
let onToolboxClose = BrowserToolboxProcess.once("close");
|
||||
const onToolboxClose = BrowserToolboxProcess.once("close");
|
||||
debugBtn.click();
|
||||
await onToolboxClose;
|
||||
|
||||
|
|
|
@ -26,15 +26,15 @@ const {
|
|||
* webextension context);
|
||||
*/
|
||||
add_task(async function testWebExtensionsToolboxNoBackgroundPage() {
|
||||
let {
|
||||
const {
|
||||
tab, document, debugBtn,
|
||||
} = await setupTestAboutDebuggingWebExtension(ADDON_NOBG_NAME, ADDON_NOBG_PATH);
|
||||
|
||||
// Be careful, this JS function is going to be executed in the addon toolbox,
|
||||
// which lives in another process. So do not try to use any scope variable!
|
||||
let env = Cc["@mozilla.org/process/environment;1"]
|
||||
const env = Cc["@mozilla.org/process/environment;1"]
|
||||
.getService(Ci.nsIEnvironment);
|
||||
let testScript = function() {
|
||||
const testScript = function() {
|
||||
/* eslint-disable no-undef */
|
||||
toolbox.selectTool("inspector")
|
||||
.then(inspector => {
|
||||
|
@ -53,8 +53,8 @@ add_task(async function testWebExtensionsToolboxNoBackgroundPage() {
|
|||
|
||||
dump("Got a nodeActor with an inline text child\n");
|
||||
|
||||
let expectedValue = "Your addon does not have any document opened yet.";
|
||||
let actualValue = nodeActor.inlineTextChild._form.nodeValue;
|
||||
const expectedValue = "Your addon does not have any document opened yet.";
|
||||
const actualValue = nodeActor.inlineTextChild._form.nodeValue;
|
||||
|
||||
if (actualValue !== expectedValue) {
|
||||
throw new Error(
|
||||
|
@ -78,7 +78,7 @@ add_task(async function testWebExtensionsToolboxNoBackgroundPage() {
|
|||
env.set("MOZ_TOOLBOX_TEST_SCRIPT", "");
|
||||
});
|
||||
|
||||
let onToolboxClose = BrowserToolboxProcess.once("close");
|
||||
const onToolboxClose = BrowserToolboxProcess.once("close");
|
||||
debugBtn.click();
|
||||
await onToolboxClose;
|
||||
|
||||
|
|
|
@ -76,15 +76,15 @@ add_task(async function testWebExtensionsToolboxSwitchToPopup() {
|
|||
onPopupCustomMessage = waitForExtensionTestMessage("popupPageFunctionCalled");
|
||||
});
|
||||
|
||||
let {
|
||||
const {
|
||||
tab, document, debugBtn,
|
||||
} = await setupTestAboutDebuggingWebExtension(ADDON_NAME, ADDON_MANIFEST_PATH);
|
||||
|
||||
// Be careful, this JS function is going to be executed in the addon toolbox,
|
||||
// which lives in another process. So do not try to use any scope variable!
|
||||
let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
|
||||
const env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
|
||||
|
||||
let testScript = function() {
|
||||
const testScript = function() {
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
let jsterm;
|
||||
|
@ -109,7 +109,7 @@ add_task(async function testWebExtensionsToolboxSwitchToPopup() {
|
|||
dump(`Clicked the menu button\n`);
|
||||
|
||||
popupFramePromise = new Promise(resolve => {
|
||||
let listener = data => {
|
||||
const listener = data => {
|
||||
if (data.frames.some(({url}) => url && url.endsWith("popup.html"))) {
|
||||
toolbox.target.off("frame-update", listener);
|
||||
resolve();
|
||||
|
@ -118,7 +118,7 @@ add_task(async function testWebExtensionsToolboxSwitchToPopup() {
|
|||
toolbox.target.on("frame-update", listener);
|
||||
});
|
||||
|
||||
let waitForFrameListUpdate = toolbox.target.once("frame-update");
|
||||
const waitForFrameListUpdate = toolbox.target.once("frame-update");
|
||||
|
||||
jsterm = console.hud.jsterm;
|
||||
jsterm.execute("myWebExtensionShowPopup()");
|
||||
|
@ -131,19 +131,19 @@ add_task(async function testWebExtensionsToolboxSwitchToPopup() {
|
|||
]);
|
||||
|
||||
dump(`Clicking the frame list button\n`);
|
||||
let btn = toolbox.doc.getElementById("command-button-frames");
|
||||
let frameMenu = await toolbox.showFramesMenu({target: btn});
|
||||
const btn = toolbox.doc.getElementById("command-button-frames");
|
||||
const frameMenu = await toolbox.showFramesMenu({target: btn});
|
||||
dump(`Clicked the frame list button\n`);
|
||||
|
||||
await frameMenu.once("open");
|
||||
|
||||
let frames = frameMenu.items;
|
||||
const frames = frameMenu.items;
|
||||
|
||||
if (frames.length != 2) {
|
||||
throw Error(`Number of frames found is wrong: ${frames.length} != 2`);
|
||||
}
|
||||
|
||||
let popupFrameBtn = frames.filter((frame) => {
|
||||
const popupFrameBtn = frames.filter((frame) => {
|
||||
return frame.label.endsWith("popup.html");
|
||||
}).pop();
|
||||
|
||||
|
@ -151,7 +151,7 @@ add_task(async function testWebExtensionsToolboxSwitchToPopup() {
|
|||
throw Error("Extension Popup frame not found in the listed frames");
|
||||
}
|
||||
|
||||
let waitForNavigated = toolbox.target.once("navigate");
|
||||
const waitForNavigated = toolbox.target.once("navigate");
|
||||
|
||||
popupFrameBtn.click();
|
||||
|
||||
|
@ -173,20 +173,20 @@ add_task(async function testWebExtensionsToolboxSwitchToPopup() {
|
|||
env.set("MOZ_TOOLBOX_TEST_SCRIPT", "");
|
||||
});
|
||||
|
||||
let onToolboxClose = BrowserToolboxProcess.once("close");
|
||||
const onToolboxClose = BrowserToolboxProcess.once("close");
|
||||
|
||||
debugBtn.click();
|
||||
|
||||
await onReadyForOpenPopup;
|
||||
|
||||
let browserActionId = makeWidgetId(ADDON_ID) + "-browser-action";
|
||||
let browserActionEl = window.document.getElementById(browserActionId);
|
||||
const browserActionId = makeWidgetId(ADDON_ID) + "-browser-action";
|
||||
const browserActionEl = window.document.getElementById(browserActionId);
|
||||
|
||||
ok(browserActionEl, "Got the browserAction button from the browser UI");
|
||||
browserActionEl.click();
|
||||
info("Clicked on the browserAction button");
|
||||
|
||||
let args = await onPopupCustomMessage;
|
||||
const args = await onPopupCustomMessage;
|
||||
ok(true, "Received console message from the popup page function as expected");
|
||||
is(args[0], "popupPageFunctionCalled", "Got the expected console message");
|
||||
is(args[1] && args[1].name, ADDON_NAME,
|
||||
|
|
|
@ -31,7 +31,7 @@ const TEST_DATA = [
|
|||
];
|
||||
|
||||
add_task(async function() {
|
||||
for (let testData of TEST_DATA) {
|
||||
for (const testData of TEST_DATA) {
|
||||
await testCheckboxState(testData);
|
||||
}
|
||||
});
|
||||
|
@ -39,14 +39,14 @@ add_task(async function() {
|
|||
async function testCheckboxState(testData) {
|
||||
info("Set preferences as defined by the current test data.");
|
||||
await new Promise(resolve => {
|
||||
let options = {"set": [
|
||||
const options = {"set": [
|
||||
["devtools.chrome.enabled", testData.chromeEnabled],
|
||||
["devtools.debugger.remote-enabled", testData.debuggerRemoteEnable],
|
||||
]};
|
||||
SpecialPowers.pushPrefEnv(options, resolve);
|
||||
});
|
||||
|
||||
let { tab, document } = await openAboutDebugging("addons");
|
||||
const { tab, document } = await openAboutDebugging("addons");
|
||||
await waitForInitialAddonList(document);
|
||||
|
||||
info("Install a test addon.");
|
||||
|
@ -57,12 +57,12 @@ async function testCheckboxState(testData) {
|
|||
});
|
||||
|
||||
info("Test checkbox checked state.");
|
||||
let addonDebugCheckbox = document.querySelector("#enable-addon-debugging");
|
||||
const addonDebugCheckbox = document.querySelector("#enable-addon-debugging");
|
||||
is(addonDebugCheckbox.checked, testData.expected,
|
||||
"Addons debugging checkbox should be in expected state.");
|
||||
|
||||
info("Test debug buttons disabled state.");
|
||||
let debugButtons = [...document.querySelectorAll("#addons .debug-button")];
|
||||
const debugButtons = [...document.querySelectorAll("#addons .debug-button")];
|
||||
ok(debugButtons.every(b => b.disabled != testData.expected),
|
||||
"Debug buttons should be in the expected state");
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ const ADDON_NAME = "test-devtools";
|
|||
|
||||
function mockFilePicker(window, file) {
|
||||
// Mock the file picker to select a test addon
|
||||
let MockFilePicker = SpecialPowers.MockFilePicker;
|
||||
const MockFilePicker = SpecialPowers.MockFilePicker;
|
||||
MockFilePicker.init(window);
|
||||
MockFilePicker.setFiles([file]);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ function mockFilePicker(window, file) {
|
|||
* @return {Promise} Promise that resolves to the output folder when done.
|
||||
*/
|
||||
function promiseWriteWebManifestForExtension(manifest, dir) {
|
||||
let files = {
|
||||
const files = {
|
||||
"manifest.json": JSON.stringify(manifest),
|
||||
};
|
||||
return AddonTestUtils.promiseWriteFilesToExtension(
|
||||
|
@ -35,7 +35,7 @@ function promiseWriteWebManifestForExtension(manifest, dir) {
|
|||
}
|
||||
|
||||
add_task(async function testLegacyInstallSuccess() {
|
||||
let { tab, document } = await openAboutDebugging("addons");
|
||||
const { tab, document } = await openAboutDebugging("addons");
|
||||
await waitForInitialAddonList(document);
|
||||
|
||||
// Install this add-on, and verify that it appears in the about:debugging UI
|
||||
|
@ -52,7 +52,7 @@ add_task(async function testLegacyInstallSuccess() {
|
|||
});
|
||||
|
||||
add_task(async function testWebextensionInstallError() {
|
||||
let { tab, document, window } = await openAboutDebugging("addons");
|
||||
const { tab, document, window } = await openAboutDebugging("addons");
|
||||
await waitForInitialAddonList(document);
|
||||
|
||||
// Trigger the file picker by clicking on the button
|
||||
|
@ -60,20 +60,20 @@ add_task(async function testWebextensionInstallError() {
|
|||
document.getElementById("load-addon-from-file").click();
|
||||
|
||||
info("wait for the install error to appear");
|
||||
let top = document.querySelector(".addons-top");
|
||||
const top = document.querySelector(".addons-top");
|
||||
await waitUntilElement(".addons-install-error", top);
|
||||
|
||||
await closeAboutDebugging(tab);
|
||||
});
|
||||
|
||||
add_task(async function testWebextensionInstallErrorRetry() {
|
||||
let { tab, document, window } = await openAboutDebugging("addons");
|
||||
const { tab, document, window } = await openAboutDebugging("addons");
|
||||
await waitForInitialAddonList(document);
|
||||
|
||||
let tempdir = AddonTestUtils.tempDir.clone();
|
||||
let addonId = "invalid-addon-install-retry@mozilla.org";
|
||||
let addonName = "invalid-addon-install-retry";
|
||||
let manifest = {
|
||||
const tempdir = AddonTestUtils.tempDir.clone();
|
||||
const addonId = "invalid-addon-install-retry@mozilla.org";
|
||||
const addonName = "invalid-addon-install-retry";
|
||||
const manifest = {
|
||||
name: addonName,
|
||||
description: "test invalid-addon-install-retry",
|
||||
// eslint-disable-next-line camelcase
|
||||
|
@ -88,7 +88,7 @@ add_task(async function testWebextensionInstallErrorRetry() {
|
|||
await promiseWriteWebManifestForExtension(manifest, tempdir);
|
||||
|
||||
// Mock the file picker to select a test addon.
|
||||
let manifestFile = tempdir.clone();
|
||||
const manifestFile = tempdir.clone();
|
||||
manifestFile.append(addonId, "manifest.json");
|
||||
mockFilePicker(window, manifestFile);
|
||||
|
||||
|
@ -96,10 +96,10 @@ add_task(async function testWebextensionInstallErrorRetry() {
|
|||
document.getElementById("load-addon-from-file").click();
|
||||
|
||||
info("wait for the install error to appear");
|
||||
let top = document.querySelector(".addons-top");
|
||||
const top = document.querySelector(".addons-top");
|
||||
await waitUntilElement(".addons-install-error", top);
|
||||
|
||||
let retryButton = document.querySelector("button.addons-install-retry");
|
||||
const retryButton = document.querySelector("button.addons-install-retry");
|
||||
is(retryButton.textContent, "Retry", "Retry button has a good label");
|
||||
|
||||
// Fix the manifest so the add-on will install.
|
||||
|
@ -110,7 +110,7 @@ add_task(async function testWebextensionInstallErrorRetry() {
|
|||
}];
|
||||
await promiseWriteWebManifestForExtension(manifest, tempdir);
|
||||
|
||||
let addonEl = document.querySelector(`[data-addon-id="${addonId}"]`);
|
||||
const addonEl = document.querySelector(`[data-addon-id="${addonId}"]`);
|
||||
// Verify this add-on isn't installed yet.
|
||||
ok(!addonEl, "Addon is not installed yet");
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ add_task(async function reloadButtonReloadsAddon() {
|
|||
}, ADDON_NAME);
|
||||
});
|
||||
|
||||
let reloaded = once(AboutDebugging, "addon-reload");
|
||||
const reloaded = once(AboutDebugging, "addon-reload");
|
||||
reloadButton.click();
|
||||
await reloaded;
|
||||
|
||||
|
@ -129,7 +129,7 @@ add_task(async function reloadButtonRefreshesMetadata() {
|
|||
// Wait for the add-on list to be updated with the reloaded name.
|
||||
const onReInstall = promiseAddonEvent("onInstalled");
|
||||
const reloadButton = getReloadButton(document, manifestBase.name);
|
||||
let reloaded = once(AboutDebugging, "addon-reload");
|
||||
const reloaded = once(AboutDebugging, "addon-reload");
|
||||
reloadButton.click();
|
||||
await reloaded;
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ const ADDON_NAME = "test-devtools";
|
|||
add_task(async function() {
|
||||
info("Turn off addon debugging.");
|
||||
await new Promise(resolve => {
|
||||
let options = {"set": [
|
||||
const options = {"set": [
|
||||
["devtools.chrome.enabled", false],
|
||||
["devtools.debugger.remote-enabled", false],
|
||||
]};
|
||||
SpecialPowers.pushPrefEnv(options, resolve);
|
||||
});
|
||||
|
||||
let { tab, document } = await openAboutDebugging("addons");
|
||||
const { tab, document } = await openAboutDebugging("addons");
|
||||
await waitForInitialAddonList(document);
|
||||
|
||||
info("Install a test addon.");
|
||||
|
@ -29,11 +29,11 @@ add_task(async function() {
|
|||
name: ADDON_NAME,
|
||||
});
|
||||
|
||||
let addonDebugCheckbox = document.querySelector("#enable-addon-debugging");
|
||||
const addonDebugCheckbox = document.querySelector("#enable-addon-debugging");
|
||||
ok(!addonDebugCheckbox.checked, "Addons debugging should be disabled.");
|
||||
|
||||
info("Check all debug buttons are disabled.");
|
||||
let debugButtons = [...document.querySelectorAll("#addons .debug-button")];
|
||||
const debugButtons = [...document.querySelectorAll("#addons .debug-button")];
|
||||
ok(debugButtons.every(b => b.disabled), "Debug buttons should be disabled");
|
||||
|
||||
info("Click on 'Enable addons debugging' checkbox.");
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// Every url navigating including #invalid-hash should be kept in history and
|
||||
// navigate back as expected.
|
||||
add_task(async function() {
|
||||
let { tab, document } = await openAboutDebugging("invalid-hash");
|
||||
const { tab, document } = await openAboutDebugging("invalid-hash");
|
||||
let element = document.querySelector(".header-name");
|
||||
is(element.textContent, "Page not found", "Show error page");
|
||||
|
||||
|
|
|
@ -11,11 +11,11 @@ const TAB_URL = URL_ROOT + "service-workers/empty-sw.html";
|
|||
add_task(async function() {
|
||||
await enableServiceWorkerDebugging();
|
||||
|
||||
let { tab, document } = await openAboutDebugging("workers");
|
||||
const { tab, document } = await openAboutDebugging("workers");
|
||||
|
||||
let swTab = await addTab(TAB_URL);
|
||||
const swTab = await addTab(TAB_URL);
|
||||
|
||||
let serviceWorkersElement = getServiceWorkerList(document);
|
||||
const serviceWorkersElement = getServiceWorkerList(document);
|
||||
|
||||
await waitUntil(() => {
|
||||
// Check that the service worker appears in the UI
|
||||
|
|
|
@ -10,11 +10,11 @@ const FETCH_SW_TAB_URL = URL_ROOT + "service-workers/fetch-sw.html";
|
|||
|
||||
async function testBody(url, expecting) {
|
||||
await enableServiceWorkerDebugging();
|
||||
let { tab, document } = await openAboutDebugging("workers");
|
||||
const { tab, document } = await openAboutDebugging("workers");
|
||||
|
||||
let swTab = await addTab(url);
|
||||
const swTab = await addTab(url);
|
||||
|
||||
let serviceWorkersElement = getServiceWorkerList(document);
|
||||
const serviceWorkersElement = getServiceWorkerList(document);
|
||||
|
||||
info("Wait for fetch flag.");
|
||||
await waitUntil(() => {
|
||||
|
|
|
@ -15,19 +15,19 @@ add_task(async function() {
|
|||
info("Force two content processes");
|
||||
await pushPref("dom.ipc.processCount", 2);
|
||||
|
||||
let { tab, document } = await openAboutDebugging("workers");
|
||||
const { tab, document } = await openAboutDebugging("workers");
|
||||
|
||||
let warningSection = document.querySelector(".service-worker-multi-process");
|
||||
let img = warningSection.querySelector(".warning");
|
||||
const warningSection = document.querySelector(".service-worker-multi-process");
|
||||
const img = warningSection.querySelector(".warning");
|
||||
ok(img, "warning message is rendered");
|
||||
|
||||
let serviceWorkersElement = getServiceWorkerList(document);
|
||||
const serviceWorkersElement = getServiceWorkerList(document);
|
||||
|
||||
let swTab = await addTab(TAB_URL, { background: true });
|
||||
const swTab = await addTab(TAB_URL, { background: true });
|
||||
|
||||
info("Wait for service worker to appear in the list");
|
||||
// Check that the service worker appears in the UI
|
||||
let serviceWorkerContainer =
|
||||
const serviceWorkerContainer =
|
||||
await waitUntilServiceWorkerContainer(SERVICE_WORKER, document);
|
||||
|
||||
info("Wait until the service worker is running and the Debug button appears");
|
||||
|
@ -40,8 +40,8 @@ add_task(async function() {
|
|||
ok(debugButton.disabled, "Start/Debug button is disabled");
|
||||
|
||||
info("Update the preference to 1");
|
||||
let onWarningCleared = waitUntil(() => {
|
||||
let hasWarning = document.querySelector(".service-worker-multi-process");
|
||||
const onWarningCleared = waitUntil(() => {
|
||||
const hasWarning = document.querySelector(".service-worker-multi-process");
|
||||
return !hasWarning && !debugButton.disabled;
|
||||
}, 100);
|
||||
await pushPref("dom.ipc.processCount", 1);
|
||||
|
@ -49,8 +49,8 @@ add_task(async function() {
|
|||
ok(!debugButton.disabled, "Debug button is enabled.");
|
||||
|
||||
info("Update the preference back to 2");
|
||||
let onWarningRestored = waitUntil(() => {
|
||||
let hasWarning = document.querySelector(".service-worker-multi-process");
|
||||
const onWarningRestored = waitUntil(() => {
|
||||
const hasWarning = document.querySelector(".service-worker-multi-process");
|
||||
return hasWarning && getDebugButton(serviceWorkerContainer).disabled;
|
||||
}, 100);
|
||||
await pushPref("dom.ipc.processCount", 2);
|
||||
|
|
|
@ -14,15 +14,15 @@ var imgClass = ".service-worker-disabled .warning";
|
|||
add_task(async function() {
|
||||
await new Promise(done => {
|
||||
info("disable service workers");
|
||||
let options = {"set": [
|
||||
const options = {"set": [
|
||||
["dom.serviceWorkers.enabled", false],
|
||||
]};
|
||||
SpecialPowers.pushPrefEnv(options, done);
|
||||
});
|
||||
|
||||
let { tab, document } = await openAboutDebugging("workers");
|
||||
const { tab, document } = await openAboutDebugging("workers");
|
||||
// Check that the warning img appears in the UI
|
||||
let img = document.querySelector(imgClass);
|
||||
const img = document.querySelector(imgClass);
|
||||
ok(img, "warning message is rendered");
|
||||
|
||||
await closeAboutDebugging(tab);
|
||||
|
@ -31,15 +31,15 @@ add_task(async function() {
|
|||
add_task(async function() {
|
||||
await new Promise(done => {
|
||||
info("set private browsing mode as default");
|
||||
let options = {"set": [
|
||||
const options = {"set": [
|
||||
["browser.privatebrowsing.autostart", true],
|
||||
]};
|
||||
SpecialPowers.pushPrefEnv(options, done);
|
||||
});
|
||||
|
||||
let { tab, document } = await openAboutDebugging("workers");
|
||||
const { tab, document } = await openAboutDebugging("workers");
|
||||
// Check that the warning img appears in the UI
|
||||
let img = document.querySelector(imgClass);
|
||||
const img = document.querySelector(imgClass);
|
||||
ok(img, "warning message is rendered");
|
||||
|
||||
await closeAboutDebugging(tab);
|
||||
|
@ -47,12 +47,12 @@ add_task(async function() {
|
|||
|
||||
add_task(async function() {
|
||||
info("Opening a new private window");
|
||||
let win = OpenBrowserWindow({private: true});
|
||||
const win = OpenBrowserWindow({private: true});
|
||||
await waitForDelayedStartupFinished(win);
|
||||
|
||||
let { tab, document } = await openAboutDebugging("workers", win);
|
||||
const { tab, document } = await openAboutDebugging("workers", win);
|
||||
// Check that the warning img appears in the UI
|
||||
let img = document.querySelector(imgClass);
|
||||
const img = document.querySelector(imgClass);
|
||||
ok(img, "warning message is rendered");
|
||||
|
||||
await closeAboutDebugging(tab);
|
||||
|
|
|
@ -16,25 +16,25 @@ const TAB_URL = URL_ROOT + "service-workers/push-sw.html";
|
|||
|
||||
add_task(async function() {
|
||||
await enableServiceWorkerDebugging();
|
||||
let { tab, document } = await openAboutDebugging("workers");
|
||||
const { tab, document } = await openAboutDebugging("workers");
|
||||
|
||||
// Listen for mutations in the service-workers list.
|
||||
let serviceWorkersElement = getServiceWorkerList(document);
|
||||
const serviceWorkersElement = getServiceWorkerList(document);
|
||||
|
||||
// Open a tab that registers a push service worker.
|
||||
let swTab = await addTab(TAB_URL);
|
||||
const swTab = await addTab(TAB_URL);
|
||||
|
||||
info("Make the test page notify us when the service worker sends a message.");
|
||||
|
||||
await ContentTask.spawn(swTab.linkedBrowser, {}, function() {
|
||||
let win = content.wrappedJSObject;
|
||||
const win = content.wrappedJSObject;
|
||||
win.navigator.serviceWorker.addEventListener("message", function(event) {
|
||||
sendAsyncMessage(event.data);
|
||||
});
|
||||
});
|
||||
|
||||
// Expect the service worker to claim the test window when activating.
|
||||
let onClaimed = onTabMessage(swTab, "sw-claimed");
|
||||
const onClaimed = onTabMessage(swTab, "sw-claimed");
|
||||
|
||||
info("Wait until the service worker appears in the UI");
|
||||
await waitUntilServiceWorkerContainer(SERVICE_WORKER, document);
|
||||
|
@ -47,13 +47,13 @@ add_task(async function() {
|
|||
await waitForServiceWorkerActivation(SERVICE_WORKER, document);
|
||||
|
||||
// Retrieve the Push button for the worker.
|
||||
let names = [...document.querySelectorAll("#service-workers .target-name")];
|
||||
let name = names.filter(element => element.textContent === SERVICE_WORKER)[0];
|
||||
const names = [...document.querySelectorAll("#service-workers .target-name")];
|
||||
const name = names.filter(element => element.textContent === SERVICE_WORKER)[0];
|
||||
ok(name, "Found the service worker in the list");
|
||||
|
||||
let targetElement = name.parentNode.parentNode;
|
||||
const targetElement = name.parentNode.parentNode;
|
||||
|
||||
let pushBtn = targetElement.querySelector(".push-button");
|
||||
const pushBtn = targetElement.querySelector(".push-button");
|
||||
ok(pushBtn, "Found its push button");
|
||||
|
||||
info("Wait for the service worker to claim the test window before proceeding.");
|
||||
|
@ -61,7 +61,7 @@ add_task(async function() {
|
|||
|
||||
info("Click on the Push button and wait for the service worker to receive " +
|
||||
"a push notification");
|
||||
let onPushNotification = onTabMessage(swTab, "sw-pushed");
|
||||
const onPushNotification = onTabMessage(swTab, "sw-pushed");
|
||||
|
||||
pushBtn.click();
|
||||
await onPushNotification;
|
||||
|
@ -83,7 +83,7 @@ add_task(async function() {
|
|||
* Helper to listen once on a message sent using postMessage from the provided tab.
|
||||
*/
|
||||
function onTabMessage(tab, message) {
|
||||
let mm = tab.linkedBrowser.messageManager;
|
||||
const mm = tab.linkedBrowser.messageManager;
|
||||
return new Promise(done => {
|
||||
mm.addMessageListener(message, function listener() {
|
||||
mm.removeMessageListener(message, listener);
|
||||
|
|
|
@ -33,7 +33,7 @@ add_task(async function() {
|
|||
},
|
||||
init() {},
|
||||
register(pageRecord) {
|
||||
let registration = {
|
||||
const registration = {
|
||||
endpoint: FAKE_ENDPOINT
|
||||
};
|
||||
this._registrations.set(pageRecord.scope, registration);
|
||||
|
@ -44,7 +44,7 @@ add_task(async function() {
|
|||
return Promise.resolve(this._registrations.get(pageRecord.scope));
|
||||
},
|
||||
unregister(pageRecord) {
|
||||
let deleted = this._registrations.delete(pageRecord.scope);
|
||||
const deleted = this._registrations.delete(pageRecord.scope);
|
||||
if (deleted) {
|
||||
this._notify(pageRecord.scope);
|
||||
}
|
||||
|
@ -52,13 +52,13 @@ add_task(async function() {
|
|||
},
|
||||
};
|
||||
|
||||
let { tab, document } = await openAboutDebugging("workers");
|
||||
const { tab, document } = await openAboutDebugging("workers");
|
||||
|
||||
// Listen for mutations in the service-workers list.
|
||||
let serviceWorkersElement = document.getElementById("service-workers");
|
||||
const serviceWorkersElement = document.getElementById("service-workers");
|
||||
|
||||
// Open a tab that registers a push service worker.
|
||||
let swTab = await addTab(TAB_URL);
|
||||
const swTab = await addTab(TAB_URL);
|
||||
|
||||
info("Wait until the service worker appears in about:debugging");
|
||||
await waitUntilServiceWorkerContainer(SERVICE_WORKER, document);
|
||||
|
@ -66,22 +66,22 @@ add_task(async function() {
|
|||
await waitForServiceWorkerActivation(SERVICE_WORKER, document);
|
||||
|
||||
// Wait for the service worker details to update.
|
||||
let names = [...document.querySelectorAll("#service-workers .target-name")];
|
||||
let name = names.filter(element => element.textContent === SERVICE_WORKER)[0];
|
||||
const names = [...document.querySelectorAll("#service-workers .target-name")];
|
||||
const name = names.filter(element => element.textContent === SERVICE_WORKER)[0];
|
||||
ok(name, "Found the service worker in the list");
|
||||
|
||||
let targetContainer = name.closest(".target-container");
|
||||
const targetContainer = name.closest(".target-container");
|
||||
|
||||
// Retrieve the push subscription endpoint URL, and verify it looks good.
|
||||
info("Wait for the push URL");
|
||||
let pushURL = await waitUntilElement(".service-worker-push-url", targetContainer);
|
||||
const pushURL = await waitUntilElement(".service-worker-push-url", targetContainer);
|
||||
|
||||
info("Found the push service URL in the service worker details");
|
||||
is(pushURL.textContent, FAKE_ENDPOINT, "The push service URL looks correct");
|
||||
|
||||
// Unsubscribe from the push service.
|
||||
ContentTask.spawn(swTab.linkedBrowser, {}, function() {
|
||||
let win = content.wrappedJSObject;
|
||||
const win = content.wrappedJSObject;
|
||||
return win.sub.unsubscribe();
|
||||
});
|
||||
|
||||
|
|
|
@ -19,13 +19,13 @@ add_task(async function() {
|
|||
await pushPref("dom.serviceWorkers.idle_timeout", SW_TIMEOUT);
|
||||
await pushPref("dom.serviceWorkers.idle_extended_timeout", SW_TIMEOUT);
|
||||
|
||||
let { tab, document } = await openAboutDebugging("workers");
|
||||
const { tab, document } = await openAboutDebugging("workers");
|
||||
|
||||
// Listen for mutations in the service-workers list.
|
||||
let serviceWorkersElement = getServiceWorkerList(document);
|
||||
const serviceWorkersElement = getServiceWorkerList(document);
|
||||
|
||||
// Open a tab that registers an empty service worker.
|
||||
let swTab = await addTab(TAB_URL);
|
||||
const swTab = await addTab(TAB_URL);
|
||||
|
||||
// Wait for the service-workers list to update.
|
||||
info("Wait until the service worker appears in about:debugging");
|
||||
|
@ -39,10 +39,10 @@ add_task(async function() {
|
|||
await waitForServiceWorkerActivation(SERVICE_WORKER, document);
|
||||
|
||||
// Retrieve the Target element corresponding to the service worker.
|
||||
let names = [...document.querySelectorAll("#service-workers .target-name")];
|
||||
let name = names.filter(element => element.textContent === SERVICE_WORKER)[0];
|
||||
const names = [...document.querySelectorAll("#service-workers .target-name")];
|
||||
const name = names.filter(element => element.textContent === SERVICE_WORKER)[0];
|
||||
ok(name, "Found the service worker in the list");
|
||||
let targetElement = name.parentNode.parentNode;
|
||||
const targetElement = name.parentNode.parentNode;
|
||||
|
||||
// The service worker may already be killed with the low 1s timeout.
|
||||
// At this stage, either the SW is started and the Debug button is visible or was
|
||||
|
@ -52,7 +52,7 @@ add_task(async function() {
|
|||
await waitUntilElement(".start-button", targetElement);
|
||||
|
||||
// We should now have a Start button but no Debug button.
|
||||
let startBtn = targetElement.querySelector(".start-button");
|
||||
const startBtn = targetElement.querySelector(".start-button");
|
||||
ok(startBtn, "Found its start button");
|
||||
ok(!targetElement.querySelector(".debug-button"), "No debug button");
|
||||
|
||||
|
|
|
@ -16,21 +16,21 @@ add_task(async function() {
|
|||
await pushPref("dom.serviceWorkers.idle_timeout", SW_TIMEOUT);
|
||||
await pushPref("dom.serviceWorkers.idle_extended_timeout", SW_TIMEOUT);
|
||||
|
||||
let { tab, document } = await openAboutDebugging("workers");
|
||||
const { tab, document } = await openAboutDebugging("workers");
|
||||
|
||||
// Listen for mutations in the service-workers list.
|
||||
let serviceWorkersElement = getServiceWorkerList(document);
|
||||
const serviceWorkersElement = getServiceWorkerList(document);
|
||||
|
||||
let swTab = await addTab(TAB_URL);
|
||||
const swTab = await addTab(TAB_URL);
|
||||
|
||||
info("Wait until the service worker appears in about:debugging");
|
||||
let container = await waitUntilServiceWorkerContainer(SERVICE_WORKER, document);
|
||||
const container = await waitUntilServiceWorkerContainer(SERVICE_WORKER, document);
|
||||
|
||||
// We should ideally check that the service worker registration goes through the
|
||||
// "registering" and "running" steps, but it is difficult to workaround race conditions
|
||||
// for a test running on a wide variety of platforms. Due to intermittent failures, we
|
||||
// simply check that the registration transitions to "stopped".
|
||||
let status = container.querySelector(".target-status");
|
||||
const status = container.querySelector(".target-status");
|
||||
await waitUntil(() => status.textContent == "Stopped", 100);
|
||||
is(status.textContent, "Stopped", "Service worker is currently stopped");
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ add_task(async function() {
|
|||
await pushPref("dom.serviceWorkers.idle_timeout", SW_TIMEOUT);
|
||||
await pushPref("dom.serviceWorkers.idle_extended_timeout", SW_TIMEOUT);
|
||||
|
||||
let { tab, document } = await openAboutDebugging("workers");
|
||||
const { tab, document } = await openAboutDebugging("workers");
|
||||
|
||||
let serviceWorkersElement = getServiceWorkerList(document);
|
||||
const serviceWorkersElement = getServiceWorkerList(document);
|
||||
|
||||
let swTab = await addTab(TAB_URL);
|
||||
const swTab = await addTab(TAB_URL);
|
||||
|
||||
info("Wait until the service worker appears in about:debugging");
|
||||
await waitUntilServiceWorkerContainer(SERVICE_WORKER, document);
|
||||
|
@ -30,15 +30,15 @@ add_task(async function() {
|
|||
ok(true, "Service worker registration resolved");
|
||||
|
||||
// Retrieve the DEBUG button for the worker
|
||||
let names = [...document.querySelectorAll("#service-workers .target-name")];
|
||||
let name = names.filter(element => element.textContent === SERVICE_WORKER)[0];
|
||||
const names = [...document.querySelectorAll("#service-workers .target-name")];
|
||||
const name = names.filter(element => element.textContent === SERVICE_WORKER)[0];
|
||||
ok(name, "Found the service worker in the list");
|
||||
let targetElement = name.parentNode.parentNode;
|
||||
let debugBtn = targetElement.querySelector(".debug-button");
|
||||
const targetElement = name.parentNode.parentNode;
|
||||
const debugBtn = targetElement.querySelector(".debug-button");
|
||||
ok(debugBtn, "Found its debug button");
|
||||
|
||||
// Click on it and wait for the toolbox to be ready
|
||||
let onToolboxReady = new Promise(done => {
|
||||
const onToolboxReady = new Promise(done => {
|
||||
gDevTools.once("toolbox-ready", function(toolbox) {
|
||||
done(toolbox);
|
||||
});
|
||||
|
|
|
@ -17,10 +17,10 @@ const TAB_URL = SCOPE + "empty-sw.html";
|
|||
add_task(async function() {
|
||||
await enableServiceWorkerDebugging();
|
||||
|
||||
let { tab, document } = await openAboutDebugging("workers");
|
||||
const { tab, document } = await openAboutDebugging("workers");
|
||||
|
||||
// Open a tab that registers an empty service worker.
|
||||
let swTab = await addTab(TAB_URL);
|
||||
const swTab = await addTab(TAB_URL);
|
||||
|
||||
info("Wait until the service worker appears in about:debugging");
|
||||
await waitUntilServiceWorkerContainer(SERVICE_WORKER, document);
|
||||
|
@ -32,20 +32,20 @@ add_task(async function() {
|
|||
await waitForServiceWorkerRegistered(swTab);
|
||||
ok(true, "Service worker registration resolved");
|
||||
|
||||
let targets = document.querySelectorAll("#service-workers .target");
|
||||
const targets = document.querySelectorAll("#service-workers .target");
|
||||
is(targets.length, 1, "One service worker is now displayed.");
|
||||
|
||||
let target = targets[0];
|
||||
let name = target.querySelector(".target-name");
|
||||
const target = targets[0];
|
||||
const name = target.querySelector(".target-name");
|
||||
is(name.textContent, SERVICE_WORKER, "Found the service worker in the list");
|
||||
|
||||
info("Check the scope displayed scope is correct");
|
||||
let scope = target.querySelector(".service-worker-scope");
|
||||
const scope = target.querySelector(".service-worker-scope");
|
||||
is(scope.textContent, SCOPE,
|
||||
"The expected scope is displayed in the service worker info.");
|
||||
|
||||
info("Unregister the service worker via the unregister link.");
|
||||
let unregisterLink = target.querySelector(".unregister-link");
|
||||
const unregisterLink = target.querySelector(".unregister-link");
|
||||
ok(unregisterLink, "Found the unregister link");
|
||||
|
||||
unregisterLink.click();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
const TAB_URL = "data:text/html,<title>foo</title>";
|
||||
|
||||
add_task(async function() {
|
||||
let { tab, document } = await openAboutDebugging("tabs");
|
||||
const { tab, document } = await openAboutDebugging("tabs");
|
||||
|
||||
// Wait for initial tabs list which may be empty
|
||||
let tabsElement = getTabList(document);
|
||||
|
@ -16,25 +16,25 @@ add_task(async function() {
|
|||
tabsElement = getTabList(document);
|
||||
|
||||
let names = [...tabsElement.querySelectorAll(".target-name")];
|
||||
let initialTabCount = names.length;
|
||||
const initialTabCount = names.length;
|
||||
|
||||
info("Open a new background tab");
|
||||
let newTab = await addTab(TAB_URL, { background: true });
|
||||
const newTab = await addTab(TAB_URL, { background: true });
|
||||
|
||||
info("Wait for the tab to appear in the list with the correct name");
|
||||
let container = await waitUntilTabContainer("foo", document);
|
||||
const container = await waitUntilTabContainer("foo", document);
|
||||
|
||||
info("Wait until the title to update");
|
||||
await waitUntil(() => {
|
||||
return container.querySelector(".target-name").title === TAB_URL;
|
||||
}, 100);
|
||||
|
||||
let icon = container.querySelector(".target-icon");
|
||||
const icon = container.querySelector(".target-icon");
|
||||
ok(icon && icon.src, "Tab icon found and src attribute is not empty");
|
||||
|
||||
info("Check if the tab icon is a valid image");
|
||||
await new Promise(r => {
|
||||
let image = new Image();
|
||||
const image = new Image();
|
||||
image.onload = () => {
|
||||
ok(true, "Favicon is not a broken image");
|
||||
r();
|
||||
|
@ -60,8 +60,8 @@ add_task(async function() {
|
|||
});
|
||||
|
||||
function getTabContainer(name, document) {
|
||||
let nameElements = [...document.querySelectorAll("#tabs .target-name")];
|
||||
let nameElement = nameElements.filter(element => element.textContent === name)[0];
|
||||
const nameElements = [...document.querySelectorAll("#tabs .target-name")];
|
||||
const nameElement = nameElements.filter(element => element.textContent === name)[0];
|
||||
if (nameElement) {
|
||||
return nameElement.closest(".target-container");
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@ async function openAboutDebugging(page, win) {
|
|||
url += "#" + page;
|
||||
}
|
||||
|
||||
let tab = await addTab(url, { window: win });
|
||||
let browser = tab.linkedBrowser;
|
||||
let document = browser.contentDocument;
|
||||
let window = browser.contentWindow;
|
||||
const tab = await addTab(url, { window: win });
|
||||
const browser = tab.linkedBrowser;
|
||||
const document = browser.contentDocument;
|
||||
const window = browser.contentWindow;
|
||||
|
||||
info("Wait until the main about debugging container is available");
|
||||
await waitUntilElement(".app", document);
|
||||
|
@ -39,10 +39,10 @@ function closeAboutDebugging(tab) {
|
|||
}
|
||||
|
||||
function getSupportsFile(path) {
|
||||
let cr = Cc["@mozilla.org/chrome/chrome-registry;1"]
|
||||
const cr = Cc["@mozilla.org/chrome/chrome-registry;1"]
|
||||
.getService(Ci.nsIChromeRegistry);
|
||||
let uri = Services.io.newURI(CHROME_URL_ROOT + path);
|
||||
let fileurl = cr.convertChromeURL(uri);
|
||||
const uri = Services.io.newURI(CHROME_URL_ROOT + path);
|
||||
const fileurl = cr.convertChromeURL(uri);
|
||||
return fileurl.QueryInterface(Ci.nsIFileURL);
|
||||
}
|
||||
|
||||
|
@ -110,8 +110,8 @@ function getServiceWorkerList(document) {
|
|||
* @return {DOMNode} container element
|
||||
*/
|
||||
function getServiceWorkerContainer(name, document) {
|
||||
let nameElements = [...document.querySelectorAll("#service-workers .target-name")];
|
||||
let nameElement = nameElements.filter(element => element.textContent === name)[0];
|
||||
const nameElements = [...document.querySelectorAll("#service-workers .target-name")];
|
||||
const nameElement = nameElements.filter(element => element.textContent === name)[0];
|
||||
if (nameElement) {
|
||||
return nameElement.closest(".target-container");
|
||||
}
|
||||
|
@ -167,9 +167,9 @@ function getTabList(document) {
|
|||
|
||||
async function installAddon({document, path, name, isWebExtension}) {
|
||||
// Mock the file picker to select a test addon
|
||||
let MockFilePicker = SpecialPowers.MockFilePicker;
|
||||
const MockFilePicker = SpecialPowers.MockFilePicker;
|
||||
MockFilePicker.init(window);
|
||||
let file = getSupportsFile(path);
|
||||
const file = getSupportsFile(path);
|
||||
MockFilePicker.setFiles([file.file]);
|
||||
|
||||
let onAddonInstalled;
|
||||
|
@ -208,8 +208,8 @@ async function installAddon({document, path, name, isWebExtension}) {
|
|||
async function uninstallAddon({document, id, name}) {
|
||||
// Now uninstall this addon
|
||||
await new Promise(async done => {
|
||||
let addon = await AddonManager.getAddonByID(id);
|
||||
let listener = {
|
||||
const addon = await AddonManager.getAddonByID(id);
|
||||
const listener = {
|
||||
onUninstalled: function(uninstalledAddon) {
|
||||
if (uninstalledAddon != addon) {
|
||||
return;
|
||||
|
@ -229,7 +229,7 @@ async function uninstallAddon({document, id, name}) {
|
|||
|
||||
function getAddonCount(document) {
|
||||
const addonListContainer = getAddonList(document);
|
||||
let addonElements = addonListContainer.querySelectorAll(".target");
|
||||
const addonElements = addonListContainer.querySelectorAll(".target");
|
||||
return addonElements.length;
|
||||
}
|
||||
|
||||
|
@ -245,8 +245,8 @@ function waitForInitialAddonList(document) {
|
|||
}
|
||||
|
||||
function getAddonContainer(name, document) {
|
||||
let nameElements = [...document.querySelectorAll("#addons-panel .target-name")];
|
||||
let nameElement = nameElements.filter(element => element.textContent === name)[0];
|
||||
const nameElements = [...document.querySelectorAll("#addons-panel .target-name")];
|
||||
const nameElement = nameElements.filter(element => element.textContent === name)[0];
|
||||
if (nameElement) {
|
||||
return nameElement.closest(".addon-target-container");
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ function assertHasTarget(expected, document, type, name) {
|
|||
function waitForServiceWorkerRegistered(tab) {
|
||||
return ContentTask.spawn(tab.linkedBrowser, {}, async function() {
|
||||
// Retrieve the `sw` promise created in the html page.
|
||||
let { sw } = content.wrappedJSObject;
|
||||
const { sw } = content.wrappedJSObject;
|
||||
await sw;
|
||||
});
|
||||
}
|
||||
|
@ -302,10 +302,10 @@ function waitForServiceWorkerRegistered(tab) {
|
|||
async function unregisterServiceWorker(tab, serviceWorkersElement) {
|
||||
// Get the initial count of service worker registrations.
|
||||
let registrations = serviceWorkersElement.querySelectorAll(".target-container");
|
||||
let registrationCount = registrations.length;
|
||||
const registrationCount = registrations.length;
|
||||
|
||||
// Wait until the registration count is decreased by one.
|
||||
let isRemoved = waitUntil(() => {
|
||||
const isRemoved = waitUntil(() => {
|
||||
registrations = serviceWorkersElement.querySelectorAll(".target-container");
|
||||
return registrations.length === registrationCount - 1;
|
||||
}, 100);
|
||||
|
@ -313,8 +313,8 @@ async function unregisterServiceWorker(tab, serviceWorkersElement) {
|
|||
// Unregister the service worker from the content page
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
|
||||
// Retrieve the `sw` promise created in the html page
|
||||
let { sw } = content.wrappedJSObject;
|
||||
let registration = await sw;
|
||||
const { sw } = content.wrappedJSObject;
|
||||
const registration = await sw;
|
||||
await registration.unregister();
|
||||
});
|
||||
|
||||
|
@ -343,7 +343,7 @@ function waitForDelayedStartupFinished(win) {
|
|||
*/
|
||||
async function setupTestAboutDebuggingWebExtension(name, path) {
|
||||
await new Promise(resolve => {
|
||||
let options = {"set": [
|
||||
const options = {"set": [
|
||||
// Force enabling of addons debugging
|
||||
["devtools.chrome.enabled", true],
|
||||
["devtools.debugger.remote-enabled", true],
|
||||
|
@ -355,7 +355,7 @@ async function setupTestAboutDebuggingWebExtension(name, path) {
|
|||
SpecialPowers.pushPrefEnv(options, resolve);
|
||||
});
|
||||
|
||||
let { tab, document } = await openAboutDebugging("addons");
|
||||
const { tab, document } = await openAboutDebugging("addons");
|
||||
await waitForInitialAddonList(document);
|
||||
|
||||
await installAddon({
|
||||
|
@ -366,11 +366,11 @@ async function setupTestAboutDebuggingWebExtension(name, path) {
|
|||
});
|
||||
|
||||
// Retrieve the DEBUG button for the addon
|
||||
let names = getInstalledAddonNames(document);
|
||||
let nameEl = names.filter(element => element.textContent === name)[0];
|
||||
const names = getInstalledAddonNames(document);
|
||||
const nameEl = names.filter(element => element.textContent === name)[0];
|
||||
ok(name, "Found the addon in the list");
|
||||
let targetElement = nameEl.parentNode.parentNode;
|
||||
let debugBtn = targetElement.querySelector(".debug-button");
|
||||
const targetElement = nameEl.parentNode.parentNode;
|
||||
const debugBtn = targetElement.querySelector(".debug-button");
|
||||
ok(debugBtn, "Found its debug button");
|
||||
|
||||
return { tab, document, debugBtn };
|
||||
|
@ -381,12 +381,12 @@ async function setupTestAboutDebuggingWebExtension(name, path) {
|
|||
* corresponding to the provided service worker url.
|
||||
*/
|
||||
async function waitForServiceWorkerActivation(swUrl, document) {
|
||||
let serviceWorkersElement = getServiceWorkerList(document);
|
||||
let names = serviceWorkersElement.querySelectorAll(".target-name");
|
||||
let name = [...names].filter(element => element.textContent === swUrl)[0];
|
||||
const serviceWorkersElement = getServiceWorkerList(document);
|
||||
const names = serviceWorkersElement.querySelectorAll(".target-name");
|
||||
const name = [...names].filter(element => element.textContent === swUrl)[0];
|
||||
|
||||
let targetElement = name.parentNode.parentNode;
|
||||
let targetStatus = targetElement.querySelector(".target-status");
|
||||
const targetElement = name.parentNode.parentNode;
|
||||
const targetStatus = targetElement.querySelector(".target-status");
|
||||
await waitUntil(() => {
|
||||
return targetStatus.textContent !== "Registering";
|
||||
}, 100);
|
||||
|
@ -396,7 +396,7 @@ async function waitForServiceWorkerActivation(swUrl, document) {
|
|||
* Set all preferences needed to enable service worker debugging and testing.
|
||||
*/
|
||||
async function enableServiceWorkerDebugging() {
|
||||
let options = { "set": [
|
||||
const options = { "set": [
|
||||
// Enable service workers.
|
||||
["dom.serviceWorkers.enabled", true],
|
||||
// Accept workers from mochitest's http.
|
||||
|
@ -419,7 +419,7 @@ async function enableServiceWorkerDebugging() {
|
|||
*/
|
||||
function promiseAddonEvent(event) {
|
||||
return new Promise(resolve => {
|
||||
let listener = {
|
||||
const listener = {
|
||||
[event]: function(...args) {
|
||||
AddonManager.removeAddonListener(listener);
|
||||
resolve(args);
|
||||
|
@ -435,7 +435,7 @@ function promiseAddonEvent(event) {
|
|||
*/
|
||||
function installAddonWithManager(filePath) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let install = await AddonManager.getInstallForFile(filePath);
|
||||
const install = await AddonManager.getInstallForFile(filePath);
|
||||
if (!install) {
|
||||
throw new Error(`An install was not created for ${filePath}`);
|
||||
}
|
||||
|
|
|
@ -15,14 +15,14 @@ var sub = null;
|
|||
// The registration promise is expected as a global by head.js's unregisterServiceWorker.
|
||||
var sw = (async function() {
|
||||
await new Promise(resolve => {
|
||||
let perm = { type: "desktop-notification", allow: true, context: document };
|
||||
const perm = { type: "desktop-notification", allow: true, context: document };
|
||||
SpecialPowers.pushPermissions([perm], resolve);
|
||||
});
|
||||
|
||||
let registrationPromise = navigator.serviceWorker.register("push-sw.js");
|
||||
const registrationPromise = navigator.serviceWorker.register("push-sw.js");
|
||||
|
||||
try {
|
||||
let registration = await registrationPromise;
|
||||
const registration = await registrationPromise;
|
||||
dump("SW registered\n");
|
||||
|
||||
try {
|
||||
|
|
|
@ -82,7 +82,7 @@ AccessibilityView.prototype = {
|
|||
// point.
|
||||
if (!accessible || accessible.indexInParent < 0) {
|
||||
const { nodes: children } = await gToolbox.walker.children(node);
|
||||
for (let child of children) {
|
||||
for (const child of children) {
|
||||
if (child.nodeType === nodeConstants.TEXT_NODE) {
|
||||
accessible = await walker.getAccessibleFor(child);
|
||||
if (accessible && accessible.indexInParent >= 0) {
|
||||
|
|
|
@ -50,7 +50,7 @@ class AccessibilityTree extends Component {
|
|||
* and updates.
|
||||
*/
|
||||
componentWillMount() {
|
||||
let { walker } = this.props;
|
||||
const { walker } = this.props;
|
||||
walker.on("reorder", this.onReorder);
|
||||
walker.on("name-change", this.onNameChange);
|
||||
walker.on("text-change", this.onTextChange);
|
||||
|
@ -65,7 +65,7 @@ class AccessibilityTree extends Component {
|
|||
* Remove accessible walker front event listeners.
|
||||
*/
|
||||
componentWillUnmount() {
|
||||
let { walker } = this.props;
|
||||
const { walker } = this.props;
|
||||
walker.off("reorder", this.onReorder);
|
||||
walker.off("name-change", this.onNameChange);
|
||||
walker.off("text-change", this.onTextChange);
|
||||
|
@ -95,7 +95,7 @@ class AccessibilityTree extends Component {
|
|||
* accessible walker as a parent.
|
||||
*/
|
||||
onNameChange(accessible, parent) {
|
||||
let { accessibles, walker, dispatch } = this.props;
|
||||
const { accessibles, walker, dispatch } = this.props;
|
||||
parent = parent || walker;
|
||||
|
||||
if (accessibles.has(accessible.actorID) ||
|
||||
|
@ -113,7 +113,7 @@ class AccessibilityTree extends Component {
|
|||
* changed.
|
||||
*/
|
||||
onTextChange(accessible) {
|
||||
let { accessibles, dispatch } = this.props;
|
||||
const { accessibles, dispatch } = this.props;
|
||||
if (accessibles.has(accessible.actorID)) {
|
||||
dispatch(fetchChildren(accessible));
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ class AccessibilityTree extends Component {
|
|||
* Render Accessibility panel content
|
||||
*/
|
||||
render() {
|
||||
let columns = [{
|
||||
const columns = [{
|
||||
"id": "default",
|
||||
"title": L10N.getStr("accessibility.role")
|
||||
}, {
|
||||
|
@ -131,7 +131,7 @@ class AccessibilityTree extends Component {
|
|||
"title": L10N.getStr("accessibility.name")
|
||||
}];
|
||||
|
||||
let {
|
||||
const {
|
||||
accessibles,
|
||||
dispatch,
|
||||
expanded,
|
||||
|
@ -140,16 +140,16 @@ class AccessibilityTree extends Component {
|
|||
walker
|
||||
} = this.props;
|
||||
|
||||
let renderValue = props => {
|
||||
const renderValue = props => {
|
||||
return Rep(Object.assign({}, props, {
|
||||
defaultRep: Grip,
|
||||
cropLimit: 50,
|
||||
}));
|
||||
};
|
||||
|
||||
let renderRow = rowProps => {
|
||||
let { object } = rowProps.member;
|
||||
let highlighted = object === highlightedItem;
|
||||
const renderRow = rowProps => {
|
||||
const { object } = rowProps.member;
|
||||
const highlighted = object === highlightedItem;
|
||||
return AccessibilityRow(Object.assign({}, rowProps, {
|
||||
walker,
|
||||
highlighted,
|
||||
|
|
|
@ -37,7 +37,7 @@ class AccessiblePropertyClass extends Component {
|
|||
}
|
||||
|
||||
componentDidUpdate({ object: prevObject, accessible: prevAccessible }) {
|
||||
let { accessible, object, focused } = this.props;
|
||||
const { accessible, object, focused } = this.props;
|
||||
// Fast check if row is focused or if the value did not update.
|
||||
if (focused || accessible !== prevAccessible || prevObject === object ||
|
||||
(object && prevObject && typeof object === "object")) {
|
||||
|
@ -48,7 +48,7 @@ class AccessiblePropertyClass extends Component {
|
|||
}
|
||||
|
||||
flashRow() {
|
||||
let row = findDOMNode(this);
|
||||
const row = findDOMNode(this);
|
||||
flashElementOn(row);
|
||||
if (this._flashMutationTimer) {
|
||||
clearTimeout(this._flashMutationTimer);
|
||||
|
@ -96,7 +96,7 @@ class Accessible extends Component {
|
|||
}
|
||||
|
||||
componentWillReceiveProps({ accessible }) {
|
||||
let oldAccessible = this.props.accessible;
|
||||
const oldAccessible = this.props.accessible;
|
||||
|
||||
if (oldAccessible) {
|
||||
if (accessible && accessible.actorID === oldAccessible.actorID) {
|
||||
|
@ -113,21 +113,21 @@ class Accessible extends Component {
|
|||
componentWillUnmount() {
|
||||
window.off(EVENTS.NEW_ACCESSIBLE_FRONT_INSPECTED, this.onAccessibleInspected);
|
||||
|
||||
let { accessible } = this.props;
|
||||
const { accessible } = this.props;
|
||||
if (accessible) {
|
||||
ACCESSIBLE_EVENTS.forEach(event => accessible.off(event, this.update));
|
||||
}
|
||||
}
|
||||
|
||||
onAccessibleInspected() {
|
||||
let { props } = this.refs;
|
||||
const { props } = this.refs;
|
||||
if (props) {
|
||||
props.refs.tree.focus();
|
||||
}
|
||||
}
|
||||
|
||||
update() {
|
||||
let { dispatch, accessible } = this.props;
|
||||
const { dispatch, accessible } = this.props;
|
||||
if (gToolbox) {
|
||||
dispatch(updateDetails(gToolbox.walker, accessible));
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ class Accessible extends Component {
|
|||
|
||||
renderItem(item, depth, focused, arrow, expanded) {
|
||||
const object = item.contents;
|
||||
let valueProps = {
|
||||
const valueProps = {
|
||||
object,
|
||||
mode: MODE.TINY,
|
||||
title: "Object",
|
||||
|
@ -210,7 +210,7 @@ class Accessible extends Component {
|
|||
valueProps.onInspectIconClick = () => this.selectNode(this.props.DOMNode);
|
||||
}
|
||||
|
||||
let classList = [ "node", "object-node" ];
|
||||
const classList = [ "node", "object-node" ];
|
||||
if (focused) {
|
||||
classList.push("focused");
|
||||
}
|
||||
|
@ -278,11 +278,11 @@ class Accessible extends Component {
|
|||
* @return {Object?} Possibly found focused item.
|
||||
*/
|
||||
const findFocused = (focused, items) => {
|
||||
for (let item of items) {
|
||||
for (const item of items) {
|
||||
if (item.path === focused) {
|
||||
return item;
|
||||
}
|
||||
let found = findFocused(focused, item.children);
|
||||
const found = findFocused(focused, item.children);
|
||||
if (found) {
|
||||
return found;
|
||||
}
|
||||
|
@ -306,12 +306,12 @@ const isNode = value => value && value.typeName === "domnode";
|
|||
* @returns {Object} a grip-like object that can be used with Reps.
|
||||
*/
|
||||
const translateNodeFrontToGrip = nodeFront => {
|
||||
let { attributes, actorID, typeName, nodeName, nodeType } = nodeFront;
|
||||
const { attributes, actorID, typeName, nodeName, nodeType } = nodeFront;
|
||||
|
||||
// The main difference between NodeFront and grips is that attributes are treated as
|
||||
// a map in grips and as an array in NodeFronts.
|
||||
let attributesMap = {};
|
||||
for (let { name, value } of attributes) {
|
||||
const attributesMap = {};
|
||||
for (const { name, value } of attributes) {
|
||||
attributesMap[name] = value;
|
||||
}
|
||||
|
||||
|
@ -339,7 +339,7 @@ const translateNodeFrontToGrip = nodeFront => {
|
|||
const makeItemsForDetails = (props, parentPath) =>
|
||||
Object.getOwnPropertyNames(props).map(name => {
|
||||
let children = [];
|
||||
let path = `${parentPath}/${name}`;
|
||||
const path = `${parentPath}/${name}`;
|
||||
let contents = props[name];
|
||||
|
||||
if (contents) {
|
||||
|
@ -370,16 +370,16 @@ const makeParentMap = (items) => {
|
|||
};
|
||||
|
||||
const mapStateToProps = ({ details }) => {
|
||||
let { accessible, DOMNode } = details;
|
||||
const { accessible, DOMNode } = details;
|
||||
if (!accessible || !DOMNode) {
|
||||
return {};
|
||||
}
|
||||
|
||||
let items = makeItemsForDetails(ORDERED_PROPS.reduce((props, key) => {
|
||||
const items = makeItemsForDetails(ORDERED_PROPS.reduce((props, key) => {
|
||||
props[key] = key === "DOMNode" ? DOMNode : accessible[key];
|
||||
return props;
|
||||
}, {}), "");
|
||||
let parents = makeParentMap(items);
|
||||
const parents = makeParentMap(items);
|
||||
|
||||
return { accessible, DOMNode, items, parents };
|
||||
};
|
||||
|
|
|
@ -38,16 +38,16 @@ class Button extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let className = [
|
||||
const className = [
|
||||
...this.props.className.split(" "),
|
||||
"devtools-button"
|
||||
].join(" ");
|
||||
let props = Object.assign({}, this.props, {
|
||||
const props = Object.assign({}, this.props, {
|
||||
className,
|
||||
"aria-busy": this.props.busy
|
||||
});
|
||||
|
||||
let classList = ["btn-content"];
|
||||
const classList = ["btn-content"];
|
||||
if (this.props.busy) {
|
||||
classList.push("devtools-throbber");
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ class Description extends Component {
|
|||
}
|
||||
|
||||
onEnable() {
|
||||
let { accessibility, dispatch } = this.props;
|
||||
const { accessibility, dispatch } = this.props;
|
||||
this.setState({ enabling: true });
|
||||
|
||||
if (gTelemetry) {
|
||||
|
@ -84,9 +84,9 @@ class Description extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let { canBeEnabled } = this.props;
|
||||
let { enabling } = this.state;
|
||||
let enableButtonStr = enabling ? "accessibility.enabling" : "accessibility.enable";
|
||||
const { canBeEnabled } = this.props;
|
||||
const { enabling } = this.state;
|
||||
const enableButtonStr = enabling ? "accessibility.enabling" : "accessibility.enable";
|
||||
|
||||
let title;
|
||||
let disableButton = false;
|
||||
|
|
|
@ -68,12 +68,12 @@ class MainFrame extends Component {
|
|||
}
|
||||
|
||||
resetAccessibility() {
|
||||
let { dispatch, accessibility } = this.props;
|
||||
const { dispatch, accessibility } = this.props;
|
||||
dispatch(reset(accessibility));
|
||||
}
|
||||
|
||||
get useLandscapeMode() {
|
||||
let { clientWidth } = document.getElementById("content");
|
||||
const { clientWidth } = document.getElementById("content");
|
||||
return clientWidth > PORTRAIT_MODE_WIDTH;
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ class MainFrame extends Component {
|
|||
* Render Accessibility panel content
|
||||
*/
|
||||
render() {
|
||||
let { accessibility, walker, enabled } = this.props;
|
||||
const { accessibility, walker, enabled } = this.props;
|
||||
|
||||
if (!enabled) {
|
||||
return Description({ accessibility });
|
||||
|
|
|
@ -48,7 +48,7 @@ class Toolbar extends Component {
|
|||
}
|
||||
|
||||
onDisable() {
|
||||
let { accessibility, dispatch } = this.props;
|
||||
const { accessibility, dispatch } = this.props;
|
||||
this.setState({ disabling: true });
|
||||
|
||||
dispatch(disable(accessibility))
|
||||
|
@ -57,9 +57,9 @@ class Toolbar extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let { canBeDisabled } = this.props;
|
||||
let { disabling } = this.state;
|
||||
let disableButtonStr = disabling ?
|
||||
const { canBeDisabled } = this.props;
|
||||
const { disabling } = this.state;
|
||||
const disableButtonStr = disabling ?
|
||||
"accessibility.disabling" : "accessibility.disable";
|
||||
let title;
|
||||
let isDisabled = false;
|
||||
|
|
|
@ -30,7 +30,7 @@ class Provider {
|
|||
return [];
|
||||
}
|
||||
|
||||
let obj = this.accessibles.get(accessible.actorID);
|
||||
const obj = this.accessibles.get(accessible.actorID);
|
||||
if (!obj || !obj.children) {
|
||||
return this.dispatch(fetchChildren(accessible));
|
||||
}
|
||||
|
|
|
@ -37,12 +37,12 @@ function accessibles(state = getInitialState(), action) {
|
|||
* @param {Object} accessible Accessible object to remove from cache.
|
||||
*/
|
||||
function cleanupChild(cache, accessible) {
|
||||
let cached = cache.get(accessible.actorID);
|
||||
const cached = cache.get(accessible.actorID);
|
||||
if (!cached) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let child of cached.children) {
|
||||
for (const child of cached.children) {
|
||||
cleanupChild(cache, child);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ function cleanupChild(cache, accessible) {
|
|||
* @param {Object} accessible Accessible object to test for staleness.
|
||||
*/
|
||||
function staleChildren(cache, accessible) {
|
||||
let cached = cache.get(accessible.actorID);
|
||||
const cached = cache.get(accessible.actorID);
|
||||
if (!cached) {
|
||||
return false;
|
||||
}
|
||||
|
@ -67,11 +67,11 @@ function staleChildren(cache, accessible) {
|
|||
}
|
||||
|
||||
function updateChildrenCache(cache, accessible, children) {
|
||||
let { actorID } = accessible;
|
||||
const { actorID } = accessible;
|
||||
|
||||
if (cache.has(actorID)) {
|
||||
let cached = cache.get(actorID);
|
||||
for (let child of cached.children) {
|
||||
const cached = cache.get(actorID);
|
||||
for (const child of cached.children) {
|
||||
// If exhisting children cache includes an accessible that is not present
|
||||
// any more or if child accessible is stale remove it and all its children
|
||||
// from cache.
|
||||
|
@ -96,7 +96,7 @@ function updateChildrenCache(cache, accessible, children) {
|
|||
* @return {Object} updated state
|
||||
*/
|
||||
function onReceiveChildren(cache, action) {
|
||||
let { accessible, response: children, error } = action;
|
||||
const { accessible, response: children, error } = action;
|
||||
|
||||
if (error) {
|
||||
console.warn("Error fetching children", accessible, error);
|
||||
|
@ -107,14 +107,14 @@ function onReceiveChildren(cache, action) {
|
|||
}
|
||||
|
||||
function onReceiveAncestry(cache, action) {
|
||||
let { accessible: acc, response: ancestry, error } = action;
|
||||
const { accessible: acc, response: ancestry, error } = action;
|
||||
|
||||
if (error) {
|
||||
console.warn("Error fetching ancestry", acc, error);
|
||||
return cache;
|
||||
}
|
||||
|
||||
let newCache = new Map(cache);
|
||||
const newCache = new Map(cache);
|
||||
ancestry.forEach(({ accessible, children }) =>
|
||||
updateChildrenCache(newCache, accessible, children));
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ function details(state = getInitialState(), action) {
|
|||
* @return {Object} updated state
|
||||
*/
|
||||
function onUpdateDetails(state, action) {
|
||||
let { accessible, response: DOMNode, error } = action;
|
||||
const { accessible, response: DOMNode, error } = action;
|
||||
if (error) {
|
||||
console.warn("Error fetching DOMNode for accessible", accessible, error);
|
||||
return state;
|
||||
|
|
|
@ -76,8 +76,8 @@ function onUnhighlight(state) {
|
|||
}
|
||||
|
||||
function updateExpandedNodes(state, ancestry) {
|
||||
let expanded = new Set(state.expanded);
|
||||
let path = ancestry.reduceRight((accPath, { accessible }) => {
|
||||
const expanded = new Set(state.expanded);
|
||||
const path = ancestry.reduceRight((accPath, { accessible }) => {
|
||||
accPath = TreeView.subPath(accPath, accessible.actorID);
|
||||
expanded.add(accPath);
|
||||
return accPath;
|
||||
|
@ -92,7 +92,7 @@ function onHighlight(state, { accessible, response: ancestry, error }) {
|
|||
return state;
|
||||
}
|
||||
|
||||
let { expanded } = updateExpandedNodes(state, ancestry);
|
||||
const { expanded } = updateExpandedNodes(state, ancestry);
|
||||
return Object.assign({}, state, { expanded, highlighted: accessible });
|
||||
}
|
||||
|
||||
|
@ -102,8 +102,8 @@ function onSelect(state, { accessible, response: ancestry, error }) {
|
|||
return state;
|
||||
}
|
||||
|
||||
let { path, expanded } = updateExpandedNodes(state, ancestry);
|
||||
let selected = TreeView.subPath(path, accessible.actorID);
|
||||
const { path, expanded } = updateExpandedNodes(state, ancestry);
|
||||
const selected = TreeView.subPath(path, accessible.actorID);
|
||||
|
||||
return Object.assign({}, state, { expanded, selected });
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ function onCanBeEnabledChange(state, { canBeEnabled }) {
|
|||
* @return {Object} updated state
|
||||
*/
|
||||
function onReset(state, { accessibility }) {
|
||||
let { enabled, canBeDisabled, canBeEnabled } = accessibility;
|
||||
const { enabled, canBeDisabled, canBeEnabled } = accessibility;
|
||||
toggleHighlightTool(enabled);
|
||||
return Object.assign({}, state, { enabled, canBeDisabled, canBeEnabled });
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
const TEST_URI = "<h1 id=\"h1\">header</h1><p id=\"p\">paragraph</p>";
|
||||
|
||||
add_task(async function testNoShowAccessibilityPropertiesContextMenu() {
|
||||
let tab = await addTab(buildURL(TEST_URI));
|
||||
let { linkedBrowser: browser } = tab;
|
||||
const tab = await addTab(buildURL(TEST_URI));
|
||||
const { linkedBrowser: browser } = tab;
|
||||
|
||||
let contextMenu = document.getElementById("contentAreaContextMenu");
|
||||
let awaitPopupShown = BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
|
||||
const contextMenu = document.getElementById("contentAreaContextMenu");
|
||||
const awaitPopupShown = BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
|
||||
await BrowserTestUtils.synthesizeMouse("#h1", 0, 0, {
|
||||
type: "contextmenu",
|
||||
button: 2,
|
||||
|
@ -18,7 +18,7 @@ add_task(async function testNoShowAccessibilityPropertiesContextMenu() {
|
|||
}, browser);
|
||||
await awaitPopupShown;
|
||||
|
||||
let inspectA11YPropsItem = contextMenu.querySelector("#context-inspect-a11y");
|
||||
const inspectA11YPropsItem = contextMenu.querySelector("#context-inspect-a11y");
|
||||
ok(inspectA11YPropsItem.hidden, "Accessibility tools are not enabled.");
|
||||
contextMenu.hidePopup();
|
||||
gBrowser.removeCurrentTab();
|
||||
|
@ -27,10 +27,10 @@ add_task(async function testNoShowAccessibilityPropertiesContextMenu() {
|
|||
addA11YPanelTask("Test show accessibility properties context menu in browser.",
|
||||
TEST_URI,
|
||||
async function({ panel, toolbox, browser }) {
|
||||
let headerSelector = "#h1";
|
||||
const headerSelector = "#h1";
|
||||
|
||||
let contextMenu = document.getElementById("contentAreaContextMenu");
|
||||
let awaitPopupShown = BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
|
||||
const contextMenu = document.getElementById("contentAreaContextMenu");
|
||||
const awaitPopupShown = BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
|
||||
await BrowserTestUtils.synthesizeMouse(headerSelector, 0, 0, {
|
||||
type: "contextmenu",
|
||||
button: 2,
|
||||
|
@ -38,17 +38,17 @@ addA11YPanelTask("Test show accessibility properties context menu in browser.",
|
|||
}, browser);
|
||||
await awaitPopupShown;
|
||||
|
||||
let inspectA11YPropsItem = contextMenu.querySelector("#context-inspect-a11y");
|
||||
const inspectA11YPropsItem = contextMenu.querySelector("#context-inspect-a11y");
|
||||
|
||||
info("Triggering 'Inspect Accessibility Properties' and waiting for " +
|
||||
"accessibility panel to open");
|
||||
inspectA11YPropsItem.click();
|
||||
contextMenu.hidePopup();
|
||||
|
||||
let selected = await panel.once("new-accessible-front-selected");
|
||||
let expectedSelectedNode = await getNodeFront(headerSelector,
|
||||
const selected = await panel.once("new-accessible-front-selected");
|
||||
const expectedSelectedNode = await getNodeFront(headerSelector,
|
||||
toolbox.getPanel("inspector"));
|
||||
let expectedSelected = await panel.walker.getAccessibleFor(expectedSelectedNode);
|
||||
const expectedSelected = await panel.walker.getAccessibleFor(expectedSelectedNode);
|
||||
is(toolbox.getCurrentPanel(), panel, "Accessibility panel is currently selected");
|
||||
is(selected, expectedSelected, "Accessible front selected correctly");
|
||||
});
|
||||
|
|
|
@ -20,19 +20,19 @@ async function openContextMenuForNode({ toolbox }, selector) {
|
|||
} else if (typeof selector === "string") {
|
||||
await selectNode(selector, inspector, "test");
|
||||
} else {
|
||||
let updated = inspector.once("inspector-updated");
|
||||
const updated = inspector.once("inspector-updated");
|
||||
inspector.selection.setNodeFront(selector, { reason: "test" });
|
||||
await updated;
|
||||
}
|
||||
|
||||
let menuUpdated = inspector.once("node-menu-updated");
|
||||
let allMenuItems = openContextMenuAndGetAllItems(inspector);
|
||||
const menuUpdated = inspector.once("node-menu-updated");
|
||||
const allMenuItems = openContextMenuAndGetAllItems(inspector);
|
||||
await menuUpdated;
|
||||
return allMenuItems;
|
||||
}
|
||||
|
||||
function checkShowA11YPropertiesNode(allMenuItems, disabled) {
|
||||
let showA11YPropertiesNode = allMenuItems.find(item =>
|
||||
const showA11YPropertiesNode = allMenuItems.find(item =>
|
||||
item.id === "node-menu-showaccessibilityproperties");
|
||||
ok(showA11YPropertiesNode,
|
||||
"the popup menu now has a show accessibility properties item");
|
||||
|
@ -45,15 +45,15 @@ async function checkAccessibleObjectSelection({ toolbox, panel }, menuItem, isTe
|
|||
const inspector = await toolbox.getPanel("inspector");
|
||||
info("Triggering 'Show Accessibility Properties' and waiting for " +
|
||||
"accessibility panel to open");
|
||||
let panelSelected = toolbox.once("accessibility-selected");
|
||||
let objectSelected = panel.once("new-accessible-front-selected");
|
||||
const panelSelected = toolbox.once("accessibility-selected");
|
||||
const objectSelected = panel.once("new-accessible-front-selected");
|
||||
menuItem.click();
|
||||
await panelSelected;
|
||||
let selected = await objectSelected;
|
||||
const selected = await objectSelected;
|
||||
|
||||
let expectedNode = isText ?
|
||||
const expectedNode = isText ?
|
||||
inspector.selection.nodeFront.inlineTextChild : inspector.selection.nodeFront;
|
||||
let expectedSelected = await panel.walker.getAccessibleFor(expectedNode);
|
||||
const expectedSelected = await panel.walker.getAccessibleFor(expectedNode);
|
||||
is(selected, expectedSelected, "Accessible front selected correctly");
|
||||
}
|
||||
|
||||
|
@ -74,9 +74,9 @@ addA11YPanelTask("Test show accessibility properties context menu.", TEST_URI,
|
|||
showA11YPropertiesNode = checkShowA11YPropertiesNode(allMenuItems, true);
|
||||
|
||||
const inspector = env.toolbox.getPanel("inspector");
|
||||
let span2 = await getNodeFront("#span-2", inspector);
|
||||
const span2 = await getNodeFront("#span-2", inspector);
|
||||
await inspector.markup.expandNode(span2);
|
||||
let { nodes } = await inspector.walker.children(span2);
|
||||
const { nodes } = await inspector.walker.children(span2);
|
||||
allMenuItems = await openContextMenuForNode(env, nodes[0]);
|
||||
showA11YPropertiesNode = checkShowA11YPropertiesNode(allMenuItems, false);
|
||||
await checkAccessibleObjectSelection(env, showA11YPropertiesNode, false);
|
||||
|
|
|
@ -48,8 +48,8 @@ const tests = [{
|
|||
}, {
|
||||
desc: "Append a new child to the document.",
|
||||
action: async ({ browser }) => ContentTask.spawn(browser, {}, () => {
|
||||
let doc = content.document;
|
||||
let button = doc.createElement("button");
|
||||
const doc = content.document;
|
||||
const button = doc.createElement("button");
|
||||
button.textContent = "Press Me!";
|
||||
doc.body.appendChild(button);
|
||||
}),
|
||||
|
|
|
@ -45,7 +45,7 @@ function shutdownA11y() {
|
|||
Cu.forceShrinkingGC();
|
||||
|
||||
return new Promise(resolve => {
|
||||
let observe = (subject, topic, data) => {
|
||||
const observe = (subject, topic, data) => {
|
||||
if (data === "0") {
|
||||
Services.obs.removeObserver(observe, "a11y-init-or-shutdown");
|
||||
resolve();
|
||||
|
@ -77,11 +77,11 @@ const EXPANDABLE_PROPS = ["actions", "states", "attributes"];
|
|||
async function addTestTab(url) {
|
||||
info("Adding a new test tab with URL: '" + url + "'");
|
||||
|
||||
let tab = await addTab(url);
|
||||
let panel = await initAccessibilityPanel(tab);
|
||||
let win = panel.panelWin;
|
||||
let doc = win.document;
|
||||
let store = win.view.store;
|
||||
const tab = await addTab(url);
|
||||
const panel = await initAccessibilityPanel(tab);
|
||||
const win = panel.panelWin;
|
||||
const doc = win.document;
|
||||
const store = win.view.store;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
doc.getElementById("accessibility-enable-button"), win);
|
||||
|
@ -110,10 +110,10 @@ async function addTestTab(url) {
|
|||
* cleanup function to make sure that the panel is still present.
|
||||
*/
|
||||
async function disableAccessibilityInspector(env) {
|
||||
let { doc, win, panel } = env;
|
||||
const { doc, win, panel } = env;
|
||||
// Disable accessibility service through the panel and wait for the shutdown
|
||||
// event.
|
||||
let shutdown = panel._front.once("shutdown");
|
||||
const shutdown = panel._front.once("shutdown");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
doc.getElementById("accessibility-disable-button"), win);
|
||||
await shutdown;
|
||||
|
@ -128,8 +128,8 @@ async function disableAccessibilityInspector(env) {
|
|||
* @return a promise that is resolved once the panel is open.
|
||||
*/
|
||||
async function initAccessibilityPanel(tab = gBrowser.selectedTab) {
|
||||
let target = TargetFactory.forTab(tab);
|
||||
let toolbox = await gDevTools.showToolbox(target, "accessibility");
|
||||
const target = TargetFactory.forTab(tab);
|
||||
const toolbox = await gDevTools.showToolbox(target, "accessibility");
|
||||
return toolbox.getCurrentPanel();
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ async function initAccessibilityPanel(tab = gBrowser.selectedTab) {
|
|||
*/
|
||||
async function checkTreeState(doc, expected) {
|
||||
info("Checking tree state.");
|
||||
let hasExpectedStructure = await BrowserTestUtils.waitForCondition(() =>
|
||||
const hasExpectedStructure = await BrowserTestUtils.waitForCondition(() =>
|
||||
[...doc.querySelectorAll(".treeRow")].every((row, i) =>
|
||||
row.querySelector(".treeLabelCell").textContent === expected[i].role &&
|
||||
row.querySelector(".treeValueCell").textContent === expected[i].name),
|
||||
|
@ -158,8 +158,8 @@ async function checkTreeState(doc, expected) {
|
|||
async function checkSidebarState(store, expectedState) {
|
||||
info("Checking sidebar state.");
|
||||
await waitUntilState(store, ({ details }) => {
|
||||
for (let key of ORDERED_PROPS) {
|
||||
let expected = expectedState[key];
|
||||
for (const key of ORDERED_PROPS) {
|
||||
const expected = expectedState[key];
|
||||
if (expected === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
@ -195,9 +195,9 @@ function selectRow(doc, rowNumber) {
|
|||
* @param {Number} rowNumber number of the row/tree node to be toggled.
|
||||
*/
|
||||
async function toggleRow(doc, rowNumber) {
|
||||
let win = doc.defaultView;
|
||||
let twisty = doc.querySelectorAll(".theme-twisty")[rowNumber];
|
||||
let expected = !twisty.classList.contains("open");
|
||||
const win = doc.defaultView;
|
||||
const twisty = doc.querySelectorAll(".theme-twisty")[rowNumber];
|
||||
const expected = !twisty.classList.contains("open");
|
||||
|
||||
info(`${expected ? "Expanding" : "Collapsing"} row ${rowNumber}.`);
|
||||
|
||||
|
@ -223,14 +223,14 @@ async function toggleRow(doc, rowNumber) {
|
|||
* structure as the return value of 'addTestTab' funciton)
|
||||
*/
|
||||
async function runA11yPanelTests(tests, env) {
|
||||
for (let { desc, action, expected } of tests) {
|
||||
for (const { desc, action, expected } of tests) {
|
||||
info(desc);
|
||||
|
||||
if (action) {
|
||||
await action(env);
|
||||
}
|
||||
|
||||
let { tree, sidebar } = expected;
|
||||
const { tree, sidebar } = expected;
|
||||
if (tree) {
|
||||
await checkTreeState(env.doc, tree);
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ function addA11yPanelTestsTask(tests, uri, msg) {
|
|||
function addA11YPanelTask(msg, uri, task) {
|
||||
add_task(async function a11YPanelTask() {
|
||||
info(msg);
|
||||
let env = await addTestTab(buildURL(uri));
|
||||
const env = await addTestTab(buildURL(uri));
|
||||
await task(env);
|
||||
await disableAccessibilityInspector(env);
|
||||
});
|
||||
|
|
|
@ -66,12 +66,12 @@ window.Application = {
|
|||
*/
|
||||
async createMessageContexts() {
|
||||
const locales = Services.locale.getAppLocalesAsBCP47();
|
||||
let generator = L10nRegistry.generateContexts(locales, ["devtools/application.ftl"]);
|
||||
const generator = L10nRegistry.generateContexts(locales, ["devtools/application.ftl"]);
|
||||
|
||||
// Return value of generateContexts is a generator and should be converted to
|
||||
// a sync iterable before using it with React.
|
||||
let contexts = [];
|
||||
for await (let message of generator) {
|
||||
const contexts = [];
|
||||
for await (const message of generator) {
|
||||
contexts.push(message);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ window.Application = {
|
|||
},
|
||||
|
||||
async updateWorkers() {
|
||||
let { service } = await this.client.mainRoot.listAllWorkers();
|
||||
const { service } = await this.client.mainRoot.listAllWorkers();
|
||||
this.actions.updateWorkers(service);
|
||||
},
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class Worker extends Component {
|
|||
return;
|
||||
}
|
||||
|
||||
let { client, worker } = this.props;
|
||||
const { client, worker } = this.props;
|
||||
gDevToolsBrowser.openWorkerToolbox(client, worker.workerActor);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ class Worker extends Component {
|
|||
return;
|
||||
}
|
||||
|
||||
let { client, worker } = this.props;
|
||||
const { client, worker } = this.props;
|
||||
client.request({
|
||||
to: worker.registrationActor,
|
||||
type: "start"
|
||||
|
@ -72,7 +72,7 @@ class Worker extends Component {
|
|||
}
|
||||
|
||||
unregister() {
|
||||
let { client, worker } = this.props;
|
||||
const { client, worker } = this.props;
|
||||
client.request({
|
||||
to: worker.registrationActor,
|
||||
type: "unregister"
|
||||
|
@ -101,18 +101,18 @@ class Worker extends Component {
|
|||
}
|
||||
|
||||
formatScope(scope) {
|
||||
let [, remainder] = getUnicodeUrl(scope).split("://");
|
||||
const [, remainder] = getUnicodeUrl(scope).split("://");
|
||||
return remainder || scope;
|
||||
}
|
||||
|
||||
formatSource(source) {
|
||||
let parts = source.split("/");
|
||||
const parts = source.split("/");
|
||||
return getUnicodeUrlPath(parts[parts.length - 1]);
|
||||
}
|
||||
|
||||
render() {
|
||||
let { worker } = this.props;
|
||||
let status = this.getServiceWorkerStatus();
|
||||
const { worker } = this.props;
|
||||
const status = this.getServiceWorkerStatus();
|
||||
|
||||
const unregisterButton = this.isActive() ?
|
||||
Localized(
|
||||
|
|
|
@ -22,7 +22,7 @@ function getDomainFromUrl(url) {
|
|||
function pageReducer(state = PageState(), action) {
|
||||
switch (action.type) {
|
||||
case UPDATE_DOMAIN: {
|
||||
let { url } = action;
|
||||
const { url } = action;
|
||||
return {
|
||||
domain: getDomainFromUrl(url)
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@ function WorkersState() {
|
|||
function workersReducer(state = WorkersState(), action) {
|
||||
switch (action.type) {
|
||||
case UPDATE_WORKERS: {
|
||||
let { workers } = action;
|
||||
const { workers } = action;
|
||||
return { list: workers };
|
||||
}
|
||||
|
||||
|
|
|
@ -13,26 +13,26 @@ const TAB_URL = URL_ROOT + "service-workers/debug.html";
|
|||
add_task(async function() {
|
||||
await enableApplicationPanel();
|
||||
|
||||
let { panel, tab, target } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
let doc = panel.panelWin.document;
|
||||
const { panel, tab, target } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
info("Wait until the service worker appears in the application panel");
|
||||
await waitUntil(() => getWorkerContainers(doc).length === 1);
|
||||
|
||||
let container = getWorkerContainers(doc)[0];
|
||||
const container = getWorkerContainers(doc)[0];
|
||||
info("Wait until the debug link is displayed and enabled");
|
||||
await waitUntil(() =>
|
||||
container.querySelector(".js-debug-link:not(.worker__debug-link--disabled)"));
|
||||
|
||||
info("Click on the debug link and wait for the new toolbox to be ready");
|
||||
let onToolboxReady = gDevTools.once("toolbox-ready");
|
||||
const onToolboxReady = gDevTools.once("toolbox-ready");
|
||||
|
||||
let debugLink = container.querySelector(".js-debug-link");
|
||||
const debugLink = container.querySelector(".js-debug-link");
|
||||
debugLink.click();
|
||||
|
||||
let serviceWorkerToolbox = await onToolboxReady;
|
||||
const serviceWorkerToolbox = await onToolboxReady;
|
||||
await serviceWorkerToolbox.selectTool("jsdebugger");
|
||||
let debuggerContext = createDebuggerContext(serviceWorkerToolbox);
|
||||
const debuggerContext = createDebuggerContext(serviceWorkerToolbox);
|
||||
|
||||
await waitForSources(debuggerContext, "debug-sw.js");
|
||||
await selectSource(debuggerContext, "debug-sw.js");
|
||||
|
|
|
@ -16,8 +16,8 @@ const EMPTY_URL = (URL_ROOT + "service-workers/empty.html")
|
|||
add_task(async function() {
|
||||
await enableApplicationPanel();
|
||||
|
||||
let { panel, target } = await openNewTabAndApplicationPanel(SIMPLE_URL);
|
||||
let doc = panel.panelWin.document;
|
||||
const { panel, target } = await openNewTabAndApplicationPanel(SIMPLE_URL);
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
info("Wait until the service worker appears in the application panel");
|
||||
await waitUntil(() => getWorkerContainers(doc).length === 1);
|
||||
|
|
|
@ -14,8 +14,8 @@ const OTHER_SCOPE_URL = URL_ROOT + "service-workers/scope-page.html";
|
|||
add_task(async function() {
|
||||
await enableApplicationPanel();
|
||||
|
||||
let { panel, target } = await openNewTabAndApplicationPanel(SIMPLE_URL);
|
||||
let doc = panel.panelWin.document;
|
||||
const { panel, target } = await openNewTabAndApplicationPanel(SIMPLE_URL);
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
info("Wait until the service worker appears in the application panel");
|
||||
await waitUntil(() => getWorkerContainers(doc).length === 1);
|
||||
|
|
|
@ -8,10 +8,10 @@ const TAB_URL = URL_ROOT + "service-workers/dynamic-registration.html";
|
|||
add_task(async function() {
|
||||
await enableApplicationPanel();
|
||||
|
||||
let { panel, tab } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
let doc = panel.panelWin.document;
|
||||
const { panel, tab } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
let isWorkerListEmpty = !!doc.querySelector(".worker-list-empty");
|
||||
const isWorkerListEmpty = !!doc.querySelector(".worker-list-empty");
|
||||
ok(isWorkerListEmpty, "No Service Worker displayed");
|
||||
|
||||
info("Register a service worker in the page.");
|
||||
|
@ -22,24 +22,24 @@ add_task(async function() {
|
|||
info("Wait until the service worker appears in the application panel");
|
||||
await waitUntil(() => getWorkerContainers(doc).length > 0);
|
||||
|
||||
let workerContainer = getWorkerContainers(doc)[0];
|
||||
const workerContainer = getWorkerContainers(doc)[0];
|
||||
|
||||
info("Wait until the unregister button is displayed for the service worker");
|
||||
await waitUntil(() => workerContainer.querySelector(".js-unregister-button"));
|
||||
|
||||
let scopeEl = workerContainer.querySelector(".js-sw-scope");
|
||||
let expectedScope = "example.com/browser/devtools/client/application/test/" +
|
||||
const scopeEl = workerContainer.querySelector(".js-sw-scope");
|
||||
const expectedScope = "example.com/browser/devtools/client/application/test/" +
|
||||
"service-workers/";
|
||||
ok(scopeEl.textContent.startsWith(expectedScope),
|
||||
"Service worker has the expected scope");
|
||||
|
||||
let updatedEl = workerContainer.querySelector(".js-sw-updated");
|
||||
const updatedEl = workerContainer.querySelector(".js-sw-updated");
|
||||
ok(updatedEl.textContent.includes(`${new Date().getFullYear()}`),
|
||||
"Service worker has a last updated time");
|
||||
|
||||
info("Unregister the service worker");
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
|
||||
let registration = await content.wrappedJSObject.sw;
|
||||
const registration = await content.wrappedJSObject.sw;
|
||||
registration.unregister();
|
||||
});
|
||||
|
||||
|
|
|
@ -14,22 +14,22 @@ const TAB_URL = (URL_ROOT + "service-workers/simple-unicode.html")
|
|||
add_task(async function() {
|
||||
await enableApplicationPanel();
|
||||
|
||||
let { panel, target } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
let doc = panel.panelWin.document;
|
||||
const { panel, target } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
info("Wait until the service worker appears in the application panel");
|
||||
await waitUntil(() => getWorkerContainers(doc).length === 1);
|
||||
|
||||
let workerContainer = getWorkerContainers(doc)[0];
|
||||
const workerContainer = getWorkerContainers(doc)[0];
|
||||
|
||||
let scopeEl = workerContainer.querySelector(".js-sw-scope");
|
||||
const scopeEl = workerContainer.querySelector(".js-sw-scope");
|
||||
ok(
|
||||
scopeEl.textContent.startsWith(
|
||||
"\u03C0\u03B1\u03C1\u03AC\u03B4\u03B5\u03B9\u03B3\u03BC\u03B1." +
|
||||
"\u03B4\u03BF\u03BA\u03B9\u03BC\u03AE"),
|
||||
"Service worker has the expected Unicode scope"
|
||||
);
|
||||
let urlEl = workerContainer.querySelector(".js-source-url");
|
||||
const urlEl = workerContainer.querySelector(".js-source-url");
|
||||
ok(
|
||||
urlEl.textContent.endsWith("\u65E5\u672C"),
|
||||
"Service worker has the expected Unicode url"
|
||||
|
|
|
@ -46,12 +46,12 @@ function navigate(target, url, waitForTargetEvent = "navigate") {
|
|||
}
|
||||
|
||||
async function openNewTabAndApplicationPanel(url) {
|
||||
let tab = await addTab(url);
|
||||
let target = TargetFactory.forTab(tab);
|
||||
const tab = await addTab(url);
|
||||
const target = TargetFactory.forTab(tab);
|
||||
await target.makeRemote();
|
||||
|
||||
let toolbox = await gDevTools.showToolbox(target, "application");
|
||||
let panel = toolbox.getCurrentPanel();
|
||||
const toolbox = await gDevTools.showToolbox(target, "application");
|
||||
const panel = toolbox.getCurrentPanel();
|
||||
return { panel, tab, target, toolbox };
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ async function unregisterAllWorkers(client) {
|
|||
});
|
||||
|
||||
info("Unregister all service workers");
|
||||
for (let worker of workers.service) {
|
||||
for (const worker of workers.service) {
|
||||
await client.request({
|
||||
to: worker.registrationActor,
|
||||
type: "unregister"
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
|
||||
// Bug 1328293
|
||||
self.onfetch = function(event) {
|
||||
let a = 5;
|
||||
const a = 5;
|
||||
console.log(a);
|
||||
};
|
||||
|
|
|
@ -49,46 +49,46 @@ var CallsListView = extend(WidgetMethods, {
|
|||
this.empty();
|
||||
|
||||
for (let i = 0, len = functionCalls.length; i < len; i++) {
|
||||
let call = functionCalls[i];
|
||||
const call = functionCalls[i];
|
||||
|
||||
let view = document.createElement("vbox");
|
||||
const view = document.createElement("vbox");
|
||||
view.className = "call-item-view devtools-monospace";
|
||||
view.setAttribute("flex", "1");
|
||||
|
||||
let contents = document.createElement("hbox");
|
||||
const contents = document.createElement("hbox");
|
||||
contents.className = "call-item-contents";
|
||||
contents.setAttribute("align", "center");
|
||||
contents.addEventListener("dblclick", this._onExpand);
|
||||
view.appendChild(contents);
|
||||
|
||||
let index = document.createElement("label");
|
||||
const index = document.createElement("label");
|
||||
index.className = "plain call-item-index";
|
||||
index.setAttribute("flex", "1");
|
||||
index.setAttribute("value", i + 1);
|
||||
|
||||
let gutter = document.createElement("hbox");
|
||||
const gutter = document.createElement("hbox");
|
||||
gutter.className = "call-item-gutter";
|
||||
gutter.appendChild(index);
|
||||
contents.appendChild(gutter);
|
||||
|
||||
if (call.callerPreview) {
|
||||
let context = document.createElement("label");
|
||||
const context = document.createElement("label");
|
||||
context.className = "plain call-item-context";
|
||||
context.setAttribute("value", call.callerPreview);
|
||||
contents.appendChild(context);
|
||||
|
||||
let separator = document.createElement("label");
|
||||
const separator = document.createElement("label");
|
||||
separator.className = "plain call-item-separator";
|
||||
separator.setAttribute("value", ".");
|
||||
contents.appendChild(separator);
|
||||
}
|
||||
|
||||
let name = document.createElement("label");
|
||||
const name = document.createElement("label");
|
||||
name.className = "plain call-item-name";
|
||||
name.setAttribute("value", call.name);
|
||||
contents.appendChild(name);
|
||||
|
||||
let argsPreview = document.createElement("label");
|
||||
const argsPreview = document.createElement("label");
|
||||
argsPreview.className = "plain call-item-args";
|
||||
argsPreview.setAttribute("crop", "end");
|
||||
argsPreview.setAttribute("flex", "100");
|
||||
|
@ -100,7 +100,7 @@ var CallsListView = extend(WidgetMethods, {
|
|||
}
|
||||
contents.appendChild(argsPreview);
|
||||
|
||||
let location = document.createElement("label");
|
||||
const location = document.createElement("label");
|
||||
location.className = "plain call-item-location";
|
||||
location.setAttribute("value", getFileName(call.file) + ":" + call.line);
|
||||
location.setAttribute("crop", "start");
|
||||
|
@ -139,15 +139,15 @@ var CallsListView = extend(WidgetMethods, {
|
|||
* A single "snapshot-image" instance received from the backend.
|
||||
*/
|
||||
showScreenshot: function(screenshot) {
|
||||
let { index, width, height, scaling, flipped, pixels } = screenshot;
|
||||
const { index, width, height, scaling, flipped, pixels } = screenshot;
|
||||
|
||||
let screenshotNode = $("#screenshot-image");
|
||||
const screenshotNode = $("#screenshot-image");
|
||||
screenshotNode.setAttribute("flipped", flipped);
|
||||
drawBackground("screenshot-rendering", width, height, pixels);
|
||||
|
||||
let dimensionsNode = $("#screenshot-dimensions");
|
||||
let actualWidth = (width / scaling) | 0;
|
||||
let actualHeight = (height / scaling) | 0;
|
||||
const dimensionsNode = $("#screenshot-dimensions");
|
||||
const actualWidth = (width / scaling) | 0;
|
||||
const actualHeight = (height / scaling) | 0;
|
||||
dimensionsNode.setAttribute("value",
|
||||
SHARED_L10N.getFormatStr("dimensions", actualWidth, actualHeight));
|
||||
|
||||
|
@ -165,7 +165,7 @@ var CallsListView = extend(WidgetMethods, {
|
|||
while (this._filmstrip.hasChildNodes()) {
|
||||
this._filmstrip.firstChild.remove();
|
||||
}
|
||||
for (let thumbnail of thumbnails) {
|
||||
for (const thumbnail of thumbnails) {
|
||||
this.appendThumbnail(thumbnail);
|
||||
}
|
||||
|
||||
|
@ -180,9 +180,9 @@ var CallsListView = extend(WidgetMethods, {
|
|||
* A single "snapshot-image" instance received from the backend.
|
||||
*/
|
||||
appendThumbnail: function(thumbnail) {
|
||||
let { index, width, height, flipped, pixels } = thumbnail;
|
||||
const { index, width, height, flipped, pixels } = thumbnail;
|
||||
|
||||
let thumbnailNode = document.createElementNS(HTML_NS, "canvas");
|
||||
const thumbnailNode = document.createElementNS(HTML_NS, "canvas");
|
||||
thumbnailNode.setAttribute("flipped", flipped);
|
||||
thumbnailNode.width = Math.max(CanvasFront.THUMBNAIL_SIZE, width);
|
||||
thumbnailNode.height = Math.max(CanvasFront.THUMBNAIL_SIZE, height);
|
||||
|
@ -203,13 +203,13 @@ var CallsListView = extend(WidgetMethods, {
|
|||
* The context function call's index.
|
||||
*/
|
||||
set highlightedThumbnail(index) {
|
||||
let currHighlightedThumbnail = $(".filmstrip-thumbnail[index='" + index + "']");
|
||||
const currHighlightedThumbnail = $(".filmstrip-thumbnail[index='" + index + "']");
|
||||
if (currHighlightedThumbnail == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
let prevIndex = this._highlightedThumbnailIndex;
|
||||
let prevHighlightedThumbnail = $(".filmstrip-thumbnail[index='" + prevIndex + "']");
|
||||
const prevIndex = this._highlightedThumbnailIndex;
|
||||
const prevHighlightedThumbnail = $(".filmstrip-thumbnail[index='" + prevIndex + "']");
|
||||
if (prevHighlightedThumbnail) {
|
||||
prevHighlightedThumbnail.removeAttribute("highlighted");
|
||||
}
|
||||
|
@ -259,8 +259,8 @@ var CallsListView = extend(WidgetMethods, {
|
|||
setConditionalTimeout("screenshot-display", SCREENSHOT_DISPLAY_DELAY, () => {
|
||||
return !this._isSliding;
|
||||
}, () => {
|
||||
let frameSnapshot = SnapshotsListView.selectedItem.attachment.actor;
|
||||
let functionCall = callItem.attachment.actor;
|
||||
const frameSnapshot = SnapshotsListView.selectedItem.attachment.actor;
|
||||
const functionCall = callItem.attachment.actor;
|
||||
frameSnapshot.generateScreenshotFor(functionCall).then(screenshot => {
|
||||
this.showScreenshot(screenshot);
|
||||
this.highlightedThumbnail = screenshot.index;
|
||||
|
@ -272,14 +272,14 @@ var CallsListView = extend(WidgetMethods, {
|
|||
* The input listener for the calls searchbox.
|
||||
*/
|
||||
_onSearch: function(e) {
|
||||
let lowerCaseSearchToken = this._searchbox.value.toLowerCase();
|
||||
const lowerCaseSearchToken = this._searchbox.value.toLowerCase();
|
||||
|
||||
this.filterContents(e => {
|
||||
let call = e.attachment.actor;
|
||||
let name = call.name.toLowerCase();
|
||||
let file = call.file.toLowerCase();
|
||||
let line = call.line.toString().toLowerCase();
|
||||
let args = call.argsPreview.toLowerCase();
|
||||
const call = e.attachment.actor;
|
||||
const name = call.name.toLowerCase();
|
||||
const file = call.file.toLowerCase();
|
||||
const line = call.line.toString().toLowerCase();
|
||||
const args = call.argsPreview.toLowerCase();
|
||||
|
||||
return name.includes(lowerCaseSearchToken) ||
|
||||
file.includes(lowerCaseSearchToken) ||
|
||||
|
@ -300,18 +300,18 @@ var CallsListView = extend(WidgetMethods, {
|
|||
* When expanding an item, it's corresponding call stack will be displayed.
|
||||
*/
|
||||
_onExpand: function(e) {
|
||||
let callItem = this.getItemForElement(e.target);
|
||||
let view = $(".call-item-view", callItem.target);
|
||||
const callItem = this.getItemForElement(e.target);
|
||||
const view = $(".call-item-view", callItem.target);
|
||||
|
||||
// If the call stack nodes were already created, simply re-show them
|
||||
// or jump to the corresponding file and line in the Debugger if a
|
||||
// location link was clicked.
|
||||
if (view.hasAttribute("call-stack-populated")) {
|
||||
let isExpanded = view.getAttribute("call-stack-expanded") == "true";
|
||||
const isExpanded = view.getAttribute("call-stack-expanded") == "true";
|
||||
|
||||
// If clicking on the location, jump to the Debugger.
|
||||
if (e.target.classList.contains("call-item-location")) {
|
||||
let { file, line } = callItem.attachment.actor;
|
||||
const { file, line } = callItem.attachment.actor;
|
||||
this._viewSourceInDebugger(file, line);
|
||||
return;
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ var CallsListView = extend(WidgetMethods, {
|
|||
return;
|
||||
}
|
||||
|
||||
let list = document.createElement("vbox");
|
||||
const list = document.createElement("vbox");
|
||||
list.className = "call-item-stack";
|
||||
view.setAttribute("call-stack-populated", "");
|
||||
view.setAttribute("call-stack-expanded", "true");
|
||||
|
@ -331,24 +331,24 @@ var CallsListView = extend(WidgetMethods, {
|
|||
/**
|
||||
* Creates a function call nodes in this container for a stack.
|
||||
*/
|
||||
let display = stack => {
|
||||
const display = stack => {
|
||||
for (let i = 1; i < stack.length; i++) {
|
||||
let call = stack[i];
|
||||
const call = stack[i];
|
||||
|
||||
let contents = document.createElement("hbox");
|
||||
const contents = document.createElement("hbox");
|
||||
contents.className = "call-item-stack-fn";
|
||||
contents.style.paddingInlineStart = (i * STACK_FUNC_INDENTATION) + "px";
|
||||
|
||||
let name = document.createElement("label");
|
||||
const name = document.createElement("label");
|
||||
name.className = "plain call-item-stack-fn-name";
|
||||
name.setAttribute("value", "↳ " + call.name + "()");
|
||||
contents.appendChild(name);
|
||||
|
||||
let spacer = document.createElement("spacer");
|
||||
const spacer = document.createElement("spacer");
|
||||
spacer.setAttribute("flex", "100");
|
||||
contents.appendChild(spacer);
|
||||
|
||||
let location = document.createElement("label");
|
||||
const location = document.createElement("label");
|
||||
location.className = "plain call-item-stack-fn-location";
|
||||
location.setAttribute("value", getFileName(call.file) + ":" + call.line);
|
||||
location.setAttribute("crop", "start");
|
||||
|
@ -364,7 +364,7 @@ var CallsListView = extend(WidgetMethods, {
|
|||
|
||||
// If this animation snapshot is loaded from disk, there are no corresponding
|
||||
// backend actors available and the data is immediately available.
|
||||
let functionCall = callItem.attachment.actor;
|
||||
const functionCall = callItem.attachment.actor;
|
||||
if (functionCall.isLoadedFromDisk) {
|
||||
display(functionCall.stack);
|
||||
} else {
|
||||
|
@ -400,7 +400,7 @@ var CallsListView = extend(WidgetMethods, {
|
|||
*/
|
||||
_onResume: function() {
|
||||
// Jump to the next draw call in the recorded animation frame snapshot.
|
||||
let drawCall = getNextDrawCall(this.items, this.selectedItem);
|
||||
const drawCall = getNextDrawCall(this.items, this.selectedItem);
|
||||
if (drawCall) {
|
||||
this.selectedItem = drawCall;
|
||||
return;
|
||||
|
@ -425,8 +425,8 @@ var CallsListView = extend(WidgetMethods, {
|
|||
this._onResume();
|
||||
return;
|
||||
}
|
||||
let callItem = this.selectedItem;
|
||||
let { file, line } = callItem.attachment.actor;
|
||||
const callItem = this.selectedItem;
|
||||
const { file, line } = callItem.attachment.actor;
|
||||
this._viewSourceInDebugger(file, line);
|
||||
},
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ var $all = (selector, target = document) => target.querySelectorAll(selector);
|
|||
*/
|
||||
function getFileName(url) {
|
||||
try {
|
||||
let { fileName } = NetworkHelper.nsIURL(url);
|
||||
const { fileName } = NetworkHelper.nsIURL(url);
|
||||
return fileName || "/";
|
||||
} catch (e) {
|
||||
// This doesn't look like a url, or nsIURL can't handle it.
|
||||
|
@ -213,7 +213,7 @@ function getFileName(url) {
|
|||
* The requested image data buffer.
|
||||
*/
|
||||
function getImageDataStorage(ctx, w, h) {
|
||||
let storage = getImageDataStorage.cache;
|
||||
const storage = getImageDataStorage.cache;
|
||||
if (storage && storage.width == w && storage.height == h) {
|
||||
return storage;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ getImageDataStorage.cache = null;
|
|||
* supplied pixels don't completely cover the canvas.
|
||||
*/
|
||||
function drawImage(canvas, width, height, pixels, options = {}) {
|
||||
let ctx = canvas.getContext("2d");
|
||||
const ctx = canvas.getContext("2d");
|
||||
|
||||
// FrameSnapshot actors return "snapshot-image" type instances with just an
|
||||
// empty pixel array if the source image is completely transparent.
|
||||
|
@ -253,12 +253,12 @@ function drawImage(canvas, width, height, pixels, options = {}) {
|
|||
return;
|
||||
}
|
||||
|
||||
let imageData = getImageDataStorage(ctx, width, height);
|
||||
const imageData = getImageDataStorage(ctx, width, height);
|
||||
imageData.data.set(pixels);
|
||||
|
||||
if (options.centered) {
|
||||
let left = (canvas.width - width) / 2;
|
||||
let top = (canvas.height - height) / 2;
|
||||
const left = (canvas.width - width) / 2;
|
||||
const top = (canvas.height - height) / 2;
|
||||
ctx.putImageData(imageData, left, top);
|
||||
} else {
|
||||
ctx.putImageData(imageData, 0, 0);
|
||||
|
@ -279,7 +279,7 @@ function drawImage(canvas, width, height, pixels, options = {}) {
|
|||
* An array buffer view of the image data.
|
||||
*/
|
||||
function drawBackground(id, width, height, pixels) {
|
||||
let canvas = document.createElementNS(HTML_NS, "canvas");
|
||||
const canvas = document.createElementNS(HTML_NS, "canvas");
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
|
||||
|
@ -297,8 +297,8 @@ function drawBackground(id, width, height, pixels) {
|
|||
*/
|
||||
function getNextDrawCall(calls, call) {
|
||||
for (let i = calls.indexOf(call) + 1, len = calls.length; i < len; i++) {
|
||||
let nextCall = calls[i];
|
||||
let name = nextCall.attachment.actor.name;
|
||||
const nextCall = calls[i];
|
||||
const name = nextCall.attachment.actor.name;
|
||||
if (CanvasFront.DRAW_CALLS.has(name)) {
|
||||
return nextCall;
|
||||
}
|
||||
|
@ -312,8 +312,8 @@ function getNextDrawCall(calls, call) {
|
|||
*/
|
||||
function getScreenshotFromCallLoadedFromDisk(calls, call) {
|
||||
for (let i = calls.indexOf(call); i >= 0; i--) {
|
||||
let prevCall = calls[i];
|
||||
let screenshot = prevCall.screenshot;
|
||||
const prevCall = calls[i];
|
||||
const screenshot = prevCall.screenshot;
|
||||
if (screenshot) {
|
||||
return screenshot;
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ function getScreenshotFromCallLoadedFromDisk(calls, call) {
|
|||
*/
|
||||
function getThumbnailForCall(thumbnails, index) {
|
||||
for (let i = thumbnails.length - 1; i >= 0; i--) {
|
||||
let thumbnail = thumbnails[i];
|
||||
const thumbnail = thumbnails[i];
|
||||
if (thumbnail.index <= index) {
|
||||
return thumbnail;
|
||||
}
|
||||
|
|
|
@ -47,36 +47,36 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
* The newly inserted item.
|
||||
*/
|
||||
addSnapshot: function() {
|
||||
let contents = document.createElement("hbox");
|
||||
const contents = document.createElement("hbox");
|
||||
contents.className = "snapshot-item";
|
||||
|
||||
let thumbnail = document.createElementNS(HTML_NS, "canvas");
|
||||
const thumbnail = document.createElementNS(HTML_NS, "canvas");
|
||||
thumbnail.className = "snapshot-item-thumbnail";
|
||||
thumbnail.width = CanvasFront.THUMBNAIL_SIZE;
|
||||
thumbnail.height = CanvasFront.THUMBNAIL_SIZE;
|
||||
|
||||
let title = document.createElement("label");
|
||||
const title = document.createElement("label");
|
||||
title.className = "plain snapshot-item-title";
|
||||
title.setAttribute("value",
|
||||
L10N.getFormatStr("snapshotsList.itemLabel", this.itemCount + 1));
|
||||
|
||||
let calls = document.createElement("label");
|
||||
const calls = document.createElement("label");
|
||||
calls.className = "plain snapshot-item-calls";
|
||||
calls.setAttribute("value",
|
||||
L10N.getStr("snapshotsList.loadingLabel"));
|
||||
|
||||
let save = document.createElement("label");
|
||||
const save = document.createElement("label");
|
||||
save.className = "plain snapshot-item-save";
|
||||
save.addEventListener("click", this._onSaveButtonClick);
|
||||
|
||||
let spacer = document.createElement("spacer");
|
||||
const spacer = document.createElement("spacer");
|
||||
spacer.setAttribute("flex", "1");
|
||||
|
||||
let footer = document.createElement("hbox");
|
||||
const footer = document.createElement("hbox");
|
||||
footer.className = "snapshot-item-footer";
|
||||
footer.appendChild(save);
|
||||
|
||||
let details = document.createElement("vbox");
|
||||
const details = document.createElement("vbox");
|
||||
details.className = "snapshot-item-details";
|
||||
details.appendChild(title);
|
||||
details.appendChild(calls);
|
||||
|
@ -125,30 +125,30 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
// Make sure the function call actors are stored on the item,
|
||||
// to be used when populating the CallsListView.
|
||||
snapshotItem.attachment.actor = snapshotActor;
|
||||
let functionCalls = snapshotItem.attachment.calls = snapshotOverview.calls;
|
||||
let thumbnails = snapshotItem.attachment.thumbnails = snapshotOverview.thumbnails;
|
||||
let screenshot = snapshotItem.attachment.screenshot = snapshotOverview.screenshot;
|
||||
const functionCalls = snapshotItem.attachment.calls = snapshotOverview.calls;
|
||||
const thumbnails = snapshotItem.attachment.thumbnails = snapshotOverview.thumbnails;
|
||||
const screenshot = snapshotItem.attachment.screenshot = snapshotOverview.screenshot;
|
||||
|
||||
let lastThumbnail = thumbnails[thumbnails.length - 1];
|
||||
let { width, height, flipped, pixels } = lastThumbnail;
|
||||
const lastThumbnail = thumbnails[thumbnails.length - 1];
|
||||
const { width, height, flipped, pixels } = lastThumbnail;
|
||||
|
||||
let thumbnailNode = $(".snapshot-item-thumbnail", snapshotItem.target);
|
||||
const thumbnailNode = $(".snapshot-item-thumbnail", snapshotItem.target);
|
||||
thumbnailNode.setAttribute("flipped", flipped);
|
||||
drawImage(thumbnailNode, width, height, pixels, { centered: true });
|
||||
|
||||
let callsNode = $(".snapshot-item-calls", snapshotItem.target);
|
||||
let drawCalls = functionCalls.filter(e => CanvasFront.DRAW_CALLS.has(e.name));
|
||||
const callsNode = $(".snapshot-item-calls", snapshotItem.target);
|
||||
const drawCalls = functionCalls.filter(e => CanvasFront.DRAW_CALLS.has(e.name));
|
||||
|
||||
let drawCallsStr = PluralForm.get(drawCalls.length,
|
||||
const drawCallsStr = PluralForm.get(drawCalls.length,
|
||||
L10N.getStr("snapshotsList.drawCallsLabel"));
|
||||
let funcCallsStr = PluralForm.get(functionCalls.length,
|
||||
const funcCallsStr = PluralForm.get(functionCalls.length,
|
||||
L10N.getStr("snapshotsList.functionCallsLabel"));
|
||||
|
||||
callsNode.setAttribute("value",
|
||||
drawCallsStr.replace("#1", drawCalls.length) + ", " +
|
||||
funcCallsStr.replace("#1", functionCalls.length));
|
||||
|
||||
let saveNode = $(".snapshot-item-save", snapshotItem.target);
|
||||
const saveNode = $(".snapshot-item-save", snapshotItem.target);
|
||||
saveNode.setAttribute("disabled", !!snapshotItem.isLoadedFromDisk);
|
||||
saveNode.setAttribute("value", snapshotItem.isLoadedFromDisk
|
||||
? L10N.getStr("snapshotsList.loadedLabel")
|
||||
|
@ -169,7 +169,7 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
if (!snapshotItem || !snapshotItem.attachment.actor) {
|
||||
return;
|
||||
}
|
||||
let { calls, thumbnails, screenshot } = snapshotItem.attachment;
|
||||
const { calls, thumbnails, screenshot } = snapshotItem.attachment;
|
||||
|
||||
$("#reload-notice").hidden = true;
|
||||
$("#empty-notice").hidden = true;
|
||||
|
@ -302,7 +302,7 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
*/
|
||||
async _stopRecordingAnimation() {
|
||||
clearNamedTimeout("canvas-actor-recording");
|
||||
let actorCanStop = await gTarget.actorHasMethod("canvas", "stopRecordingAnimationFrame");
|
||||
const actorCanStop = await gTarget.actorHasMethod("canvas", "stopRecordingAnimationFrame");
|
||||
|
||||
if (actorCanStop) {
|
||||
await gFront.stopRecordingAnimationFrame();
|
||||
|
@ -325,8 +325,8 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
async _onRecordSuccess(snapshotActor) {
|
||||
// Clear bail-out case if frame found in CANVAS_ACTOR_RECORDING_ATTEMPT milliseconds
|
||||
clearNamedTimeout("canvas-actor-recording");
|
||||
let snapshotItem = this.getItemAtIndex(this.itemCount - 1);
|
||||
let snapshotOverview = await snapshotActor.getOverview();
|
||||
const snapshotItem = this.getItemAtIndex(this.itemCount - 1);
|
||||
const snapshotOverview = await snapshotActor.getOverview();
|
||||
this.customizeSnapshot(snapshotItem, snapshotActor, snapshotOverview);
|
||||
|
||||
this._recording = false;
|
||||
|
@ -351,7 +351,7 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
* The click listener for the "import" button in this container.
|
||||
*/
|
||||
_onImportButtonClick: function() {
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
const fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
fp.init(window, L10N.getStr("snapshotsList.saveDialogTitle"), Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilter(L10N.getStr("snapshotsList.saveDialogJSONFilter"), "*.json");
|
||||
fp.appendFilter(L10N.getStr("snapshotsList.saveDialogAllFilter"), "*.*");
|
||||
|
@ -361,7 +361,7 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
return;
|
||||
}
|
||||
|
||||
let channel = NetUtil.newChannel({
|
||||
const channel = NetUtil.newChannel({
|
||||
uri: NetUtil.newURI(fp.file), loadUsingSystemPrincipal: true});
|
||||
channel.contentType = "text/plain";
|
||||
|
||||
|
@ -372,7 +372,7 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
}
|
||||
var data;
|
||||
try {
|
||||
let string = NetUtil.readInputStreamToString(inputStream, inputStream.available());
|
||||
const string = NetUtil.readInputStreamToString(inputStream, inputStream.available());
|
||||
data = JSON.parse(string);
|
||||
} catch (e) {
|
||||
console.error("Could not read animation frame snapshot file.");
|
||||
|
@ -385,7 +385,7 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
|
||||
// Add a `isLoadedFromDisk` flag on everything to avoid sending invalid
|
||||
// requests to the backend, since we're not dealing with actors anymore.
|
||||
let snapshotItem = this.addSnapshot();
|
||||
const snapshotItem = this.addSnapshot();
|
||||
snapshotItem.isLoadedFromDisk = true;
|
||||
data.calls.forEach(e => e.isLoadedFromDisk = true);
|
||||
|
||||
|
@ -398,9 +398,9 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
* The click listener for the "save" button of each item in this container.
|
||||
*/
|
||||
_onSaveButtonClick: function(e) {
|
||||
let snapshotItem = this.getItemForElement(e.target);
|
||||
const snapshotItem = this.getItemForElement(e.target);
|
||||
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
const fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
fp.init(window, L10N.getStr("snapshotsList.saveDialogTitle"), Ci.nsIFilePicker.modeSave);
|
||||
fp.appendFilter(L10N.getStr("snapshotsList.saveDialogJSONFilter"), "*.json");
|
||||
fp.appendFilter(L10N.getStr("snapshotsList.saveDialogAllFilter"), "*.*");
|
||||
|
@ -408,21 +408,21 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
|
||||
// Start serializing all the function call actors for the specified snapshot,
|
||||
// while the nsIFilePicker dialog is being opened. Snappy.
|
||||
let serialized = (async function() {
|
||||
let data = {
|
||||
const serialized = (async function() {
|
||||
const data = {
|
||||
fileType: CALLS_LIST_SERIALIZER_IDENTIFIER,
|
||||
version: CALLS_LIST_SERIALIZER_VERSION,
|
||||
calls: [],
|
||||
thumbnails: [],
|
||||
screenshot: null
|
||||
};
|
||||
let functionCalls = snapshotItem.attachment.calls;
|
||||
let thumbnails = snapshotItem.attachment.thumbnails;
|
||||
let screenshot = snapshotItem.attachment.screenshot;
|
||||
const functionCalls = snapshotItem.attachment.calls;
|
||||
const thumbnails = snapshotItem.attachment.thumbnails;
|
||||
const screenshot = snapshotItem.attachment.screenshot;
|
||||
|
||||
// Prepare all the function calls for serialization.
|
||||
await DevToolsUtils.yieldingEach(functionCalls, (call, i) => {
|
||||
let { type, name, file, line, timestamp, argsPreview, callerPreview } = call;
|
||||
const { type, name, file, line, timestamp, argsPreview, callerPreview } = call;
|
||||
return call.getDetails().then(({ stack }) => {
|
||||
data.calls[i] = {
|
||||
type: type,
|
||||
|
@ -439,16 +439,16 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
|
||||
// Prepare all the thumbnails for serialization.
|
||||
await DevToolsUtils.yieldingEach(thumbnails, (thumbnail, i) => {
|
||||
let { index, width, height, flipped, pixels } = thumbnail;
|
||||
const { index, width, height, flipped, pixels } = thumbnail;
|
||||
data.thumbnails.push({ index, width, height, flipped, pixels });
|
||||
});
|
||||
|
||||
// Prepare the screenshot for serialization.
|
||||
let { index, width, height, flipped, pixels } = screenshot;
|
||||
const { index, width, height, flipped, pixels } = screenshot;
|
||||
data.screenshot = { index, width, height, flipped, pixels };
|
||||
|
||||
let string = JSON.stringify(data);
|
||||
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
const string = JSON.stringify(data);
|
||||
const converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
|
||||
converter.charset = "UTF-8";
|
||||
|
@ -461,8 +461,8 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
if (result == Ci.nsIFilePicker.returnCancel) {
|
||||
return;
|
||||
}
|
||||
let footer = $(".snapshot-item-footer", snapshotItem.target);
|
||||
let save = $(".snapshot-item-save", snapshotItem.target);
|
||||
const footer = $(".snapshot-item-footer", snapshotItem.target);
|
||||
const save = $(".snapshot-item-save", snapshotItem.target);
|
||||
|
||||
// Show a throbber and a "Saving…" label if serializing isn't immediate.
|
||||
setNamedTimeout("call-list-save", CALLS_LIST_SLOW_SAVE_DELAY, () => {
|
||||
|
@ -472,7 +472,7 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
});
|
||||
|
||||
serialized.then(inputStream => {
|
||||
let outputStream = FileUtils.openSafeFileOutputStream(fp.file);
|
||||
const outputStream = FileUtils.openSafeFileOutputStream(fp.file);
|
||||
|
||||
NetUtil.asyncCopy(inputStream, outputStream, status => {
|
||||
if (!Components.isSuccessCode(status)) {
|
||||
|
@ -489,8 +489,8 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
});
|
||||
|
||||
function showNotification(toolbox, name, message) {
|
||||
let notificationBox = toolbox.getNotificationBox();
|
||||
let notification = notificationBox.getNotificationWithValue(name);
|
||||
const notificationBox = toolbox.getNotificationBox();
|
||||
const notification = notificationBox.getNotificationWithValue(name);
|
||||
if (!notification) {
|
||||
notificationBox.appendNotification(message, name, "", notificationBox.PRIORITY_WARNING_HIGH);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, front } = await initCallWatcherBackend(SIMPLE_CANVAS_URL);
|
||||
const { target, front } = await initCallWatcherBackend(SIMPLE_CANVAS_URL);
|
||||
|
||||
ok(target, "Should have a target available.");
|
||||
ok(front, "Should have a protocol front available.");
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, front } = await initCallWatcherBackend(SIMPLE_CANVAS_URL);
|
||||
const { target, front } = await initCallWatcherBackend(SIMPLE_CANVAS_URL);
|
||||
|
||||
let navigated = once(target, "navigate");
|
||||
const navigated = once(target, "navigate");
|
||||
|
||||
await front.setup({
|
||||
tracedGlobals: ["CanvasRenderingContext2D", "WebGLRenderingContext"],
|
||||
|
@ -25,7 +25,7 @@ async function ifTestingSupported() {
|
|||
// Allow the content to execute some functions.
|
||||
await waitForTick();
|
||||
|
||||
let functionCalls = await front.pauseRecording();
|
||||
const functionCalls = await front.pauseRecording();
|
||||
ok(functionCalls,
|
||||
"An array of function call actors was sent after reloading.");
|
||||
ok(functionCalls.length > 0,
|
||||
|
@ -45,7 +45,7 @@ async function ifTestingSupported() {
|
|||
is(functionCalls[0].argsPreview, "0, 0, 128, 128",
|
||||
"The called function's args preview is correct.");
|
||||
|
||||
let details = await functionCalls[1].getDetails();
|
||||
const details = await functionCalls[1].getDetails();
|
||||
ok(details,
|
||||
"The first called function has some details available.");
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, front } = await initCanvasDebuggerBackend(SIMPLE_CANVAS_URL);
|
||||
const { target, front } = await initCanvasDebuggerBackend(SIMPLE_CANVAS_URL);
|
||||
|
||||
let navigated = once(target, "navigate");
|
||||
const navigated = once(target, "navigate");
|
||||
|
||||
await front.setup({ reload: true });
|
||||
ok(true, "The front was setup up successfully.");
|
||||
|
@ -17,15 +17,15 @@ async function ifTestingSupported() {
|
|||
await navigated;
|
||||
ok(true, "Target automatically navigated when the front was set up.");
|
||||
|
||||
let snapshotActor = await front.recordAnimationFrame();
|
||||
const snapshotActor = await front.recordAnimationFrame();
|
||||
ok(snapshotActor,
|
||||
"A snapshot actor was sent after recording.");
|
||||
|
||||
let animationOverview = await snapshotActor.getOverview();
|
||||
const animationOverview = await snapshotActor.getOverview();
|
||||
ok(snapshotActor,
|
||||
"An animation overview could be retrieved after recording.");
|
||||
|
||||
let functionCalls = animationOverview.calls;
|
||||
const functionCalls = animationOverview.calls;
|
||||
ok(functionCalls,
|
||||
"An array of function call actors was sent after recording.");
|
||||
is(functionCalls.length, 8,
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, front } = await initCanvasDebuggerBackend(SIMPLE_CANVAS_URL);
|
||||
const { target, front } = await initCanvasDebuggerBackend(SIMPLE_CANVAS_URL);
|
||||
|
||||
let navigated = once(target, "navigate");
|
||||
const navigated = once(target, "navigate");
|
||||
|
||||
await front.setup({ reload: true });
|
||||
ok(true, "The front was setup up successfully.");
|
||||
|
@ -17,15 +17,15 @@ async function ifTestingSupported() {
|
|||
await navigated;
|
||||
ok(true, "Target automatically navigated when the front was set up.");
|
||||
|
||||
let snapshotActor = await front.recordAnimationFrame();
|
||||
const snapshotActor = await front.recordAnimationFrame();
|
||||
ok(snapshotActor,
|
||||
"A snapshot actor was sent after recording.");
|
||||
|
||||
let animationOverview = await snapshotActor.getOverview();
|
||||
const animationOverview = await snapshotActor.getOverview();
|
||||
ok(animationOverview,
|
||||
"An animation overview could be retrieved after recording.");
|
||||
|
||||
let thumbnails = animationOverview.thumbnails;
|
||||
const thumbnails = animationOverview.thumbnails;
|
||||
ok(thumbnails,
|
||||
"An array of thumbnails was sent after recording.");
|
||||
is(thumbnails.length, 4,
|
||||
|
@ -80,6 +80,6 @@ async function ifTestingSupported() {
|
|||
}
|
||||
|
||||
function Uint32(src) {
|
||||
let charView = new Uint8Array(src);
|
||||
const charView = new Uint8Array(src);
|
||||
return new Uint32Array(charView.buffer);
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, front } = await initCanvasDebuggerBackend(SIMPLE_CANVAS_URL);
|
||||
const { target, front } = await initCanvasDebuggerBackend(SIMPLE_CANVAS_URL);
|
||||
|
||||
let navigated = once(target, "navigate");
|
||||
const navigated = once(target, "navigate");
|
||||
|
||||
await front.setup({ reload: true });
|
||||
ok(true, "The front was setup up successfully.");
|
||||
|
@ -17,15 +17,15 @@ async function ifTestingSupported() {
|
|||
await navigated;
|
||||
ok(true, "Target automatically navigated when the front was set up.");
|
||||
|
||||
let snapshotActor = await front.recordAnimationFrame();
|
||||
const snapshotActor = await front.recordAnimationFrame();
|
||||
ok(snapshotActor,
|
||||
"A snapshot actor was sent after recording.");
|
||||
|
||||
let animationOverview = await snapshotActor.getOverview();
|
||||
const animationOverview = await snapshotActor.getOverview();
|
||||
ok(snapshotActor,
|
||||
"An animation overview could be retrieved after recording.");
|
||||
|
||||
let screenshot = animationOverview.screenshot;
|
||||
const screenshot = animationOverview.screenshot;
|
||||
ok(screenshot,
|
||||
"A screenshot was sent after recording.");
|
||||
|
||||
|
@ -45,6 +45,6 @@ async function ifTestingSupported() {
|
|||
}
|
||||
|
||||
function Uint32(src) {
|
||||
let charView = new Uint8Array(src);
|
||||
const charView = new Uint8Array(src);
|
||||
return new Uint32Array(charView.buffer);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, front } = await initCanvasDebuggerBackend(SIMPLE_CANVAS_TRANSPARENT_URL);
|
||||
const { target, front } = await initCanvasDebuggerBackend(SIMPLE_CANVAS_TRANSPARENT_URL);
|
||||
|
||||
let navigated = once(target, "navigate");
|
||||
const navigated = once(target, "navigate");
|
||||
|
||||
await front.setup({ reload: true });
|
||||
ok(true, "The front was setup up successfully.");
|
||||
|
@ -16,10 +16,10 @@ async function ifTestingSupported() {
|
|||
await navigated;
|
||||
ok(true, "Target automatically navigated when the front was set up.");
|
||||
|
||||
let snapshotActor = await front.recordAnimationFrame();
|
||||
let animationOverview = await snapshotActor.getOverview();
|
||||
const snapshotActor = await front.recordAnimationFrame();
|
||||
const animationOverview = await snapshotActor.getOverview();
|
||||
|
||||
let functionCalls = animationOverview.calls;
|
||||
const functionCalls = animationOverview.calls;
|
||||
ok(functionCalls,
|
||||
"An array of function call actors was sent after recording.");
|
||||
is(functionCalls.length, 8,
|
||||
|
@ -34,10 +34,10 @@ async function ifTestingSupported() {
|
|||
is(functionCalls[6].name, "fillRect",
|
||||
"The fourth called function's name is correct.");
|
||||
|
||||
let firstDrawCallScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[0]);
|
||||
let secondDrawCallScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[2]);
|
||||
let thirdDrawCallScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[4]);
|
||||
let fourthDrawCallScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[6]);
|
||||
const firstDrawCallScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[0]);
|
||||
const secondDrawCallScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[2]);
|
||||
const thirdDrawCallScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[4]);
|
||||
const fourthDrawCallScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[6]);
|
||||
|
||||
ok(firstDrawCallScreenshot,
|
||||
"The first draw call has a screenshot attached.");
|
||||
|
@ -95,6 +95,6 @@ async function ifTestingSupported() {
|
|||
}
|
||||
|
||||
function Uint32(src) {
|
||||
let charView = new Uint8Array(src);
|
||||
const charView = new Uint8Array(src);
|
||||
return new Uint32Array(charView.buffer);
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, front } = await initCanvasDebuggerBackend(SIMPLE_CANVAS_URL);
|
||||
const { target, front } = await initCanvasDebuggerBackend(SIMPLE_CANVAS_URL);
|
||||
|
||||
let navigated = once(target, "navigate");
|
||||
const navigated = once(target, "navigate");
|
||||
|
||||
await front.setup({ reload: true });
|
||||
ok(true, "The front was setup up successfully.");
|
||||
|
@ -17,18 +17,18 @@ async function ifTestingSupported() {
|
|||
await navigated;
|
||||
ok(true, "Target automatically navigated when the front was set up.");
|
||||
|
||||
let snapshotActor = await front.recordAnimationFrame();
|
||||
let animationOverview = await snapshotActor.getOverview();
|
||||
const snapshotActor = await front.recordAnimationFrame();
|
||||
const animationOverview = await snapshotActor.getOverview();
|
||||
|
||||
let functionCalls = animationOverview.calls;
|
||||
const functionCalls = animationOverview.calls;
|
||||
ok(functionCalls,
|
||||
"An array of function call actors was sent after recording.");
|
||||
is(functionCalls.length, 8,
|
||||
"The number of function call actors is correct.");
|
||||
|
||||
let firstNonDrawCall = await functionCalls[1].getDetails();
|
||||
let secondNonDrawCall = await functionCalls[3].getDetails();
|
||||
let lastNonDrawCall = await functionCalls[7].getDetails();
|
||||
const firstNonDrawCall = await functionCalls[1].getDetails();
|
||||
const secondNonDrawCall = await functionCalls[3].getDetails();
|
||||
const lastNonDrawCall = await functionCalls[7].getDetails();
|
||||
|
||||
is(firstNonDrawCall.name, "fillStyle",
|
||||
"The first non-draw function's name is correct.");
|
||||
|
@ -37,9 +37,9 @@ async function ifTestingSupported() {
|
|||
is(lastNonDrawCall.name, "requestAnimationFrame",
|
||||
"The last non-draw function's name is correct.");
|
||||
|
||||
let firstScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[1]);
|
||||
let secondScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[3]);
|
||||
let lastScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[7]);
|
||||
const firstScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[1]);
|
||||
const secondScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[3]);
|
||||
const lastScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[7]);
|
||||
|
||||
ok(firstScreenshot,
|
||||
"A screenshot was successfully retrieved for the first non-draw function.");
|
||||
|
@ -48,7 +48,7 @@ async function ifTestingSupported() {
|
|||
ok(lastScreenshot,
|
||||
"A screenshot was successfully retrieved for the last non-draw function.");
|
||||
|
||||
let firstActualScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[0]);
|
||||
const firstActualScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[0]);
|
||||
ok(sameArray(firstScreenshot.pixels, firstActualScreenshot.pixels),
|
||||
"The screenshot for the first non-draw function is correct.");
|
||||
is(firstScreenshot.width, 128,
|
||||
|
@ -56,7 +56,7 @@ async function ifTestingSupported() {
|
|||
is(firstScreenshot.height, 128,
|
||||
"The screenshot for the first non-draw function has the correct height.");
|
||||
|
||||
let secondActualScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[2]);
|
||||
const secondActualScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[2]);
|
||||
ok(sameArray(secondScreenshot.pixels, secondActualScreenshot.pixels),
|
||||
"The screenshot for the second non-draw function is correct.");
|
||||
is(secondScreenshot.width, 128,
|
||||
|
@ -64,7 +64,7 @@ async function ifTestingSupported() {
|
|||
is(secondScreenshot.height, 128,
|
||||
"The screenshot for the second non-draw function has the correct height.");
|
||||
|
||||
let lastActualScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[6]);
|
||||
const lastActualScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[6]);
|
||||
ok(sameArray(lastScreenshot.pixels, lastActualScreenshot.pixels),
|
||||
"The screenshot for the last non-draw function is correct.");
|
||||
is(lastScreenshot.width, 128,
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, front } = await initCanvasDebuggerBackend(SIMPLE_BITMASKS_URL);
|
||||
const { target, front } = await initCanvasDebuggerBackend(SIMPLE_BITMASKS_URL);
|
||||
|
||||
let navigated = once(target, "navigate");
|
||||
const navigated = once(target, "navigate");
|
||||
|
||||
await front.setup({ reload: true });
|
||||
ok(true, "The front was setup up successfully.");
|
||||
|
@ -17,9 +17,9 @@ async function ifTestingSupported() {
|
|||
await navigated;
|
||||
ok(true, "Target automatically navigated when the front was set up.");
|
||||
|
||||
let snapshotActor = await front.recordAnimationFrame();
|
||||
let animationOverview = await snapshotActor.getOverview();
|
||||
let functionCalls = animationOverview.calls;
|
||||
const snapshotActor = await front.recordAnimationFrame();
|
||||
const animationOverview = await snapshotActor.getOverview();
|
||||
const functionCalls = animationOverview.calls;
|
||||
|
||||
is(functionCalls[0].name, "clearRect",
|
||||
"The first called function's name is correct.");
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, front } = await initCanvasDebuggerBackend(WEBGL_ENUM_URL);
|
||||
const { target, front } = await initCanvasDebuggerBackend(WEBGL_ENUM_URL);
|
||||
|
||||
let navigated = once(target, "navigate");
|
||||
const navigated = once(target, "navigate");
|
||||
|
||||
await front.setup({ reload: true });
|
||||
ok(true, "The front was setup up successfully.");
|
||||
|
@ -17,9 +17,9 @@ async function ifTestingSupported() {
|
|||
await navigated;
|
||||
ok(true, "Target automatically navigated when the front was set up.");
|
||||
|
||||
let snapshotActor = await front.recordAnimationFrame();
|
||||
let animationOverview = await snapshotActor.getOverview();
|
||||
let functionCalls = animationOverview.calls;
|
||||
const snapshotActor = await front.recordAnimationFrame();
|
||||
const animationOverview = await snapshotActor.getOverview();
|
||||
const functionCalls = animationOverview.calls;
|
||||
|
||||
is(functionCalls[0].name, "clear",
|
||||
"The function's name is correct.");
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, front } = await initCanvasDebuggerBackend(WEBGL_BINDINGS_URL);
|
||||
const { target, front } = await initCanvasDebuggerBackend(WEBGL_BINDINGS_URL);
|
||||
loadFrameScriptUtils();
|
||||
|
||||
let navigated = once(target, "navigate");
|
||||
const navigated = once(target, "navigate");
|
||||
|
||||
await front.setup({ reload: true });
|
||||
ok(true, "The front was setup up successfully.");
|
||||
|
@ -18,11 +18,11 @@ async function ifTestingSupported() {
|
|||
await navigated;
|
||||
ok(true, "Target automatically navigated when the front was set up.");
|
||||
|
||||
let snapshotActor = await front.recordAnimationFrame();
|
||||
let animationOverview = await snapshotActor.getOverview();
|
||||
let functionCalls = animationOverview.calls;
|
||||
const snapshotActor = await front.recordAnimationFrame();
|
||||
const animationOverview = await snapshotActor.getOverview();
|
||||
const functionCalls = animationOverview.calls;
|
||||
|
||||
let firstScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[0]);
|
||||
const firstScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[0]);
|
||||
is(firstScreenshot.index, -1,
|
||||
"The first screenshot didn't encounter any draw call.");
|
||||
is(firstScreenshot.scaling, 0.25,
|
||||
|
@ -58,7 +58,7 @@ async function ifTestingSupported() {
|
|||
512,
|
||||
"The debuggee's gl context viewport's left coord. wasn't changed.");
|
||||
|
||||
let secondScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[1]);
|
||||
const secondScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[1]);
|
||||
is(secondScreenshot.index, 1,
|
||||
"The second screenshot has the correct index.");
|
||||
is(secondScreenshot.width, CanvasFront.WEBGL_SCREENSHOT_MAX_HEIGHT,
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, front } = await initCanvasDebuggerBackend(SET_TIMEOUT_URL);
|
||||
const { target, front } = await initCanvasDebuggerBackend(SET_TIMEOUT_URL);
|
||||
|
||||
let navigated = once(target, "navigate");
|
||||
const navigated = once(target, "navigate");
|
||||
|
||||
await front.setup({ reload: true });
|
||||
ok(true, "The front was setup up successfully.");
|
||||
|
@ -17,15 +17,15 @@ async function ifTestingSupported() {
|
|||
await navigated;
|
||||
ok(true, "Target automatically navigated when the front was set up.");
|
||||
|
||||
let snapshotActor = await front.recordAnimationFrame();
|
||||
const snapshotActor = await front.recordAnimationFrame();
|
||||
ok(snapshotActor,
|
||||
"A snapshot actor was sent after recording.");
|
||||
|
||||
let animationOverview = await snapshotActor.getOverview();
|
||||
const animationOverview = await snapshotActor.getOverview();
|
||||
ok(snapshotActor,
|
||||
"An animation overview could be retrieved after recording.");
|
||||
|
||||
let functionCalls = animationOverview.calls;
|
||||
const functionCalls = animationOverview.calls;
|
||||
ok(functionCalls,
|
||||
"An array of function call actors was sent after recording.");
|
||||
is(functionCalls.length, 8,
|
||||
|
@ -70,9 +70,9 @@ async function ifTestingSupported() {
|
|||
is(functionCalls[7].callerPreview, "Object",
|
||||
"The last called function's caller preview is correct.");
|
||||
|
||||
let firstNonDrawCall = await functionCalls[1].getDetails();
|
||||
let secondNonDrawCall = await functionCalls[3].getDetails();
|
||||
let lastNonDrawCall = await functionCalls[7].getDetails();
|
||||
const firstNonDrawCall = await functionCalls[1].getDetails();
|
||||
const secondNonDrawCall = await functionCalls[3].getDetails();
|
||||
const lastNonDrawCall = await functionCalls[7].getDetails();
|
||||
|
||||
is(firstNonDrawCall.name, "fillStyle",
|
||||
"The first non-draw function's name is correct.");
|
||||
|
@ -81,9 +81,9 @@ async function ifTestingSupported() {
|
|||
is(lastNonDrawCall.name, "setTimeout",
|
||||
"The last non-draw function's name is correct.");
|
||||
|
||||
let firstScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[1]);
|
||||
let secondScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[3]);
|
||||
let lastScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[7]);
|
||||
const firstScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[1]);
|
||||
const secondScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[3]);
|
||||
const lastScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[7]);
|
||||
|
||||
ok(firstScreenshot,
|
||||
"A screenshot was successfully retrieved for the first non-draw function.");
|
||||
|
@ -92,7 +92,7 @@ async function ifTestingSupported() {
|
|||
ok(lastScreenshot,
|
||||
"A screenshot was successfully retrieved for the last non-draw function.");
|
||||
|
||||
let firstActualScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[0]);
|
||||
const firstActualScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[0]);
|
||||
ok(sameArray(firstScreenshot.pixels, firstActualScreenshot.pixels),
|
||||
"The screenshot for the first non-draw function is correct.");
|
||||
is(firstScreenshot.width, 128,
|
||||
|
@ -100,7 +100,7 @@ async function ifTestingSupported() {
|
|||
is(firstScreenshot.height, 128,
|
||||
"The screenshot for the first non-draw function has the correct height.");
|
||||
|
||||
let secondActualScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[2]);
|
||||
const secondActualScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[2]);
|
||||
ok(sameArray(secondScreenshot.pixels, secondActualScreenshot.pixels),
|
||||
"The screenshot for the second non-draw function is correct.");
|
||||
is(secondScreenshot.width, 128,
|
||||
|
@ -108,7 +108,7 @@ async function ifTestingSupported() {
|
|||
is(secondScreenshot.height, 128,
|
||||
"The screenshot for the second non-draw function has the correct height.");
|
||||
|
||||
let lastActualScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[6]);
|
||||
const lastActualScreenshot = await snapshotActor.generateScreenshotFor(functionCalls[6]);
|
||||
ok(sameArray(lastScreenshot.pixels, lastActualScreenshot.pixels),
|
||||
"The screenshot for the last non-draw function is correct.");
|
||||
is(lastScreenshot.width, 128,
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, front } = await initCanvasDebuggerBackend(NO_CANVAS_URL);
|
||||
const { target, front } = await initCanvasDebuggerBackend(NO_CANVAS_URL);
|
||||
loadFrameScriptUtils();
|
||||
|
||||
let navigated = once(target, "navigate");
|
||||
const navigated = once(target, "navigate");
|
||||
|
||||
await front.setup({ reload: true });
|
||||
ok(true, "The front was setup up successfully.");
|
||||
|
@ -18,7 +18,7 @@ async function ifTestingSupported() {
|
|||
await navigated;
|
||||
ok(true, "Target automatically navigated when the front was set up.");
|
||||
|
||||
let startRecording = front.recordAnimationFrame();
|
||||
const startRecording = front.recordAnimationFrame();
|
||||
await front.stopRecordingAnimationFrame();
|
||||
|
||||
ok(!(await startRecording),
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
let { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
const { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
|
||||
await reload(target);
|
||||
|
||||
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
await Promise.all([recordingFinished, callListPopulated]);
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
let { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
const { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
|
||||
await reload(target);
|
||||
|
||||
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
await Promise.all([recordingFinished, callListPopulated]);
|
||||
|
||||
|
@ -42,7 +42,7 @@ async function ifTestingSupported() {
|
|||
"8", "", "requestAnimationFrame", "(Function)", "doc_simple-canvas.html:30");
|
||||
|
||||
function testItem(item, index, context, name, args, location) {
|
||||
let i = CallsListView.indexOfItem(item);
|
||||
const i = CallsListView.indexOfItem(item);
|
||||
is(i, index - 1,
|
||||
"The item at index " + index + " is correctly displayed in the UI.");
|
||||
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
let { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
let searchbox = $("#calls-searchbox");
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
const { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
const searchbox = $("#calls-searchbox");
|
||||
|
||||
await reload(target);
|
||||
|
||||
let firstRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const firstRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
await Promise.all([firstRecordingFinished, callListPopulated]);
|
||||
|
@ -43,7 +43,7 @@ async function ifTestingSupported() {
|
|||
is(CallsListView.visibleItems[0].attachment.actor.callerPreview, "Object",
|
||||
"The visible item's caller has the expected value.");
|
||||
|
||||
let secondRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const secondRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
|
|
|
@ -12,23 +12,23 @@ registerCleanupFunction(function() {
|
|||
});
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL);
|
||||
let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL);
|
||||
const { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
|
||||
await reload(target);
|
||||
|
||||
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
await Promise.all([recordingFinished, callListPopulated]);
|
||||
|
||||
let callItem = CallsListView.getItemAtIndex(2);
|
||||
let locationLink = $(".call-item-location", callItem.target);
|
||||
const callItem = CallsListView.getItemAtIndex(2);
|
||||
const locationLink = $(".call-item-location", callItem.target);
|
||||
|
||||
is($(".call-item-stack", callItem.target), null,
|
||||
"There should be no stack container available yet for the draw call.");
|
||||
|
||||
let callStackDisplayed = once(window, EVENTS.CALL_STACK_DISPLAYED);
|
||||
const callStackDisplayed = once(window, EVENTS.CALL_STACK_DISPLAYED);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, locationLink, window);
|
||||
await callStackDisplayed;
|
||||
|
||||
|
@ -65,12 +65,12 @@ async function ifTestingSupported() {
|
|||
"doc_simple-canvas-deep-stack.html:35",
|
||||
"The fourth function on the stack has the correct location.");
|
||||
|
||||
let jumpedToSource = once(window, EVENTS.SOURCE_SHOWN_IN_JS_DEBUGGER);
|
||||
const jumpedToSource = once(window, EVENTS.SOURCE_SHOWN_IN_JS_DEBUGGER);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, $(".call-item-stack-fn-location", callItem.target));
|
||||
await jumpedToSource;
|
||||
|
||||
let toolbox = await gDevTools.getToolbox(target);
|
||||
let { panelWin: { DebuggerView: view } } = toolbox.getPanel("jsdebugger");
|
||||
const toolbox = await gDevTools.getToolbox(target);
|
||||
const { panelWin: { DebuggerView: view } } = toolbox.getPanel("jsdebugger");
|
||||
|
||||
is(view.Sources.selectedValue, getSourceActor(view.Sources, SIMPLE_CANVAS_DEEP_STACK_URL),
|
||||
"The expected source was shown in the debugger.");
|
||||
|
|
|
@ -13,23 +13,23 @@ registerCleanupFunction(function() {
|
|||
});
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL);
|
||||
let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL);
|
||||
const { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
|
||||
await reload(target);
|
||||
|
||||
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
await Promise.all([recordingFinished, callListPopulated]);
|
||||
|
||||
let callItem = CallsListView.getItemAtIndex(2);
|
||||
let locationLink = $(".call-item-location", callItem.target);
|
||||
const callItem = CallsListView.getItemAtIndex(2);
|
||||
const locationLink = $(".call-item-location", callItem.target);
|
||||
|
||||
is($(".call-item-stack", callItem.target), null,
|
||||
"There should be no stack container available yet for the draw call.");
|
||||
|
||||
let callStackDisplayed = once(window, EVENTS.CALL_STACK_DISPLAYED);
|
||||
const callStackDisplayed = once(window, EVENTS.CALL_STACK_DISPLAYED);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, locationLink, window);
|
||||
await callStackDisplayed;
|
||||
|
||||
|
@ -40,12 +40,12 @@ async function ifTestingSupported() {
|
|||
ok($all(".call-item-stack-fn", callItem.target).length >= 4,
|
||||
"There should be at least 4 functions on the stack for the draw call.");
|
||||
|
||||
let jumpedToSource = once(window, EVENTS.SOURCE_SHOWN_IN_JS_DEBUGGER);
|
||||
const jumpedToSource = once(window, EVENTS.SOURCE_SHOWN_IN_JS_DEBUGGER);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, $(".call-item-location", callItem.target));
|
||||
await jumpedToSource;
|
||||
|
||||
let toolbox = await gDevTools.getToolbox(target);
|
||||
let { panelWin: { DebuggerView: view } } = toolbox.getPanel("jsdebugger");
|
||||
const toolbox = await gDevTools.getToolbox(target);
|
||||
const { panelWin: { DebuggerView: view } } = toolbox.getPanel("jsdebugger");
|
||||
|
||||
is(view.Sources.selectedValue, getSourceActor(view.Sources, SIMPLE_CANVAS_DEEP_STACK_URL),
|
||||
"The expected source was shown in the debugger.");
|
||||
|
|
|
@ -7,19 +7,19 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL);
|
||||
let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL);
|
||||
const { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
|
||||
await reload(target);
|
||||
|
||||
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
await Promise.all([recordingFinished, callListPopulated]);
|
||||
|
||||
let callItem = CallsListView.getItemAtIndex(2);
|
||||
let view = $(".call-item-view", callItem.target);
|
||||
let contents = $(".call-item-contents", callItem.target);
|
||||
const callItem = CallsListView.getItemAtIndex(2);
|
||||
const view = $(".call-item-view", callItem.target);
|
||||
const contents = $(".call-item-contents", callItem.target);
|
||||
|
||||
is(view.hasAttribute("call-stack-populated"), false,
|
||||
"The call item's view should not have the stack populated yet.");
|
||||
|
@ -28,7 +28,7 @@ async function ifTestingSupported() {
|
|||
is($(".call-item-stack", callItem.target), null,
|
||||
"There should be no stack container available yet for the draw call.");
|
||||
|
||||
let callStackDisplayed = once(window, EVENTS.CALL_STACK_DISPLAYED);
|
||||
const callStackDisplayed = once(window, EVENTS.CALL_STACK_DISPLAYED);
|
||||
EventUtils.sendMouseEvent({ type: "dblclick" }, contents, window);
|
||||
await callStackDisplayed;
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
let { window, EVENTS, SnapshotsListView } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
const { window, EVENTS, SnapshotsListView } = panel.panelWin;
|
||||
|
||||
await reload(target);
|
||||
|
||||
let firstRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const firstRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
|
||||
await firstRecordingFinished;
|
||||
|
@ -20,7 +20,7 @@ async function ifTestingSupported() {
|
|||
is(SnapshotsListView.itemCount, 1,
|
||||
"There should be one item available in the snapshots list.");
|
||||
|
||||
let secondRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const secondRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
|
||||
await secondRecordingFinished;
|
||||
|
@ -29,7 +29,7 @@ async function ifTestingSupported() {
|
|||
is(SnapshotsListView.itemCount, 2,
|
||||
"There should be two items available in the snapshots list.");
|
||||
|
||||
let clearingFinished = once(window, EVENTS.SNAPSHOTS_LIST_CLEARED);
|
||||
const clearingFinished = once(window, EVENTS.SNAPSHOTS_LIST_CLEARED);
|
||||
SnapshotsListView._onClearButtonClick();
|
||||
|
||||
await clearingFinished;
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
let { window, $, EVENTS, SnapshotsListView } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
const { window, $, EVENTS, SnapshotsListView } = panel.panelWin;
|
||||
|
||||
await reload(target);
|
||||
|
||||
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
let screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
|
||||
const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
const screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
await Promise.all([recordingFinished, callListPopulated, screenshotDisplayed]);
|
||||
|
||||
|
|
|
@ -6,21 +6,21 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
let { window, $, $all, EVENTS, SnapshotsListView } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
const { window, $, $all, EVENTS, SnapshotsListView } = panel.panelWin;
|
||||
|
||||
await reload(target);
|
||||
|
||||
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
let thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED);
|
||||
const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
const thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
await Promise.all([recordingFinished, callListPopulated, thumbnailsDisplayed]);
|
||||
|
||||
is($all(".filmstrip-thumbnail").length, 4,
|
||||
"There should be 4 thumbnails displayed in the UI.");
|
||||
|
||||
let firstThumbnail = $(".filmstrip-thumbnail[index='0']");
|
||||
const firstThumbnail = $(".filmstrip-thumbnail[index='0']");
|
||||
ok(firstThumbnail,
|
||||
"The first thumbnail element should be for the function call at index 0.");
|
||||
is(firstThumbnail.width, 50,
|
||||
|
@ -30,7 +30,7 @@ async function ifTestingSupported() {
|
|||
is(firstThumbnail.getAttribute("flipped"), "false",
|
||||
"The first thumbnail should not be flipped vertically.");
|
||||
|
||||
let secondThumbnail = $(".filmstrip-thumbnail[index='2']");
|
||||
const secondThumbnail = $(".filmstrip-thumbnail[index='2']");
|
||||
ok(secondThumbnail,
|
||||
"The second thumbnail element should be for the function call at index 2.");
|
||||
is(secondThumbnail.width, 50,
|
||||
|
@ -40,7 +40,7 @@ async function ifTestingSupported() {
|
|||
is(secondThumbnail.getAttribute("flipped"), "false",
|
||||
"The second thumbnail should not be flipped vertically.");
|
||||
|
||||
let thirdThumbnail = $(".filmstrip-thumbnail[index='4']");
|
||||
const thirdThumbnail = $(".filmstrip-thumbnail[index='4']");
|
||||
ok(thirdThumbnail,
|
||||
"The third thumbnail element should be for the function call at index 4.");
|
||||
is(thirdThumbnail.width, 50,
|
||||
|
@ -50,7 +50,7 @@ async function ifTestingSupported() {
|
|||
is(thirdThumbnail.getAttribute("flipped"), "false",
|
||||
"The third thumbnail should not be flipped vertically.");
|
||||
|
||||
let fourthThumbnail = $(".filmstrip-thumbnail[index='6']");
|
||||
const fourthThumbnail = $(".filmstrip-thumbnail[index='6']");
|
||||
ok(fourthThumbnail,
|
||||
"The fourth thumbnail element should be for the function call at index 6.");
|
||||
is(fourthThumbnail.width, 50,
|
||||
|
|
|
@ -7,15 +7,15 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
const { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
|
||||
await reload(target);
|
||||
|
||||
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
let thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED);
|
||||
let screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
|
||||
const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
const thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED);
|
||||
const screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
await Promise.all([
|
||||
recordingFinished,
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
let { $ } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
const { $ } = panel.panelWin;
|
||||
|
||||
is($("#snapshots-pane").hasAttribute("hidden"), false,
|
||||
"The snapshots pane should initially be visible.");
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
let { window, EVENTS, $, SnapshotsListView } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
const { window, EVENTS, $, SnapshotsListView } = panel.panelWin;
|
||||
|
||||
await reload(target);
|
||||
|
||||
|
@ -23,8 +23,8 @@ async function ifTestingSupported() {
|
|||
is(SnapshotsListView.selectedIndex, -1,
|
||||
"There should be no selected item in the snapshots list view.");
|
||||
|
||||
let recordingStarted = once(window, EVENTS.SNAPSHOT_RECORDING_STARTED);
|
||||
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const recordingStarted = once(window, EVENTS.SNAPSHOT_RECORDING_STARTED);
|
||||
const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
|
||||
await recordingStarted;
|
||||
|
|
|
@ -6,20 +6,20 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
let { window, EVENTS, L10N, $, SnapshotsListView } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
const { window, EVENTS, L10N, $, SnapshotsListView } = panel.panelWin;
|
||||
|
||||
await reload(target);
|
||||
|
||||
let recordingStarted = once(window, EVENTS.SNAPSHOT_RECORDING_STARTED);
|
||||
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
let recordingSelected = once(window, EVENTS.SNAPSHOT_RECORDING_SELECTED);
|
||||
const recordingStarted = once(window, EVENTS.SNAPSHOT_RECORDING_STARTED);
|
||||
const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const recordingSelected = once(window, EVENTS.SNAPSHOT_RECORDING_SELECTED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
|
||||
await recordingStarted;
|
||||
ok(true, "Started recording a snapshot of the animation loop.");
|
||||
|
||||
let item = SnapshotsListView.getItemAtIndex(0);
|
||||
const item = SnapshotsListView.getItemAtIndex(0);
|
||||
|
||||
is($(".snapshot-item-title", item.target).getAttribute("value"),
|
||||
L10N.getFormatStr("snapshotsList.itemLabel", 1),
|
||||
|
|
|
@ -7,18 +7,18 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
let { window, EVENTS, $, SnapshotsListView } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
const { window, EVENTS, $, SnapshotsListView } = panel.panelWin;
|
||||
|
||||
await reload(target);
|
||||
|
||||
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
|
||||
await recordingFinished;
|
||||
ok(true, "Finished recording a snapshot of the animation loop.");
|
||||
|
||||
let item = SnapshotsListView.getItemAtIndex(0);
|
||||
const item = SnapshotsListView.getItemAtIndex(0);
|
||||
|
||||
is(SnapshotsListView.selectedItem, item,
|
||||
"The first item should now be selected in the snapshots list view (1).");
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(RAF_BEGIN_URL);
|
||||
let { window, EVENTS, gFront, SnapshotsListView } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(RAF_BEGIN_URL);
|
||||
const { window, EVENTS, gFront, SnapshotsListView } = panel.panelWin;
|
||||
loadFrameScriptUtils();
|
||||
|
||||
await reload(target);
|
||||
|
||||
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
|
||||
// Wait until after the recording started to trigger the content.
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
let { window, $, EVENTS } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
const { window, $, EVENTS } = panel.panelWin;
|
||||
|
||||
let reset = once(window, EVENTS.UI_RESET);
|
||||
let navigated = reload(target);
|
||||
const reset = once(window, EVENTS.UI_RESET);
|
||||
const navigated = reload(target);
|
||||
|
||||
await reset;
|
||||
ok(true, "The UI was reset after the refresh button was clicked.");
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
const { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
|
||||
is(SnapshotsListView.itemCount, 0,
|
||||
"There should be no snapshots initially displayed in the UI.");
|
||||
|
@ -23,10 +23,10 @@ async function ifTestingSupported() {
|
|||
|
||||
await reload(target);
|
||||
|
||||
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
let thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED);
|
||||
let screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
|
||||
const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
const thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED);
|
||||
const screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
await Promise.all([
|
||||
recordingFinished,
|
||||
|
@ -47,8 +47,8 @@ async function ifTestingSupported() {
|
|||
is($all(".filmstrip-thumbnail").length, 4,
|
||||
"All the thumbnails should now be displayed in the UI (2).");
|
||||
|
||||
let reset = once(window, EVENTS.UI_RESET);
|
||||
let navigated = reload(target);
|
||||
const reset = once(window, EVENTS.UI_RESET);
|
||||
const navigated = reload(target);
|
||||
|
||||
await reset;
|
||||
ok(true, "The UI was reset after the refresh button was clicked.");
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
*/
|
||||
|
||||
async function ifTestingSupported() {
|
||||
let { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
let { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
|
||||
const { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
|
||||
|
||||
await reload(target);
|
||||
|
||||
|
@ -28,7 +28,7 @@ async function ifTestingSupported() {
|
|||
is(CallsListView.selectedIndex, -1,
|
||||
"There should still be no call item automatically selected in the snapshot.");
|
||||
|
||||
let secondSnapshotTarget = SnapshotsListView.getItemAtIndex(1).target;
|
||||
const secondSnapshotTarget = SnapshotsListView.getItemAtIndex(1).target;
|
||||
let snapshotSelected = waitForSnapshotSelection();
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, secondSnapshotTarget, window);
|
||||
|
||||
|
@ -40,8 +40,8 @@ async function ifTestingSupported() {
|
|||
is(CallsListView.selectedIndex, -1,
|
||||
"There should still be no call item automatically selected in the snapshot.");
|
||||
|
||||
let firstDrawCallContents = $(".call-item-contents", CallsListView.getItemAtIndex(2).target);
|
||||
let screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
|
||||
const firstDrawCallContents = $(".call-item-contents", CallsListView.getItemAtIndex(2).target);
|
||||
const screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, firstDrawCallContents, window);
|
||||
|
||||
await screenshotDisplayed;
|
||||
|
@ -52,7 +52,7 @@ async function ifTestingSupported() {
|
|||
is(CallsListView.selectedIndex, 2,
|
||||
"The first draw call should now be selected in the snapshot.");
|
||||
|
||||
let firstSnapshotTarget = SnapshotsListView.getItemAtIndex(0).target;
|
||||
const firstSnapshotTarget = SnapshotsListView.getItemAtIndex(0).target;
|
||||
snapshotSelected = waitForSnapshotSelection();
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, firstSnapshotTarget, window);
|
||||
|
||||
|
@ -65,22 +65,22 @@ async function ifTestingSupported() {
|
|||
"There should still be no call item automatically selected in the snapshot.");
|
||||
|
||||
function recordAndWaitForFirstSnapshot() {
|
||||
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
let snapshotSelected = waitForSnapshotSelection();
|
||||
const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const snapshotSelected = waitForSnapshotSelection();
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
return Promise.all([recordingFinished, snapshotSelected]);
|
||||
}
|
||||
|
||||
function recordAndWaitForAnotherSnapshot() {
|
||||
let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
|
||||
SnapshotsListView._onRecordButtonClick();
|
||||
return recordingFinished;
|
||||
}
|
||||
|
||||
function waitForSnapshotSelection() {
|
||||
let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
let thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED);
|
||||
let screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
|
||||
const callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
|
||||
const thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED);
|
||||
const screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
|
||||
return Promise.all([
|
||||
callListPopulated,
|
||||
thumbnailsDisplayed,
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче