Merge mozilla-central to inbound a=merge on a CLOSED TREE

This commit is contained in:
Coroiu Cristina 2018-04-13 19:09:10 +03:00
Родитель ba82122aa0 fca4426325
Коммит fd27fd90f1
197 изменённых файлов: 1831 добавлений и 1160 удалений

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

@ -116,17 +116,9 @@ devtools/client/storage/test/*.html
!devtools/client/storage/test/storage-search.html
!devtools/client/storage/test/storage-unsecured-iframe.html
!devtools/client/storage/test/storage-unsecured-iframe-usercontextid.html
devtools/client/webaudioeditor/**
devtools/client/webconsole/old/net/**
!devtools/client/webconsole/test/mochitest/**
devtools/client/webconsole/old/test/**
devtools/client/webconsole/old/webconsole.js
devtools/client/webide/**
!devtools/client/webide/components/webideCli.js
devtools/server/tests/browser/storage-*.html
!devtools/server/tests/browser/storage-unsecured-iframe.html
devtools/server/tests/browser/stylesheets-nested-iframes.html
devtools/server/tests/unit/xpcshell_debugging_script.js
devtools/client/shared/webpack/shims/test/test_clipboard.html
devtools/shared/qrcode/tests/mochitest/test_decode.html
devtools/shared/tests/mochitest/*.html
@ -137,6 +129,10 @@ devtools/client/commandline/**
# Soon to be removed, the new/ directory is explicitly excluded below due to
# also being an imported repository.
devtools/client/debugger/**
# Soon to be removed
devtools/client/webconsole/old/net/**
devtools/client/webconsole/old/test/**
devtools/client/webconsole/old/webconsole.js
# Ignore devtools imported repositories
devtools/client/debugger/new/**
@ -144,6 +140,7 @@ devtools/client/shared/components/reps/**
# Ignore devtools preferences files
devtools/client/preferences/**
devtools/client/webide/preferences/**
devtools/shared/preferences/**
devtools/startup/preferences/devtools-startup.js
@ -180,6 +177,9 @@ devtools/server/tests/unit/babel_and_browserify_script_with_source_map.js
devtools/server/tests/unit/setBreakpoint*
devtools/server/tests/unit/sourcemapped.js
# devtools specific format test file
devtools/server/tests/unit/xpcshell_debugging_script.js
# dom/ exclusions
dom/abort/**
dom/animation/**
@ -343,7 +343,6 @@ services/sync/services-sync.js
servo/**
# Remote protocol exclusions
testing/marionette/test_*.js
testing/marionette/atom.js
testing/marionette/legacyaction.js
testing/marionette/client

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

@ -499,8 +499,7 @@ const gStoragePressureObserver = {
_lastNotificationTime: -1,
observe(subject, topic, data) {
if (topic != "QuotaManager::StoragePressure" ||
!Services.prefs.getBoolPref("browser.storageManager.enabled")) {
if (topic != "QuotaManager::StoragePressure") {
return;
}

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

@ -23,7 +23,6 @@ function openAboutPrefPromise() {
// Test only displaying notification once within the given interval
add_task(async function() {
const TEST_NOTIFICATION_INTERVAL_MS = 2000;
await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.enabled", true]]});
await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.pressureNotification.minIntervalMS", TEST_NOTIFICATION_INTERVAL_MS]]});
// Commenting this to see if we really need it
// await SpecialPowers.pushPrefEnv({set: [["privacy.reduceTimerPrecision", false]]});
@ -47,7 +46,6 @@ add_task(async function() {
// Test guiding user to the about:preferences when usage exceeds the given threshold
add_task(async function() {
await SpecialPowers.pushPrefEnv({ set: [["browser.storageManager.enabled", true]] });
await SpecialPowers.pushPrefEnv({ set: [["browser.storageManager.pressureNotification.minIntervalMS", 0]] });
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "https://example.com");
@ -74,7 +72,6 @@ add_task(async function() {
// Test not displaying the 2nd notification if one is already being displayed
add_task(async function() {
const TEST_NOTIFICATION_INTERVAL_MS = 0;
await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.enabled", true]]});
await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.pressureNotification.minIntervalMS", TEST_NOTIFICATION_INTERVAL_MS]]});
await notifyStoragePressure();

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

@ -744,7 +744,9 @@ if (Services.prefs.getBoolPref("identity.fxaccounts.enabled")) {
// We need to use "click" instead of "command" here so openUILink
// respects different buttons (eg, to open in a new tab).
item.addEventListener("click", e => {
doc.defaultView.openWebLinkIn(tabInfo.url, e);
doc.defaultView.openUILink(tabInfo.url, e, {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({})
});
if (doc.defaultView.whereToOpenLink(e) != "current") {
e.preventDefault();
e.stopPropagation();

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

@ -19,6 +19,8 @@ const DECKINDEX_TABSDISABLED = 1;
const DECKINDEX_FETCHING = 2;
const DECKINDEX_NOCLIENTS = 3;
const SAMPLE_TAB_URL = "https://example.com/";
var initialLocation = gBrowser.currentURI.spec;
var newTab = null;
@ -335,7 +337,7 @@ add_task(async function() {
// on the second to last page we should have 22 items shown
// (because we have to show at least NEXT_PAGE_MIN_TABS=5 tabs on the last page)
for (let i = 1; i <= 77; i++) {
allTabsDesktop.push({ title: "Tab #" + i });
allTabsDesktop.push({ title: "Tab #" + i, url: SAMPLE_TAB_URL });
}
return allTabsDesktop;
}(),
@ -343,6 +345,7 @@ add_task(async function() {
]);
};
gSync.updateAllUI({ status: UIState.STATUS_SIGNED_IN, lastSync: new Date(),
email: "foo@bar.com" });
@ -370,6 +373,7 @@ add_task(async function() {
node = node.nextSibling;
is(node.getAttribute("itemtype"), "tab", "node is a tab");
is(node.getAttribute("label"), "Tab #" + (i + 1), "the tab is the correct one");
is(node.getAttribute("targetURI"), SAMPLE_TAB_URL, "url is the correct one");
}
let showMoreButton;
if (showMoreLabel) {
@ -383,6 +387,14 @@ add_task(async function() {
return showMoreButton;
}
async function checkCanOpenURL() {
let tabList = document.getElementById("PanelUI-remotetabs-tabslist");
let node = tabList.firstChild.nextSibling;
let promiseTabOpened = BrowserTestUtils.waitForLocationChange(gBrowser, SAMPLE_TAB_URL);
node.click();
await promiseTabOpened;
}
let showMoreButton;
function clickShowMoreButton() {
let promise = promiseObserverNotified("synced-tabs-menu:test:tabs-updated");
@ -400,6 +412,6 @@ add_task(async function() {
await clickShowMoreButton();
checkTabsPage(77, null);
await hideOverflow();
/* calling this will close the overflow menu */
await checkCanOpenURL();
});

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

@ -368,7 +368,7 @@ class BasePopup {
this.panel.style.setProperty("--arrowpanel-background", background);
if (background == "#fff") {
// Set a usable default color that work with the default background-color.
this.panel.style.setProperty("--arrowpanel-border-color", "hsla(210,4%,10%,.05)");
this.panel.style.setProperty("--arrowpanel-border-color", "hsla(210,4%,10%,.15)");
}
this.background = background;
}

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

@ -2767,10 +2767,8 @@ const ContentPermissionIntegration = {
return new PermissionUI.DesktopNotificationPermissionPrompt(request);
}
case "persistent-storage": {
if (Services.prefs.getBoolPref("browser.storageManager.enabled")) {
return new PermissionUI.PersistentStoragePermissionPrompt(request);
}
}
case "midi": {
return new PermissionUI.MIDIPermissionPrompt(request);
}

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

@ -337,7 +337,6 @@ var gPrivacyPane = {
}
}
if (Services.prefs.getBoolPref("browser.storageManager.enabled")) {
Services.obs.addObserver(this, "sitedatamanager:sites-updated");
Services.obs.addObserver(this, "sitedatamanager:updating-sites");
let unload = () => {
@ -353,9 +352,6 @@ var gPrivacyPane = {
gPrivacyPane.showSiteDataSettings);
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "storage-permissions";
document.getElementById("siteDataLearnMoreLink").setAttribute("href", url);
let siteDataGroup = document.getElementById("siteDataGroup");
siteDataGroup.removeAttribute("data-hidden-from-search");
}
let notificationInfoURL =
Services.urlFormatter.formatURLPref("app.support.baseURL") + "push";

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

@ -160,7 +160,7 @@
</groupbox>
<!-- Site Data -->
<groupbox id="siteDataGroup" hidden="true" data-category="panePrivacy" data-hidden-from-search="true">
<groupbox id="siteDataGroup" data-category="panePrivacy">
<caption><label data-l10n-id="sitedata-header"/></caption>
<hbox data-subcategory="sitedata" align="baseline">

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

@ -4,7 +4,6 @@
ChromeUtils.import("resource://gre/modules/PlacesUtils.jsm");
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
const storageManagerDisabled = !SpecialPowers.getBoolPref("browser.storageManager.enabled");
const browserContainersGroupDisabled = !SpecialPowers.getBoolPref("privacy.userContext.ui.enabled");
function test() {
@ -22,14 +21,7 @@ function checkElements(expectedPane) {
element.id === "drmGroup") {
continue;
}
// The siteDataGroup in the Storage Management project is currently only pref-on on Nightly for testing purpose.
// During the test and the transition period, we have to check the pref to see if the siteDataGroup
// should be hidden always. This would be a bit bothersome, same as the offlineGroup as below.
// However, this checking is necessary to make sure we don't leak the siteDataGroup into beta/release build
if (element.id == "siteDataGroup" && storageManagerDisabled) {
is_element_hidden(element, "Disabled siteDataGroup should be hidden");
continue;
}
// The browserContainersGroup is still only pref-on on Nightly
if (element.id == "browserContainersGroup" && browserContainersGroupDisabled) {
is_element_hidden(element, "Disabled browserContainersGroup should be hidden");

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

@ -5,8 +5,7 @@
// Enabling Searching functionatily. Will display search bar form this testcase forward.
add_task(async function() {
await SpecialPowers.pushPrefEnv({"set": [
["browser.preferences.search", true],
["browser.storageManager.enabled", true]
["browser.preferences.search", true]
]});
});

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

@ -7,8 +7,7 @@ requestLongerTimeout(2);
// Enabling Searching functionatily. Will display search bar form this testcase forward.
add_task(async function() {
await SpecialPowers.pushPrefEnv({"set": [
["browser.preferences.search", true],
["browser.storageManager.enabled", true]
["browser.preferences.search", true]
]});
});

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

@ -212,49 +212,6 @@ add_task(async function exiting_search_reverts_to_general_pane() {
BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
/**
* Test for "Site Data" case, verifying elements with data-hidden-from-search = true
* are hidden in search result.
*/
add_task(async function verify_hidden_from_search_elements_dont_show_up() {
await SpecialPowers.pushPrefEnv({ "set": [["browser.storageManager.enabled", false]] });
await openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true });
let generalPane = gBrowser.contentDocument.getElementById("generalCategory");
is_element_hidden(generalPane, "Should not be in general");
// Performs search
let searchInput = gBrowser.contentDocument.getElementById("searchInput");
is(searchInput, gBrowser.contentDocument.activeElement.closest("#searchInput"),
"Search input should be focused when visiting preferences");
let query = "site data";
let searchCompletedPromise = BrowserTestUtils.waitForEvent(
gBrowser.contentWindow, "PreferencesSearchCompleted", evt => evt.detail == query);
EventUtils.sendString(query);
await searchCompletedPromise;
let mainPrefTag = gBrowser.contentDocument.getElementById("mainPrefPane");
let child = mainPrefTag.querySelector("#siteDataGroup");
is_element_hidden(child, "Should be hidden in search results");
// Takes search off
searchCompletedPromise = BrowserTestUtils.waitForEvent(
gBrowser.contentWindow, "PreferencesSearchCompleted", evt => evt.detail == "");
let count = query.length;
while (count--) {
EventUtils.sendKey("BACK_SPACE");
}
await searchCompletedPromise;
// Checks if back to normal
is_element_visible(generalPane, "Should be in generalPane");
BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
/**
* Test for if we go to another tab after searching
*/

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

@ -4,7 +4,6 @@
* Test for "command" event on search input (when user clicks the x button)
*/
add_task(async function() {
await SpecialPowers.pushPrefEnv({"set": [["browser.storageManager.enabled", false]]});
await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
let generalPane = gBrowser.contentDocument.getElementById("generalCategory");

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

@ -684,12 +684,6 @@ var gPermissionObject = {
}
};
// Delete this entry while being pre-off
// or the persistent-storage permission would appear in Page info's Permission section
if (!Services.prefs.getBoolPref("browser.storageManager.enabled")) {
delete gPermissionObject["persistent-storage"];
}
if (!Services.prefs.getBoolPref("dom.webmidi.enabled")) {
// ESLint gets angry about array versus dot notation here, but some permission
// names use hyphens. Disabling rule for line to keep things consistent.

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

@ -6,19 +6,13 @@
ChromeUtils.import("resource:///modules/SitePermissions.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
const STORAGE_MANAGER_ENABLED = Services.prefs.getBoolPref("browser.storageManager.enabled");
const RESIST_FINGERPRINTING_ENABLED = Services.prefs.getBoolPref("privacy.resistFingerprinting");
const MIDI_ENABLED = Services.prefs.getBoolPref("dom.webmidi.enabled");
add_task(async function testPermissionsListing() {
let expectedPermissions = ["camera", "cookie", "desktop-notification", "focus-tab-by-prompt",
"geo", "image", "install", "microphone", "plugin:flash", "popup", "screen", "shortcuts"];
if (STORAGE_MANAGER_ENABLED) {
// The persistent-storage permission is still only pref-on on Nightly
// so we add it only when it's pref-on.
// Should remove this checking and add it as default after it is fully pref-on.
expectedPermissions.push("persistent-storage");
}
"geo", "image", "install", "microphone", "plugin:flash", "popup", "screen", "shortcuts",
"persistent-storage"];
if (RESIST_FINGERPRINTING_ENABLED) {
// Canvas permission should be hidden unless privacy.resistFingerprinting
// is true.
@ -113,13 +107,7 @@ add_task(async function testExactHostMatch() {
let subUri = Services.io.newURI("https://test1.example.com");
let exactHostMatched = ["desktop-notification", "focus-tab-by-prompt", "camera",
"microphone", "screen", "geo"];
if (STORAGE_MANAGER_ENABLED) {
// The persistent-storage permission is still only pref-on on Nightly
// so we add it only when it's pref-on.
// Should remove this checking and add it as default after it is fully pref-on.
exactHostMatched.push("persistent-storage");
}
"microphone", "screen", "geo", "persistent-storage"];
if (RESIST_FINGERPRINTING_ENABLED) {
// Canvas permission should be hidden unless privacy.resistFingerprinting
// is true.

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

@ -16,7 +16,6 @@ let lastTab = null;
var PermissionPrompts = {
init(libDir) {
Services.prefs.setBoolPref("browser.storageManager.enabled", true);
Services.prefs.setBoolPref("media.navigator.permission.fake", true);
Services.prefs.setBoolPref("extensions.install.requireBuiltInCerts", false);
Services.prefs.setBoolPref("signon.rememberSignons", true);

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

@ -47,6 +47,7 @@ module.exports = {
"client/scratchpad/**",
"client/shared/*.jsm",
"client/shared/widgets/*.jsm",
"client/webide/**",
],
"rules": {
"consistent-return": "off",
@ -56,6 +57,7 @@ module.exports = {
"client/framework/**",
"client/scratchpad/**",
"client/shared/AppCacheUtils.jsm",
"client/webide/**",
],
"rules": {
"max-nested-callbacks": "off",
@ -66,6 +68,7 @@ module.exports = {
"client/scratchpad/**",
"client/shared/*.jsm",
"client/shared/widgets/*.jsm",
"client/webide/**",
],
"rules": {
"max-len": "off",
@ -84,6 +87,7 @@ module.exports = {
"client/scratchpad/**",
"client/shared/*.jsm",
"client/shared/widgets/*.jsm",
"client/webide/**",
],
"rules": {
"mozilla/no-aArgs": "off",
@ -102,6 +106,7 @@ module.exports = {
"client/scratchpad/**",
"client/shared/AppCacheUtils.jsm",
"client/shared/widgets/*.jsm",
"client/webide/**",
],
"rules": {
"no-shadow": "off",
@ -110,6 +115,7 @@ module.exports = {
"files": [
"client/framework/**",
"client/scratchpad/**",
"client/webide/**",
],
"rules": {
"strict": "off",
@ -122,16 +128,21 @@ module.exports = {
// Note: Bug 1342237 may be removing shadereditor, check before
// doing more work on enabling these rules.
"client/shadereditor/**",
// Note: Bug 1403944 may be removing webaudioeditor, check before
// doing more work on enabling these rules.
"client/webaudioeditor/**",
],
"rules": {
"consistent-return": "off",
"max-len": "off",
"mozilla/no-aArgs": "off",
"mozilla/var-only-at-top-level": "off",
"no-redeclare": "off",
"no-return-assign": "off",
"no-shadow": "off",
"no-undef": "off",
"no-unused-vars": "off",
"no-useless-call": "off",
"strict": "off",
}
}, {

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

@ -15,11 +15,6 @@ Services.scriptloader.loadSubScript(
const { AddonManager } = ChromeUtils.import("resource://gre/modules/AddonManager.jsm", {});
const { Management } = ChromeUtils.import("resource://gre/modules/Extension.jsm", {});
flags.testing = true;
registerCleanupFunction(() => {
flags.testing = false;
});
async function openAboutDebugging(page, win) {
info("opening about:debugging");
let url = "about:debugging";

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

@ -19,11 +19,6 @@ var testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
Services.scriptloader.loadSubScript(testDir + "/helpers.js", this);
Services.scriptloader.loadSubScript(testDir + "/mockCommands.js", this, "UTF-8");
flags.testing = true;
SimpleTest.registerCleanupFunction(() => {
flags.testing = false;
});
function whenDelayedStartupFinished(aWindow, aCallback) {
Services.obs.addObserver(function observer(aSubject, aTopic) {
if (aWindow == aSubject) {

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

@ -12,8 +12,7 @@ add_task(async function() {
// TODO: This test tries to verify the normal behavior of the netmonitor and
// therefore needs to avoid the explicit check for tests. Bug 1167188 will
// allow us to remove this workaround.
let isTesting = flags.testing;
flags.testing = false;
await pushPref("devtools.testing", false);
let tab = await addTab(URL_ROOT + "doc_viewsource.html");
let target = TargetFactory.forTab(tab);
@ -30,5 +29,4 @@ add_task(async function() {
await gDevTools.closeToolbox(target);
tab = target = toolbox = panel = null;
gBrowser.removeCurrentTab();
flags.testing = isTesting;
});

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

@ -23,6 +23,7 @@ var ChromeUtils = require("ChromeUtils");
var {gDevTools} = require("devtools/client/framework/devtools");
var EventEmitter = require("devtools/shared/event-emitter");
var Telemetry = require("devtools/client/shared/telemetry");
const { getUnicodeUrl } = require("devtools/client/shared/unicode-url");
var { attachThread, detachThread } = require("./attach-thread");
var Menu = require("devtools/client/framework/menu");
var MenuItem = require("devtools/client/framework/menu-item");
@ -2057,11 +2058,13 @@ Toolbox.prototype = {
let title;
if (this.target.name && this.target.name != this.target.url) {
const url = this.target.isWebExtension ?
this.target.getExtensionPathName(this.target.url) : this.target.url;
this.target.getExtensionPathName(this.target.url) :
getUnicodeUrl(this.target.url);
title = L10N.getFormatStr("toolbox.titleTemplate2", this.target.name,
url);
} else {
title = L10N.getFormatStr("toolbox.titleTemplate1", this.target.url);
title = L10N.getFormatStr("toolbox.titleTemplate1",
getUnicodeUrl(this.target.url));
}
this.postMessage({
name: "set-host-title",
@ -2148,11 +2151,12 @@ Toolbox.prototype = {
// A frame is checked if it's the selected one.
let checked = frame.id == this.selectedFrameId;
let label = frame.url;
let label;
if (this.target.isWebExtension) {
// Show a shorter url for extensions page.
label = this.target.getExtensionPathName(frame.url);
} else {
label = getUnicodeUrl(frame.url);
}
// Create menu item.

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

@ -19,12 +19,6 @@ var {ActorRegistryFront} = require("devtools/shared/fronts/actor-registry");
// lines.
SimpleTest.requestCompleteLog();
// Set the testing flag on DevToolsUtils and reset it when the test ends
flags.testing = true;
registerCleanupFunction(() => {
flags.testing = false;
});
// Toggle this pref on to see all DevTools event communication. This is hugely
// useful for fixing race conditions.
// Services.prefs.setBoolPref("devtools.dump.emit", true);

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

@ -32,11 +32,6 @@ const {LocalizationHelper} = require("devtools/shared/l10n");
const INSPECTOR_L10N =
new LocalizationHelper("devtools/client/locales/inspector.properties");
flags.testing = true;
registerCleanupFunction(() => {
flags.testing = false;
});
registerCleanupFunction(() => {
Services.prefs.clearUserPref("devtools.inspector.activeSidebar");
});

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

@ -23,8 +23,6 @@ SimpleTest.registerCleanupFunction(function() {
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
var { immutableUpdate } = DevToolsUtils;
var flags = require("devtools/shared/flags");
flags.testing = true;
var constants = require("devtools/client/memory/constants");
var {

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

@ -10,10 +10,13 @@ var { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {}
var Services = require("Services");
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
var flags = require("devtools/shared/flags");
flags.testing = true;
flags.wantLogging = true;
flags.wantVerbose = false;
Services.prefs.setBoolPref("devtools.testing", true);
Services.prefs.setBoolPref("devtools.debugger.log", true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("devtools.testing");
Services.prefs.clearUserPref("devtools.debugger.log");
});
var { OS } = require("resource://gre/modules/osfile.jsm");
var { FileUtils } = require("resource://gre/modules/FileUtils.jsm");

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

@ -3,6 +3,15 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/reject-some-requires */
// This file is a chrome-API-dependent version of the module
// devtools/client/netmonitor/src/utils/open-request-in-tab.js, so that it can
// take advantage of utilizing chrome APIs. But because of this, it isn't
// intended to be used in Chrome-API-free applications, such as the Launchpad.
//
// Please keep in mind that if the feature in this file has changed, don't
// forget to also change that accordingly in
// devtools/client/netmonitor/src/utils/open-request-in-tab.js.
"use strict";
let { Cc, Ci } = require("chrome");

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

@ -2,6 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This file is a chrome-API-free version of the module
// devtools/client/netmonitor/src/utils/firefox/open-request-in-tab.js, so that
// it can be used in Chrome-API-free applications, such as the Launchpad. But
// because of this, it cannot take advantage of utilizing chrome APIs and should
// implement the similar functionalities on its own.
//
// Please keep in mind that if the feature in this file has changed, don't
// forget to also change that accordingly in
// devtools/client/netmonitor/src/utils/firefox/open-request-in-tab.js.
"use strict";
const Services = require("Services");

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

@ -6,6 +6,9 @@
"use strict";
const { getUnicodeUrl, getUnicodeUrlPath, getUnicodeHostname } =
require("devtools/client/shared/unicode-url");
const {
UPDATE_PROPS,
} = require("devtools/client/netmonitor/src/constants");
@ -120,22 +123,6 @@ function writeHeaderText(headers) {
return headers.map(({name, value}) => name + ": " + value).join("\n");
}
/**
* Convert a string into unicode if string is valid.
* If there is a malformed URI sequence, it returns input string.
*
* @param {string} url - a string
* @return {string} unicode string
*/
function decodeUnicodeUrl(string) {
try {
return decodeURIComponent(string);
} catch (err) {
// Ignore error and return input string directly.
}
return string;
}
/**
* Decode base64 string.
*
@ -175,7 +162,7 @@ function getAbbreviatedMimeType(mimeType) {
*/
function getUrlBaseName(url) {
const pathname = (new URL(url)).pathname;
return decodeUnicodeUrl(
return getUnicodeUrlPath(
pathname.replace(/\S*\//, "") || pathname || "/");
}
@ -196,27 +183,27 @@ function getUrlQuery(url) {
* @return {string} unicode basename and query portions of a url
*/
function getUrlBaseNameWithQuery(url) {
return getUrlBaseName(url) + decodeUnicodeUrl((new URL(url)).search);
return getUrlBaseName(url) + getUnicodeUrlPath((new URL(url)).search);
}
/**
* Helpers for getting unicode hostname portion of an URL.
* Helpers for getting hostname portion of an URL.
*
* @param {string} url - url string
* @return {string} unicode hostname of a url
*/
function getUrlHostName(url) {
return decodeUnicodeUrl((new URL(url)).hostname);
return new URL(url).hostname;
}
/**
* Helpers for getting unicode host portion of an URL.
* Helpers for getting host portion of an URL.
*
* @param {string} url - url string
* @return {string} unicode host of a url
*/
function getUrlHost(url) {
return decodeUnicodeUrl((new URL(url)).host);
return new URL(url).host;
}
/**
@ -237,9 +224,22 @@ function getUrlDetails(url) {
let baseNameWithQuery = getUrlBaseNameWithQuery(url);
let host = getUrlHost(url);
let hostname = getUrlHostName(url);
let unicodeUrl = decodeUnicodeUrl(url);
let unicodeUrl = getUnicodeUrl(url);
let scheme = getUrlScheme(url);
// If the hostname contains unreadable ASCII characters, we need to do the
// following two steps:
// 1. Converting the unreadable hostname to a readable Unicode domain name.
// For example, converting xn--g6w.xn--8pv into a Unicode domain name.
// 2. Replacing the unreadable hostname portion in the `host` with the
// readable hostname.
// For example, replacing xn--g6w.xn--8pv:8000 with [Unicode domain]:8000
// After finishing the two steps, we get a readable `host`.
const unicodeHostname = getUnicodeHostname(hostname);
if (unicodeHostname !== hostname) {
host = host.replace(hostname, unicodeHostname);
}
// Mark local hosts specially, where "local" is as defined in the W3C
// spec for secure contexts.
// http://www.w3.org/TR/powerful-features/
@ -277,8 +277,8 @@ function parseQueryString(query) {
return query.replace(/^[?&]/, "").split("&").map(e => {
let param = e.split("=");
return {
name: param[0] ? decodeUnicodeUrl(param[0]) : "",
value: param[1] ? decodeUnicodeUrl(param[1]) : "",
name: param[0] ? getUnicodeUrlPath(param[0]) : "",
value: param[1] ? getUnicodeUrlPath(param[1]) : "",
};
});
}
@ -297,8 +297,8 @@ function parseFormData(sections) {
return sections.replace(/^&/, "").split("&").map(e => {
let param = e.split("=");
return {
name: param[0] ? decodeUnicodeUrl(param[0]) : "",
value: param[1] ? decodeUnicodeUrl(param[1]) : "",
name: param[0] ? getUnicodeUrlPath(param[0]) : "",
value: param[1] ? getUnicodeUrlPath(param[1]) : "",
};
});
}
@ -491,7 +491,6 @@ module.exports = {
fetchNetworkUpdatePacket,
formDataURI,
writeHeaderText,
decodeUnicodeUrl,
getAbbreviatedMimeType,
getEndTime,
getFormattedProtocol,

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

@ -18,8 +18,8 @@ const {
getFormattedIPAndPort,
getFormattedTime,
} = require("devtools/client/netmonitor/src/utils/format-utils");
const { getUnicodeUrl } = require("devtools/client/shared/unicode-url");
const {
decodeUnicodeUrl,
getFormattedProtocol,
getUrlBaseName,
getUrlHost,
@ -410,7 +410,7 @@ function verifyRequestItemTarget(document, requestList, requestItem, method,
let target = document.querySelectorAll(".request-list-item")[visibleIndex];
// Bug 1414981 - Request URL should not show #hash
let unicodeUrl = decodeUnicodeUrl(url).split("#")[0];
let unicodeUrl = getUnicodeUrl(url.split("#")[0]);
let name = getUrlBaseName(url);
let query = getUrlQuery(url);
let host = getUrlHost(url);

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

@ -88,6 +88,7 @@ let webpackConfig = {
"devtools/shared/fronts/timeline": path.join(__dirname, "../../client/shared/webpack/shims/fronts-timeline-shim"),
"devtools/shared/platform/clipboard": path.join(__dirname, "../../client/shared/webpack/shims/platform-clipboard-stub"),
"devtools/client/netmonitor/src/utils/firefox/open-request-in-tab": path.join(__dirname, "src/utils/open-request-in-tab"),
"devtools/client/shared/unicode-url": path.join(__dirname, "../../client/shared/webpack/shims/unicode-url-stub"),
// Locales need to be explicitly mapped to the en-US subfolder
"devtools/client/locales": path.join(__dirname, "../../client/locales/en-US"),

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

@ -15,9 +15,7 @@ var { require } = BrowserLoader({
const EventEmitter = require("devtools/shared/event-emitter");
const { perfDescription } = require("devtools/shared/specs/perf");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const flags = require("devtools/shared/flags");
flags.testing = true;
let EXPECTED_DTU_ASSERT_FAILURE_COUNT = 0;
SimpleTest.registerCleanupFunction(function() {
if (DevToolsUtils.assertionFailureCount !== EXPECTED_DTU_ASSERT_FAILURE_COUNT) {

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

@ -14,7 +14,6 @@ let flags = require("devtools/shared/flags");
let { TargetFactory } = require("devtools/client/framework/target");
let { Toolbox } = require("devtools/client/framework/toolbox");
flags.testing = true;
let { require: browserRequire } = BrowserLoader({
baseURI: "resource://devtools/client/performance/",
window

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

@ -52,11 +52,8 @@ const key = (id, win = window) => {
// Don't pollute global scope.
(() => {
const flags = require("devtools/shared/flags");
const PrefUtils = require("devtools/client/performance/test/helpers/prefs");
flags.testing = true;
// Make sure all the prefs are reverted to their defaults once tests finish.
let stopObservingPrefs = PrefUtils.whenUnknownPrefChanged("devtools.performance",
pref => {
@ -71,7 +68,6 @@ const key = (id, win = window) => {
registerCleanupFunction(() => {
info("finish() was called, cleaning up...");
flags.testing = false;
PrefUtils.rollbackPrefsToDefault();
stopObservingPrefs();

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

@ -48,14 +48,12 @@ SimpleTest.waitForExplicitFinish();
// should be enough.
requestLongerTimeout(2);
flags.testing = true;
Services.prefs.setCharPref("devtools.devices.url", TEST_URI_ROOT + "devices.json");
// The appearance of this notification causes intermittent behavior in some tests that
// send mouse events, since it causes the content to shift when it appears.
Services.prefs.setBoolPref("devtools.responsive.reloadNotification.enabled", false);
registerCleanupFunction(async () => {
flags.testing = false;
Services.prefs.clearUserPref("devtools.devices.url");
Services.prefs.clearUserPref("devtools.responsive.reloadNotification.enabled");
Services.prefs.clearUserPref("devtools.responsive.html.displayedDeviceList");

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

@ -8,12 +8,12 @@
const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const promise = require("promise");
const Services = require("Services");
const Store = require("devtools/client/responsive.html/store");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const flags = require("devtools/shared/flags");
flags.testing = true;
Services.prefs.setBoolPref("devtools.testing", true);
registerCleanupFunction(() => {
flags.testing = false;
Services.prefs.clearUserPref("devtools.testing");
});

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

@ -11,17 +11,11 @@ const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {}
const {gDevTools} = require("devtools/client/framework/devtools");
const Services = require("Services");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const flags = require("devtools/shared/flags");
const promise = require("promise");
const defer = require("devtools/shared/defer");
var gScratchpadWindow; // Reference to the Scratchpad chrome window object
flags.testing = true;
registerCleanupFunction(() => {
flags.testing = false;
});
/**
* Open a Scratchpad window.
*

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

@ -7,6 +7,8 @@
const { Component } = require("devtools/client/shared/vendor/react");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const { getUnicodeUrl, getUnicodeUrlPath, getUnicodeHostname } =
require("devtools/client/shared/unicode-url");
const { getSourceNames, parseURL, isScratchpadScheme, getSourceMappedFile } =
require("devtools/client/shared/source-utils");
const { LocalizationHelper } = require("devtools/shared/l10n");
@ -133,6 +135,10 @@ class Frame extends Component {
let column = frame.column != void 0 ? Number(frame.column) : null;
const { short, long, host } = getSourceNames(source);
const unicodeShort = getUnicodeUrlPath(short);
const unicodeLong = getUnicodeUrl(long);
const unicodeHost = host ? getUnicodeHostname(host) : "";
// Reparse the URL to determine if we should link this; `getSourceNames`
// has already cached this indirectly. We don't want to attempt to
// link to "self-hosted" and "(unknown)". However, we do want to link
@ -144,7 +150,7 @@ class Frame extends Component {
const elements = [];
const sourceElements = [];
let sourceEl;
let tooltip = long;
let tooltip = unicodeLong;
// Exclude all falsy values, including `0`, as line numbers start with 1.
if (line) {
@ -177,7 +183,7 @@ class Frame extends Component {
}
}
let displaySource = showFullSourceUrl ? long : short;
let displaySource = showFullSourceUrl ? unicodeLong : unicodeShort;
if (isSourceMapped) {
displaySource = getSourceMappedFile(displaySource);
} else if (showEmptyPathAsHost && (displaySource === "" || displaySource === "/")) {
@ -238,12 +244,12 @@ class Frame extends Component {
}
elements.push(sourceEl);
if (showHost && host) {
if (showHost && unicodeHost) {
elements.push(" ");
elements.push(dom.span({
key: "host",
className: "frame-link-host",
}, host));
}, unicodeHost));
}
return dom.span(attributes, ...elements);

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

@ -15,11 +15,9 @@ var Services = require("Services");
var { DebuggerServer } = require("devtools/server/main");
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
var flags = require("devtools/shared/flags");
var { TargetFactory } = require("devtools/client/framework/target");
var { Toolbox } = require("devtools/client/framework/toolbox");
flags.testing = true;
var { require: browserRequire } = BrowserLoader({
baseURI: "resource://devtools/client/shared/",
window

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

@ -53,6 +53,7 @@ DevToolsModules(
'telemetry.js',
'theme.js',
'undo.js',
'unicode-url.js',
'view-source.js',
'webgl-utils.js',
'zoom-keys.js',

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

@ -7,9 +7,6 @@
"use strict";
const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const flags = require("devtools/shared/flags");
flags.testing = true;
function waitUntilState(store, predicate) {
return new Promise(resolve => {

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

@ -17,13 +17,13 @@ const asyncStorage = require("devtools/shared/async-storage");
// should be enough.
requestLongerTimeout(2);
flags.testing = true;
Services.prefs.setBoolPref("devtools.testing", true);
Services.prefs.clearUserPref("devtools.responsive.html.displayedDeviceList");
Services.prefs.setCharPref("devtools.devices.url",
"http://example.com/browser/devtools/client/responsive.html/test/browser/devices.json");
registerCleanupFunction(() => {
flags.testing = false;
Services.prefs.clearUserPref("devtools.testing");
Services.prefs.clearUserPref("devtools.devices.url");
Services.prefs.clearUserPref("devtools.responsive.html.displayedDeviceList");
asyncStorage.removeItem("devtools.devices.url_cache");

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

@ -25,7 +25,6 @@ const {loader, require} = scopedCuImport("resource://devtools/shared/Loader.jsm"
const {gDevTools} = require("devtools/client/framework/devtools");
const {TargetFactory} = require("devtools/client/framework/target");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const flags = require("devtools/shared/flags");
let promise = require("promise");
let defer = require("devtools/shared/defer");
const Services = require("Services");
@ -109,9 +108,7 @@ function loadFrameScriptUtils(browser = gBrowser.selectedBrowser) {
return mm;
}
flags.testing = true;
registerCleanupFunction(() => {
flags.testing = false;
Services.prefs.clearUserPref("devtools.dump.emit");
Services.prefs.clearUserPref("devtools.toolbox.host");
Services.prefs.clearUserPref("devtools.toolbox.previousHost");

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

@ -0,0 +1,240 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Tests utility functions contained in `unicode-url.js`
*/
const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const { getUnicodeUrl, getUnicodeUrlPath, getUnicodeHostname } =
require("devtools/client/shared/unicode-url");
// List of URLs used to test Unicode URL conversion
const TEST_URLS = [
// Type: Readable ASCII URLs
// Expected: All of Unicode versions should equal to the raw.
{
raw: "https://example.org",
expectedUnicode: "https://example.org",
},
{
raw: "http://example.org",
expectedUnicode: "http://example.org",
},
{
raw: "ftp://example.org",
expectedUnicode: "ftp://example.org",
},
{
raw: "https://example.org.",
expectedUnicode: "https://example.org.",
},
{
raw: "https://example.org/",
expectedUnicode: "https://example.org/",
},
{
raw: "https://example.org/test",
expectedUnicode: "https://example.org/test",
},
{
raw: "https://example.org/test.html",
expectedUnicode: "https://example.org/test.html",
},
{
raw: "https://example.org/test.html?one=1&two=2",
expectedUnicode: "https://example.org/test.html?one=1&two=2",
},
{
raw: "https://example.org/test.html#here",
expectedUnicode: "https://example.org/test.html#here",
},
{
raw: "https://example.org/test.html?one=1&two=2#here",
expectedUnicode: "https://example.org/test.html?one=1&two=2#here",
},
// Type: Unreadable URLs with either Punycode domain names or URI-encoded
// paths
// Expected: Unreadable domain names and URI-encoded paths should be converted
// to readable Unicode.
{
raw: "https://xn--g6w.xn--8pv/test.html",
// Do not type Unicode characters directly, because this test file isn't
// specified with a known encoding.
expectedUnicode: "https://\u6e2c.\u672c/test.html",
},
{
raw: "https://example.org/%E6%B8%AC%E8%A9%A6.html",
// Do not type Unicode characters directly, because this test file isn't
// specified with a known encoding.
expectedUnicode: "https://example.org/\u6e2c\u8a66.html",
},
{
raw: "https://example.org/test.html?One=%E4%B8%80",
// Do not type Unicode characters directly, because this test file isn't
// specified with a known encoding.
expectedUnicode: "https://example.org/test.html?One=\u4e00",
},
{
raw: "https://example.org/test.html?%E4%B8%80=1",
// Do not type Unicode characters directly, because this test file isn't
// specified with a known encoding.
expectedUnicode: "https://example.org/test.html?\u4e00=1",
},
{
raw: "https://xn--g6w.xn--8pv/%E6%B8%AC%E8%A9%A6.html" +
"?%E4%B8%80=%E4%B8%80" +
"#%E6%AD%A4",
// Do not type Unicode characters directly, because this test file isn't
// specified with a known encoding.
expectedUnicode: "https://\u6e2c.\u672c/\u6e2c\u8a66.html" +
"?\u4e00=\u4e00" +
"#\u6b64",
},
// Type: data: URIs
// Expected: All should not be converted.
{
raw: "data:text/plain;charset=UTF-8;Hello%20world",
expectedUnicode: "data:text/plain;charset=UTF-8;Hello%20world",
},
{
raw: "data:text/plain;charset=UTF-8;%E6%B8%AC%20%E8%A9%A6",
expectedUnicode: "data:text/plain;charset=UTF-8;%E6%B8%AC%20%E8%A9%A6",
},
{
raw: "data:image/png;base64,iVBORw0KGgoAAA" +
"ANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4" +
"//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU" +
"5ErkJggg==",
expectedUnicode: "data:image/png;base64,iVBORw0KGgoAAA" +
"ANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4" +
"//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU" +
"5ErkJggg==",
},
// Type: Malformed URLs
// Expected: All should not be converted.
{
raw: "://example.org/test",
expectedUnicode: "://example.org/test",
},
{
raw: "://xn--g6w.xn--8pv/%E6%B8%AC%E8%A9%A6.html" +
"?%E4%B8%80=%E4%B8%80",
expectedUnicode: "://xn--g6w.xn--8pv/%E6%B8%AC%E8%A9%A6.html" +
"?%E4%B8%80=%E4%B8%80",
},
{
// %E8%A9 isn't a valid UTF-8 code, so this URL is malformed.
raw: "https://xn--g6w.xn--8pv/%E6%B8%AC%E8%A9",
expectedUnicode: "https://xn--g6w.xn--8pv/%E6%B8%AC%E8%A9",
},
];
// List of hostanmes used to test Unicode hostname conversion
const TEST_HOSTNAMES = [
// Type: Readable ASCII hostnames
// Expected: All of Unicode versions should equal to the raw.
{
raw: "example",
expectedUnicode: "example",
},
{
raw: "example.org",
expectedUnicode: "example.org",
},
// Type: Unreadable Punycode hostnames
// Expected: Punycode should be converted to readable Unicode.
{
raw: "xn--g6w",
// Do not type Unicode characters directly, because this test file isn't
// specified with a known encoding.
expectedUnicode: "\u6e2c",
},
{
raw: "xn--g6w.xn--8pv",
// Do not type Unicode characters directly, because this test file isn't
// specified with a known encoding.
expectedUnicode: "\u6e2c.\u672c",
},
];
// List of URL paths used to test Unicode URL path conversion
const TEST_URL_PATHS = [
// Type: Readable ASCII URL paths
// Expected: All of Unicode versions should equal to the raw.
{
raw: "test",
expectedUnicode: "test",
},
{
raw: "/",
expectedUnicode: "/",
},
{
raw: "/test",
expectedUnicode: "/test",
},
{
raw: "/test.html?one=1&two=2#here",
expectedUnicode: "/test.html?one=1&two=2#here",
},
// Type: Unreadable URI-encoded URL paths
// Expected: URL paths should be converted to readable Unicode.
{
raw: "/%E6%B8%AC%E8%A9%A6",
// Do not type Unicode characters directly, because this test file isn't
// specified with a known encoding.
expectedUnicode: "/\u6e2c\u8a66",
},
{
raw: "/%E6%B8%AC%E8%A9%A6.html",
// Do not type Unicode characters directly, because this test file isn't
// specified with a known encoding.
expectedUnicode: "/\u6e2c\u8a66.html",
},
{
raw: "/%E6%B8%AC%E8%A9%A6.html" +
"?%E4%B8%80=%E4%B8%80&%E4%BA%8C=%E4%BA%8C" +
"#%E6%AD%A4",
// Do not type Unicode characters directly, because this test file isn't
// specified with a known encoding.
expectedUnicode: "/\u6e2c\u8a66.html" +
"?\u4e00=\u4e00&\u4e8c=\u4e8c" +
"#\u6b64",
},
// Type: Malformed URL paths
// Expected: All should not be converted.
{
// %E8%A9 isn't a valid UTF-8 code, so this URL is malformed.
raw: "/%E6%B8%AC%E8%A9",
expectedUnicode: "/%E6%B8%AC%E8%A9",
},
];
function run_test() {
// Test URLs
for (let url of TEST_URLS) {
let result = getUnicodeUrl(url.raw);
equal(result, url.expectedUnicode,
"Test getUnicodeUrl: " + url.raw +
" should be unicodized to " + url.expectedUnicode);
}
// Test hostnames
for (let hostname of TEST_HOSTNAMES) {
let result = getUnicodeHostname(hostname.raw);
equal(result, hostname.expectedUnicode,
"Test getUnicodeHostname: " + hostname.raw +
" should be unicodized to " + hostname.expectedUnicode);
}
// Test URL paths
for (let urlPath of TEST_URL_PATHS) {
let result = getUnicodeUrlPath(urlPath.raw);
equal(result, urlPath.expectedUnicode,
"Test getUnicodeUrlPath: " + urlPath.raw +
" should be unicodized to " + urlPath.expectedUnicode);
}
}

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

@ -25,5 +25,6 @@ support-files =
[test_source-utils.js]
[test_suggestion-picker.js]
[test_undoStack.js]
[test_unicode-url.js]
[test_VariablesView_filtering-without-controller.js]
[test_VariablesView_getString_promise.js]

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

@ -0,0 +1,115 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// This file is a chrome-API-dependent version of the module
// devtools/client/shared/webpack/shims/unicode-url-stub.js, so that it can
// take advantage of utilizing chrome APIs. But because of this, it isn't
// intended to be used in Chrome-API-free applications, such as the Launchpad.
//
// Please keep in mind that if the feature in this file has changed, don't
// forget to also change that accordingly in
// devtools/client/shared/webpack/shims/unicode-url-stub.js.
const { Cc, Ci } = require("chrome");
const idnService =
Cc["@mozilla.org/network/idn-service;1"].getService(Ci.nsIIDNService);
/**
* Gets a readble Unicode hostname from a hostname.
*
* If the `hostname` is a readable ASCII hostname, such as example.org, then
* this function will simply return the original `hostname`.
*
* If the `hostname` is a Punycode hostname representing a Unicode domain name,
* such as xn--g6w.xn--8pv, then this function will return the readable Unicode
* domain name by decoding the Punycode hostname.
*
* @param {string} hostname
* the hostname from which the Unicode hostname will be
* parsed, such as example.org, xn--g6w.xn--8pv.
* @return {string} The Unicode hostname. It may be the same as the `hostname`
* passed to this function if the `hostname` itself is
* a readable ASCII hostname or a Unicode hostname.
*/
function getUnicodeHostname(hostname) {
return idnService.convertToDisplayIDN(hostname, {});
}
/**
* Gets a readble Unicode URL pathname from a URL pathname.
*
* If the `urlPath` is a readable ASCII URL pathname, such as /a/b/c.js, then
* this function will simply return the original `urlPath`.
*
* If the `urlPath` is a URI-encoded pathname, such as %E8%A9%A6/%E6%B8%AC.js,
* then this function will return the readable Unicode pathname.
*
* If the `urlPath` is a malformed URL pathname, then this function will simply
* return the original `urlPath`.
*
* @param {string} urlPath
* the URL path from which the Unicode URL path will be parsed,
* such as /a/b/c.js, %E8%A9%A6/%E6%B8%AC.js.
* @return {string} The Unicode URL Path. It may be the same as the `urlPath`
* passed to this function if the `urlPath` itself is a readable
* ASCII url or a Unicode url.
*/
function getUnicodeUrlPath(urlPath) {
try {
return decodeURIComponent(urlPath);
} catch (err) {
dump("Warning: getUnicodeUrlPath failed to get a Unicode URL from" +
`${urlPath}, reason: ${err}`);
}
return urlPath;
}
/**
* Gets a readable Unicode URL from a URL.
*
* If the `url` is a readable ASCII URL, such as http://example.org/a/b/c.js,
* then this function will simply return the original `url`.
*
* If the `url` includes either an unreadable Punycode domain name or an
* unreadable URI-encoded pathname, such as
* http://xn--g6w.xn--8pv/%E8%A9%A6/%E6%B8%AC.js, then this function will return
* the readable URL by decoding all its unreadable URL components to Unicode
* characters.
*
* If the `url` is a malformed URL, then this function will return the original
* `url`.
*
* If the `url` is a data: URI, then this function will return the original
* `url`.
*
* @param {string} url
* the full URL, or a data: URI. from which the readable URL
* will be parsed, such as, http://example.org/a/b/c.js,
* http://xn--g6w.xn--8pv/%E8%A9%A6/%E6%B8%AC.js
* @return {string} The readable URL. It may be the same as the `url` passed to
* this function if the `url` itself is readable.
*/
function getUnicodeUrl(url) {
try {
const { protocol, hostname } = new URL(url);
if (protocol === "data:") {
// Never convert a data: URI.
return url;
}
const readableHostname = getUnicodeHostname(hostname);
url = decodeURIComponent(url);
return url.replace(hostname, readableHostname);
} catch (err) {
dump("Warning: getUnicodeUrl failed to get a Unicode URL from" +
`${url}, reason: ${err}`);
}
return url;
}
module.exports = {
getUnicodeHostname,
getUnicodeUrlPath,
getUnicodeUrl,
};

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

@ -0,0 +1,32 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// TODO This file aims to implement a Chrome-API-free replacement for
// devtools/client/shared/unicode-url.js, so that it can be used in the
// Launchpad.
//
// Currently this is just a dummpy mock of
// devtools/client/shared/unicode-url.js, no actual functionaly involved.
// Eventually we'll want to implement it. Once implemented, we should keep the
// feature the same as devtools/client/shared/unicode-url.js.
"use strict";
function getUnicodeHostname(hostname) {
return hostname;
}
function getUnicodeUrlPath(urlPath) {
return urlPath;
}
function getUnicodeUrl(url) {
return url;
}
module.exports = {
getUnicodeHostname,
getUnicodeUrlPath,
getUnicodeUrl,
};

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

@ -16,11 +16,6 @@ const { NetUtil } = require("resource://gre/modules/NetUtil.jsm");
const Editor = require("devtools/client/sourceeditor/editor");
const {getClientCssProperties} = require("devtools/shared/fronts/css-properties");
flags.testing = true;
SimpleTest.registerCleanupFunction(() => {
flags.testing = false;
});
function promiseWaitForFocus() {
return new Promise(resolve =>
waitForFocus(resolve));

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

@ -10,6 +10,7 @@ const {LocalizationHelper, ELLIPSIS} = require("devtools/shared/l10n");
const KeyShortcuts = require("devtools/client/shared/key-shortcuts");
const JSOL = require("devtools/client/shared/vendor/jsol");
const {KeyCodes} = require("devtools/client/shared/keycodes");
const { getUnicodeHostname } = require("devtools/client/shared/unicode-url");
// GUID to be used as a separator in compound keys. This must match the same
// constant in devtools/server/actors/storage.js,
@ -455,7 +456,8 @@ class StorageUI {
async handleAddedItems(added) {
for (let type in added) {
for (let host in added[type]) {
this.tree.add([type, {id: host, type: "url"}]);
const label = this.getReadableLabelFromHostname(host);
this.tree.add([type, {id: host, label: label, type: "url"}]);
for (let name of added[type][host]) {
try {
name = JSON.parse(name);
@ -672,7 +674,8 @@ class StorageUI {
}
this.storageTypes[type] = storageTypes[type];
for (let host in storageTypes[type].hosts) {
this.tree.add([type, {id: host, type: "url"}]);
const label = this.getReadableLabelFromHostname(host);
this.tree.add([type, {id: host, label: label, type: "url"}]);
for (let name of storageTypes[type].hosts[host]) {
try {
let names = JSON.parse(name);
@ -772,6 +775,35 @@ class StorageUI {
this.emit("sidebar-updated");
}
/**
* Gets a readable label from the hostname. If the hostname is a Punycode
* domain(I.e. an ASCII domain name representing a Unicode domain name), then
* this function decodes it to the readable Unicode domain name, and label
* the Unicode domain name toggether with the original domian name, and then
* return the label; if the hostname isn't a Punycode domain(I.e. it isn't
* encoded and is readable on its own), then this function simply returns the
* original hostname.
*
* @param {string} host
* The string representing a host, e.g, example.com, example.com:8000
*/
getReadableLabelFromHostname(host) {
try {
const { hostname } = new URL(host);
const unicodeHostname = getUnicodeHostname(hostname);
if (hostname !== unicodeHostname) {
// If the hostname is a Punycode domain representing a Unicode domain,
// we decode it to the Unicode domain name, and then label the Unicode
// domain name together with the original domain name.
return host.replace(hostname, unicodeHostname) + " [ " + host + " ]";
}
} catch (_) {
// Skip decoding for a host which doesn't include a domain name, simply
// consider them to be readable.
}
return host;
}
/**
* Tries to parse a string value into either a json or a key-value separated
* object and populates the sidebar with the parsed value. The value can also
@ -779,7 +811,7 @@ class StorageUI {
*
* @param {string} name
* The key corresponding to the `value` string in the object
* @param {string} value
* @param {string} originalValue
* The string to be parsed into an object
*/
parseItemValue(name, originalValue) {
@ -881,8 +913,6 @@ class StorageUI {
* Select handler for the storage tree. Fetches details of the selected item
* from the storage details and populates the storage tree.
*
* @param {string} event
* The name of the event fired
* @param {array} item
* An array of ids which represent the location of the selected item in
* the storage tree

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

@ -83,7 +83,7 @@ var WebAudioEditorController = {
/**
* Remove events emitted by the current tab target.
*/
destroy: function () {
destroy: function() {
gTarget.off("will-navigate", this._onTabWillNavigate);
gFront.off("start-context", this._onStartContext);
gFront.off("create-node", this._onCreateNode);
@ -100,7 +100,7 @@ var WebAudioEditorController = {
* Called when page is reloaded to show the reload notice and waiting
* for an audio context notice.
*/
reset: function () {
reset: function() {
$("#content").hidden = true;
ContextView.resetUI();
InspectorView.resetUI();
@ -110,7 +110,7 @@ var WebAudioEditorController = {
// Since node events (create, disconnect, connect) are all async,
// we have to make sure to wait that the node has finished creating
// before performing an operation on it.
getNode: async function (nodeActor) {
getNode: async function(nodeActor) {
let id = nodeActor.actorID;
let node = gAudioNodes.get(id);
@ -132,7 +132,7 @@ var WebAudioEditorController = {
* so that the graph can update marker styling, as that
* cannot currently be done with CSS.
*/
_onThemeChange: function () {
_onThemeChange: function() {
let newValue = Services.prefs.getCharPref("devtools.theme");
window.emit(EVENTS.THEME_CHANGE, newValue);
},
@ -167,7 +167,7 @@ var WebAudioEditorController = {
* Called after the first audio node is created in an audio context,
* signaling that the audio context is being used.
*/
_onStartContext: function () {
_onStartContext: function() {
$("#reload-notice").hidden = true;
$("#waiting-notice").hidden = true;
$("#content").hidden = false;
@ -178,7 +178,7 @@ var WebAudioEditorController = {
* Called when a new node is created. Creates an `AudioNodeView` instance
* for tracking throughout the editor.
*/
_onCreateNode: function (nodeActor) {
_onCreateNode: function(nodeActor) {
gAudioNodes.add(nodeActor);
},
@ -186,7 +186,7 @@ var WebAudioEditorController = {
* Called on `destroy-node` when an AudioNode is GC'd. Removes
* from the AudioNode array and fires an event indicating the removal.
*/
_onDestroyNode: function (nodeActor) {
_onDestroyNode: function(nodeActor) {
gAudioNodes.remove(gAudioNodes.get(nodeActor.actorID));
},

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

@ -84,8 +84,12 @@ EventEmitter.decorate(this);
/**
* DOM query helper.
*/
function $(selector, target = document) { return target.querySelector(selector); }
function $$(selector, target = document) { return target.querySelectorAll(selector); }
function $(selector, target = document) {
return target.querySelector(selector);
}
function $$(selector, target = document) {
return target.querySelectorAll(selector);
}
/**
* Takes an iterable collection, and a hash. Return the first

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

@ -141,7 +141,6 @@ class AudioNodeModel extends EventEmitter {
}
}
/**
* Constructor for a Collection of `AudioNodeModel` models.
*
@ -181,6 +180,7 @@ class AudioNodesCollection extends EventEmitter {
* @return AudioNodeModel
*/
add(obj) {
// eslint-disable-next-line new-cap
let node = new this.model(obj);
node.collection = this;

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

@ -20,7 +20,7 @@ function WebAudioEditorPanel(iframeWindow, toolbox) {
exports.WebAudioEditorPanel = WebAudioEditorPanel;
WebAudioEditorPanel.prototype = {
open: function () {
open: function() {
let targetPromise;
// Local debugging needs to make the target remote.
@ -55,7 +55,7 @@ WebAudioEditorPanel.prototype = {
return this._toolbox.target;
},
destroy: function () {
destroy: function() {
// Make sure this panel is not already destroyed.
if (this._destroyer) {
return this._destroyer;

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

@ -5,7 +5,7 @@
* Test AudioNode#addAutomationEvent();
*/
add_task(async function () {
add_task(async function() {
let { target, front } = await initBackend(SIMPLE_CONTEXT_URL);
let [_, [destNode, oscNode, gainNode]] = await Promise.all([
front.setup({ reload: true }),

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

@ -5,7 +5,7 @@
* Test AudioNode#bypass(), AudioNode#isBypassed()
*/
add_task(async function () {
add_task(async function() {
let { target, front } = await initBackend(SIMPLE_CONTEXT_URL);
let [_, [destNode, oscNode, gainNode]] = await Promise.all([
front.setup({ reload: true }),

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

@ -5,7 +5,7 @@
* Test AudioNode#bypassable
*/
add_task(async function () {
add_task(async function() {
let { target, front } = await initBackend(SIMPLE_NODES_URL);
let [_, nodes] = await Promise.all([
front.setup({ reload: true }),

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

@ -6,7 +6,7 @@
* Uses the editor front as the actors do not retain connect state.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;

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

@ -6,7 +6,7 @@
* Uses the editor front as the actors do not retain connect state.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;

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

@ -6,7 +6,7 @@
* a curve as the last event to check duration spread.
*/
add_task(async function () {
add_task(async function() {
let { target, front } = await initBackend(SIMPLE_CONTEXT_URL);
let [_, [destNode, oscNode, gainNode]] = await Promise.all([
front.setup({ reload: true }),

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

@ -6,7 +6,7 @@
* `setTargetAtTime`, which approaches its target to infinity.
*/
add_task(async function () {
add_task(async function() {
let { target, front } = await initBackend(SIMPLE_CONTEXT_URL);
let [_, [destNode, oscNode, gainNode]] = await Promise.all([
front.setup({ reload: true }),

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

@ -6,7 +6,7 @@
* its argument.
*/
add_task(async function () {
add_task(async function() {
let { target, front } = await initBackend(SIMPLE_CONTEXT_URL);
let [_, [destNode, oscNode, gainNode]] = await Promise.all([
front.setup({ reload: true }),

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

@ -5,7 +5,7 @@
* Test AudioNode#getParamFlags()
*/
add_task(async function () {
add_task(async function() {
let { target, front } = await initBackend(SIMPLE_NODES_URL);
let [_, nodes] = await Promise.all([
front.setup({ reload: true }),
@ -33,12 +33,10 @@ add_task(async function () {
if (param === "buffer") {
is(flags.Buffer, true, "`buffer` params have Buffer flag");
}
else if (param === "bufferSize" || param === "frequencyBinCount") {
} else if (param === "bufferSize" || param === "frequencyBinCount") {
is(flags.readonly, true, param + " is readonly");
}
else if (param === "curve") {
is(flags["Float32Array"], true, "`curve` param has Float32Array flag");
} else if (param === "curve") {
is(flags.Float32Array, true, "`curve` param has Float32Array flag");
}
}
}

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

@ -5,7 +5,7 @@
* Test AudioNode#getParams()
*/
add_task(async function () {
add_task(async function() {
let { target, front } = await initBackend(SIMPLE_NODES_URL);
let [_, nodes] = await Promise.all([
front.setup({ reload: true }),
@ -35,12 +35,10 @@ add_task(async function () {
if (param === "buffer") {
is(flags.Buffer, true, "`buffer` params have Buffer flag");
}
else if (param === "bufferSize" || param === "frequencyBinCount") {
} else if (param === "bufferSize" || param === "frequencyBinCount") {
is(flags.readonly, true, param + " is readonly");
}
else if (param === "curve") {
is(flags["Float32Array"], true, "`curve` param has Float32Array flag");
} else if (param === "curve") {
is(flags.Float32Array, true, "`curve` param has Float32Array flag");
}
});
});

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

@ -6,7 +6,7 @@
* from the AudioNode actors.
*/
add_task(async function () {
add_task(async function() {
let { target, front } = await initBackend(SIMPLE_NODES_URL);
let [_, nodes] = await Promise.all([
front.setup({ reload: true }),
@ -39,8 +39,7 @@ function compare(actual, expected, type) {
value = getGripValue(value);
if (typeof expected[param] === "function") {
ok(expected[param](value), type + " has a passing value for " + param);
}
else {
} else {
is(value, expected[param], type + " has correct default value and type for " + param);
}
});

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

@ -5,7 +5,7 @@
* Test AudioNode#getParam() / AudioNode#setParam()
*/
add_task(async function () {
add_task(async function() {
let { target, front } = await initBackend(SIMPLE_CONTEXT_URL);
let [_, [destNode, oscNode, gainNode]] = await Promise.all([
front.setup({ reload: true }),

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

@ -5,7 +5,7 @@
* Test AudioNode#source
*/
add_task(async function () {
add_task(async function() {
let { target, front } = await initBackend(SIMPLE_NODES_URL);
let [_, nodes] = await Promise.all([
front.setup({ reload: true }),
@ -17,10 +17,11 @@ add_task(async function () {
actualTypes.forEach((type, i) => {
let shouldBeSource = type === "AudioBufferSourceNode" || type === "OscillatorNode";
if (shouldBeSource)
if (shouldBeSource) {
is(isSourceResult[i], true, type + "'s `source` is `true`");
else
} else {
is(isSourceResult[i], false, type + "'s `source` is `false`");
}
});
await removeTab(target.tab);

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

@ -5,7 +5,7 @@
* Test AudioNode#type
*/
add_task(async function () {
add_task(async function() {
let { target, front } = await initBackend(SIMPLE_NODES_URL);
let [_, nodes] = await Promise.all([
front.setup({ reload: true }),

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

@ -10,7 +10,7 @@
const BUG_1130901_URL = EXAMPLE_URL + "doc_bug_1130901.html";
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(BUG_1130901_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;

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

@ -9,7 +9,7 @@
const BUG_1112378_URL = EXAMPLE_URL + "doc_bug_1112378.html";
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(BUG_1112378_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;

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

@ -6,7 +6,7 @@
* or params exist.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(AUTOMATION_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS } = panelWin;

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

@ -6,7 +6,7 @@
* switching between AudioParam rerenders the graph.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(AUTOMATION_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, AutomationView } = panelWin;

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

@ -9,7 +9,7 @@
const BUG_1125817_URL = EXAMPLE_URL + "doc_bug_1125817.html";
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(BUG_1125817_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;

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

@ -9,7 +9,7 @@
* All done in one test since this test takes a few seconds to clear GC.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(DESTROY_NODES_URL);
let { panelWin } = panel;
let { gFront, $, $$, gAudioNodes } = panelWin;

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

@ -5,7 +5,7 @@
* Tests that the reloading/onContentLoaded hooks work.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { gFront, $ } = panel.panelWin;

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

@ -6,7 +6,7 @@
* the correct node in the InspectorView
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(COMPLEX_CONTEXT_URL);
let panelWin = panel.panelWin;
let { gFront, $, $$, InspectorView } = panelWin;

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

@ -7,7 +7,7 @@
const { setTheme } = require("devtools/client/shared/theme");
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, MARKER_STYLING } = panelWin;

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

@ -7,7 +7,7 @@
var connectCount = 0;
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;

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

@ -5,7 +5,7 @@
* Tests more edge rendering for complex graphs.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(COMPLEX_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$ } = panelWin;
@ -23,7 +23,6 @@ add_task(async function () {
let types = ["AudioDestinationNode", "OscillatorNode", "GainNode", "ScriptProcessorNode",
"OscillatorNode", "GainNode", "AudioBufferSourceNode", "BiquadFilterNode"];
types.forEach((type, i) => {
ok(findGraphNode(panelWin, nodeIDs[i]).classList.contains("type-" + type), "found " + type + " with class");
});

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

@ -5,7 +5,7 @@
* Tests to ensure that selected nodes stay selected on graph redraw.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS } = panelWin;

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

@ -5,7 +5,7 @@
* Tests audio param connection rendering.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(CONNECT_MULTI_PARAM_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS } = panelWin;

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

@ -5,7 +5,7 @@
* Tests to ensure that param connections trigger graph redraws
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS } = panelWin;

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

@ -7,7 +7,7 @@
const BUG_1141261_URL = EXAMPLE_URL + "doc_bug_1141261.html";
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(BUG_1141261_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS } = panelWin;

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

@ -5,7 +5,7 @@
* Tests that SVG nodes and edges were created for the Graph View.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS } = panelWin;

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

@ -5,7 +5,7 @@
* Tests that the graph's scale and position is reset on a page reload.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, ContextView } = panelWin;

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

@ -5,7 +5,7 @@
* Tests that nodes are correctly bypassed when bypassing.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;

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

@ -6,7 +6,7 @@
* the inspector panel as intended.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, InspectorView } = panelWin;

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

@ -6,7 +6,7 @@
* a preference
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, InspectorView } = panelWin;

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

@ -6,7 +6,7 @@
* loads the correct node inside the inspector.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, InspectorView } = panelWin;

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

@ -6,7 +6,7 @@
* the audio graph if both pages have an AudioContext.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $ } = panelWin;

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

@ -5,7 +5,7 @@
* Tests that properties are updated when modifying the VariablesView.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, PropertiesView } = panelWin;
@ -37,17 +37,17 @@ add_task(async function () {
}, "default loaded string");
click(panelWin, findGraphNode(panelWin, nodeIds[2]));
await waitForInspectorRender(panelWin, EVENTS),
await waitForInspectorRender(panelWin, EVENTS);
checkVariableView(gVars, 0, {
"gain": 0
}, "default loaded number");
click(panelWin, findGraphNode(panelWin, nodeIds[1]));
await waitForInspectorRender(panelWin, EVENTS),
await waitForInspectorRender(panelWin, EVENTS);
await setAndCheck(0, "type", "square", "square", "sets string as string");
click(panelWin, findGraphNode(panelWin, nodeIds[2]));
await waitForInspectorRender(panelWin, EVENTS),
await waitForInspectorRender(panelWin, EVENTS);
await setAndCheck(0, "gain", "0.005", 0.005, "sets number as number");
await setAndCheck(0, "gain", "0.1", 0.1, "sets float as float");
await setAndCheck(0, "gain", ".2", 0.2, "sets float without leading zero as float");
@ -56,7 +56,7 @@ add_task(async function () {
});
function setAndCheckVariable(panelWin, gVars) {
return async function (varNum, prop, value, expected, desc) {
return async function(varNum, prop, value, expected, desc) {
await modifyVariableView(panelWin, gVars, varNum, prop, value);
var props = {};
props[prop] = expected;

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

@ -5,7 +5,7 @@
* Tests that properties are not updated when modifying the VariablesView.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(COMPLEX_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, PropertiesView } = panelWin;

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

@ -15,8 +15,9 @@ function waitForDeviceClosed() {
ChromeUtils.import("resource:///modules/webrtcUI.jsm", temp);
let webrtcUI = temp.webrtcUI;
if (!webrtcUI.showGlobalIndicator)
if (!webrtcUI.showGlobalIndicator) {
return Promise.resolve();
}
return new Promise((resolve, reject) => {
const message = "webrtc:UpdateGlobalIndicators";
@ -30,7 +31,7 @@ function waitForDeviceClosed() {
});
}
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(MEDIA_NODES_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, PropertiesView } = panelWin;

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

@ -6,7 +6,7 @@
* like AudioBuffer and Float32Array in properties of AudioNodes.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(BUFFER_AND_ARRAY_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, PropertiesView } = panelWin;

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

@ -6,7 +6,7 @@
* correctly, with default values and correct types.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_NODES_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, PropertiesView } = panelWin;

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

@ -5,7 +5,7 @@
* Tests that params view shows params when they exist, and are hidden otherwise.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, PropertiesView } = panelWin;

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

@ -6,7 +6,7 @@
* event and reshow the tools after reloading.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { gFront, $ } = panel.panelWin;

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

@ -6,7 +6,7 @@
* the graph.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $ } = panelWin;

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

@ -6,7 +6,7 @@
* the inspector and selected node.
*/
add_task(async function () {
add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, InspectorView } = panelWin;

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

@ -5,7 +5,7 @@
* Tests that switching to an iframe works fine.
*/
add_task(async function () {
add_task(async function() {
Services.prefs.setBoolPref("devtools.command-button-frames.enabled", true);
let { target, panel, toolbox } = await initWebAudioEditor(IFRAME_CONTEXT_URL);

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

@ -6,7 +6,7 @@
* with correct arguments from the content.
*/
add_task(async function () {
add_task(async function() {
let { target, front } = await initBackend(AUTOMATION_URL);
let events = [];

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