Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/devtools/client/debugger/packages/devtools-reps/src/object-inspector/actions.js b/devtools/client/debugger/packages/devtools-reps/src/object-inspector/actions.js
- index 97b47263a7e4..f3a7258bad0a 100644
- --- a/devtools/client/debugger/packages/devtools-reps/src/object-inspector/actions.js
- +++ b/devtools/client/debugger/packages/devtools-reps/src/object-inspector/actions.js
- @@ -7,7 +7,7 @@
- import type { GripProperties, Node, Props, ReduxAction } from "./types";
- const { loadItemProperties } = require("./utils/load-properties");
- -const { getLoadedProperties, getActors } = require("./reducer");
- +const { getLoadedProperties, getActors, getWatchpoints } = require("./reducer");
- type Dispatch = ReduxAction => void;
- @@ -73,38 +73,31 @@ function nodePropertiesLoaded(
- };
- }
- -function addWatchpoint(
- - item,
- - watchpoint: string,
- -) {
- -
- +function addWatchpoint(item, watchpoint: string) {
- const buildLabel = item => {
- if (item.parent) {
- return `${buildLabel(item.parent)}.${item.name}`;
- }
- return item.name;
- };
- -
- - return async function ({ dispatch, client }: ThunkArgs) {
- - let object = item.parent.contents.value;
- +
- + return async function({ dispatch, client }: ThunkArgs) {
- + const object = item.parent.contents.value;
- const path = item.parent.path;
- const property = item.name;
- const label = buildLabel(item);
- dispatch({
- type: "SET_WATCHPOINT",
- - data: { path, watchpoint, property },
- + data: { path, watchpoint, property, actor: object.actor },
- });
- await client.addWatchpoint(object, property, label, watchpoint);
- };
- }
- -function removeWatchpoint(
- - item,
- -) {
- -
- - return async function ({ dispatch, client }: ThunkArgs) {
- +function removeWatchpoint(item) {
- + return async function({ dispatch, client }: ThunkArgs) {
- const object = item.parent.contents.value;
- const property = item.name;
- const path = item.parent.path;
- @@ -144,8 +137,11 @@ function rootsChanged(props: Props) {
- function releaseActors(state, client) {
- const actors = getActors(state);
- + const watchpoints = getWatchpoints(state);
- for (const actor of actors) {
- - client.releaseActor(actor);
- + if (!watchpoints.has(actor)) {
- + client.releaseActor(actor);
- + }
- }
- }
- diff --git a/devtools/client/debugger/packages/devtools-reps/src/object-inspector/reducer.js b/devtools/client/debugger/packages/devtools-reps/src/object-inspector/reducer.js
- index e8a8638f3f9c..966651e2fdea 100644
- --- a/devtools/client/debugger/packages/devtools-reps/src/object-inspector/reducer.js
- +++ b/devtools/client/debugger/packages/devtools-reps/src/object-inspector/reducer.js
- @@ -10,6 +10,7 @@ function initialState() {
- loadedProperties: new Map(),
- evaluations: new Map(),
- actors: new Set(),
- + watchpoints: new Map(),
- };
- }
- @@ -41,17 +42,15 @@ function reducer(
- ownProperties: {
- ...obj.ownProperties,
- [data.property]: {
- - ...obj.ownProperties[data.property],
- - watchpoint: data.watchpoint,
- - }
- - },
- - };
- + ...obj.ownProperties[data.property],
- + watchpoint: data.watchpoint,
- + },
- + },
- + };
- return cloneState({
- - loadedProperties: new Map(state.loadedProperties).set(
- - data.path,
- - newObj,
- - ),
- + loadedProperties: new Map(state.loadedProperties).set(data.path, newObj),
- + watchpoints: new Map(state.watchpoints).set(data.actor, data.watchpoint),
- });
- }
- @@ -63,17 +62,15 @@ function reducer(
- ownProperties: {
- ...obj.ownProperties,
- [data.property]: {
- - ...obj.ownProperties[data.property],
- - watchpoint: null,
- - }
- - },
- - };
- + ...obj.ownProperties[data.property],
- + watchpoint: null,
- + },
- + },
- + };
- return cloneState({
- - loadedProperties: new Map(state.loadedProperties).set(
- - data.path,
- - newObj,
- - ),
- + loadedProperties: new Map(state.loadedProperties).set(data.path, newObj),
- + watchpoints: new Map(state.watchpoints).delete(data.actor),
- });
- }
- @@ -110,7 +107,7 @@ function reducer(
- // NOTE: we clear the state on resume because otherwise the scopes pane
- // would be out of date. Bug 1514760
- if (type === "RESUME" || type == "NAVIGATE") {
- - return initialState();
- + return { ...initialState(), watchpoints: state.watchpoints };
- }
- return state;
- @@ -132,6 +129,10 @@ function getActors(state) {
- return getObjectInspectorState(state).actors;
- }
- +function getWatchpoints(state) {
- + return getObjectInspectorState(state).watchpoints;
- +}
- +
- function getLoadedProperties(state) {
- return getObjectInspectorState(state).loadedProperties;
- }
- @@ -146,6 +147,7 @@ function getEvaluations(state) {
- const selectors = {
- getActors,
- + getWatchpoints,
- getEvaluations,
- getExpandedPathKeys,
- getExpandedPaths,
- diff --git a/devtools/server/actors/object.js b/devtools/server/actors/object.js
- index 7aa67b162ac0..a755efa8fe9d 100644
- --- a/devtools/server/actors/object.js
- +++ b/devtools/server/actors/object.js
- @@ -108,6 +108,11 @@ const proto = {
- },
- addWatchpoint(property, label, watchpointType) {
- +
- + // promote all objects to the thread level
- + console.log(`>> addWatchpoint ${label} ${this.actorID}`)
- + this.thread.threadObjectGrip(this);
- +
- if (this._originalDescriptors.has(property)) {
- return;
- }
- @@ -136,6 +141,7 @@ const proto = {
- }),
- get: this.obj.makeDebuggeeValue(() => {
- pauseAndRespond();
- + return desc.value;
- }),
- });
- }
- @@ -145,9 +151,12 @@ const proto = {
- configurable: desc.configurable,
- enumerable: desc.enumerable,
- set: this.obj.makeDebuggeeValue(v => {
- - desc.value = v;
- pauseAndRespond();
- + desc.value = v;
- }),
- + get: this.obj.makeDebuggeeValue(() => {
- + return desc.value;
- + })
- });
- }
- },
- @@ -166,6 +175,14 @@ const proto = {
- * Returns a grip for this actor for returning in a protocol message.
- */
- form: function() {
- +
- + if (!this.actorID) {
- + console.log(`>> object form WTF`, (new Error('')).stack)
- + }
- +
- + console.log(`>> object form ${this.actorID}`)
- +
- +
- const g = {
- type: "object",
- actor: this.actorID,
- @@ -1016,7 +1033,9 @@ const proto = {
- * Release the actor, when it isn't needed anymore.
- * Protocol.js uses this release method to call the destroy method.
- */
- - release: function() {},
- + release: function() {
- + console.log(`>> releasing object actor ${this.actorID}`, (new Error('').stack));
- + },
- };
- exports.ObjectActor = protocol.ActorClassWithSpec(objectSpec, proto);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement