Diff
Modified: trunk/LayoutTests/ChangeLog (91672 => 91673)
--- trunk/LayoutTests/ChangeLog 2011-07-25 17:00:04 UTC (rev 91672)
+++ trunk/LayoutTests/ChangeLog 2011-07-25 17:06:02 UTC (rev 91673)
@@ -1,5 +1,18 @@
2011-07-25 Sheriff Bot <[email protected]>
+ Unreviewed, rolling out r91665.
+ http://trac.webkit.org/changeset/91665
+ https://bugs.webkit.org/show_bug.cgi?id=65118
+
+ Breaks inspector tests on JSC (Requested by pfeldman on
+ #webkit).
+
+ * inspector/protocol/console-agent-expected.txt:
+ * inspector/protocol/runtime-agent-expected.txt:
+ * inspector/runtime/runtime-callFunctionOn.html:
+
+2011-07-25 Sheriff Bot <[email protected]>
+
Unreviewed, rolling out r91668.
http://trac.webkit.org/changeset/91668
https://bugs.webkit.org/show_bug.cgi?id=65117
Modified: trunk/LayoutTests/inspector/protocol/console-agent-expected.txt (91672 => 91673)
--- trunk/LayoutTests/inspector/protocol/console-agent-expected.txt 2011-07-25 17:00:04 UTC (rev 91672)
+++ trunk/LayoutTests/inspector/protocol/console-agent-expected.txt 2011-07-25 17:06:02 UTC (rev 91673)
@@ -64,7 +64,7 @@
parameters : [
{
type : "string"
- value : "test"
+ description : "test"
}
]
stackTrace : <object>
@@ -85,6 +85,7 @@
result : {
result : {
type : "undefined"
+ description : "undefined"
}
}
id : <number>
Modified: trunk/LayoutTests/inspector/protocol/runtime-agent-expected.txt (91672 => 91673)
--- trunk/LayoutTests/inspector/protocol/runtime-agent-expected.txt 2011-07-25 17:00:04 UTC (rev 91672)
+++ trunk/LayoutTests/inspector/protocol/runtime-agent-expected.txt 2011-07-25 17:06:02 UTC (rev 91673)
@@ -18,8 +18,9 @@
{
result : {
result : {
+ objectId : <string>
+ hasChildren : true
type : "object"
- objectId : <string>
className : <string>
description : "TestObject"
}
@@ -44,8 +45,9 @@
{
result : {
result : {
+ objectId : <string>
+ hasChildren : true
type : "object"
- objectId : <string>
className : <string>
description : "TestObject"
}
@@ -71,7 +73,7 @@
result : {
result : {
type : "string"
- value : "callFunctionOn function works fine"
+ description : "callFunctionOn function works fine"
}
}
id : <number>
@@ -140,21 +142,22 @@
name : "assignedByCallFunctionOn"
value : {
type : "string"
- value : "callFunctionOn function works fine"
+ description : "callFunctionOn function works fine"
}
}
{
name : "assignedBySetPropertyValue"
value : {
type : "boolean"
- value : true
+ description : "true"
}
}
{
name : "__proto__"
value : {
+ objectId : <string>
+ hasChildren : true
type : "object"
- objectId : <string>
className : <string>
description : "TestObject"
}
Modified: trunk/LayoutTests/inspector/runtime/runtime-callFunctionOn.html (91672 => 91673)
--- trunk/LayoutTests/inspector/runtime/runtime-callFunctionOn.html 2011-07-25 17:00:04 UTC (rev 91672)
+++ trunk/LayoutTests/inspector/runtime/runtime-callFunctionOn.html 2011-07-25 17:06:02 UTC (rev 91673)
@@ -26,7 +26,7 @@
function step2(error, result, wasThrown)
{
- InspectorTest.addResult(result.value);
+ InspectorTest.addResult(result.description);
next();
}
},
@@ -48,7 +48,7 @@
function step2(error, result, wasThrown)
{
- InspectorTest.addResult(result.value);
+ InspectorTest.addResult(result.description);
next();
}
}
Modified: trunk/Source/WebCore/ChangeLog (91672 => 91673)
--- trunk/Source/WebCore/ChangeLog 2011-07-25 17:00:04 UTC (rev 91672)
+++ trunk/Source/WebCore/ChangeLog 2011-07-25 17:06:02 UTC (rev 91673)
@@ -1,5 +1,42 @@
2011-07-25 Sheriff Bot <[email protected]>
+ Unreviewed, rolling out r91665.
+ http://trac.webkit.org/changeset/91665
+ https://bugs.webkit.org/show_bug.cgi?id=65118
+
+ Breaks inspector tests on JSC (Requested by pfeldman on
+ #webkit).
+
+ * inspector/InjectedScriptSource.js:
+ (.):
+ ():
+ * inspector/Inspector.json:
+ * inspector/front-end/ConsoleView.js:
+ (WebInspector.ConsoleView.prototype._format):
+ (WebInspector.ConsoleView.prototype._formatAsArrayEntry):
+ (WebInspector.ConsoleMessage.prototype._format):
+ * inspector/front-end/ElementsTreeOutline.js:
+ (WebInspector.ElementsTreeElement.prototype._createTooltipForNode.setTooltip):
+ * inspector/front-end/ObjectPropertiesSection.js:
+ (WebInspector.ObjectPropertyTreeElement.prototype.update):
+ * inspector/front-end/PropertiesSidebarPane.js:
+ (WebInspector.PropertiesSidebarPane.prototype.update.nodePrototypesReady):
+ * inspector/front-end/RemoteObject.js:
+ (WebInspector.RemoteObject):
+ (WebInspector.RemoteObject.fromPrimitiveValue):
+ (WebInspector.RemoteObject.fromPayload):
+ (WebInspector.RemoteObject.prototype.callFunction):
+ (WebInspector.LocalJSONObject.prototype.get type):
+ * inspector/front-end/SourceFrame.js:
+ (WebInspector.SourceFrame.prototype._showPopup.showObjectPopup):
+ (WebInspector.SourceFrame.prototype._showPopup):
+ * inspector/front-end/inspector.js:
+ (WebInspector.log.logMessage):
+ (WebInspector.log):
+ (WebInspector.inspect):
+
+2011-07-25 Sheriff Bot <[email protected]>
+
Unreviewed, rolling out r91668.
http://trac.webkit.org/changeset/91668
https://bugs.webkit.org/show_bug.cgi?id=65117
Modified: trunk/Source/WebCore/inspector/InjectedScriptSource.js (91672 => 91673)
--- trunk/Source/WebCore/inspector/InjectedScriptSource.js 2011-07-25 17:00:04 UTC (rev 91672)
+++ trunk/Source/WebCore/inspector/InjectedScriptSource.js 2011-07-25 17:06:02 UTC (rev 91673)
@@ -50,31 +50,14 @@
this._objectGroups = {};
}
-InjectedScript.primitiveTypes = {
- undefined: true,
- boolean: true,
- number: true,
- string: true
-}
-
InjectedScript.prototype = {
- isPrimitiveValue: function(object)
- {
- // FIXME(33716): typeof document.all is always 'undefined'.
- return InjectedScript.primitiveTypes[typeof object] && !this._isHTMLAllCollection(object);
- },
-
wrapObject: function(object, groupName, canAccessInspectedWindow)
{
if (canAccessInspectedWindow)
return this._wrapObject(object, groupName);
-
var result = {};
result.type = typeof object;
- if (this._isPrimitiveValue(object))
- result.value = object;
- else
- result.description = this._toString(object);
+ result.description = this._toString(object);
return result;
},
@@ -111,34 +94,26 @@
_wrapObject: function(object, objectGroupName)
{
try {
- return new InjectedScript.RemoteObject(object, objectGroupName);
- } catch (e) {
- try {
- var description = injectedScript._describe(e);
- } catch (ex) {
- var description = "<failed to convert exception to string>";
+ if (typeof object === "object" || typeof object === "function" || this._isHTMLAllCollection(object)) {
+ var id = this._lastBoundObjectId++;
+ this._idToWrappedObject[id] = object;
+ var objectId = "{\"injectedScriptId\":" + injectedScriptId + ",\"id\":" + id + "}";
+ if (objectGroupName) {
+ var group = this._objectGroups[objectGroupName];
+ if (!group) {
+ group = [];
+ this._objectGroups[objectGroupName] = group;
+ }
+ group.push(id);
+ this._idToObjectGroupName[id] = objectGroupName;
+ }
}
- return new InjectedScript.RemoteObject(description);
+ return InjectedScript.RemoteObject.fromObject(object, objectId);
+ } catch (e) {
+ return InjectedScript.RemoteObject.fromException(e);
}
},
- _bind: function(object, objectGroupName)
- {
- var id = this._lastBoundObjectId++;
- this._idToWrappedObject[id] = object;
- var objectId = "{\"injectedScriptId\":" + injectedScriptId + ",\"id\":" + id + "}";
- if (objectGroupName) {
- var group = this._objectGroups[objectGroupName];
- if (!group) {
- group = [];
- this._objectGroups[objectGroupName] = group;
- }
- group.push(id);
- this._idToObjectGroupName[id] = objectGroupName;
- }
- return objectId;
- },
-
_parseObjectId: function(objectId)
{
return InjectedScriptHost.evaluate("(" + objectId + ")");
@@ -381,7 +356,7 @@
{
var parsedObjectId = this._parseObjectId(objectId);
var object = this._objectForId(parsedObjectId);
- if (!object || this._subtype(object) !== "node")
+ if (!object || this._type(object) !== "node")
return null;
return object;
},
@@ -397,18 +372,19 @@
return (typeof object === "undefined") && InjectedScriptHost.isHTMLAllCollection(object);
},
- _subtype: function(obj)
+ _type: function(obj)
{
if (obj === null)
return "null";
var type = typeof obj;
- if (this.isPrimitiveValue(obj))
- return null;
+ if (type !== "object" && type !== "function") {
+ // FIXME(33716): typeof document.all is always 'undefined'.
+ if (this._isHTMLAllCollection(obj))
+ return "array";
+ return type;
+ }
- if (this._isHTMLAllCollection(obj))
- return "array";
-
var preciseType = InjectedScriptHost.type(obj);
if (preciseType)
return preciseType;
@@ -423,39 +399,39 @@
}
// If owning frame has navigated to somewhere else window properties will be undefined.
- return null;
+ // In this case just return result of the typeof.
+ return type;
},
_describe: function(obj)
{
- if (this.isPrimitiveValue(obj))
- return null;
+ var type = this._type(obj);
- var type = typeof obj;
- if (type === "function")
- return this._toString(obj);
-
- // Type is object, get subtype.
- var subtype = this._subtype(obj);
-
- if (subtype === "regexp")
- return this._toString(obj);
-
- var className = InjectedScriptHost.internalConstructorName(obj);
- if (subtype === "array") {
+ switch (type) {
+ case "object":
+ // Fall through.
+ case "node":
+ var result = InjectedScriptHost.internalConstructorName(obj);
+ if (result === "Object") {
+ // In Chromium DOM wrapper prototypes will have Object as their constructor name,
+ // get the real DOM wrapper name from the constructor property.
+ var constructorName = obj.constructor && obj.constructor.name;
+ if (constructorName)
+ return constructorName;
+ }
+ return result;
+ case "array":
+ var className = InjectedScriptHost.internalConstructorName(obj);
if (typeof obj.length === "number")
className += "[" + obj.length + "]";
return className;
+ case "string":
+ return obj;
+ case "function":
+ // Fall through.
+ default:
+ return this._toString(obj);
}
-
- if (className === "Object") {
- // In Chromium DOM wrapper prototypes will have Object as their constructor name,
- // get the real DOM wrapper name from the constructor property.
- var constructorName = obj.constructor && obj.constructor.name;
- if (constructorName)
- return constructorName;
- }
- return className;
},
_toString: function(obj)
@@ -467,26 +443,42 @@
var injectedScript = new InjectedScript();
-InjectedScript.RemoteObject = function(object, objectGroupName)
+InjectedScript.RemoteObject = function(objectId, type, className, description, hasChildren)
{
- this.type = typeof object;
- if (injectedScript.isPrimitiveValue(object) || object === null) {
- // We don't send undefined values over JSON.
- if (typeof object !== "undefined")
- this.value = object;
- if (object === null)
- this.subtype = "null";
- return;
+ if (objectId) {
+ this.objectId = objectId;
+ this.hasChildren = hasChildren;
}
+ this.type = type;
+ if (className)
+ this.className = className;
+ this.description = description;
+}
- this.objectId = injectedScript._bind(object, objectGroupName);
- var subtype = injectedScript._subtype(object)
- if (subtype)
- this.subtype = subtype;
- this.className = InjectedScriptHost.internalConstructorName(object);
- this.description = injectedScript._describe(object);
+InjectedScript.RemoteObject.fromException = function(e)
+{
+ try {
+ var description = injectedScript._describe(e);
+ } catch (ex) {
+ var description = "<failed to convert exception to string>";
+ }
+ return new InjectedScript.RemoteObject(null, "string", null, "[ Exception: " + description + " ]");
}
+// This method may throw
+InjectedScript.RemoteObject.fromObject = function(object, objectId)
+{
+ var type = injectedScript._type(object);
+ var rawType = typeof object;
+ var hasChildren = (rawType === "object" && object !== null && (!!Object.getOwnPropertyNames(object).length || !!object.__proto__)) || rawType === "function";
+ var className;
+ // Avoid explicit assignment to undefined as its value can be overriden (see crbug.com/88414).
+ if (typeof object === "object" || typeof object === "function")
+ className = InjectedScriptHost.internalConstructorName(object);
+ var description = injectedScript._describe(object);
+ return new InjectedScript.RemoteObject(objectId, type, className, description, hasChildren);
+}
+
InjectedScript.CallFrameProxy = function(ordinal, callFrame)
{
this.id = "{\"ordinal\":" + ordinal + ",\"injectedScriptId\":" + injectedScriptId + "}";
@@ -653,7 +645,7 @@
copy: function(object)
{
- if (injectedScript._subtype(object) === "node")
+ if (injectedScript._type(object) === "node")
object = object.outerHTML;
InjectedScriptHost.copyText(object);
},
Modified: trunk/Source/WebCore/inspector/Inspector.json (91672 => 91673)
--- trunk/Source/WebCore/inspector/Inspector.json 2011-07-25 17:00:04 UTC (rev 91672)
+++ trunk/Source/WebCore/inspector/Inspector.json 2011-07-25 17:06:02 UTC (rev 91673)
@@ -222,12 +222,11 @@
"type": "object",
"description": "Mirror object referencing original _javascript_ object.",
"properties": [
- { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean"], "description": "Object type." },
- { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date"], "description": "Object subtype hint. Specified for <code>object</code> type values only." },
- { "name": "className", "type": "string", "optional": true, "description": "Object class (constructor) name. Specified for <code>object</code> type values only." },
- { "name": "value", "type": "any", "optional": true, "description": "Remote object value (in case of primitive values)." },
- { "name": "description", "type": "string", "optional": true, "description": "String representation of the object." },
- { "name": "objectId", "type": "string", "optional": true, "description": "Unique object identifier (for non-primitive values)." }
+ { "name": "description", "type": "string", "description": "String representation of the object." },
+ { "name": "hasChildren", "type": "boolean", "optional": true, "description": "True when this object can be queried for children." },
+ { "name": "objectId", "type": "string", "optional": true, "description": "Unique object identifier (for non-primitive values)." },
+ { "name": "type", "type": "string", "enum": ["object", "array", "function", "null", "node", "undefined", "string", "number", "boolean", "regexp", "date"], "description": "Object type." },
+ { "name": "className", "type": "string", "optional": true, "description": "Object class name." }
]
},
{
Modified: trunk/Source/WebCore/inspector/front-end/ConsoleView.js (91672 => 91673)
--- trunk/Source/WebCore/inspector/front-end/ConsoleView.js 2011-07-25 17:00:04 UTC (rev 91672)
+++ trunk/Source/WebCore/inspector/front-end/ConsoleView.js 2011-07-25 17:06:02 UTC (rev 91673)
@@ -615,16 +615,11 @@
_format: function(output, forceObjectFormat)
{
- var type;
- if (forceObjectFormat)
- type = "object";
- else if (output instanceof WebInspector.RemoteObject)
- type = output.subtype || output.type;
- else
- type = typeof output;
+ var isProxy = (output != null && typeof output === "object");
+ var type = (forceObjectFormat ? "object" : WebInspector.RemoteObject.type(output));
var formatter = this._customFormatters[type];
- if (!formatter) {
+ if (!formatter || !isProxy) {
formatter = this._formatvalue;
output = output.description;
}
@@ -712,7 +707,7 @@
_formatAsArrayEntry: function(output)
{
// Prevent infinite expansion of cross-referencing arrays.
- return this._format(output, output.subtype && output.subtype === "array");
+ return this._format(output, WebInspector.RemoteObject.type(output) === "array");
}
}
@@ -849,10 +844,6 @@
// Formatting code below assumes that parameters are all wrappers whereas frontend console
// API allows passing arbitrary values as messages (strings, numbers, etc.). Wrap them here.
for (var i = 0; i < parameters.length; ++i) {
- // FIXME: Only pass runtime wrappers here.
- if (parameters[i] instanceof WebInspector.RemoteObject)
- continue;
-
if (typeof parameters[i] === "object")
parameters[i] = WebInspector.RemoteObject.fromPayload(parameters[i]);
else
Modified: trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js (91672 => 91673)
--- trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js 2011-07-25 17:00:04 UTC (rev 91672)
+++ trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js 2011-07-25 17:06:02 UTC (rev 91673)
@@ -579,9 +579,9 @@
if (!node.nodeName() || node.nodeName().toLowerCase() !== "img")
return;
- function setTooltip(result)
+ function setTooltip(error, result, wasThrown)
{
- if (!result || result.type !== "string")
+ if (error || wasThrown || result.type !== "string")
return;
try {
Modified: trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js (91672 => 91673)
--- trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js 2011-07-25 17:00:04 UTC (rev 91672)
+++ trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js 2011-07-25 17:06:02 UTC (rev 91673)
@@ -204,7 +204,7 @@
this.valueElement.addStyleClass("error");
if (this.property.value.type)
this.valueElement.addStyleClass("console-formatted-" + this.property.value.type);
- if (this.property.value.subtype === "node")
+ if (this.property.value.type === "node")
this.valueElement.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), false);
this.listItemElement.removeChildren();
Modified: trunk/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js (91672 => 91673)
--- trunk/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js 2011-07-25 17:00:04 UTC (rev 91672)
+++ trunk/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js 2011-07-25 17:06:02 UTC (rev 91673)
@@ -65,10 +65,11 @@
object.release();
}
- function nodePrototypesReady(object)
+ function nodePrototypesReady(error, objectPayload, wasThrown)
{
- if (!object)
+ if (error || wasThrown)
return;
+ var object = WebInspector.RemoteObject.fromPayload(objectPayload);
object.getOwnProperties(fillSection.bind(this));
}
Modified: trunk/Source/WebCore/inspector/front-end/RemoteObject.js (91672 => 91673)
--- trunk/Source/WebCore/inspector/front-end/RemoteObject.js 2011-07-25 17:00:04 UTC (rev 91672)
+++ trunk/Source/WebCore/inspector/front-end/RemoteObject.js 2011-07-25 17:06:02 UTC (rev 91673)
@@ -28,25 +28,17 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.RemoteObject = function(objectId, type, subtype, value, description)
+WebInspector.RemoteObject = function(objectId, type, description, hasChildren)
{
+ this._objectId = objectId;
this._type = type;
- if (objectId) {
- // handle
- this._objectId = objectId;
- this._subtype = subtype;
- this._description = description;
- this._hasChildren = true;
- } else {
- // Primitive
- this._description = value + "";
- this._hasChildren = false;
- }
+ this._description = description;
+ this._hasChildren = hasChildren;
}
WebInspector.RemoteObject.fromPrimitiveValue = function(value)
{
- return new WebInspector.RemoteObject(null, typeof value, null, value);
+ return new WebInspector.RemoteObject(null, typeof value, value);
}
WebInspector.RemoteObject.fromLocalObject = function(value)
@@ -71,9 +63,10 @@
WebInspector.RemoteObject.fromPayload = function(payload)
{
- console.assert(typeof payload === "object", "Remote object payload should only be an object");
-
- return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.subtype, payload.value, payload.description);
+ if (typeof payload === "object")
+ return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.description, payload.hasChildren);
+ // FIXME: make sure we only get here with real payloads in the new DebuggerAgent.js.
+ return payload;
}
WebInspector.RemoteObject.type = function(remoteObject)
@@ -99,11 +92,6 @@
return this._type;
},
- get subtype()
- {
- return this._subtype;
- },
-
get description()
{
return this._description;
@@ -162,12 +150,7 @@
callFunction: function(functionDeclaration, callback)
{
- function mycallback(error, result, wasThrown)
- {
- callback((error || wasThrown) ? null : WebInspector.RemoteObject.fromPayload(result));
- }
-
- RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), undefined, mycallback);
+ RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), undefined, callback);
},
release: function()
@@ -249,18 +232,11 @@
get type()
{
- return typeof this._value;
- },
-
- get subtype()
- {
if (this._value === null)
return "null";
-
if (this._value instanceof Array)
return "array";
-
- return undefined;
+ return typeof this._value;
},
get hasChildren()
Modified: trunk/Source/WebCore/inspector/front-end/SourceFrame.js (91672 => 91673)
--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js 2011-07-25 17:00:04 UTC (rev 91672)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js 2011-07-25 17:06:02 UTC (rev 91673)
@@ -788,7 +788,7 @@
return;
var popupContentElement = null;
- if (result.type !== "object") {
+ if (result.type !== "object" && result.type !== "node" && result.type !== "array") {
popupContentElement = document.createElement("span");
popupContentElement.className = "monospace console-formatted-" + result.type;
popupContentElement.style.whiteSpace = "pre";
Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (91672 => 91673)
--- trunk/Source/WebCore/inspector/front-end/inspector.js 2011-07-25 17:00:04 UTC (rev 91672)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js 2011-07-25 17:06:02 UTC (rev 91673)
@@ -1128,7 +1128,7 @@
WebInspector.log.repeatCount = repeatCount;
// ConsoleMessage expects a proxy object
- message = WebInspector.RemoteObject.fromPrimitiveValue(message);
+ message = new WebInspector.RemoteObject.fromPrimitiveValue(message);
// post the message
var msg = new WebInspector.ConsoleMessage(
@@ -1168,7 +1168,7 @@
WebInspector.inspect = function(payload, hints)
{
var object = WebInspector.RemoteObject.fromPayload(payload);
- if (object.subtype === "node") {
+ if (object.type === "node") {
// Request node from backend and focus it.
object.pushNodeToFrontend(WebInspector.updateFocusedNode.bind(WebInspector), object.release.bind(object));
return;