Changeset 56532 in webkit


Ignore:
Timestamp:
Mar 25, 2010 5:19:35 AM (14 years ago)
Author:
pfeldman@chromium.org
Message:

2010-03-25 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Timothy Hatcher.

Web Inspector: Expect console object wrapping to fail.

https://bugs.webkit.org/show_bug.cgi?id=36587

  • inspector/front-end/InjectedScript.js: (injectedScriptConstructor):
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r56530 r56532  
     12010-03-25  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Timothy Hatcher.
     4
     5        Web Inspector: Expect console object wrapping to fail.
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=36587
     8
     9        * inspector/front-end/InjectedScript.js:
     10        (injectedScriptConstructor):
     11
    1122010-03-25  Joanmarie Diggs  <joanmarie.diggs@gmail.com>
    213
  • trunk/WebCore/inspector/InjectedScript.cpp

    r54421 r56532  
    7575    wrapFunction.appendArgument(value);
    7676    wrapFunction.appendArgument("console");
    77     ScriptValue r = wrapFunction.call();
     77    bool hadException = false;
     78    ScriptValue r = wrapFunction.call(hadException);
     79    if (hadException)
     80        return SerializedScriptValue::create("<exception>");
    7881    return r.serialize(m_injectedScriptObject.scriptState());
    7982}
  • trunk/WebCore/inspector/front-end/InjectedScript.js

    r56393 r56532  
    3636InjectedScript.wrapObject = function(object, objectGroupName)
    3737{
    38     var objectId;
    39     if (typeof object === "object" || typeof object === "function" ||
    40         (typeof object === "undefined" && object instanceof inspectedWindow.HTMLAllCollection)) { // FIXME(33716)
    41         var id = InjectedScript.lastBoundObjectId++;
    42         objectId = "object#" + id;
    43         InjectedScript.idToWrappedObject[objectId] = object;
    44 
    45         var group = InjectedScript.objectGroups[objectGroupName];
    46         if (!group) {
    47             group = [];
    48             InjectedScript.objectGroups[objectGroupName] = group;
    49         }
    50         group.push(objectId);
     38    try {
     39        var objectId;
     40        if (typeof object === "object" || typeof object === "function" || InjectedScript._isHTMLAllCollection(object)) {
     41            var id = InjectedScript.lastBoundObjectId++;
     42            objectId = "object#" + id;
     43            InjectedScript.idToWrappedObject[objectId] = object;
     44
     45            var group = InjectedScript.objectGroups[objectGroupName];
     46            if (!group) {
     47                group = [];
     48                InjectedScript.objectGroups[objectGroupName] = group;
     49            }
     50            group.push(objectId);
     51        }
     52        return InjectedScript.createProxyObject(object, objectId);
     53    } catch (e) {
     54        return InjectedScript.createProxyObject("[ Exception: " + e.toString() + " ]");
    5155    }
    5256    return InjectedScript.createProxyObject(object, objectId);
     
    874878InjectedScript._isDefined = function(object)
    875879{
    876     return object || object instanceof inspectedWindow.HTMLAllCollection;
     880    return object || InjectedScript._isHTMLAllCollection(object);
     881}
     882
     883InjectedScript._isHTMLAllCollection = function(object)
     884{
     885    // document.all is reported as undefined, but we still want to process it.
     886    return (typeof object === "undefined") && inspectedWindow.HTMLAllCollection && object instanceof inspectedWindow.HTMLAllCollection;
    877887}
    878888
     
    883893
    884894    // FIXME(33716): typeof document.all is always 'undefined'.
    885     if (obj instanceof inspectedWindow.HTMLAllCollection)
     895    if (InjectedScript._isHTMLAllCollection(obj))
    886896        return "array";
    887897
     
    908918    if (obj instanceof win.NodeList)
    909919        return "array";
    910     if (obj instanceof win.HTMLCollection || obj instanceof win.HTMLAllCollection)
     920    if (obj instanceof win.HTMLCollection)
    911921        return "array";
    912922    if (obj instanceof win.Error)
Note: See TracChangeset for help on using the changeset viewer.