https://bugs.webkit.org/show_bug.cgi?id=141875
Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-02-21
Reviewed by Timothy Hatcher.
Source/JavaScriptCore:
* inspector/protocol/Runtime.json:
Add generatePreview to getProperties.
* inspector/InjectedScript.cpp:
(Inspector::InjectedScript::getProperties):
(Inspector::InjectedScript::getInternalProperties):
* inspector/InjectedScript.h:
* inspector/agents/InspectorRuntimeAgent.cpp:
(Inspector::InspectorRuntimeAgent::getProperties):
* inspector/agents/InspectorRuntimeAgent.h:
Plumb the generatePreview boolean through to the injected script.
* inspector/InjectedScriptSource.js:
Add generatePreview for getProperties.
Fix callFunctionOn to generatePreviews if asked.
Source/WebInspectorUI:
* UserInterface/Models/PropertyDescriptor.js:
(WebInspector.PropertyDescriptor.fromPayload):
Fix InternalPropertyDescriptor ingestion. There was no ".internal"
property on these objects, so take a flag.
* UserInterface/Protocol/RemoteObject.js:
(WebInspector.RemoteObject.prototype._getPropertyDescriptors):
Fix InternalPropertyDescriptor ingestion by specifying during
importing the internal properties. Also, get previews.
(WebInspector.RemoteObject.prototype.callFunction):
Always get previews when using callFunctionOn.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@180483
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-02-21 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Generate Previews more often for RemoteObject interaction
+ https://bugs.webkit.org/show_bug.cgi?id=141875
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/protocol/Runtime.json:
+ Add generatePreview to getProperties.
+
+ * inspector/InjectedScript.cpp:
+ (Inspector::InjectedScript::getProperties):
+ (Inspector::InjectedScript::getInternalProperties):
+ * inspector/InjectedScript.h:
+ * inspector/agents/InspectorRuntimeAgent.cpp:
+ (Inspector::InspectorRuntimeAgent::getProperties):
+ * inspector/agents/InspectorRuntimeAgent.h:
+ Plumb the generatePreview boolean through to the injected script.
+
+ * inspector/InjectedScriptSource.js:
+ Add generatePreview for getProperties.
+ Fix callFunctionOn to generatePreviews if asked.
+
2015-02-20 Mark Lam <mark.lam@apple.com>
Refactor JSWrapperMap.mm to defer creation of the ObjC JSValue until the latest possible moment.
*result = BindingTraits<Inspector::Protocol::Debugger::FunctionDetails>::runtimeCast(WTF::move(resultValue));
}
-void InjectedScript::getProperties(ErrorString& errorString, const String& objectId, bool ownProperties, bool ownAndGetterProperties, RefPtr<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>* properties)
+void InjectedScript::getProperties(ErrorString& errorString, const String& objectId, bool ownProperties, bool ownAndGetterProperties, bool generatePreview, RefPtr<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>* properties)
{
Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getProperties"), inspectorEnvironment()->functionCallHandler());
function.appendArgument(objectId);
function.appendArgument(ownProperties);
function.appendArgument(ownAndGetterProperties);
+ function.appendArgument(generatePreview);
RefPtr<InspectorValue> result;
makeCall(function, &result);
*properties = BindingTraits<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTF::move(result));
}
-void InjectedScript::getInternalProperties(ErrorString& errorString, const String& objectId, RefPtr<Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>* properties)
+void InjectedScript::getInternalProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>* properties)
{
Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getInternalProperties"), inspectorEnvironment()->functionCallHandler());
function.appendArgument(objectId);
+ function.appendArgument(generatePreview);
RefPtr<InspectorValue> result;
makeCall(function, &result);
void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<Protocol::Runtime::RemoteObject>* result, Protocol::OptOutput<bool>* wasThrown);
void evaluateOnCallFrame(ErrorString&, const Deprecated::ScriptValue& callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, RefPtr<Protocol::Runtime::RemoteObject>* result, Protocol::OptOutput<bool>* wasThrown);
void getFunctionDetails(ErrorString&, const String& functionId, RefPtr<Protocol::Debugger::FunctionDetails>* result);
- void getProperties(ErrorString&, const String& objectId, bool ownProperties, bool ownAndGetterProperties, RefPtr<Protocol::Array<Protocol::Runtime::PropertyDescriptor>>* result);
- void getInternalProperties(ErrorString&, const String& objectId, RefPtr<Protocol::Array<Protocol::Runtime::InternalPropertyDescriptor>>* result);
+ void getProperties(ErrorString&, const String& objectId, bool ownProperties, bool ownAndGetterProperties, bool generatePreview, RefPtr<Protocol::Array<Protocol::Runtime::PropertyDescriptor>>* result);
+ void getInternalProperties(ErrorString&, const String& objectId, bool generatePreview, RefPtr<Protocol::Array<Protocol::Runtime::InternalPropertyDescriptor>>* result);
void getCollectionEntries(ErrorString&, const String& objectId, const String& objectGroup, int startIndex, int numberToFetch, RefPtr<Protocol::Array<Protocol::Runtime::CollectionEntry>>* entries);
Ref<Protocol::Array<Protocol::Debugger::CallFrame>> wrapCallFrames(const Deprecated::ScriptValue&);
return result;
},
- getProperties: function(objectId, ownProperties, ownAndGetterProperties)
+ getProperties: function(objectId, ownProperties, ownAndGetterProperties, generatePreview)
{
var parsedObjectId = this._parseObjectId(objectId);
var object = this._objectForId(parsedObjectId);
if ("set" in descriptor)
descriptor.set = this._wrapObject(descriptor.set, objectGroupName);
if ("value" in descriptor)
- descriptor.value = this._wrapObject(descriptor.value, objectGroupName);
+ descriptor.value = this._wrapObject(descriptor.value, objectGroupName, false, generatePreview);
if (!("configurable" in descriptor))
descriptor.configurable = false;
if (!("enumerable" in descriptor))
return descriptors;
},
- getInternalProperties: function(objectId)
+ getInternalProperties: function(objectId, generatePreview)
{
var parsedObjectId = this._parseObjectId(objectId);
var object = this._objectForId(parsedObjectId);
for (var i = 0; i < descriptors.length; ++i) {
var descriptor = descriptors[i];
if ("value" in descriptor)
- descriptor.value = this._wrapObject(descriptor.value, objectGroupName);
+ descriptor.value = this._wrapObject(descriptor.value, objectGroupName, false, generatePreview);
}
return descriptors;
return this._evaluateAndWrap(InjectedScriptHost.evaluate, InjectedScriptHost, expression, objectGroup, false, injectCommandLineAPI, returnByValue, generatePreview);
},
- callFunctionOn: function(objectId, expression, args, returnByValue)
+ callFunctionOn: function(objectId, expression, args, returnByValue, generatePreview)
{
var parsedObjectId = this._parseObjectId(objectId);
var object = this._objectForId(parsedObjectId);
return {
wasThrown: false,
- result: this._wrapObject(func.apply(object, resolvedArgs), objectGroup, returnByValue)
+ result: this._wrapObject(func.apply(object, resolvedArgs), objectGroup, returnByValue, generatePreview)
};
} catch (e) {
return this._createThrownValue(e, objectGroup);
}
}
-void InspectorRuntimeAgent::getProperties(ErrorString& errorString, const String& objectId, const bool* const ownProperties, const bool* const ownAndGetterProperties, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
+void InspectorRuntimeAgent::getProperties(ErrorString& errorString, const String& objectId, const bool* const ownProperties, const bool* const ownAndGetterProperties, const bool* const generatePreview, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
{
InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
if (injectedScript.hasNoValue()) {
ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = setPauseOnExceptionsState(m_scriptDebugServer, ScriptDebugServer::DontPauseOnExceptions);
muteConsole();
- injectedScript.getProperties(errorString, objectId, asBool(ownProperties), asBool(ownAndGetterProperties), &result);
- injectedScript.getInternalProperties(errorString, objectId, &internalProperties);
+ injectedScript.getProperties(errorString, objectId, asBool(ownProperties), asBool(ownAndGetterProperties), asBool(generatePreview), &result);
+ injectedScript.getInternalProperties(errorString, objectId, asBool(generatePreview), &internalProperties);
unmuteConsole();
setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsState);
virtual void evaluate(ErrorString&, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown) override final;
virtual void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const RefPtr<Inspector::InspectorArray>&& optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown) override final;
virtual void releaseObject(ErrorString&, const ErrorString& objectId) override final;
- virtual void getProperties(ErrorString&, const String& objectId, const bool* ownProperties, const bool* ownAndGetterProperties, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) override final;
+ virtual void getProperties(ErrorString&, const String& objectId, const bool* ownProperties, const bool* ownAndGetterProperties, const bool* generatePreview, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) override final;
virtual void getCollectionEntries(ErrorString&, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::CollectionEntry>>& entries) override final;
virtual void releaseObjectGroup(ErrorString&, const String& objectGroup) override final;
virtual void run(ErrorString&) override;
"parameters": [
{ "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to return properties for." },
{ "name": "ownProperties", "optional": true, "type": "boolean", "description": "If true, returns properties belonging only to the object itself, not to its prototype chain." },
- { "name": "ownAndGetterProperties", "optional": true, "type": "boolean", "description": "If true, returns properties belonging to the object itself, and getters in its prototype chain." }
+ { "name": "ownAndGetterProperties", "optional": true, "type": "boolean", "description": "If true, returns properties belonging to the object itself, and getters in its prototype chain." },
+ { "name": "generatePreview", "type": "boolean", "optional": true, "description": "Whether preview should be generated for property values." }
],
"returns": [
{ "name": "result", "type": "array", "items": { "$ref": "PropertyDescriptor"}, "description": "Object properties." },
+2015-02-21 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Generate Previews more often for RemoteObject interaction
+ https://bugs.webkit.org/show_bug.cgi?id=141875
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Models/PropertyDescriptor.js:
+ (WebInspector.PropertyDescriptor.fromPayload):
+ Fix InternalPropertyDescriptor ingestion. There was no ".internal"
+ property on these objects, so take a flag.
+
+ * UserInterface/Protocol/RemoteObject.js:
+ (WebInspector.RemoteObject.prototype._getPropertyDescriptors):
+ Fix InternalPropertyDescriptor ingestion by specifying during
+ importing the internal properties. Also, get previews.
+
+ (WebInspector.RemoteObject.prototype.callFunction):
+ Always get previews when using callFunctionOn.
+
2015-02-20 Ronald Jett <rjett@apple.com>
Web Inspector: Add a setting for clearing the console on page reload
this._internal = isInternalProperty || false;
};
-// Runtime.PropertyDescriptor or Runtime.InternalPropertyDescriptor.
-WebInspector.PropertyDescriptor.fromPayload = function(payload)
+// Runtime.PropertyDescriptor or Runtime.InternalPropertyDescriptor (second argument).
+WebInspector.PropertyDescriptor.fromPayload = function(payload, internal)
{
if (payload.value)
payload.value = WebInspector.RemoteObject.fromPayload(payload.value);
if (payload.set)
payload.set = WebInspector.RemoteObject.fromPayload(payload.set);
- if (payload.internal) {
+ if (internal) {
console.assert(payload.value);
payload.writable = payload.configurable = payload.enumerable = false;
payload.isOwn = true;
}
- return new WebInspector.PropertyDescriptor(payload, payload.isOwn, payload.wasThrown, payload.internal);
+ return new WebInspector.PropertyDescriptor(payload, payload.isOwn, payload.wasThrown, internal);
};
WebInspector.PropertyDescriptor.prototype = {
return;
}
- if (internalProperties)
- properties = properties.concat(internalProperties);
-
var descriptors = properties.map(function(payload) {
return WebInspector.PropertyDescriptor.fromPayload(payload);
});
+ if (internalProperties) {
+ descriptors = descriptors.concat(internalProperties.map(function(payload) {
+ return WebInspector.PropertyDescriptor.fromPayload(payload, true);
+ }));
+ }
+
callback(descriptors);
}
return;
}
- RuntimeAgent.getProperties(this._objectId, ownProperties, ownAndGetterProperties, remoteObjectBinder);
+ RuntimeAgent.getProperties(this._objectId, ownProperties, ownAndGetterProperties, true, remoteObjectBinder);
},
// FIXME: Phase out these functions. They return RemoteObjectProperty instead of PropertyDescriptors.
callback((error || wasThrown) ? null : WebInspector.RemoteObject.fromPayload(result));
}
- RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), args, true, undefined, mycallback);
+ RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), args, true, undefined, true, mycallback);
},
callFunctionJSON: function(functionDeclaration, args, callback)