Changeset 85722 in webkit


Ignore:
Timestamp:
May 3, 2011 11:45:27 PM (13 years ago)
Author:
yurys@chromium.org
Message:

2011-05-03 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: can't inspect element in an iframe when element originates from non-frame document
https://bugs.webkit.org/show_bug.cgi?id=60031

  • inspector/elements/elements-inspect-iframe-from-different-domain-expected.txt: Added.
  • inspector/elements/elements-inspect-iframe-from-different-domain.html: Added.

2011-05-03 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: can't inspect element in an iframe when element originates from non-frame document
https://bugs.webkit.org/show_bug.cgi?id=60031

Inspected object type evaluation has moved into native bindings. This way it doesn't
depend on the current JS context.

Test: inspector/elements/elements-inspect-iframe-from-different-domain.html

  • bindings/js/JSInjectedScriptHostCustom.cpp: (WebCore::JSInjectedScriptHost::isHTMLAllCollection): this method helps distinguish real undefined values from HTMLAllCollection (WebCore::JSInjectedScriptHost::type): method that returns presice type of the passed value
  • bindings/v8/custom/V8InjectedScriptHostCustom.cpp: (WebCore::V8InjectedScriptHost::isHTMLAllCollectionCallback): (WebCore::V8InjectedScriptHost::typeCallback):
  • inspector/InjectedScriptHost.idl:
  • inspector/InjectedScriptSource.js: (.):
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r85715 r85722  
     12011-05-03  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: can't inspect element in an iframe when element originates from non-frame document
     6        https://bugs.webkit.org/show_bug.cgi?id=60031
     7
     8        * inspector/elements/elements-inspect-iframe-from-different-domain-expected.txt: Added.
     9        * inspector/elements/elements-inspect-iframe-from-different-domain.html: Added.
     10
    1112011-05-03  Dan Bernstein  <mitz@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r85721 r85722  
     12011-05-03  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: can't inspect element in an iframe when element originates from non-frame document
     6        https://bugs.webkit.org/show_bug.cgi?id=60031
     7       
     8        Inspected object type evaluation has moved into native bindings. This way it doesn't
     9        depend on the current JS context.
     10
     11        Test: inspector/elements/elements-inspect-iframe-from-different-domain.html
     12
     13        * bindings/js/JSInjectedScriptHostCustom.cpp:
     14        (WebCore::JSInjectedScriptHost::isHTMLAllCollection): this method helps distinguish
     15        real undefined values from HTMLAllCollection
     16        (WebCore::JSInjectedScriptHost::type): method that returns presice type of the passed
     17        value
     18        * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
     19        (WebCore::V8InjectedScriptHost::isHTMLAllCollectionCallback):
     20        (WebCore::V8InjectedScriptHost::typeCallback):
     21        * inspector/InjectedScriptHost.idl:
     22        * inspector/InjectedScriptSource.js:
     23        (.):
     24
    1252011-05-03  Pratik Solanki  <psolanki@apple.com>
    226
  • trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp

    r85035 r85722  
    4040#include "JSDatabase.h"
    4141#endif
     42#include "DateInstance.h"
    4243#include "ExceptionCode.h"
    4344#include "InjectedScriptHost.h"
    4445#include "InspectorDebuggerAgent.h"
    4546#include "InspectorValues.h"
     47#include "JSArray.h"
     48#include "JSHTMLAllCollection.h"
     49#include "JSHTMLCollection.h"
    4650#include "JSNode.h"
     51#include "JSNodeList.h"
     52#include "RegExpObject.h"
    4753#include "ScriptValue.h"
    4854#if ENABLE(DOM_STORAGE)
     
    9197}
    9298
     99JSValue JSInjectedScriptHost::isHTMLAllCollection(ExecState* exec)
     100{
     101    if (exec->argumentCount() < 1)
     102        return jsUndefined();
     103
     104    JSValue value = exec->argument(0);
     105    return jsBoolean(value.inherits(&JSHTMLAllCollection::s_info));
     106}
     107
     108JSValue JSInjectedScriptHost::type(ExecState* exec)
     109{
     110    if (exec->argumentCount() < 1)
     111        return jsUndefined();
     112
     113    JSValue value = exec->argument(0);
     114    if (value.isString())
     115        return jsString(exec, String("string"));
     116    if (value.inherits(&JSArray::s_info))
     117        return jsString(exec, String("array"));
     118    if (value.isBoolean())
     119        return jsString(exec, String("boolean"));
     120    if (value.isNumber())
     121        return jsString(exec, String("number"));
     122    if (value.inherits(&DateInstance::s_info))
     123        return jsString(exec, String("date"));
     124    if (value.inherits(&RegExpObject::s_info))
     125        return jsString(exec, String("regexp"));
     126    if (value.inherits(&JSNode::s_info))
     127        return jsString(exec, String("node"));
     128    if (value.inherits(&JSNodeList::s_info))
     129        return jsString(exec, String("array"));
     130    if (value.inherits(&JSHTMLCollection::s_info))
     131        return jsString(exec, String("array"));
     132    return jsUndefined();
     133}
     134
    93135JSValue JSInjectedScriptHost::inspect(ExecState* exec)
    94136{
  • trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp

    r85035 r85722  
    4040#include "V8BindingState.h"
    4141#include "V8Database.h"
     42#include "V8HTMLAllCollection.h"
     43#include "V8HTMLCollection.h"
    4244#include "V8HiddenPropertyName.h"
     45#include "V8NodeList.h"
    4346#include "V8Node.h"
    4447#include "V8Proxy.h"
     
    9093}
    9194
     95v8::Handle<v8::Value> V8InjectedScriptHost::isHTMLAllCollectionCallback(const v8::Arguments& args)
     96{
     97    INC_STATS("InjectedScriptHost.isHTMLAllCollectionCallback()");
     98    if (args.Length() < 1)
     99        return v8::Undefined();
     100
     101    if (!args[0]->IsObject())
     102        return v8::False();
     103
     104    v8::HandleScope handleScope;
     105    return v8::Boolean::New(V8HTMLAllCollection::HasInstance(args[0]));
     106}
     107
     108v8::Handle<v8::Value> V8InjectedScriptHost::typeCallback(const v8::Arguments& args)
     109{
     110    INC_STATS("InjectedScriptHost.typeCallback()");
     111    if (args.Length() < 1)
     112        return v8::Undefined();
     113
     114    v8::Handle<v8::Value> value = args[0];
     115    if (value->IsString())
     116        return v8::String::New("string");
     117    if (value->IsArray())
     118        return v8::String::New("array");
     119    if (value->IsBoolean())
     120        return v8::String::New("boolean");
     121    if (value->IsNumber())
     122        return v8::String::New("number");
     123    if (value->IsDate())
     124        return v8::String::New("date");
     125    if (value->IsRegExp())
     126        return v8::String::New("regexp");
     127    if (V8Node::HasInstance(value))
     128        return v8::String::New("node");
     129    if (V8NodeList::HasInstance(value))
     130        return v8::String::New("array");
     131    if (V8HTMLCollection::HasInstance(value))
     132        return v8::String::New("array");
     133    return v8::Undefined();
     134}
     135
    92136v8::Handle<v8::Value> V8InjectedScriptHost::inspectCallback(const v8::Arguments& args)
    93137{
  • trunk/Source/WebCore/inspector/InjectedScriptHost.idl

    r85035 r85722  
    3939        [Custom] DOMObject inspectedNode(in int num);
    4040        [Custom] DOMObject internalConstructorName(in DOMObject object);
     41        [Custom] boolean isHTMLAllCollection(in DOMObject object);
     42        [Custom] DOMString type(in DOMObject object);
    4143
    4244        [Custom] int databaseId(in DOMObject database);
  • trunk/Source/WebCore/inspector/InjectedScriptSource.js

    r85596 r85722  
    346346    {
    347347        // document.all is reported as undefined, but we still want to process it.
    348         return (typeof object === "undefined") && inspectedWindow.HTMLAllCollection && object instanceof inspectedWindow.HTMLAllCollection;
     348        return (typeof object === "undefined") && InjectedScriptHost.isHTMLAllCollection(object);
    349349    },
    350350
     
    362362        }
    363363
    364         // If owning frame has navigated to somewhere else window properties will be undefined.
    365         // In this case just return result of the typeof.
    366         if (!inspectedWindow.document)
    367             return type;
    368 
    369         if (obj instanceof inspectedWindow.Node)
    370             return "node";
    371         if (obj instanceof inspectedWindow.String)
    372             return "string";
    373         if (obj instanceof inspectedWindow.Array)
    374             return "array";
    375         if (obj instanceof inspectedWindow.Boolean)
    376             return "boolean";
    377         if (obj instanceof inspectedWindow.Number)
    378             return "number";
    379         if (obj instanceof inspectedWindow.Date)
    380             return "date";
    381         if (obj instanceof inspectedWindow.RegExp)
    382             return "regexp";
     364        var preciseType = InjectedScriptHost.type(obj);
     365        if (preciseType)
     366            return preciseType;
     367
    383368        // FireBug's array detection.
    384369        try {
     
    388373                return "array";
    389374        } catch (e) {
    390             return type;
    391         }
    392         if (obj instanceof inspectedWindow.NodeList)
    393             return "array";
    394         if (obj instanceof inspectedWindow.HTMLCollection)
    395             return "array";
     375        }
     376
     377        // If owning frame has navigated to somewhere else window properties will be undefined.
     378        // In this case just return result of the typeof.
    396379        return type;
    397380    },
Note: See TracChangeset for help on using the changeset viewer.