Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/devtools/client/debugger/src/actions/sources/newSources.js b/devtools/client/debugger/src/actions/sources/newSources.js
- index f10bbcf7aa3f..7bfb8520f3d1 100644
- --- a/devtools/client/debugger/src/actions/sources/newSources.js
- +++ b/devtools/client/debugger/src/actions/sources/newSources.js
- @@ -291,8 +291,6 @@ export function newGeneratedSources(sourceInfo: Array<GeneratedSourceData>) {
- getState,
- client,
- }: ThunkArgs): Promise<Array<Source>> => {
- - const supportsWasm = client.hasWasmSupport();
- -
- const resultIds = [];
- const newSourcesObj = {};
- const newSourceActors: Array<SourceActor> = [];
- @@ -310,7 +308,7 @@ export function newGeneratedSources(sourceInfo: Array<GeneratedSourceData>) {
- introductionUrl: source.introductionUrl,
- introductionType: source.introductionType,
- isBlackBoxed: false,
- - isWasm: !!supportsWasm && source.introductionType === "wasm",
- + isWasm: source.introductionType === "wasm",
- isExtension: (source.url && isUrlExtension(source.url)) || false,
- };
- }
- diff --git a/devtools/client/debugger/src/client/firefox.js b/devtools/client/debugger/src/client/firefox.js
- index d79c76f2b797..471f09dddbb7 100644
- --- a/devtools/client/debugger/src/client/firefox.js
- +++ b/devtools/client/debugger/src/client/firefox.js
- @@ -25,28 +25,20 @@ export async function onConnect(connection: any, actions: Object) {
- return;
- }
- - const supportsWasm =
- - features.wasm && !!debuggerClient.mainRoot.traits.wasmBinarySource;
- -
- setupCommands({
- threadFront,
- tabTarget,
- debuggerClient,
- - supportsWasm,
- });
- - setupEvents({ threadFront, tabTarget, actions, supportsWasm });
- + setupEvents({ threadFront, tabTarget, actions });
- tabTarget.on("will-navigate", actions.willNavigate);
- tabTarget.on("navigate", actions.navigated);
- - await threadFront.reconfigure({
- - observeAsmJS: true,
- - pauseWorkersUntilAttach: true,
- - wasmBinarySource: supportsWasm,
- - skipBreakpoints: prefs.skipPausing,
- - logEventBreakpoints: prefs.logEventBreakpoints,
- - });
- + // I'm removing reconfigure here because it feels redundant
- + // 1. a bunch of options are duplicates
- + // 2. a bunch of options were static and have been for some time so we can just make assumptions in the server
- // Retrieve possible event listener breakpoints
- actions.getEventListenerBreakpointTypes().catch(e => console.error(e));
- diff --git a/devtools/client/debugger/src/client/firefox/commands.js b/devtools/client/debugger/src/client/firefox/commands.js
- index 7daea96bc12e..2f168ca41b1e 100644
- --- a/devtools/client/debugger/src/client/firefox/commands.js
- +++ b/devtools/client/debugger/src/client/firefox/commands.js
- @@ -48,29 +48,22 @@ let debuggerClient: DebuggerClient;
- let sourceActors: { [ActorId]: SourceId };
- let breakpoints: { [string]: Object };
- let eventBreakpoints: ?EventListenerActiveList;
- -let supportsWasm: boolean;
- type Dependencies = {
- threadFront: ThreadFront,
- tabTarget: Target,
- debuggerClient: DebuggerClient,
- - supportsWasm: boolean,
- };
- function setupCommands(dependencies: Dependencies) {
- currentThreadFront = dependencies.threadFront;
- currentTarget = dependencies.tabTarget;
- debuggerClient = dependencies.debuggerClient;
- - supportsWasm = dependencies.supportsWasm;
- targets = { worker: {}, contentProcess: {} };
- sourceActors = {};
- breakpoints = {};
- }
- -function hasWasmSupport() {
- - return supportsWasm;
- -}
- -
- function createObjectClient(grip: Grip) {
- return debuggerClient.createObjectClient(grip);
- }
- diff --git a/devtools/client/debugger/src/client/firefox/targets.js b/devtools/client/debugger/src/client/firefox/targets.js
- index 04d5ffc7d1c6..5977648e920c 100644
- --- a/devtools/client/debugger/src/client/firefox/targets.js
- +++ b/devtools/client/debugger/src/client/firefox/targets.js
- @@ -5,7 +5,7 @@
- // @flow
- import { addThreadEventListeners } from "./events";
- -import { prefs } from "../../utils/prefs";
- +import { prefs, asyncStore, features } from "../../utils/prefs";
- import type { DebuggerClient, Target } from "./types";
- import type { ThreadType } from "../../types";
- @@ -16,9 +16,45 @@ type Args = {
- options: Object,
- };
- +type MainRoot = {
- + traits: Object,
- +};
- +
- +// The crux of this proposal is that the debugger gets to say what options the thread cares about.
- +// Someday, i hope the logic for options and attaching is pulled into some toolbox level thing, but for now
- +// given that we manage attaching to threads here... we might as well own the options as well.
- +export async function getTargetOptions(mainRoot: MainRoot) {
- + const eventBreakpoints = await asyncStore.eventListenerBreakpoints;
- +
- + // I'm a bit nervous about this data structure lining up with the shape of `breakpoints`,
- + // but it is probably pretty close...
- + const breakpoints = await asyncStore.pendingBreakpoints;
- +
- + const {
- + pauseOnExceptions,
- + ignoreCaughtExceptions,
- + shouldShowOverlay,
- + skipBreakpoints,
- + logEventBreakpoints,
- + } = prefs;
- +
- + const supportsWasm = features.wasm && !!mainRoot.traits.wasmBinarySource;
- +
- + return {
- + eventBreakpoints,
- + breakpoints,
- + pauseOnExceptions,
- + ignoreCaughtExceptions,
- + shouldShowOverlay,
- + skipBreakpoints,
- + logEventBreakpoints,
- + };
- +}
- +
- async function attachTargets(type, targetLists, args) {
- const newTargets = {};
- const targets = args.targets[type] || {};
- + const targetOptions = getTargetOptions(args.debuggerClient.mainRoot);
- for (const targetFront of targetLists) {
- try {
- @@ -35,7 +71,7 @@ async function attachTargets(type, targetLists, args) {
- // But workers targets are still only managed by the debugger codebase
- // and so we have to attach their thread actor
- if (!threadFront) {
- - [, threadFront] = await targetFront.attachThread(args.options);
- + [, threadFront] = await targetFront.attachThread(targetOptions);
- // NOTE: resume is not necessary for ProcessDescriptors and can be removed
- // once we switch to WorkerDescriptors
- threadFront.resume();
- diff --git a/devtools/client/debugger/src/utils/test-head.js b/devtools/client/debugger/src/utils/test-head.js
- index 09330e4854f4..c8ff83ef803b 100644
- --- a/devtools/client/debugger/src/utils/test-head.js
- +++ b/devtools/client/debugger/src/utils/test-head.js
- @@ -30,10 +30,6 @@ import type { Source, OriginalSourceData, GeneratedSourceData } from "../types";
- * @static
- */
- function createStore(client: any, initialState: any = {}, sourceMapsMock: any) {
- - client = {
- - hasWasmSupport: () => true,
- - ...client,
- - };
- const store = configureStore({
- log: false,
- diff --git a/devtools/client/framework/toolbox.js b/devtools/client/framework/toolbox.js
- index 9d55b4bee606..3558ff221dd2 100644
- --- a/devtools/client/framework/toolbox.js
- +++ b/devtools/client/framework/toolbox.js
- @@ -144,6 +144,10 @@ loader.lazyRequireGetter(
- "devtools/client/inspector/node-picker"
- );
- +loader.lazyGetter(this, "getTargetOptions", () =>
- + require("devtools/client/debugger/src/firefox/targets")
- +)
- +
- loader.lazyGetter(this, "domNodeConstants", () => {
- return require("devtools/shared/dom-node-constants");
- });
- @@ -639,25 +643,8 @@ Toolbox.prototype = {
- },
- _attachAndResumeThread: async function(target) {
- - const [, threadFront] = await target.attachThread({
- - autoBlackBox: false,
- - ignoreFrameEnvironment: true,
- - pauseOnExceptions: Services.prefs.getBoolPref(
- - "devtools.debugger.pause-on-exceptions"
- - ),
- - ignoreCaughtExceptions: Services.prefs.getBoolPref(
- - "devtools.debugger.ignore-caught-exceptions"
- - ),
- - shouldShowOverlay: Services.prefs.getBoolPref(
- - "devtools.debugger.features.overlay"
- - ),
- - skipBreakpoints: Services.prefs.getBoolPref(
- - "devtools.debugger.skip-pausing"
- - ),
- - logEventBreakpoints: Services.prefs.getBoolPref(
- - "devtools.debugger.log-event-breakpoints"
- - ),
- - });
- + const targetOptions = getTargetOptions(this.target.client.mainRoot);
- + const [, threadFront] = await target.attachThread(targetOptions);
- try {
- await threadFront.resume();
- diff --git a/devtools/server/actors/thread.js b/devtools/server/actors/thread.js
- index 02b95ec1d6cf..75ebc7b0ffeb 100644
- --- a/devtools/server/actors/thread.js
- +++ b/devtools/server/actors/thread.js
- @@ -357,16 +357,18 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
- if (options.breakpoints) {
- this._setBreakpointsOnAttach(options.breakpoints);
- }
- +
- if (options.eventBreakpoints) {
- this.setActiveEventBreakpoints(options.eventBreakpoints);
- }
- - this.dbg.enable();
- -
- - if ("observeAsmJS" in this._options) {
- - this.dbg.allowUnobservedAsmJS = !this._options.observeAsmJS;
- + if (this._parent.pauseWorkersUntilAttach) {
- + this._parent.pauseWorkersUntilAttach(options.pauseWorkersUntilAttach);
- }
- + this.dbg.enable();
- + this.dbg.allowUnobservedAsmJS = false;
- +
- // Notify the parent that we've finished attaching. If this is a worker
- // thread which was paused until attaching, this will allow content to
- // begin executing.
- @@ -665,17 +667,6 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
- return { error: "wrongState" };
- }
- const options = request.options || {};
- -
- - if ("observeAsmJS" in options) {
- - this.dbg.allowUnobservedAsmJS = !options.observeAsmJS;
- - }
- -
- - if ("pauseWorkersUntilAttach" in options) {
- - if (this._parent.pauseWorkersUntilAttach) {
- - this._parent.pauseWorkersUntilAttach(options.pauseWorkersUntilAttach);
- - }
- - }
- -
- Object.assign(this._options, options);
- // Update the global source store
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement