зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1560178
- fix devtools tests that load untrusted URIs in the parent, r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D36311 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
8b9bc73770
Коммит
125429e38a
|
@ -6,6 +6,7 @@ prefs =
|
|||
# test behavior by always setting it to false.
|
||||
devtools.aboutdebugging.showHiddenAddons=false
|
||||
support-files =
|
||||
empty.html
|
||||
head.js
|
||||
helper-adb.js
|
||||
helper-addons.js
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<body>fake_profiler_page</body>
|
|
@ -1,7 +1,9 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
"use strict"; // defined in head.js
|
||||
|
||||
/* global CHROME_URL_ROOT */
|
||||
|
||||
// This head file contains helpers to create mock versions of the ClientWrapper class
|
||||
// defined at devtools/client/aboutdebugging-new/src/modules/client-wrapper.js .
|
||||
|
@ -91,8 +93,7 @@ function createClientMock() {
|
|||
setPreference: function(prefName, value) {
|
||||
this._preferences[prefName] = value;
|
||||
},
|
||||
getPerformancePanelUrl: () =>
|
||||
"data:text/html;charset=UTF-8,fake_profiler_page",
|
||||
getPerformancePanelUrl: () => CHROME_URL_ROOT + "empty.html",
|
||||
loadPerformanceProfiler: () => {},
|
||||
// Valid compatibility report
|
||||
checkVersionCompatibility: () => {
|
||||
|
|
|
@ -14,6 +14,12 @@ Services.scriptloader.loadSubScript(
|
|||
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
|
||||
// This is far from ideal. https://bugzilla.mozilla.org/show_bug.cgi?id=1565279
|
||||
// covers removing this pref flip.
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["security.allow_unsafe_parent_loads", true]],
|
||||
});
|
||||
|
||||
function toggleAllTools(state) {
|
||||
for (const [, tool] of gDevTools._tools) {
|
||||
if (!tool.visibilityswitch) {
|
||||
|
|
|
@ -291,6 +291,10 @@ add_task(async function testSidebarSetExtensionPage() {
|
|||
|
||||
info("Testing sidebar.setExtensionPage");
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["security.allow_unsafe_parent_loads", true]],
|
||||
});
|
||||
|
||||
const expectedURL =
|
||||
"data:text/html,<!DOCTYPE html><html><body><h1>Extension Page";
|
||||
|
||||
|
@ -299,6 +303,7 @@ add_task(async function testSidebarSetExtensionPage() {
|
|||
await testSetExtensionPageSidebarPanel(sidebarPanelContent, expectedURL);
|
||||
|
||||
inspectedWindowFront.destroy();
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
add_task(async function teardownExtensionSidebar() {
|
||||
|
|
|
@ -8,6 +8,7 @@ devtools.jar:
|
|||
content/shared/vendor/dagre-d3.js (shared/vendor/dagre-d3.js)
|
||||
content/shared/widgets/widgets.css (shared/widgets/widgets.css)
|
||||
content/shared/widgets/VariablesView.xul (shared/widgets/VariablesView.xul)
|
||||
content/shared/webextension-fallback.html (shared/webextension-fallback.html)
|
||||
content/webconsole/index.html (webconsole/index.html)
|
||||
* content/scratchpad/index.xul (scratchpad/index.xul)
|
||||
content/shared/splitview.css (shared/splitview.css)
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
// Tests that scrollIntoViewIfNeeded works properly.
|
||||
const { scrollIntoViewIfNeeded } = require("devtools/client/shared/scroll");
|
||||
|
||||
const TEST_URI = TEST_URI_ROOT + "doc_layoutHelpers.html";
|
||||
const TEST_URI = CHROME_URL_ROOT + "doc_layoutHelpers.html";
|
||||
|
||||
add_task(async function() {
|
||||
const [host, win] = await createHost("bottom", TEST_URI);
|
||||
|
|
|
@ -17,6 +17,10 @@ add_task(async function() {
|
|||
});
|
||||
|
||||
async function performTest() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["security.allow_unsafe_parent_loads", true]],
|
||||
});
|
||||
|
||||
const OutputParser = require("devtools/client/shared/output-parser");
|
||||
|
||||
const [host, , doc] = await createHost(
|
||||
|
|
|
@ -12,6 +12,9 @@ const TEST_URI =
|
|||
const { TreeWidget } = require("devtools/client/shared/widgets/TreeWidget");
|
||||
|
||||
add_task(async function() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["security.allow_unsafe_parent_loads", true]],
|
||||
});
|
||||
await addTab("about:blank");
|
||||
const [host, , doc] = await createHost("bottom", TEST_URI);
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@ const TEST_URI =
|
|||
const { TreeWidget } = require("devtools/client/shared/widgets/TreeWidget");
|
||||
|
||||
add_task(async function() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["security.allow_unsafe_parent_loads", true]],
|
||||
});
|
||||
await addTab("about:blank");
|
||||
const [host, win, doc] = await createHost("bottom", TEST_URI);
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@ const TEST_URI =
|
|||
const { TreeWidget } = require("devtools/client/shared/widgets/TreeWidget");
|
||||
|
||||
add_task(async function() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["security.allow_unsafe_parent_loads", true]],
|
||||
});
|
||||
await addTab("about:blank");
|
||||
const [host, , doc] = await createHost("bottom", TEST_URI);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ const { DOMHelpers } = ChromeUtils.import(
|
|||
const { Hosts } = require("devtools/client/framework/toolbox-hosts");
|
||||
|
||||
const TEST_URI_ROOT = "http://example.com/browser/devtools/client/shared/test/";
|
||||
const OPTIONS_VIEW_URL = TEST_URI_ROOT + "doc_options-view.xul";
|
||||
const OPTIONS_VIEW_URL = CHROME_URL_ROOT + "doc_options-view.xul";
|
||||
|
||||
const EXAMPLE_URL =
|
||||
"chrome://mochitests/content/browser/devtools/client/shared/test/";
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<!-- 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 https://mozilla.org/MPL/2.0/. -->
|
||||
<meta charset="utf-8">
|
||||
<h1>Your addon does not have any document opened yet.</h1>
|
|
@ -33,8 +33,8 @@ loader.lazyRequireGetter(
|
|||
"devtools/server/actors/thread",
|
||||
true
|
||||
);
|
||||
const FALLBACK_DOC_MESSAGE =
|
||||
"Your addon does not have any document opened yet.";
|
||||
const FALLBACK_DOC_URL =
|
||||
"chrome://devtools/content/shared/webextension-fallback.html";
|
||||
|
||||
/**
|
||||
* Protocol.js expects only the prototype object, and does not maintain the prototype
|
||||
|
@ -177,12 +177,12 @@ webExtensionTargetPrototype._searchFallbackWindow = function() {
|
|||
return this.fallbackWindow;
|
||||
}
|
||||
|
||||
// Set and initialized the fallbackWindow (which initially is a empty
|
||||
// Set and initialize the fallbackWindow (which initially is a empty
|
||||
// about:blank browser), this window is related to a XUL browser element
|
||||
// specifically created for the devtools server and it is never used
|
||||
// or navigated anywhere else.
|
||||
this.fallbackWindow = this.chromeGlobal.content;
|
||||
this.fallbackWindow.location = "data:text/html,<h1>" + FALLBACK_DOC_MESSAGE;
|
||||
this.fallbackWindow.document.location.href = FALLBACK_DOC_URL;
|
||||
|
||||
return this.fallbackWindow;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче