| Index: third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js b/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js
|
| index 7e4001ef80d2b56d0a2c2ea2df9f9cc671065bb3..6dbd64494b56032efc62ddc4355bcc02224a8b4e 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js
|
| @@ -32,9 +32,6 @@
|
| */
|
| SDK.CallFunctionResult;
|
|
|
| -/**
|
| - * @unrestricted
|
| - */
|
| SDK.RemoteObject = class {
|
| /**
|
| * This may not be an interface due to "instanceof SDK.RemoteObject" checks in the code.
|
| @@ -127,13 +124,11 @@ SDK.RemoteObject = class {
|
|
|
| if (typeof object.unserializableValue !== 'undefined')
|
| return {unserializableValue: object.unserializableValue};
|
| - if (typeof object._unserializableValue !== 'undefined')
|
| + if (object instanceof SDK.RemoteObjectImpl && typeof object._unserializableValue !== 'undefined')
|
| return {unserializableValue: object._unserializableValue};
|
|
|
| if (typeof object.objectId !== 'undefined')
|
| return {objectId: object.objectId};
|
| - if (typeof object._objectId !== 'undefined')
|
| - return {objectId: object._objectId};
|
|
|
| return {value: object.value};
|
| }
|
| @@ -210,6 +205,11 @@ SDK.RemoteObject = class {
|
| return null;
|
| }
|
|
|
| + /** @return {!Protocol.Runtime.RemoteObjectId|undefined} */
|
| + get objectId() {
|
| + return 'Not implemented';
|
| + }
|
| +
|
| /** @return {string} */
|
| get type() {
|
| throw 'Not implemented';
|
| @@ -220,6 +220,11 @@ SDK.RemoteObject = class {
|
| throw 'Not implemented';
|
| }
|
|
|
| + /** @return {*} */
|
| + get value() {
|
| + throw 'Not implemented';
|
| + }
|
| +
|
| /** @return {string|undefined} */
|
| get description() {
|
| throw 'Not implemented';
|
| @@ -231,6 +236,13 @@ SDK.RemoteObject = class {
|
| }
|
|
|
| /**
|
| + * @return {!Protocol.Runtime.ObjectPreview|undefined}
|
| + */
|
| + get preview() {
|
| + return undefined;
|
| + }
|
| +
|
| + /**
|
| * @return {number}
|
| */
|
| arrayLength() {
|
| @@ -306,6 +318,14 @@ SDK.RemoteObject = class {
|
| }
|
|
|
| /**
|
| + * @param {!Array.<string>} propertyPath
|
| + * @param {function(?SDK.RemoteObject, boolean=)} callback
|
| + */
|
| + getProperty(propertyPath, callback) {
|
| + throw 'Not implemented';
|
| + }
|
| +
|
| + /**
|
| * @return {!Promise<?Array<!SDK.EventListener>>}
|
| */
|
| eventListeners() {
|
| @@ -391,21 +411,24 @@ SDK.RemoteObject = class {
|
| }
|
| }
|
|
|
| - /**
|
| - * @return {!SDK.Target}
|
| - */
|
| - target() {
|
| - throw new Error('Target-less object');
|
| + release() {
|
| }
|
|
|
| /**
|
| - * @return {?SDK.DebuggerModel}
|
| + * @return {!SDK.DebuggerModel}
|
| */
|
| debuggerModel() {
|
| throw new Error('DebuggerModel-less object');
|
| }
|
|
|
| /**
|
| + * @return {!SDK.RuntimeModel}
|
| + */
|
| + runtimeModel() {
|
| + throw new Error('RuntimeModel-less object');
|
| + }
|
| +
|
| + /**
|
| * @return {boolean}
|
| */
|
| isNode() {
|
| @@ -414,12 +437,9 @@ SDK.RemoteObject = class {
|
| };
|
|
|
|
|
| -/**
|
| - * @unrestricted
|
| - */
|
| SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
| /**
|
| - * @param {!SDK.Target} target
|
| + * @param {!SDK.RuntimeModel} runtimeModel
|
| * @param {string|undefined} objectId
|
| * @param {string} type
|
| * @param {string|undefined} subtype
|
| @@ -429,12 +449,11 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
| * @param {!Protocol.Runtime.ObjectPreview=} preview
|
| * @param {!Protocol.Runtime.CustomPreview=} customPreview
|
| */
|
| - constructor(target, objectId, type, subtype, value, unserializableValue, description, preview, customPreview) {
|
| + constructor(runtimeModel, objectId, type, subtype, value, unserializableValue, description, preview, customPreview) {
|
| super();
|
|
|
| - this._target = target;
|
| - this._runtimeAgent = target.runtimeAgent();
|
| - this._debuggerModel = SDK.DebuggerModel.fromTarget(target);
|
| + this._runtimeModel = runtimeModel;
|
| + this._runtimeAgent = runtimeModel.target().runtimeAgent();
|
|
|
| this._type = type;
|
| this._subtype = subtype;
|
| @@ -455,12 +474,12 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
| unserializableValue === Protocol.Runtime.UnserializableValue.NegativeInfinity ||
|
| unserializableValue === Protocol.Runtime.UnserializableValue.Negative0 ||
|
| unserializableValue === Protocol.Runtime.UnserializableValue.NaN)
|
| - this.value = Number(unserializableValue);
|
| + this._value = Number(unserializableValue);
|
| else
|
| - this.value = unserializableValue;
|
| + this._value = unserializableValue;
|
|
|
| } else {
|
| - this.value = value;
|
| + this._value = value;
|
| }
|
| }
|
| this._customPreview = customPreview || null;
|
| @@ -474,7 +493,10 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
| return this._customPreview;
|
| }
|
|
|
| - /** @return {!Protocol.Runtime.RemoteObjectId} */
|
| + /**
|
| + * @override
|
| + * @return {!Protocol.Runtime.RemoteObjectId|undefined}
|
| + */
|
| get objectId() {
|
| return this._objectId;
|
| }
|
| @@ -497,6 +519,14 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
|
|
| /**
|
| * @override
|
| + * @return {*}
|
| + */
|
| + get value() {
|
| + return this._value;
|
| + }
|
| +
|
| + /**
|
| + * @override
|
| * @return {string|undefined}
|
| */
|
| get description() {
|
| @@ -512,6 +542,7 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
| }
|
|
|
| /**
|
| + * @override
|
| * @return {!Protocol.Runtime.ObjectPreview|undefined}
|
| */
|
| get preview() {
|
| @@ -549,7 +580,7 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
| * @this {SDK.RemoteObjectImpl}
|
| */
|
| function eventListeners(fulfill, reject) {
|
| - if (!this.target().hasDOMCapability()) {
|
| + if (!this._runtimeModel.target().hasDOMCapability()) {
|
| // TODO(kozyatinskiy): figure out how this should work for |window| when there is no DOMDebugger.
|
| fulfill([]);
|
| return;
|
| @@ -560,7 +591,8 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
| return;
|
| }
|
|
|
| - this.target().domdebuggerAgent().getEventListeners(this._objectId, undefined, undefined, mycallback.bind(this));
|
| + this._runtimeModel.target().domdebuggerAgent().getEventListeners(
|
| + this._objectId, undefined, undefined, mycallback.bind(this));
|
|
|
| /**
|
| * @this {SDK.RemoteObjectImpl}
|
| @@ -581,10 +613,11 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
| */
|
| function createEventListener(payload) {
|
| return new SDK.EventListener(
|
| - this._target, this, payload.type, payload.useCapture, payload.passive, payload.once,
|
| - payload.handler ? this.target().runtimeModel.createRemoteObject(payload.handler) : null,
|
| - payload.originalHandler ? this.target().runtimeModel.createRemoteObject(payload.originalHandler) : null,
|
| - /** @type {!SDK.DebuggerModel.Location} */ (this._debuggerModel.createRawLocationByScriptId(
|
| + this._runtimeModel, this, payload.type, payload.useCapture, payload.passive, payload.once,
|
| + payload.handler ? this._runtimeModel.createRemoteObject(payload.handler) : null,
|
| + payload.originalHandler ? this._runtimeModel.createRemoteObject(payload.originalHandler) : null,
|
| + /** @type {!SDK.DebuggerModel.Location} */
|
| + (this.debuggerModel().createRawLocationByScriptId(
|
| payload.scriptId, payload.lineNumber, payload.columnNumber)),
|
| null);
|
| }
|
| @@ -592,6 +625,7 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
| }
|
|
|
| /**
|
| + * @override
|
| * @param {!Array.<string>} propertyPath
|
| * @param {function(?SDK.RemoteObject, boolean=)} callback
|
| */
|
| @@ -638,24 +672,24 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
| return;
|
| }
|
| if (exceptionDetails) {
|
| - this.target().runtimeModel.exceptionThrown(Date.now(), exceptionDetails);
|
| + this._runtimeModel.exceptionThrown(Date.now(), exceptionDetails);
|
| callback(null, null);
|
| return;
|
| }
|
| var result = [];
|
| for (var i = 0; properties && i < properties.length; ++i) {
|
| var property = properties[i];
|
| - var propertyValue = property.value ? this._target.runtimeModel.createRemoteObject(property.value) : null;
|
| - var propertySymbol = property.symbol ? this._target.runtimeModel.createRemoteObject(property.symbol) : null;
|
| + var propertyValue = property.value ? this._runtimeModel.createRemoteObject(property.value) : null;
|
| + var propertySymbol = property.symbol ? this._runtimeModel.createRemoteObject(property.symbol) : null;
|
| var remoteProperty = new SDK.RemoteObjectProperty(
|
| property.name, propertyValue, !!property.enumerable, !!property.writable, !!property.isOwn,
|
| !!property.wasThrown, propertySymbol);
|
|
|
| if (typeof property.value === 'undefined') {
|
| if (property.get && property.get.type !== 'undefined')
|
| - remoteProperty.getter = this._target.runtimeModel.createRemoteObject(property.get);
|
| + remoteProperty.getter = this._runtimeModel.createRemoteObject(property.get);
|
| if (property.set && property.set.type !== 'undefined')
|
| - remoteProperty.setter = this._target.runtimeModel.createRemoteObject(property.set);
|
| + remoteProperty.setter = this._runtimeModel.createRemoteObject(property.set);
|
| }
|
|
|
| result.push(remoteProperty);
|
| @@ -667,7 +701,7 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
| var property = internalProperties[i];
|
| if (!property.value)
|
| continue;
|
| - var propertyValue = this._target.runtimeModel.createRemoteObject(property.value);
|
| + var propertyValue = this._runtimeModel.createRemoteObject(property.value);
|
| internalPropertiesResult.push(new SDK.RemoteObjectProperty(property.name, propertyValue, true, false));
|
| }
|
| }
|
| @@ -695,7 +729,7 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
| * @param {?Protocol.Error} error
|
| * @param {!Protocol.Runtime.RemoteObject} result
|
| * @param {!Protocol.Runtime.ExceptionDetails=} exceptionDetails
|
| - * @this {SDK.RemoteObject}
|
| + * @this {SDK.RemoteObjectImpl}
|
| */
|
| function evaluatedCallback(error, result, exceptionDetails) {
|
| if (error || !!exceptionDetails) {
|
| @@ -796,7 +830,7 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
| if (error)
|
| callback(null, false);
|
| else
|
| - callback(this.target().runtimeModel.createRemoteObject(result), !!exceptionDetails);
|
| + callback(this._runtimeModel.createRemoteObject(result), !!exceptionDetails);
|
| }
|
|
|
| this._runtimeAgent.callFunctionOn(
|
| @@ -824,6 +858,9 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
| this._objectId, functionDeclaration.toString(), args, true, true, false, undefined, undefined, mycallback);
|
| }
|
|
|
| + /**
|
| + * @override
|
| + */
|
| release() {
|
| if (!this._objectId)
|
| return;
|
| @@ -840,18 +877,18 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
|
|
| /**
|
| * @override
|
| - * @return {!SDK.Target}
|
| + * @return {!SDK.DebuggerModel}
|
| */
|
| - target() {
|
| - return this._target;
|
| + debuggerModel() {
|
| + return this._runtimeModel.debuggerModel();
|
| }
|
|
|
| /**
|
| * @override
|
| - * @return {?SDK.DebuggerModel}
|
| + * @return {!SDK.RuntimeModel}
|
| */
|
| - debuggerModel() {
|
| - return this._debuggerModel;
|
| + runtimeModel() {
|
| + return this._runtimeModel;
|
| }
|
|
|
| /**
|
| @@ -864,12 +901,9 @@ SDK.RemoteObjectImpl = class extends SDK.RemoteObject {
|
| };
|
|
|
|
|
| -/**
|
| - * @unrestricted
|
| - */
|
| SDK.ScopeRemoteObject = class extends SDK.RemoteObjectImpl {
|
| /**
|
| - * @param {!SDK.Target} target
|
| + * @param {!SDK.RuntimeModel} runtimeModel
|
| * @param {string|undefined} objectId
|
| * @param {!SDK.ScopeRef} scopeRef
|
| * @param {string} type
|
| @@ -879,8 +913,8 @@ SDK.ScopeRemoteObject = class extends SDK.RemoteObjectImpl {
|
| * @param {string=} description
|
| * @param {!Protocol.Runtime.ObjectPreview=} preview
|
| */
|
| - constructor(target, objectId, scopeRef, type, subtype, value, unserializableValue, description, preview) {
|
| - super(target, objectId, type, subtype, value, unserializableValue, description, preview);
|
| + constructor(runtimeModel, objectId, scopeRef, type, subtype, value, unserializableValue, description, preview) {
|
| + super(runtimeModel, objectId, type, subtype, value, unserializableValue, description, preview);
|
| this._scopeRef = scopeRef;
|
| this._savedScopeProperties = undefined;
|
| }
|
| @@ -936,7 +970,7 @@ SDK.ScopeRemoteObject = class extends SDK.RemoteObjectImpl {
|
| */
|
| doSetObjectPropertyValue(result, argumentName, callback) {
|
| var name = /** @type {string} */ (argumentName.value);
|
| - this._debuggerModel.setVariableValue(
|
| + this.debuggerModel().setVariableValue(
|
| this._scopeRef.number, name, SDK.RemoteObject.toCallArgument(result), this._scopeRef.callFrameId,
|
| setVariableValueCallback.bind(this));
|
|
|
| @@ -952,7 +986,7 @@ SDK.ScopeRemoteObject = class extends SDK.RemoteObjectImpl {
|
| if (this._savedScopeProperties) {
|
| for (var i = 0; i < this._savedScopeProperties.length; i++) {
|
| if (this._savedScopeProperties[i].name === name)
|
| - this._savedScopeProperties[i].value = this._target.runtimeModel.createRemoteObject(result);
|
| + this._savedScopeProperties[i].value = this._runtimeModel.createRemoteObject(result);
|
| }
|
| }
|
| callback();
|
| @@ -960,9 +994,6 @@ SDK.ScopeRemoteObject = class extends SDK.RemoteObjectImpl {
|
| }
|
| };
|
|
|
| -/**
|
| - * @unrestricted
|
| - */
|
| SDK.ScopeRef = class {
|
| /**
|
| * @param {number} number
|
| @@ -1015,9 +1046,6 @@ SDK.RemoteObjectProperty = class {
|
| // for traversing prototypes, extracting class names via constructor, handling properties
|
| // or functions.
|
|
|
| -/**
|
| - * @unrestricted
|
| - */
|
| SDK.LocalJSONObject = class extends SDK.RemoteObject {
|
| /**
|
| * @param {*} value
|
| @@ -1025,6 +1053,26 @@ SDK.LocalJSONObject = class extends SDK.RemoteObject {
|
| constructor(value) {
|
| super();
|
| this._value = value;
|
| + /** @type {string} */
|
| + this._cachedDescription;
|
| + /** @type {!Array<!SDK.RemoteObjectProperty>} */
|
| + this._cachedChildren;
|
| + }
|
| +
|
| + /**
|
| + * @override
|
| + * @return {!Protocol.Runtime.RemoteObjectId|undefined}
|
| + * */
|
| + get objectId() {
|
| + return undefined;
|
| + }
|
| +
|
| + /**
|
| + * @override
|
| + * @return {*}
|
| + */
|
| + get value() {
|
| + return this._value;
|
| }
|
|
|
| /**
|
| @@ -1260,9 +1308,6 @@ SDK.LocalJSONObject = class extends SDK.RemoteObject {
|
| }
|
| };
|
|
|
| -/**
|
| - * @unrestricted
|
| - */
|
| SDK.RemoteArray = class {
|
| /**
|
| * @param {!SDK.RemoteObject} object
|
| @@ -1372,9 +1417,6 @@ SDK.RemoteArray = class {
|
| };
|
|
|
|
|
| -/**
|
| - * @unrestricted
|
| - */
|
| SDK.RemoteFunction = class {
|
| /**
|
| * @param {!SDK.RemoteObject} object
|
|
|