forked from mirrors/gecko-dev
Backed out 8 changesets (bug 1651518, bug 1883847) dt failures in nsTArray.h. CLOSED TREE
Backed out changeset 481558275c1d (bug 1651518) Backed out changeset 5337435e8bca (bug 1651518) Backed out changeset 8fe0c1a4da7f (bug 1651518) Backed out changeset 840a0d9db260 (bug 1651518) Backed out changeset eaab9de5819d (bug 1651518) Backed out changeset cf71de92d782 (bug 1651518) Backed out changeset d778691464db (bug 1651518) Backed out changeset af28e5f719e8 (bug 1883847)
This commit is contained in:
parent
17e92790dd
commit
621bf1a656
37 changed files with 179 additions and 223 deletions
|
|
@ -38,8 +38,7 @@ add_task(async function () {
|
|||
await waitForThreadCount(dbg, 1);
|
||||
const threads = dbg.selectors.getThreads();
|
||||
is(threads.length, 1, "Got the page and the worker threads");
|
||||
is(threads[0].name, "worker.js", "Thread name is correct");
|
||||
is(threads[0].url, WORKER_URL, "Thread URL is correct");
|
||||
is(threads[0].name, WORKER_URL, "Thread name is correct");
|
||||
|
||||
const source = await waitForSource(dbg, "worker.js");
|
||||
await selectSource(dbg, source);
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ add_task(async function testSourceTextContent() {
|
|||
|
||||
const workerThread = dbg.selectors
|
||||
.getAllThreads()
|
||||
.find(thread => thread.url == `${BASE_URL}same-url.js`);
|
||||
.find(thread => thread.name == `${BASE_URL}same-url.js`);
|
||||
|
||||
is(
|
||||
sourceActors.filter(actor => actor.thread == workerThread.actor).length,
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ add_task(async function testSourceTreeOnTheIntegrationTestPage() {
|
|||
|
||||
const workerThread = dbg.selectors
|
||||
.getAllThreads()
|
||||
.find(thread => thread.url == testServer.urlFor("same-url.sjs"));
|
||||
.find(thread => thread.name == testServer.urlFor("same-url.sjs"));
|
||||
|
||||
is(
|
||||
sourceActors.filter(actor => actor.thread == workerThread.actor).length,
|
||||
|
|
|
|||
|
|
@ -12,16 +12,13 @@ const CHROME_DEBUGGER_PROFILE_NAME = "chrome_debugger_profile";
|
|||
|
||||
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
|
||||
import { require } from "resource://devtools/shared/loader/Loader.sys.mjs";
|
||||
import {
|
||||
useDistinctSystemPrincipalLoader,
|
||||
releaseDistinctSystemPrincipalLoader,
|
||||
} from "resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs";
|
||||
import { Subprocess } from "resource://gre/modules/Subprocess.sys.mjs";
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const {
|
||||
useDistinctSystemPrincipalLoader,
|
||||
releaseDistinctSystemPrincipalLoader,
|
||||
} = ChromeUtils.importESModule(
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs",
|
||||
{ global: "shared" }
|
||||
);
|
||||
const lazy = {};
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
BackgroundTasksUtils: "resource://gre/modules/BackgroundTasksUtils.sys.mjs",
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ var { loader, require } = ChromeUtils.importESModule(
|
|||
|
||||
var { useDistinctSystemPrincipalLoader, releaseDistinctSystemPrincipalLoader } =
|
||||
ChromeUtils.importESModule(
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs",
|
||||
{ global: "shared" }
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs"
|
||||
);
|
||||
|
||||
// Require this module to setup core modules
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ let tracker, releaseTrackerLoader;
|
|||
useDistinctSystemPrincipalLoader,
|
||||
releaseDistinctSystemPrincipalLoader,
|
||||
} = ChromeUtils.importESModule(
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs",
|
||||
{ global: "shared" }
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs"
|
||||
);
|
||||
|
||||
const requester = {};
|
||||
|
|
|
|||
|
|
@ -28,12 +28,6 @@ class WorkerTargetFront extends TargetMixin(
|
|||
get isServiceWorker() {
|
||||
return this._type === Ci.nsIWorkerDebugger.TYPE_SERVICE;
|
||||
}
|
||||
|
||||
// Display file name instead of absolute URL in the context selector/threads panel
|
||||
get name() {
|
||||
return this._url.split("/").pop();
|
||||
}
|
||||
|
||||
form(json) {
|
||||
this.actorID = json.actor;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ if (DEBUG_ALLOCATIONS) {
|
|||
useDistinctSystemPrincipalLoader,
|
||||
releaseDistinctSystemPrincipalLoader,
|
||||
} = ChromeUtils.importESModule(
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs",
|
||||
{ global: "shared" }
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs"
|
||||
);
|
||||
const requester = {};
|
||||
const loader = useDistinctSystemPrincipalLoader(requester);
|
||||
|
|
@ -79,8 +78,7 @@ if (DEBUG_STEP) {
|
|||
useDistinctSystemPrincipalLoader,
|
||||
releaseDistinctSystemPrincipalLoader,
|
||||
} = ChromeUtils.importESModule(
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs",
|
||||
{ global: "shared" }
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs"
|
||||
);
|
||||
const requester = {};
|
||||
const loader = useDistinctSystemPrincipalLoader(requester);
|
||||
|
|
|
|||
|
|
@ -24,18 +24,12 @@ function filterTextSet(text) {
|
|||
}
|
||||
|
||||
function filterToggle(filter) {
|
||||
return async ({ dispatch, getState, webConsoleUI, prefsService }) => {
|
||||
// When enabling CSS Warning message, we have to start listening for it
|
||||
let filterState = getAllFilters(getState());
|
||||
if (filter == FILTERS.CSS && !filterState[FILTERS.CSS]) {
|
||||
await webConsoleUI.watchCssMessages();
|
||||
}
|
||||
|
||||
return ({ dispatch, getState, prefsService }) => {
|
||||
dispatch({
|
||||
type: FILTER_TOGGLE,
|
||||
filter,
|
||||
});
|
||||
filterState = getAllFilters(getState());
|
||||
const filterState = getAllFilters(getState());
|
||||
prefsService.setBoolPref(
|
||||
PREFS.FILTER[filter.toUpperCase()],
|
||||
filterState[filter]
|
||||
|
|
|
|||
43
devtools/client/webconsole/enhancers/css-error-reporting.js
Normal file
43
devtools/client/webconsole/enhancers/css-error-reporting.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/* 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";
|
||||
|
||||
const {
|
||||
INITIALIZE,
|
||||
FILTER_TOGGLE,
|
||||
FILTERS,
|
||||
} = require("resource://devtools/client/webconsole/constants.js");
|
||||
|
||||
/**
|
||||
* This is responsible for ensuring that error reporting is enabled if the CSS
|
||||
* filter is toggled on.
|
||||
*/
|
||||
function ensureCSSErrorReportingEnabled(webConsoleUI) {
|
||||
let watchingCSSMessages = false;
|
||||
return next => (reducer, initialState, enhancer) => {
|
||||
function ensureErrorReportingEnhancer(state, action) {
|
||||
state = reducer(state, action);
|
||||
|
||||
// If we're already watching CSS messages, or if the CSS filter is disabled,
|
||||
// we don't do anything.
|
||||
if (!webConsoleUI || watchingCSSMessages || !state.filters.css) {
|
||||
return state;
|
||||
}
|
||||
|
||||
const cssFilterToggled =
|
||||
action.type == FILTER_TOGGLE && action.filter == FILTERS.CSS;
|
||||
|
||||
if (cssFilterToggled || action.type == INITIALIZE) {
|
||||
watchingCSSMessages = true;
|
||||
webConsoleUI.watchCssMessages();
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
return next(ensureErrorReportingEnhancer, initialState, enhancer);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = ensureCSSErrorReportingEnabled;
|
||||
|
|
@ -6,5 +6,6 @@
|
|||
DevToolsModules(
|
||||
"actor-releaser.js",
|
||||
"batching.js",
|
||||
"css-error-reporting.js",
|
||||
"message-cache-clearing.js",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ const {
|
|||
// Enhancers
|
||||
const enableBatching = require("resource://devtools/client/webconsole/enhancers/batching.js");
|
||||
const enableActorReleaser = require("resource://devtools/client/webconsole/enhancers/actor-releaser.js");
|
||||
const ensureCSSErrorReportingEnabled = require("resource://devtools/client/webconsole/enhancers/css-error-reporting.js");
|
||||
const enableMessagesCacheClearing = require("resource://devtools/client/webconsole/enhancers/message-cache-clearing.js");
|
||||
|
||||
/**
|
||||
|
|
@ -118,6 +119,7 @@ function configureStore(webConsoleUI, options = {}) {
|
|||
middleware,
|
||||
enableActorReleaser(webConsoleUI),
|
||||
enableMessagesCacheClearing(webConsoleUI),
|
||||
ensureCSSErrorReportingEnabled(webConsoleUI),
|
||||
// ⚠️ Keep this one last so it will be executed before all the other ones. This is
|
||||
// needed so batched actions can be "unbatched" and handled in the other enhancers.
|
||||
enableBatching()
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ add_task(async function () {
|
|||
});
|
||||
checkContextSelectorMenuItemAt(hud, workerIndex, {
|
||||
label: workerFile,
|
||||
tooltip: workerUrl,
|
||||
tooltip: workerFile,
|
||||
checked: true,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ function setupStore(
|
|||
}
|
||||
const store = configureStore(webConsoleUI, {
|
||||
...storeOptions,
|
||||
thunkArgs: { toolbox: {}, webConsoleUI },
|
||||
thunkArgs: { toolbox: {} },
|
||||
telemetry: new Telemetry(),
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ describe("Filtering", () => {
|
|||
expect(messages.length).toEqual(numUnfilterableMessages + 5);
|
||||
});
|
||||
|
||||
it("filters css messages", async () => {
|
||||
it("filters css messages", () => {
|
||||
const message = stubPreparedMessages.get(
|
||||
"Unknown property ‘such-unknown-property’. Declaration dropped."
|
||||
);
|
||||
|
|
@ -109,7 +109,7 @@ describe("Filtering", () => {
|
|||
let messages = getVisibleMessages(store.getState());
|
||||
expect(messages.length).toEqual(numUnfilterableMessages);
|
||||
|
||||
await store.dispatch(actions.filterToggle("css"));
|
||||
store.dispatch(actions.filterToggle("css"));
|
||||
messages = getVisibleMessages(store.getState());
|
||||
expect(messages.length).toEqual(numUnfilterableMessages + 1);
|
||||
});
|
||||
|
|
@ -251,12 +251,12 @@ describe("Filtering", () => {
|
|||
});
|
||||
|
||||
describe("Clear filters", () => {
|
||||
it("clears all filters", async () => {
|
||||
it("clears all filters", () => {
|
||||
const store = setupStore();
|
||||
|
||||
// Setup test case
|
||||
store.dispatch(actions.filterToggle(FILTERS.ERROR));
|
||||
await store.dispatch(actions.filterToggle(FILTERS.CSS));
|
||||
store.dispatch(actions.filterToggle(FILTERS.CSS));
|
||||
store.dispatch(actions.filterToggle(FILTERS.NET));
|
||||
store.dispatch(actions.filterToggle(FILTERS.NETXHR));
|
||||
store.dispatch(actions.filterTextSet("foobar"));
|
||||
|
|
|
|||
|
|
@ -17,10 +17,7 @@ const {
|
|||
getAdHocFrontOrPrimitiveGrip,
|
||||
} = require("resource://devtools/client/fronts/object.js");
|
||||
|
||||
const {
|
||||
PREFS,
|
||||
FILTERS,
|
||||
} = require("resource://devtools/client/webconsole/constants.js");
|
||||
const { PREFS } = require("resource://devtools/client/webconsole/constants.js");
|
||||
|
||||
const FirefoxDataProvider = require("resource://devtools/client/netmonitor/src/connector/firefox-data-provider.js");
|
||||
|
||||
|
|
@ -182,11 +179,21 @@ class WebConsoleUI {
|
|||
});
|
||||
|
||||
const resourceCommand = this.hud.resourceCommand;
|
||||
if (this._watchedResources) {
|
||||
resourceCommand.unwatchResources(this._watchedResources, {
|
||||
resourceCommand.unwatchResources(
|
||||
[
|
||||
resourceCommand.TYPES.CONSOLE_MESSAGE,
|
||||
resourceCommand.TYPES.ERROR_MESSAGE,
|
||||
resourceCommand.TYPES.PLATFORM_MESSAGE,
|
||||
resourceCommand.TYPES.DOCUMENT_EVENT,
|
||||
resourceCommand.TYPES.LAST_PRIVATE_CONTEXT_EXIT,
|
||||
resourceCommand.TYPES.JSTRACER_TRACE,
|
||||
resourceCommand.TYPES.JSTRACER_STATE,
|
||||
],
|
||||
{ onAvailable: this._onResourceAvailable }
|
||||
);
|
||||
resourceCommand.unwatchResources([resourceCommand.TYPES.CSS_MESSAGE], {
|
||||
onAvailable: this._onResourceAvailable,
|
||||
});
|
||||
}
|
||||
|
||||
this.stopWatchingNetworkResources();
|
||||
|
||||
|
|
@ -325,7 +332,8 @@ class WebConsoleUI {
|
|||
onDestroyed: this._onTargetDestroyed,
|
||||
});
|
||||
|
||||
this._watchedResources = [
|
||||
await resourceCommand.watchResources(
|
||||
[
|
||||
resourceCommand.TYPES.CONSOLE_MESSAGE,
|
||||
resourceCommand.TYPES.ERROR_MESSAGE,
|
||||
resourceCommand.TYPES.PLATFORM_MESSAGE,
|
||||
|
|
@ -333,18 +341,9 @@ class WebConsoleUI {
|
|||
resourceCommand.TYPES.LAST_PRIVATE_CONTEXT_EXIT,
|
||||
resourceCommand.TYPES.JSTRACER_TRACE,
|
||||
resourceCommand.TYPES.JSTRACER_STATE,
|
||||
];
|
||||
|
||||
// CSS Warnings are only enabled when the user explicitely requested to show them
|
||||
// as it can slow down page load.
|
||||
const shouldShowCssWarnings = this.wrapper.getFilterState(FILTERS.CSS);
|
||||
if (shouldShowCssWarnings) {
|
||||
this._watchedResources.push(resourceCommand.TYPES.CSS_MESSAGE);
|
||||
}
|
||||
|
||||
await resourceCommand.watchResources(this._watchedResources, {
|
||||
onAvailable: this._onResourceAvailable,
|
||||
});
|
||||
],
|
||||
{ onAvailable: this._onResourceAvailable }
|
||||
);
|
||||
|
||||
if (this.isBrowserConsole || this.isBrowserToolboxConsole) {
|
||||
const shouldEnableNetworkMonitoring = Services.prefs.getBoolPref(
|
||||
|
|
@ -452,18 +451,11 @@ class WebConsoleUI {
|
|||
this.wrapper.dispatchTabWillNavigate({ timeStamp, url });
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the CSS Warning filter is enabled, in order to start observing for them in the backend.
|
||||
*/
|
||||
async watchCssMessages() {
|
||||
const { resourceCommand } = this.hud;
|
||||
if (this._watchedResources.includes(resourceCommand.TYPES.CSS_MESSAGE)) {
|
||||
return;
|
||||
}
|
||||
await resourceCommand.watchResources([resourceCommand.TYPES.CSS_MESSAGE], {
|
||||
onAvailable: this._onResourceAvailable,
|
||||
});
|
||||
this._watchedResources.push(resourceCommand.TYPES.CSS_MESSAGE);
|
||||
}
|
||||
|
||||
_onResourceAvailable(resources) {
|
||||
|
|
|
|||
|
|
@ -31,9 +31,6 @@ const EventEmitter = require("resource://devtools/shared/event-emitter.js");
|
|||
const App = createFactory(
|
||||
require("resource://devtools/client/webconsole/components/App.js")
|
||||
);
|
||||
const {
|
||||
getAllFilters,
|
||||
} = require("resource://devtools/client/webconsole/selectors/filters.js");
|
||||
|
||||
loader.lazyGetter(this, "AppErrorBoundary", () =>
|
||||
createFactory(
|
||||
|
|
@ -174,19 +171,6 @@ class WebConsoleWrapper {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the reducer store for the current state of filtering
|
||||
* a given type of message
|
||||
*
|
||||
* @param {String} filter
|
||||
* Type of message to be filtered.
|
||||
* @return {Boolean}
|
||||
* True if this type of message should be displayed.
|
||||
*/
|
||||
getFilterState(filter) {
|
||||
return getAllFilters(this.getStore().getState())[filter];
|
||||
}
|
||||
|
||||
dispatchMessageAdd(packet) {
|
||||
this.batchedMessagesAdd([packet]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -256,8 +256,6 @@ function getResourceTypeDictionaryForTargetType(targetType) {
|
|||
return WorkerTargetResources;
|
||||
case Targets.TYPES.SERVICE_WORKER:
|
||||
return WorkerTargetResources;
|
||||
case Targets.TYPES.SHARED_WORKER:
|
||||
return WorkerTargetResources;
|
||||
default:
|
||||
throw new Error(`Unsupported target actor typeName '${targetType}'`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -279,7 +279,8 @@ exports.WatcherActor = class WatcherActor extends Actor {
|
|||
unwatchTargets(targetType, options = {}) {
|
||||
const isWatchingTargets = ParentProcessWatcherRegistry.unwatchTargets(
|
||||
this,
|
||||
targetType
|
||||
targetType,
|
||||
options
|
||||
);
|
||||
if (!isWatchingTargets) {
|
||||
return;
|
||||
|
|
@ -293,6 +294,13 @@ exports.WatcherActor = class WatcherActor extends Actor {
|
|||
options,
|
||||
});
|
||||
}
|
||||
|
||||
// Unregister the JS Actors if there is no more DevTools code observing any target/resource,
|
||||
// unless we're switching mode (having both condition at the same time should only
|
||||
// happen in tests).
|
||||
if (!options.isModeSwitching) {
|
||||
ParentProcessWatcherRegistry.maybeUnregisterJSActors();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -653,6 +661,9 @@ exports.WatcherActor = class WatcherActor extends Actor {
|
|||
);
|
||||
targetActor.removeSessionDataEntry("resources", targetActorResourceTypes);
|
||||
}
|
||||
|
||||
// Unregister the JS Window Actor if there is no more DevTools code observing any target/resource
|
||||
ParentProcessWatcherRegistry.maybeUnregisterJSActors();
|
||||
}
|
||||
|
||||
clearResources(resourceTypes) {
|
||||
|
|
|
|||
|
|
@ -198,11 +198,14 @@ export const ParentProcessWatcherRegistry = {
|
|||
* The type of data to be removed
|
||||
* @param Array<Object> entries
|
||||
* The values to be removed to this type of data
|
||||
* @params {Object} options
|
||||
* @params {Boolean} options.isModeSwitching: Set to true true when this is called as the
|
||||
* result of a change to the devtools.browsertoolbox.scope pref.
|
||||
*
|
||||
* @return boolean
|
||||
* True if we such entry was already registered, for this watcher actor.
|
||||
*/
|
||||
removeSessionDataEntry(watcher, type, entries) {
|
||||
removeSessionDataEntry(watcher, type, entries, options) {
|
||||
const sessionData = this.getSessionData(watcher);
|
||||
if (!sessionData) {
|
||||
return false;
|
||||
|
|
@ -218,6 +221,19 @@ export const ParentProcessWatcherRegistry = {
|
|||
return false;
|
||||
}
|
||||
|
||||
const isWatchingSomething = SUPPORTED_DATA_TYPES.some(
|
||||
dataType => sessionData[dataType] && !!sessionData[dataType].length
|
||||
);
|
||||
|
||||
// Remove the watcher reference if it's not watching for anything anymore, unless we're
|
||||
// doing a mode switch; in such case we don't mean to end the DevTools session, so we
|
||||
// still want to have access to the underlying data (furthermore, such case should only
|
||||
// happen in tests, in a regular workflow we'd still be watching for resources).
|
||||
if (!isWatchingSomething && !options?.isModeSwitching) {
|
||||
sessionDataByWatcherActor.delete(watcher.actorID);
|
||||
watcherActors.delete(watcher.actorID);
|
||||
}
|
||||
|
||||
persistMapToSharedData();
|
||||
|
||||
return true;
|
||||
|
|
@ -271,13 +287,19 @@ export const ParentProcessWatcherRegistry = {
|
|||
* The WatcherActor which stops observing.
|
||||
* @param string targetType
|
||||
* The new target type to stop listening to.
|
||||
* @params {Object} options
|
||||
* @params {Boolean} options.isModeSwitching: Set to true true when this is called as the
|
||||
* result of a change to the devtools.browsertoolbox.scope pref.
|
||||
* @return boolean
|
||||
* True if we were watching for this target type, for this watcher actor.
|
||||
*/
|
||||
unwatchTargets(watcher, targetType) {
|
||||
return this.removeSessionDataEntry(watcher, SUPPORTED_DATA.TARGETS, [
|
||||
targetType,
|
||||
]);
|
||||
unwatchTargets(watcher, targetType, options) {
|
||||
return this.removeSessionDataEntry(
|
||||
watcher,
|
||||
SUPPORTED_DATA.TARGETS,
|
||||
[targetType],
|
||||
options
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -159,10 +159,10 @@ function getWatcherSupportedTargets(type) {
|
|||
return {
|
||||
[Targets.TYPES.FRAME]: true,
|
||||
[Targets.TYPES.PROCESS]: true,
|
||||
[Targets.TYPES.WORKER]: true,
|
||||
[Targets.TYPES.SERVICE_WORKER]:
|
||||
type == SESSION_TYPES.BROWSER_ELEMENT || type == SESSION_TYPES.ALL,
|
||||
[Targets.TYPES.SHARED_WORKER]: type == SESSION_TYPES.ALL,
|
||||
[Targets.TYPES.WORKER]:
|
||||
type == SESSION_TYPES.BROWSER_ELEMENT ||
|
||||
type == SESSION_TYPES.WEBEXTENSION,
|
||||
[Targets.TYPES.SERVICE_WORKER]: type == SESSION_TYPES.BROWSER_ELEMENT,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const lazy = {};
|
||||
ChromeUtils.defineESModuleGetters(
|
||||
lazy,
|
||||
{
|
||||
loader: "resource://devtools/shared/loader/Loader.sys.mjs",
|
||||
},
|
||||
{ global: "contextual" }
|
||||
);
|
||||
|
||||
ChromeUtils.defineESModuleGetters(
|
||||
lazy,
|
||||
{
|
||||
|
|
@ -18,8 +10,9 @@ ChromeUtils.defineESModuleGetters(
|
|||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs",
|
||||
useDistinctSystemPrincipalLoader:
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs",
|
||||
loader: "resource://devtools/shared/loader/Loader.sys.mjs",
|
||||
},
|
||||
{ global: "shared" }
|
||||
{ global: "contextual" }
|
||||
);
|
||||
|
||||
// Name of the attribute into which we save data in `sharedData` object.
|
||||
|
|
@ -164,17 +157,11 @@ export const ContentProcessWatcherRegistry = {
|
|||
return { connection, loader };
|
||||
}
|
||||
|
||||
// When debugging a privileged page, like about:addons, this module will run in the same compartment
|
||||
// as the debugged page. Both will run in the shared system compartment.
|
||||
const { sessionContext, forwardingPrefix } = watcherDataObject;
|
||||
// For the browser toolbox, we need to use a distinct loader in order to debug privileged JS.
|
||||
// The thread actor ultimately need to be in a distinct compartments from its debuggees.
|
||||
// So we are using a special loader, which will use a distinct privileged global and compartment
|
||||
// to load itself as well as all its modules.
|
||||
//
|
||||
// Note that when we are running the Browser Toolbox, this module will already be loaded in a special, distinct global and compartment
|
||||
// Thanks to `loadInDevToolsLoader` flag of BrowserToolboxDevToolsProcess's JS Process Actor configuration.
|
||||
// So that the Loader will also be loaded in the right, distinct compartment.
|
||||
loader =
|
||||
useDistinctLoader || watcherDataObject.sessionContext.type == "all"
|
||||
useDistinctLoader || sessionContext.type == "all"
|
||||
? lazy.useDistinctSystemPrincipalLoader(watcherDataObject)
|
||||
: lazy.loader;
|
||||
watcherDataObject.loader = loader;
|
||||
|
|
@ -192,7 +179,6 @@ export const ContentProcessWatcherRegistry = {
|
|||
|
||||
// Instantiate a DevToolsServerConnection which will pipe all its outgoing RDP packets
|
||||
// up to the parent process manager via DevToolsProcess JS Actor messages.
|
||||
const { forwardingPrefix } = watcherDataObject;
|
||||
connection = DevToolsServer.connectToParentWindowActor(
|
||||
watcherDataObject.jsProcessActor,
|
||||
forwardingPrefix,
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ ChromeUtils.defineESModuleGetters(
|
|||
"resource://devtools/server/actors/watcher/SessionDataHelpers.sys.mjs",
|
||||
ServiceWorkerTargetWatcher:
|
||||
"resource://devtools/server/connectors/js-process-actor/target-watchers/service_worker.sys.mjs",
|
||||
SharedWorkerTargetWatcher:
|
||||
"resource://devtools/server/connectors/js-process-actor/target-watchers/shared_worker.sys.mjs",
|
||||
WorkerTargetWatcher:
|
||||
"resource://devtools/server/connectors/js-process-actor/target-watchers/worker.sys.mjs",
|
||||
WindowGlobalTargetWatcher:
|
||||
|
|
@ -79,13 +77,6 @@ export class DevToolsProcessChild extends JSProcessActorChild {
|
|||
return lazy.ServiceWorkerTargetWatcher;
|
||||
},
|
||||
},
|
||||
|
||||
shared_worker: {
|
||||
activeListener: 0,
|
||||
get watcher() {
|
||||
return lazy.SharedWorkerTargetWatcher;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
#initialized = false;
|
||||
|
|
@ -432,14 +423,6 @@ export class DevToolsProcessChild extends JSProcessActorChild {
|
|||
updateType
|
||||
);
|
||||
}
|
||||
if (watchingTargetTypes.includes("shared_worker")) {
|
||||
await this.#watchers.shared_worker.watcher.addOrSetSessionDataEntry(
|
||||
watcherDataObject,
|
||||
type,
|
||||
entries,
|
||||
updateType
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -496,14 +479,14 @@ export class DevToolsProcessChild extends JSProcessActorChild {
|
|||
* but also within this class when the last watcher stopped watching for targets.
|
||||
*/
|
||||
didDestroy() {
|
||||
// Unregister all the active watchers.
|
||||
// This will destroy all the active target actors and unregister the target observers.
|
||||
for (const watcherDataObject of ContentProcessWatcherRegistry.getAllWatchersDataObjects()) {
|
||||
this.#destroyWatcher(watcherDataObject);
|
||||
// Stop watching for all target types
|
||||
for (const entry of Object.values(this.#watchers)) {
|
||||
if (entry.activeListener > 0) {
|
||||
entry.watcher.unwatch();
|
||||
entry.activeListener = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// The previous for loop should have removed all the elements,
|
||||
// but just to be safe, wipe all stored data to avoid any possible leak.
|
||||
ContentProcessWatcherRegistry.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
DevToolsModules(
|
||||
"process.sys.mjs",
|
||||
"service_worker.sys.mjs",
|
||||
"shared_worker.sys.mjs",
|
||||
"window-global.sys.mjs",
|
||||
"worker.sys.mjs",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
/* 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/. */
|
||||
|
||||
import { WorkerTargetWatcherClass } from "resource://devtools/server/connectors/js-process-actor/target-watchers/worker.sys.mjs";
|
||||
|
||||
class SharedWorkerTargetWatcherClass extends WorkerTargetWatcherClass {
|
||||
constructor() {
|
||||
super("shared_worker");
|
||||
}
|
||||
}
|
||||
|
||||
export const SharedWorkerTargetWatcher = new SharedWorkerTargetWatcherClass();
|
||||
|
|
@ -229,13 +229,6 @@ export class WorkerTargetWatcherClass {
|
|||
workerInfo.workerTargetForm = workerTargetForm;
|
||||
workerInfo.transport = transport;
|
||||
|
||||
// Bail out and cleanup the actor by closing the transport,
|
||||
// if we stopped listening for workers while waiting for onConnectToWorker resolution.
|
||||
if (!watcherDataObject.workers.includes(workerInfo)) {
|
||||
transport.close();
|
||||
return;
|
||||
}
|
||||
|
||||
const { forwardingPrefix } = watcherDataObject;
|
||||
// Immediately queue a message for the parent process, before applying any SessionData
|
||||
// as it may start emitting RDP events on the target actor and be lost if the client
|
||||
|
|
@ -280,11 +273,23 @@ export class WorkerTargetWatcherClass {
|
|||
|
||||
destroyTargetsForWatcher(watcherDataObject) {
|
||||
// Notify to all worker threads to destroy their target actor running in them
|
||||
for (const { transport } of watcherDataObject.workers) {
|
||||
// The transport may not be set if the worker is still being connected to from createWorkerTargetActor.
|
||||
for (const {
|
||||
dbg,
|
||||
workerThreadServerForwardingPrefix,
|
||||
transport,
|
||||
} of watcherDataObject.workers) {
|
||||
if (isWorkerDebuggerAlive(dbg)) {
|
||||
try {
|
||||
dbg.postMessage(
|
||||
JSON.stringify({
|
||||
type: "disconnect",
|
||||
forwardingPrefix: workerThreadServerForwardingPrefix,
|
||||
})
|
||||
);
|
||||
} catch (e) {}
|
||||
}
|
||||
// Also cleanup the DevToolsTransport created in the main thread to bridge RDP to the worker thread
|
||||
if (transport) {
|
||||
// Clean the DevToolsTransport created in the main thread to bridge RDP to the worker thread.
|
||||
// This will also send a last message to the worker to clean things up in the other thread.
|
||||
transport.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -317,16 +322,6 @@ export class WorkerTargetWatcherClass {
|
|||
return false;
|
||||
}
|
||||
|
||||
// subprocess workers are ignored because they take several seconds to
|
||||
// attach to when opening the browser toolbox. See bug 1594597.
|
||||
if (
|
||||
/resource:\/\/gre\/modules\/subprocess\/subprocess_.*\.worker\.js/.test(
|
||||
dbg.url
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { type: sessionContextType } = sessionData.sessionContext;
|
||||
if (sessionContextType == "all") {
|
||||
return true;
|
||||
|
|
@ -377,9 +372,10 @@ export class WorkerTargetWatcherClass {
|
|||
}
|
||||
|
||||
if (dbg.type === TYPE_SHARED) {
|
||||
// Don't expose shared workers when debugging a tab.
|
||||
// For now, they are only exposed in the browser toolbox, when Session Context Type is set to "all".
|
||||
return false;
|
||||
// We still don't fully support instantiating targets for shared workers from the server side
|
||||
throw new Error(
|
||||
"Server side listening for shared workers isn't supported"
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -258,12 +258,6 @@ var DevToolsServer = {
|
|||
// Remove connections that were accepted in the listener.
|
||||
for (const connID of Object.getOwnPropertyNames(this._connections)) {
|
||||
const connection = this._connections[connID];
|
||||
// When calling connection.close on a previous element,
|
||||
// this may unregister some of the following other connections in `_connections`
|
||||
// and make them be null here.
|
||||
if (!connection) {
|
||||
continue;
|
||||
}
|
||||
if (connection.isAcceptedBy(listener)) {
|
||||
connection.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ export function initContentProcessTarget(msg) {
|
|||
useDistinctSystemPrincipalLoader,
|
||||
releaseDistinctSystemPrincipalLoader,
|
||||
} = ChromeUtils.importESModule(
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs",
|
||||
{ global: "shared" }
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs"
|
||||
);
|
||||
|
||||
// Use a unique object to identify this one usage of the loader
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@ try {
|
|||
customLoader = false;
|
||||
if (content.document.nodePrincipal.isSystemPrincipal) {
|
||||
const { useDistinctSystemPrincipalLoader } = ChromeUtils.importESModule(
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs",
|
||||
{ global: "shared" }
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs"
|
||||
);
|
||||
loader = useDistinctSystemPrincipalLoader(chromeGlobal);
|
||||
customLoader = true;
|
||||
|
|
@ -182,8 +181,7 @@ try {
|
|||
if (customLoader) {
|
||||
const { releaseDistinctSystemPrincipalLoader } =
|
||||
ChromeUtils.importESModule(
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs",
|
||||
{ global: "shared" }
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs"
|
||||
);
|
||||
releaseDistinctSystemPrincipalLoader(chromeGlobal);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,8 +89,7 @@ function getDistinctDevToolsServer() {
|
|||
useDistinctSystemPrincipalLoader,
|
||||
releaseDistinctSystemPrincipalLoader,
|
||||
} = ChromeUtils.importESModule(
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs",
|
||||
{ global: "shared" }
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs"
|
||||
);
|
||||
const requester = {};
|
||||
const distinctLoader = useDistinctSystemPrincipalLoader(requester);
|
||||
|
|
|
|||
|
|
@ -179,10 +179,6 @@ class ResourceCommand {
|
|||
}
|
||||
}
|
||||
|
||||
// Copy the array in order to avoid the callsite to modify the list of watched resources by mutating the array.
|
||||
// You have to call (un)watchResources to update the list of resources being watched!
|
||||
resources = [...resources];
|
||||
|
||||
// Pending watchers are used in unwatchResources to remove watchers which
|
||||
// are not fully registered yet. Store `onAvailable` which is the unique key
|
||||
// for a watcher, as well as the resources array, so that unwatchResources
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@ add_task(async function () {
|
|||
};
|
||||
|
||||
info("Watch for error messages resources");
|
||||
const watchedResources = [resourceCommand.TYPES.ERROR_MESSAGE];
|
||||
await resourceCommand.watchResources(watchedResources, {
|
||||
await resourceCommand.watchResources([resourceCommand.TYPES.ERROR_MESSAGE], {
|
||||
onAvailable,
|
||||
});
|
||||
|
||||
|
|
@ -35,10 +34,6 @@ add_task(async function () {
|
|||
"no resources were received after the first watchResources call"
|
||||
);
|
||||
|
||||
// Clear the array which was passed to watchResources.
|
||||
// It should not impact ResourceCommand behavior!
|
||||
watchedResources.length = 0;
|
||||
|
||||
info("Trigger an error in the page");
|
||||
await ContentTask.spawn(tab.linkedBrowser, [], function frameScript() {
|
||||
const document = content.document;
|
||||
|
|
|
|||
|
|
@ -72,12 +72,7 @@ export function DevToolsLoader({
|
|||
"toolkit/locales": "chrome://global/locale",
|
||||
};
|
||||
|
||||
// In case the Loader ESM is loaded in DevTools global,
|
||||
// also reuse this global for all CommonJS modules.
|
||||
const sharedGlobal =
|
||||
useDevToolsLoaderGlobal ||
|
||||
// eslint-disable-next-line mozilla/reject-globalThis-modification
|
||||
Cu.getRealmLocation(globalThis) == "DevTools global"
|
||||
const sharedGlobal = useDevToolsLoaderGlobal
|
||||
? Cu.getGlobalForObject({})
|
||||
: undefined;
|
||||
this.loader = new Loader({
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ const {
|
|||
useDistinctSystemPrincipalLoader,
|
||||
releaseDistinctSystemPrincipalLoader,
|
||||
} = ChromeUtils.importESModule(
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs",
|
||||
{ global: "shared" }
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs"
|
||||
);
|
||||
|
||||
const { DevToolsSocketStatus } = ChromeUtils.importESModule(
|
||||
|
|
|
|||
|
|
@ -60,8 +60,7 @@ function distinct_system_principal_loader() {
|
|||
useDistinctSystemPrincipalLoader,
|
||||
releaseDistinctSystemPrincipalLoader,
|
||||
} = ChromeUtils.importESModule(
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs",
|
||||
{ global: "shared" }
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs"
|
||||
);
|
||||
|
||||
const requester = {};
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ const {
|
|||
useDistinctSystemPrincipalLoader,
|
||||
releaseDistinctSystemPrincipalLoader,
|
||||
} = ChromeUtils.importESModule(
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs",
|
||||
{ global: "shared" }
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs"
|
||||
);
|
||||
|
||||
function run_test() {
|
||||
|
|
|
|||
|
|
@ -1091,8 +1091,7 @@ DevToolsStartup.prototype = {
|
|||
useDistinctSystemPrincipalLoader,
|
||||
releaseDistinctSystemPrincipalLoader,
|
||||
} = ChromeUtils.importESModule(
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs",
|
||||
{ global: "shared" }
|
||||
"resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs"
|
||||
);
|
||||
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in a new issue