Backed out changeset 3c716a5a7906 (bug 1295608)

This commit is contained in:
Sebastian Hengst 2016-08-25 14:20:10 +02:00
Родитель fc382e1dda
Коммит a75ae94d08
18 изменённых файлов: 78 добавлений и 55 удалений

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

@ -4,8 +4,9 @@
"use strict"; "use strict";
const LAYOUT_ERRORS_L10N = const { LocalizationHelper } = require("devtools/client/shared/l10n");
new LocalizationHelper("global/locale/layout_errors.properties"); const STRINGS_URI = "global/locale/layout_errors.properties";
const L10N = new LocalizationHelper(STRINGS_URI);
// Test that when an animation is selected, its list of animated properties is // Test that when an animation is selected, its list of animated properties is
// displayed below it. // displayed below it.
@ -78,7 +79,7 @@ function hasExpectedWarnings(containerEl) {
for (let warning of warnings) { for (let warning of warnings) {
let warningID = let warningID =
"CompositorAnimationWarningTransformWithGeometricProperties"; "CompositorAnimationWarningTransformWithGeometricProperties";
if (warning.getAttribute("title") == LAYOUT_ERRORS_L10N.getStr(warningID)) { if (warning.getAttribute("title") == L10N.getStr(warningID)) {
return true; return true;
} }
} }

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

@ -7,6 +7,11 @@ requestLongerTimeout(2);
// Test that the panel shows no animation data for invalid or not animated nodes // Test that the panel shows no animation data for invalid or not animated nodes
const { LocalizationHelper } = require("devtools/client/shared/l10n");
const STRINGS_URI = "devtools/locale/animationinspector.properties";
const L10N = new LocalizationHelper(STRINGS_URI);
add_task(function* () { add_task(function* () {
yield addTab(URL_ROOT + "doc_simple_animation.html"); yield addTab(URL_ROOT + "doc_simple_animation.html");
let {inspector, panel, window} = yield openAnimationInspector(); let {inspector, panel, window} = yield openAnimationInspector();
@ -23,7 +28,7 @@ add_task(function* () {
is(panel.animationsTimelineComponent.animationsEl.childNodes.length, 0, is(panel.animationsTimelineComponent.animationsEl.childNodes.length, 0,
"No animation displayed in the timeline component for a still node"); "No animation displayed in the timeline component for a still node");
is(document.querySelector("#error-type").textContent, is(document.querySelector("#error-type").textContent,
ANIMATION_L10N.getStr("panel.invalidElementSelected"), L10N.getStr("panel.invalidElementSelected"),
"The correct error message is displayed"); "The correct error message is displayed");
info("Select the comment text node and check that the panel is empty"); info("Select the comment text node and check that the panel is empty");
@ -37,6 +42,6 @@ add_task(function* () {
is(panel.animationsTimelineComponent.animationsEl.childNodes.length, 0, is(panel.animationsTimelineComponent.animationsEl.childNodes.length, 0,
"No animation displayed in the timeline component for a text node"); "No animation displayed in the timeline component for a text node");
is(document.querySelector("#error-type").textContent, is(document.querySelector("#error-type").textContent,
ANIMATION_L10N.getStr("panel.invalidElementSelected"), L10N.getStr("panel.invalidElementSelected"),
"The correct error message is displayed"); "The correct error message is displayed");
}); });

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

@ -9,6 +9,11 @@ requestLongerTimeout(2);
// Test that when animations displayed in the timeline are running on the // Test that when animations displayed in the timeline are running on the
// compositor, they get a special icon and information in the tooltip. // compositor, they get a special icon and information in the tooltip.
const { LocalizationHelper } = require("devtools/client/shared/l10n");
const STRINGS_URI = "devtools/locale/animationinspector.properties";
const L10N = new LocalizationHelper(STRINGS_URI);
add_task(function* () { add_task(function* () {
yield addTab(URL_ROOT + "doc_simple_animation.html"); yield addTab(URL_ROOT + "doc_simple_animation.html");
let {inspector, panel} = yield openAnimationInspector(); let {inspector, panel} = yield openAnimationInspector();
@ -21,7 +26,7 @@ add_task(function* () {
ok(animationEl.classList.contains("fast-track"), ok(animationEl.classList.contains("fast-track"),
"The animation element has the fast-track css class"); "The animation element has the fast-track css class");
ok(hasTooltip(animationEl, ok(hasTooltip(animationEl,
ANIMATION_L10N.getStr("player.allPropertiesOnCompositorTooltip")), L10N.getStr("player.allPropertiesOnCompositorTooltip")),
"The animation element has the right tooltip content"); "The animation element has the right tooltip content");
info("Select a node we know doesn't have an animation on the compositor"); info("Select a node we know doesn't have an animation on the compositor");
@ -31,10 +36,10 @@ add_task(function* () {
ok(!animationEl.classList.contains("fast-track"), ok(!animationEl.classList.contains("fast-track"),
"The animation element does not have the fast-track css class"); "The animation element does not have the fast-track css class");
ok(!hasTooltip(animationEl, ok(!hasTooltip(animationEl,
ANIMATION_L10N.getStr("player.allPropertiesOnCompositorTooltip")), L10N.getStr("player.allPropertiesOnCompositorTooltip")),
"The animation element does not have oncompositor tooltip content"); "The animation element does not have oncompositor tooltip content");
ok(!hasTooltip(animationEl, ok(!hasTooltip(animationEl,
ANIMATION_L10N.getStr("player.somePropertiesOnCompositorTooltip")), L10N.getStr("player.somePropertiesOnCompositorTooltip")),
"The animation element does not have oncompositor tooltip content"); "The animation element does not have oncompositor tooltip content");
info("Select a node we know has animation on the compositor and not on the" + info("Select a node we know has animation on the compositor and not on the" +
@ -45,7 +50,7 @@ add_task(function* () {
ok(animationEl.classList.contains("fast-track"), ok(animationEl.classList.contains("fast-track"),
"The animation element has the fast-track css class"); "The animation element has the fast-track css class");
ok(hasTooltip(animationEl, ok(hasTooltip(animationEl,
ANIMATION_L10N.getStr("player.somePropertiesOnCompositorTooltip")), L10N.getStr("player.somePropertiesOnCompositorTooltip")),
"The animation element has the right tooltip content"); "The animation element has the right tooltip content");
}); });

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

@ -14,8 +14,6 @@ Services.scriptloader.loadSubScript(
const FRAME_SCRIPT_URL = CHROME_URL_ROOT + "doc_frame_script.js"; const FRAME_SCRIPT_URL = CHROME_URL_ROOT + "doc_frame_script.js";
const COMMON_FRAME_SCRIPT_URL = "chrome://devtools/content/shared/frame-script-utils.js"; const COMMON_FRAME_SCRIPT_URL = "chrome://devtools/content/shared/frame-script-utils.js";
const TAB_NAME = "animationinspector"; const TAB_NAME = "animationinspector";
const ANIMATION_L10N =
new LocalizationHelper("devtools/locale/animationinspector.properties");
// Auto clean-up when a test ends // Auto clean-up when a test ends
registerCleanupFunction(function* () { registerCleanupFunction(function* () {

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

@ -8,8 +8,10 @@
// in an attribute. // in an attribute.
const TEST_URL = URL_ROOT + "doc_markup_links.html"; const TEST_URL = URL_ROOT + "doc_markup_links.html";
const STRINGS = Services.strings
const TOOLBOX_L10N = new LocalizationHelper("devtools/locale/toolbox.properties"); .createBundle("chrome://devtools/locale/inspector.properties");
const TOOLBOX_STRINGS = Services.strings
.createBundle("chrome://devtools/locale/toolbox.properties");
// The test case array contains objects with the following properties: // The test case array contains objects with the following properties:
// - selector: css selector for the node to select in the inspector // - selector: css selector for the node to select in the inspector
@ -26,9 +28,9 @@ const TEST_DATA = [{
popupNodeSelector: ".link", popupNodeSelector: ".link",
isLinkFollowItemVisible: true, isLinkFollowItemVisible: true,
isLinkCopyItemVisible: true, isLinkCopyItemVisible: true,
linkFollowItemLabel: TOOLBOX_L10N.getStr( linkFollowItemLabel: TOOLBOX_STRINGS.GetStringFromName(
"toolbox.viewCssSourceInStyleEditor.label"), "toolbox.viewCssSourceInStyleEditor.label"),
linkCopyItemLabel: INSPECTOR_L10N.getStr( linkCopyItemLabel: STRINGS.GetStringFromName(
"inspector.menu.copyUrlToClipboard.label") "inspector.menu.copyUrlToClipboard.label")
}, { }, {
selector: "link[rel=icon]", selector: "link[rel=icon]",
@ -36,9 +38,9 @@ const TEST_DATA = [{
popupNodeSelector: ".link", popupNodeSelector: ".link",
isLinkFollowItemVisible: true, isLinkFollowItemVisible: true,
isLinkCopyItemVisible: true, isLinkCopyItemVisible: true,
linkFollowItemLabel: INSPECTOR_L10N.getStr( linkFollowItemLabel: STRINGS.GetStringFromName(
"inspector.menu.openUrlInNewTab.label"), "inspector.menu.openUrlInNewTab.label"),
linkCopyItemLabel: INSPECTOR_L10N.getStr( linkCopyItemLabel: STRINGS.GetStringFromName(
"inspector.menu.copyUrlToClipboard.label") "inspector.menu.copyUrlToClipboard.label")
}, { }, {
selector: "link", selector: "link",
@ -52,17 +54,17 @@ const TEST_DATA = [{
popupNodeSelector: ".link", popupNodeSelector: ".link",
isLinkFollowItemVisible: true, isLinkFollowItemVisible: true,
isLinkCopyItemVisible: false, isLinkCopyItemVisible: false,
linkFollowItemLabel: INSPECTOR_L10N.getFormatStr( linkFollowItemLabel: STRINGS.formatStringFromName(
"inspector.menu.selectElement.label", "name") "inspector.menu.selectElement.label", ["name"], 1)
}, { }, {
selector: "script", selector: "script",
attributeName: "src", attributeName: "src",
popupNodeSelector: ".link", popupNodeSelector: ".link",
isLinkFollowItemVisible: true, isLinkFollowItemVisible: true,
isLinkCopyItemVisible: true, isLinkCopyItemVisible: true,
linkFollowItemLabel: TOOLBOX_L10N.getStr( linkFollowItemLabel: TOOLBOX_STRINGS.GetStringFromName(
"toolbox.viewJsSourceInDebugger.label"), "toolbox.viewJsSourceInDebugger.label"),
linkCopyItemLabel: INSPECTOR_L10N.getStr( linkCopyItemLabel: STRINGS.GetStringFromName(
"inspector.menu.copyUrlToClipboard.label") "inspector.menu.copyUrlToClipboard.label")
}, { }, {
selector: "p[for]", selector: "p[for]",

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

@ -22,7 +22,7 @@ function* addNewRuleFromContextMenu(inspector, view) {
let allMenuItems = openStyleContextMenuAndGetAllItems(view, view.element); let allMenuItems = openStyleContextMenuAndGetAllItems(view, view.element);
let menuitemAddRule = allMenuItems.find(item => item.label === let menuitemAddRule = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.addNewRule")); _STRINGS.GetStringFromName("styleinspector.contextmenu.addNewRule"));
ok(menuitemAddRule.visible, "Add rule is visible"); ok(menuitemAddRule.visible, "Add rule is visible");

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

@ -17,6 +17,9 @@ const CONTENT = `
</body> </body>
`; `;
const STRINGS = Services.strings
.createBundle("chrome://devtools-shared/locale/styleinspector.properties");
add_task(function* () { add_task(function* () {
let tab = yield addTab("data:text/html;charset=utf-8," + CONTENT); let tab = yield addTab("data:text/html;charset=utf-8," + CONTENT);
@ -33,13 +36,13 @@ function checkRuleViewContent({styleDocument}) {
is(headers.length, 3, "There are 3 headers for inherited rules"); is(headers.length, 3, "There are 3 headers for inherited rules");
is(headers[0].textContent, is(headers[0].textContent,
STYLE_INSPECTOR_L10N.getFormatStr("rule.inheritedFrom", "p"), STRINGS.formatStringFromName("rule.inheritedFrom", ["p"], 1),
"The first header is correct"); "The first header is correct");
is(headers[1].textContent, is(headers[1].textContent,
STYLE_INSPECTOR_L10N.getFormatStr("rule.inheritedFrom", "div"), STRINGS.formatStringFromName("rule.inheritedFrom", ["div"], 1),
"The second header is correct"); "The second header is correct");
is(headers[2].textContent, is(headers[2].textContent,
STYLE_INSPECTOR_L10N.getFormatStr("rule.inheritedFrom", "body"), STRINGS.formatStringFromName("rule.inheritedFrom", ["body"], 1),
"The third header is correct"); "The third header is correct");
let rules = styleDocument.querySelectorAll(".ruleview-rule"); let rules = styleDocument.querySelectorAll(".ruleview-rule");
@ -47,14 +50,17 @@ function checkRuleViewContent({styleDocument}) {
for (let rule of rules) { for (let rule of rules) {
let selector = rule.querySelector(".ruleview-selectorcontainer"); let selector = rule.querySelector(".ruleview-selectorcontainer");
is(selector.textContent, STYLE_INSPECTOR_L10N.getStr("rule.sourceElement"), is(selector.textContent,
STRINGS.GetStringFromName("rule.sourceElement"),
"The rule's selector is correct"); "The rule's selector is correct");
let propertyNames = [...rule.querySelectorAll(".ruleview-propertyname")]; let propertyNames = [...rule.querySelectorAll(".ruleview-propertyname")];
is(propertyNames.length, 1, "There's only one property name, as expected"); is(propertyNames.length, 1,
"There's only one property name, as expected");
let propertyValues = [...rule.querySelectorAll(".ruleview-propertyvalue")]; let propertyValues = [...rule.querySelectorAll(".ruleview-propertyvalue")];
is(propertyValues.length, 1, "There's only one property value, as expected"); is(propertyValues.length, 1,
"There's only one property value, as expected");
} }
} }

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

@ -61,7 +61,7 @@ function* testMdnContextMenuItemVisibility(view) {
info("Creating context menu with " + node + " as popupNode"); info("Creating context menu with " + node + " as popupNode");
let allMenuItems = openStyleContextMenuAndGetAllItems(view, node); let allMenuItems = openStyleContextMenuAndGetAllItems(view, node);
let menuitemShowMdnDocs = allMenuItems.find(item => item.label === let menuitemShowMdnDocs = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.showMdnDocs")); _STRINGS.GetStringFromName("styleinspector.contextmenu.showMdnDocs"));
let isVisible = menuitemShowMdnDocs.visible; let isVisible = menuitemShowMdnDocs.visible;
let shouldBeVisible = isPropertyNameNode(node); let shouldBeVisible = isPropertyNameNode(node);

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

@ -45,7 +45,7 @@ add_task(function* () {
let allMenuItems = openStyleContextMenuAndGetAllItems(view, nameSpan.firstChild); let allMenuItems = openStyleContextMenuAndGetAllItems(view, nameSpan.firstChild);
let menuitemShowMdnDocs = allMenuItems.find(item => item.label === let menuitemShowMdnDocs = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.showMdnDocs")); _STRINGS.GetStringFromName("styleinspector.contextmenu.showMdnDocs"));
let cssDocs = view.tooltips.cssDocs; let cssDocs = view.tooltips.cssDocs;

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

@ -105,7 +105,7 @@ function* testMdnContextMenuItemVisibility(view, shouldBeVisible) {
let node = root.querySelector("." + PROPERTY_NAME_CLASS).firstChild; let node = root.querySelector("." + PROPERTY_NAME_CLASS).firstChild;
let allMenuItems = openStyleContextMenuAndGetAllItems(view, node); let allMenuItems = openStyleContextMenuAndGetAllItems(view, node);
let menuitemShowMdnDocs = allMenuItems.find(item => item.label === let menuitemShowMdnDocs = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.showMdnDocs")); _STRINGS.GetStringFromName("styleinspector.contextmenu.showMdnDocs"));
let isVisible = menuitemShowMdnDocs.visible; let isVisible = menuitemShowMdnDocs.visible;
is(isVisible, shouldBeVisible, is(isVisible, shouldBeVisible,

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

@ -215,21 +215,21 @@ add_task(function* () {
function* checkCopyStyle(view, node, menuItemLabel, expectedPattern, visible) { function* checkCopyStyle(view, node, menuItemLabel, expectedPattern, visible) {
let allMenuItems = openStyleContextMenuAndGetAllItems(view, node); let allMenuItems = openStyleContextMenuAndGetAllItems(view, node);
let menuItem = allMenuItems.find(item => let menuItem = allMenuItems.find(item =>
item.label === STYLE_INSPECTOR_L10N.getStr(menuItemLabel)); item.label === _STRINGS.GetStringFromName(menuItemLabel));
let menuitemCopy = allMenuItems.find(item => item.label === let menuitemCopy = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.copy")); _STRINGS.GetStringFromName("styleinspector.contextmenu.copy"));
let menuitemCopyLocation = allMenuItems.find(item => item.label === let menuitemCopyLocation = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.copyLocation")); _STRINGS.GetStringFromName("styleinspector.contextmenu.copyLocation"));
let menuitemCopyPropertyDeclaration = allMenuItems.find(item => item.label === let menuitemCopyPropertyDeclaration = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.copyPropertyDeclaration")); _STRINGS.GetStringFromName("styleinspector.contextmenu.copyPropertyDeclaration"));
let menuitemCopyPropertyName = allMenuItems.find(item => item.label === let menuitemCopyPropertyName = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.copyPropertyName")); _STRINGS.GetStringFromName("styleinspector.contextmenu.copyPropertyName"));
let menuitemCopyPropertyValue = allMenuItems.find(item => item.label === let menuitemCopyPropertyValue = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.copyPropertyValue")); _STRINGS.GetStringFromName("styleinspector.contextmenu.copyPropertyValue"));
let menuitemCopySelector = allMenuItems.find(item => item.label === let menuitemCopySelector = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.copySelector")); _STRINGS.GetStringFromName("styleinspector.contextmenu.copySelector"));
let menuitemCopyRule = allMenuItems.find(item => item.label === let menuitemCopyRule = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.copyRule")); _STRINGS.GetStringFromName("styleinspector.contextmenu.copyRule"));
ok(menuitemCopy.disabled, ok(menuitemCopy.disabled,
"Copy disabled is as expected: true"); "Copy disabled is as expected: true");

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

@ -16,7 +16,10 @@ add_task(function* () {
let elementStyle = view._elementStyle; let elementStyle = view._elementStyle;
let inline = STYLE_INSPECTOR_L10N.getStr("rule.sourceInline"); let _strings = Services.strings
.createBundle("chrome://devtools-shared/locale/styleinspector.properties");
let inline = _strings.GetStringFromName("rule.sourceInline");
is(elementStyle.rules.length, 3, "Should have 3 rules."); is(elementStyle.rules.length, 3, "Should have 3 rules.");
is(elementStyle.rules[0].title, inline, "check rule 0 title"); is(elementStyle.rules[0].title, inline, "check rule 0 title");

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

@ -69,7 +69,7 @@ function* checkCopySelection(view) {
let allMenuItems = openStyleContextMenuAndGetAllItems(view, prop); let allMenuItems = openStyleContextMenuAndGetAllItems(view, prop);
let menuitemCopy = allMenuItems.find(item => item.label === let menuitemCopy = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.copy")); _STRINGS.GetStringFromName("styleinspector.contextmenu.copy"));
ok(menuitemCopy.visible, ok(menuitemCopy.visible,
"Copy menu item is displayed as expected"); "Copy menu item is displayed as expected");
@ -103,7 +103,7 @@ function* checkSelectAll(view) {
let allMenuItems = openStyleContextMenuAndGetAllItems(view, prop); let allMenuItems = openStyleContextMenuAndGetAllItems(view, prop);
let menuitemCopy = allMenuItems.find(item => item.label === let menuitemCopy = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.copy")); _STRINGS.GetStringFromName("styleinspector.contextmenu.copy"));
ok(menuitemCopy.visible, ok(menuitemCopy.visible,
"Copy menu item is displayed as expected"); "Copy menu item is displayed as expected");
@ -131,7 +131,7 @@ function* checkCopyEditorValue(view) {
let allMenuItems = openStyleContextMenuAndGetAllItems(view, editor.input); let allMenuItems = openStyleContextMenuAndGetAllItems(view, editor.input);
let menuitemCopy = allMenuItems.find(item => item.label === let menuitemCopy = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.copy")); _STRINGS.GetStringFromName("styleinspector.contextmenu.copy"));
ok(menuitemCopy.visible, ok(menuitemCopy.visible,
"Copy menu item is displayed as expected"); "Copy menu item is displayed as expected");

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

@ -19,8 +19,8 @@ var {getInplaceEditorForSpan: inplaceEditor} =
const ROOT_TEST_DIR = getRootDirectory(gTestPath); const ROOT_TEST_DIR = getRootDirectory(gTestPath);
const FRAME_SCRIPT_URL = ROOT_TEST_DIR + "doc_frame_script.js"; const FRAME_SCRIPT_URL = ROOT_TEST_DIR + "doc_frame_script.js";
const _STRINGS = Services.strings.createBundle(
const STYLE_INSPECTOR_L10N = new LocalizationHelper("chrome://devtools-shared/locale/styleinspector.properties"); "chrome://devtools-shared/locale/styleinspector.properties");
registerCleanupFunction(() => { registerCleanupFunction(() => {
Services.prefs.clearUserPref("devtools.defaultColorUnit"); Services.prefs.clearUserPref("devtools.defaultColorUnit");

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

@ -35,7 +35,7 @@ function* testCopyToClipboard(inspector, view) {
let allMenuItems = openStyleContextMenuAndGetAllItems(view, element); let allMenuItems = openStyleContextMenuAndGetAllItems(view, element);
let menuitemCopyColor = allMenuItems.find(item => item.label === let menuitemCopyColor = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.copyColor")); _STRINGS.GetStringFromName("styleinspector.contextmenu.copyColor"));
ok(menuitemCopyColor.visible, "Copy color is visible"); ok(menuitemCopyColor.visible, "Copy color is visible");

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

@ -5,13 +5,17 @@
/* Tests both Copy URL and Copy Data URL context menu items */ /* Tests both Copy URL and Copy Data URL context menu items */
const PROPERTIES_URL = "chrome://devtools-shared/locale/styleinspector.properties";
const TEST_DATA_URI = "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs="; const TEST_DATA_URI = "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=";
// Invalid URL still needs to be reachable otherwise getImageDataUrl will // Invalid URL still needs to be reachable otherwise getImageDataUrl will
// timeout. DevTools chrome:// URLs aren't content accessible, so use some // timeout. DevTools chrome:// URLs aren't content accessible, so use some
// random resource:// URL here. // random resource:// URL here.
const INVALID_IMAGE_URI = "resource://devtools/client/definitions.js"; const INVALID_IMAGE_URI = "resource://devtools/client/definitions.js";
const ERROR_MESSAGE = STYLE_INSPECTOR_L10N.getStr("styleinspector.copyImageDataUrlError");
const ERROR_MESSAGE = Services.strings
.createBundle(PROPERTIES_URL)
.GetStringFromName("styleinspector.copyImageDataUrlError");
add_task(function* () { add_task(function* () {
const TEST_URI = `<style type="text/css"> const TEST_URI = `<style type="text/css">
@ -75,9 +79,9 @@ function* testCopyUrlToClipboard({view, inspector}, type, selector, expected) {
info("Simulate right click on the background-image URL"); info("Simulate right click on the background-image URL");
let allMenuItems = openStyleContextMenuAndGetAllItems(view, imageLink); let allMenuItems = openStyleContextMenuAndGetAllItems(view, imageLink);
let menuitemCopyUrl = allMenuItems.find(item => item.label === let menuitemCopyUrl = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.copyUrl")); _STRINGS.GetStringFromName("styleinspector.contextmenu.copyUrl"));
let menuitemCopyImageDataUrl = allMenuItems.find(item => item.label === let menuitemCopyImageDataUrl = allMenuItems.find(item => item.label ===
STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.copyImageDataUrl")); _STRINGS.GetStringFromName("styleinspector.contextmenu.copyImageDataUrl"));
info("Context menu is displayed"); info("Context menu is displayed");
ok(menuitemCopyUrl.visible, ok(menuitemCopyUrl.visible,

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

@ -21,7 +21,8 @@ const TEST_URL_ROOT_SSL =
"https://example.com/browser/devtools/client/inspector/shared/test/"; "https://example.com/browser/devtools/client/inspector/shared/test/";
const ROOT_TEST_DIR = getRootDirectory(gTestPath); const ROOT_TEST_DIR = getRootDirectory(gTestPath);
const FRAME_SCRIPT_URL = ROOT_TEST_DIR + "doc_frame_script.js"; const FRAME_SCRIPT_URL = ROOT_TEST_DIR + "doc_frame_script.js";
const STYLE_INSPECTOR_L10N = new LocalizationHelper("chrome://devtools-shared/locale/styleinspector.properties"); const _STRINGS = Services.strings.createBundle(
"chrome://devtools-shared/locale/styleinspector.properties");
// Clean-up all prefs that might have been changed during a test run // Clean-up all prefs that might have been changed during a test run
// (safer here because if the test fails, then the pref is never reverted) // (safer here because if the test fails, then the pref is never reverted)

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

@ -34,9 +34,6 @@ Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/inspector/test/shared-head.js", "chrome://mochitests/content/browser/devtools/client/inspector/test/shared-head.js",
this); this);
const {LocalizationHelper} = require("devtools/client/shared/l10n");
const INSPECTOR_L10N = new LocalizationHelper("devtools/locale/inspector.properties");
flags.testing = true; flags.testing = true;
registerCleanupFunction(() => { registerCleanupFunction(() => {
flags.testing = false; flags.testing = false;
@ -231,8 +228,9 @@ var focusSearchBoxUsingShortcut = Task.async(function* (panelWin, callback) {
let focused = once(searchBox, "focus"); let focused = once(searchBox, "focus");
panelWin.focus(); panelWin.focus();
let strings = Services.strings.createBundle(
synthesizeKeyShortcut(INSPECTOR_L10N.getStr("inspector.searchHTML.key")); "chrome://devtools/locale/inspector.properties");
synthesizeKeyShortcut(strings.GetStringFromName("inspector.searchHTML.key"));
yield focused; yield focused;