Changeset 31890 in webkit


Ignore:
Timestamp:
Apr 14, 2008 4:46:40 PM (16 years ago)
Author:
Adam Roben
Message:

Don't let the inspected page overwrite properties of JS objects in the Inspector

<https://bugs.webkit.org/show_bug.cgi?id=16011>
<rdar://problem/5604409>

<https://bugs.webkit.org/show_bug.cgi?id=16837>
<rdar://problem/5813850>

Reviewed by Sam Weinig and Geoff Garen.

Tests (contributed by Adam Barth and Collin Jackson):
manual-tests/inspector-wrappers

  • GNUmakefile.am:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • WebCoreSources.bkl: Added new files to the projects.
  • bindings/js/JSQuarantinedObjectWrapper.cpp: Added. (WebCore::): (WebCore::JSQuarantinedObjectWrapper::asWrapper): Converts a JSValue into a JSQuarantinedObjectWrapper, if the JSValue is in fact a JSQuarantinedObjectWrapper. (WebCore::JSQuarantinedObjectWrapper::cachedValueGetter): Callback to be used with PropertySlot. (WebCore::JSQuarantinedObjectWrapper::JSQuarantinedObjectWrapper): Hold onto the object we're wrapping and its global object. Pass the wrapped prototype up to the JSObject constructor. (WebCore::JSQuarantinedObjectWrapper::~JSQuarantinedObjectWrapper): (WebCore::JSQuarantinedObjectWrapper::unwrappedExecStateMatches): Returns true if our underlying object originated from the same global object as the passed-in ExecState. (WebCore::JSQuarantinedObjectWrapper::unwrappedExecState): (WebCore::JSQuarantinedObjectWrapper::transferExceptionToExecState): Wraps and moves an exception from our underlying ExecState to the passed-in one. (WebCore::JSQuarantinedObjectWrapper::mark): Marks ourselves and the objects we're holding references to.

(WebCore::JSQuarantinedObjectWrapper::getOwnPropertySlot):
(WebCore::JSQuarantinedObjectWrapper::put):
(WebCore::JSQuarantinedObjectWrapper::deleteProperty):
(WebCore::JSQuarantinedObjectWrapper::implementsConstruct):
(WebCore::JSQuarantinedObjectWrapper::construct):
(WebCore::JSQuarantinedObjectWrapper::implementsHasInstance):
(WebCore::JSQuarantinedObjectWrapper::hasInstance):
(WebCore::JSQuarantinedObjectWrapper::implementsCall):
(WebCore::JSQuarantinedObjectWrapper::callAsFunction):
(WebCore::JSQuarantinedObjectWrapper::getPropertyNames):
JSObject overrides. These each check the appropriate permission before
allowing the call to proceed. We wrap all outgoing values using
m_wrapOutgoingValue, and we prepare all incoming values with the
virtual prepareIncomingValue function. If an exception is raised when
calling the underlying object, we transfer the exception in wrapped
form to the passed-in ExecState.

  • bindings/js/JSQuarantinedObjectWrapper.h: Added. (WebCore::JSQuarantinedObjectWrapper::unwrappedObject): (WebCore::JSQuarantinedObjectWrapper::className): We return the underlying object's class name so that we can successfully masquerade as that underlying object when, e.g., Object.prototype.toString is called on us. (WebCore::JSQuarantinedObjectWrapper::classInfo):

(WebCore::JSQuarantinedObjectWrapper::allowsGetProperty):
(WebCore::JSQuarantinedObjectWrapper::allowsSetProperty):
(WebCore::JSQuarantinedObjectWrapper::allowsDeleteProperty):
(WebCore::JSQuarantinedObjectWrapper::allowsConstruct):
(WebCore::JSQuarantinedObjectWrapper::allowsHasInstance):
(WebCore::JSQuarantinedObjectWrapper::allowsCallAsFunction):
(WebCore::JSQuarantinedObjectWrapper::allowsGetPropertyNames):
These virtual methods let subclasses define the allowed operations on
the wrapped object. By default all operations are disabled.

  • bindings/js/JSInspectedObjectWrapper.cpp: Added. This subclass of JSQuarantinedObjectWrapper is used to wrap objects from the inspected page being passed to the Inspector. (WebCore::wrappers): (WebCore::): (WebCore::JSInspectedObjectWrapper::wrap): Wraps the passed-in object if needed and returns the wrapper. If this object has been wrapped previously we'll return the old wrapper rather than make a new one. (WebCore::JSInspectedObjectWrapper::JSInspectedObjectWrapper): Add ourselves to the wrapper map. (WebCore::JSInspectedObjectWrapper::~JSInspectedObjectWrapper): Remove ourselves from the wrapper map. (WebCore::JSInspectedObjectWrapper::prepareIncomingValue): Ensure that any objects passed to the inspected object are either wrappers around objects from the inspected page (in which case we unwrap them so that the inspected page never sees the wrapper), or wrapped callbacks from the Inspector.
  • bindings/js/JSInspectedObjectWrapper.h: Added. (WebCore::JSInspectedObjectWrapper::classInfo): (WebCore::JSInspectedObjectWrapper::allowsGetProperty): (WebCore::JSInspectedObjectWrapper::allowsSetProperty): (WebCore::JSInspectedObjectWrapper::allowsDeleteProperty): (WebCore::JSInspectedObjectWrapper::allowsConstruct): (WebCore::JSInspectedObjectWrapper::allowsHasInstance): (WebCore::JSInspectedObjectWrapper::allowsCallAsFunction): (WebCore::JSInspectedObjectWrapper::allowsGetPropertyNames): These all return true so that the Inspector can use objects from the inspected page however it needs. (WebCore::JSInspectedObjectWrapper::wrapOutgoingValue): Wrap all outgoing values as JSInspectedObjectWrappers.
  • bindings/js/JSInspectorCallbackWrapper.cpp: Added. This subclass of JSQuarantinedObjectWrapper is used to wrap callbacks that the Inspector passes to the inspected page (e.g., for event listeners or client-side storage callbacks). (WebCore::wrappers): (WebCore::): (WebCore::JSInspectorCallbackWrapper::wrap): Wraps the passed-in object if needed and returns the wrapper. If this object has been wrapped previously we'll return the old wrapper rather than make a new one. (WebCore::JSInspectorCallbackWrapper::JSInspectorCallbackWrapper): Add ourselves to the wrapper map. (WebCore::JSInspectorCallbackWrapper::~JSInspectorCallbackWrapper): Remove ourselves from the wrapper map. (WebCore::JSInspectorCallbackWrapper::prepareIncomingValue): Ensure that values passed from the inspected page to an Inspector callback are wrapped in JSInspectedObjectWrappers. We also allow the inspected page to pass ourselves in (which will happen in the case of a client-side storage callback, where the callback itself is passed as the this object). In this case we unwrap ourselves so that the Inspector doesn't have to deal with the wrapper.
  • bindings/js/JSInspectorCallbackWrapper.h: Added. (WebCore::JSInspectorCallbackWrapper::classInfo): (WebCore::JSInspectorCallbackWrapper::allowsCallAsFunction): This is the only allowed operation on a JSInspectorCallbackWrapper. (WebCore::JSInspectorCallbackWrapper::wrapOutgoingValue): Wrap all outgoing values as JSInspectorCallbackWrappers.
  • page/InspectorController.cpp: (WebCore::getResourceDocumentNode): Wrap the Document before passing it to the Inspector. (WebCore::highlightDOMNode): Unwrap the Node that the Inspector passed to us. (WebCore::databaseTableNames): Unwrap the Database that the Inspector passed to us. (WebCore::inspectedWindow): Wrap the Window before passing it to the Inspector. (WebCore::InspectorController::focusNode): Wrap the Node before passing it to the Inspector. (WebCore::wrapCallback): Wraps the passed-in callback in a JSInspectorCallbackWrapper. (WebCore::InspectorController::addDatabaseScriptResource): Wrap the Database beore pasing it to the Inspector. (WebCore::InspectorController::windowScriptObjectAvailable): Add the new wrapCallback function to the InspectorController JS object.
  • page/inspector/ElementsPanel.js: (WebInspector.ElementsPanel.reset): Wrap the contentLoaded callback.
  • page/inspector/DatabaseQueryView.js: (WebInspector.DatabaseQueryView._enterKeyPressed):
  • page/inspector/DatabaseTableView.js: (WebInspector.DatabaseTableView.update): Pass null instead of an empty array to executeSql since we're no longer allowed to pass any unwrapped objects to the inspected page. We now wrap all callbacks being passed to the inspected page using InspectorController.wrapCallback.
Location:
trunk/WebCore
Files:
17 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r31889 r31890  
     12008-04-14  Adam Roben  <aroben@apple.com>
     2
     3        Don't let the inspected page overwrite properties of JS objects in the
     4        Inspector
     5
     6        <https://bugs.webkit.org/show_bug.cgi?id=16011>
     7        <rdar://problem/5604409>
     8
     9        <https://bugs.webkit.org/show_bug.cgi?id=16837>
     10        <rdar://problem/5813850>
     11
     12        Reviewed by Sam Weinig and Geoff Garen.
     13
     14        Tests (contributed by Adam Barth and Collin Jackson):
     15        manual-tests/inspector-wrappers
     16
     17        * GNUmakefile.am:
     18        * WebCore.pro:
     19        * WebCore.vcproj/WebCore.vcproj:
     20        * WebCore.xcodeproj/project.pbxproj:
     21        * WebCoreSources.bkl:
     22        Added new files to the projects.
     23
     24        * bindings/js/JSQuarantinedObjectWrapper.cpp: Added.
     25        (WebCore::):
     26        (WebCore::JSQuarantinedObjectWrapper::asWrapper): Converts a JSValue
     27        into a JSQuarantinedObjectWrapper, if the JSValue is in fact a
     28        JSQuarantinedObjectWrapper.
     29        (WebCore::JSQuarantinedObjectWrapper::cachedValueGetter): Callback to
     30        be used with PropertySlot.
     31        (WebCore::JSQuarantinedObjectWrapper::JSQuarantinedObjectWrapper):
     32        Hold onto the object we're wrapping and its global object. Pass the
     33        wrapped prototype up to the JSObject constructor.
     34        (WebCore::JSQuarantinedObjectWrapper::~JSQuarantinedObjectWrapper):
     35        (WebCore::JSQuarantinedObjectWrapper::unwrappedExecStateMatches):
     36        Returns true if our underlying object originated from the same global
     37        object as the passed-in ExecState.
     38        (WebCore::JSQuarantinedObjectWrapper::unwrappedExecState):
     39        (WebCore::JSQuarantinedObjectWrapper::transferExceptionToExecState):
     40        Wraps and moves an exception from our underlying ExecState to the
     41        passed-in one.
     42        (WebCore::JSQuarantinedObjectWrapper::mark): Marks ourselves and the
     43        objects we're holding references to.
     44
     45        (WebCore::JSQuarantinedObjectWrapper::getOwnPropertySlot):
     46        (WebCore::JSQuarantinedObjectWrapper::put):
     47        (WebCore::JSQuarantinedObjectWrapper::deleteProperty):
     48        (WebCore::JSQuarantinedObjectWrapper::implementsConstruct):
     49        (WebCore::JSQuarantinedObjectWrapper::construct):
     50        (WebCore::JSQuarantinedObjectWrapper::implementsHasInstance):
     51        (WebCore::JSQuarantinedObjectWrapper::hasInstance):
     52        (WebCore::JSQuarantinedObjectWrapper::implementsCall):
     53        (WebCore::JSQuarantinedObjectWrapper::callAsFunction):
     54        (WebCore::JSQuarantinedObjectWrapper::getPropertyNames):
     55        JSObject overrides. These each check the appropriate permission before
     56        allowing the call to proceed. We wrap all outgoing values using
     57        m_wrapOutgoingValue, and we prepare all incoming values with the
     58        virtual prepareIncomingValue function. If an exception is raised when
     59        calling the underlying object, we transfer the exception in wrapped
     60        form to the passed-in ExecState.
     61
     62        * bindings/js/JSQuarantinedObjectWrapper.h: Added.
     63        (WebCore::JSQuarantinedObjectWrapper::unwrappedObject):
     64        (WebCore::JSQuarantinedObjectWrapper::className): We return the
     65        underlying object's class name so that we can successfully masquerade
     66        as that underlying object when, e.g., Object.prototype.toString is
     67        called on us.
     68        (WebCore::JSQuarantinedObjectWrapper::classInfo):
     69
     70        (WebCore::JSQuarantinedObjectWrapper::allowsGetProperty):
     71        (WebCore::JSQuarantinedObjectWrapper::allowsSetProperty):
     72        (WebCore::JSQuarantinedObjectWrapper::allowsDeleteProperty):
     73        (WebCore::JSQuarantinedObjectWrapper::allowsConstruct):
     74        (WebCore::JSQuarantinedObjectWrapper::allowsHasInstance):
     75        (WebCore::JSQuarantinedObjectWrapper::allowsCallAsFunction):
     76        (WebCore::JSQuarantinedObjectWrapper::allowsGetPropertyNames):
     77        These virtual methods let subclasses define the allowed operations on
     78        the wrapped object. By default all operations are disabled.
     79
     80        * bindings/js/JSInspectedObjectWrapper.cpp: Added. This subclass of
     81        JSQuarantinedObjectWrapper is used to wrap objects from the inspected
     82        page being passed to the Inspector.
     83        (WebCore::wrappers):
     84        (WebCore::):
     85        (WebCore::JSInspectedObjectWrapper::wrap): Wraps the passed-in object
     86        if needed and returns the wrapper. If this object has been wrapped
     87        previously we'll return the old wrapper rather than make a new one.
     88        (WebCore::JSInspectedObjectWrapper::JSInspectedObjectWrapper): Add
     89        ourselves to the wrapper map.
     90        (WebCore::JSInspectedObjectWrapper::~JSInspectedObjectWrapper): Remove
     91        ourselves from the wrapper map.
     92        (WebCore::JSInspectedObjectWrapper::prepareIncomingValue): Ensure that
     93        any objects passed to the inspected object are either wrappers around
     94        objects from the inspected page (in which case we unwrap them so that
     95        the inspected page never sees the wrapper), or wrapped callbacks from
     96        the Inspector.
     97        * bindings/js/JSInspectedObjectWrapper.h: Added.
     98        (WebCore::JSInspectedObjectWrapper::classInfo):
     99        (WebCore::JSInspectedObjectWrapper::allowsGetProperty):
     100        (WebCore::JSInspectedObjectWrapper::allowsSetProperty):
     101        (WebCore::JSInspectedObjectWrapper::allowsDeleteProperty):
     102        (WebCore::JSInspectedObjectWrapper::allowsConstruct):
     103        (WebCore::JSInspectedObjectWrapper::allowsHasInstance):
     104        (WebCore::JSInspectedObjectWrapper::allowsCallAsFunction):
     105        (WebCore::JSInspectedObjectWrapper::allowsGetPropertyNames):
     106        These all return true so that the Inspector can use objects from the
     107        inspected page however it needs.
     108        (WebCore::JSInspectedObjectWrapper::wrapOutgoingValue): Wrap all
     109        outgoing values as JSInspectedObjectWrappers.
     110
     111        * bindings/js/JSInspectorCallbackWrapper.cpp: Added. This subclass of
     112        JSQuarantinedObjectWrapper is used to wrap callbacks that the
     113        Inspector passes to the inspected page (e.g., for event listeners or
     114        client-side storage callbacks).
     115        (WebCore::wrappers):
     116        (WebCore::):
     117        (WebCore::JSInspectorCallbackWrapper::wrap): Wraps the passed-in
     118        object if needed and returns the wrapper. If this object has been
     119        wrapped previously we'll return the old wrapper rather than make a new
     120        one.
     121        (WebCore::JSInspectorCallbackWrapper::JSInspectorCallbackWrapper): Add
     122        ourselves to the wrapper map.
     123        (WebCore::JSInspectorCallbackWrapper::~JSInspectorCallbackWrapper):
     124        Remove ourselves from the wrapper map.
     125        (WebCore::JSInspectorCallbackWrapper::prepareIncomingValue): Ensure
     126        that values passed from the inspected page to an Inspector callback
     127        are wrapped in JSInspectedObjectWrappers. We also allow the inspected
     128        page to pass ourselves in (which will happen in the case of a
     129        client-side storage callback, where the callback itself is passed as
     130        the `this` object). In this case we unwrap ourselves so that the
     131        Inspector doesn't have to deal with the wrapper.
     132        * bindings/js/JSInspectorCallbackWrapper.h: Added.
     133        (WebCore::JSInspectorCallbackWrapper::classInfo):
     134        (WebCore::JSInspectorCallbackWrapper::allowsCallAsFunction):
     135        This is the only allowed operation on a JSInspectorCallbackWrapper.
     136        (WebCore::JSInspectorCallbackWrapper::wrapOutgoingValue): Wrap all
     137        outgoing values as JSInspectorCallbackWrappers.
     138
     139        * page/InspectorController.cpp:
     140        (WebCore::getResourceDocumentNode): Wrap the Document before passing
     141        it to the Inspector.
     142        (WebCore::highlightDOMNode): Unwrap the Node that the Inspector passed
     143        to us.
     144        (WebCore::databaseTableNames): Unwrap the Database that the Inspector
     145        passed to us.
     146        (WebCore::inspectedWindow): Wrap the Window before passing it to the
     147        Inspector.
     148        (WebCore::InspectorController::focusNode): Wrap the Node before
     149        passing it to the Inspector.
     150        (WebCore::wrapCallback): Wraps the passed-in callback in a
     151        JSInspectorCallbackWrapper.
     152        (WebCore::InspectorController::addDatabaseScriptResource): Wrap the
     153        Database beore pasing it to the Inspector.
     154        (WebCore::InspectorController::windowScriptObjectAvailable): Add the
     155        new wrapCallback function to the InspectorController JS object.
     156
     157        * page/inspector/ElementsPanel.js:
     158        (WebInspector.ElementsPanel.reset): Wrap the contentLoaded callback.
     159
     160        * page/inspector/DatabaseQueryView.js:
     161        (WebInspector.DatabaseQueryView._enterKeyPressed):
     162        * page/inspector/DatabaseTableView.js:
     163        (WebInspector.DatabaseTableView.update):
     164        Pass null instead of an empty array to executeSql since we're no
     165        longer allowed to pass any unwrapped objects to the inspected page.
     166        We now wrap all callbacks being passed to the inspected page using
     167        InspectorController.wrapCallback.
     168
    11692008-04-14  Adam Roben  <aroben@apple.com>
    2170
  • trunk/WebCore/GNUmakefile.am

    r31878 r31890  
    488488        WebCore/bindings/js/JSHistoryCustom.cpp \
    489489        WebCore/bindings/js/JSImageConstructor.cpp \
     490        WebCore/bindings/js/JSInspectedObjectWrapper.cpp \
     491        WebCore/bindings/js/JSInspectorCallbackWrapper.cpp \
    490492        WebCore/bindings/js/JSLocationCustom.cpp \
    491493        WebCore/bindings/js/JSEventTargetNode.cpp \
     
    514516        WebCore/bindings/js/JSNodeIteratorCustom.cpp \
    515517        WebCore/bindings/js/JSNodeListCustom.cpp \
     518        WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp \
    516519        WebCore/bindings/js/JSRGBColor.cpp \
    517520        WebCore/bindings/js/JSPluginArrayCustom.cpp \
  • trunk/WebCore/WebCore.pro

    r31873 r31890  
    436436    bindings/js/JSHTMLSelectElementCustom.cpp \
    437437    bindings/js/JSImageConstructor.cpp \
     438    bindings/js/JSInspectedObjectWrapper.cpp \
     439    bindings/js/JSInspectorCallbackWrapper.cpp \
    438440    bindings/js/JSLocationCustom.cpp \
    439441    bindings/js/JSNamedNodeMapCustom.cpp \
     
    445447    bindings/js/JSNodeIteratorCustom.cpp \
    446448    bindings/js/JSNodeListCustom.cpp \
     449    bindings/js/JSQuarantinedObjectWrapper.cpp \
    447450    bindings/js/JSRGBColor.cpp \
    448451    bindings/js/JSStyleSheetCustom.cpp \
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r31873 r31890  
    35223522                                </File>
    35233523                                <File
     3524                                        RelativePath="..\page\inspector\Database.js"
     3525                                        >
     3526                                </File>
     3527                                <File
     3528                                        RelativePath="..\page\inspector\DatabaseQueryView.js"
     3529                                        >
     3530                                </File>
     3531                                <File
     3532                                        RelativePath="..\page\inspector\DatabasesPanel.js"
     3533                                        >
     3534                                </File>
     3535                                <File
     3536                                        RelativePath="..\page\inspector\DatabaseTableView.js"
     3537                                        >
     3538                                </File>
     3539                                <File
     3540                                        RelativePath="..\page\inspector\ElementsPanel.js"
     3541                                        >
     3542                                </File>
     3543                                <File
     3544                                        RelativePath="..\page\inspector\FontView.js"
     3545                                        >
     3546                                </File>
     3547                                <File
     3548                                        RelativePath="..\page\inspector\ImageView.js"
     3549                                        >
     3550                                </File>
     3551                                <File
     3552                                        RelativePath="..\page\inspector\inspector.css"
     3553                                        >
     3554                                </File>
     3555                                <File
     3556                                        RelativePath="..\page\inspector\inspector.html"
     3557                                        >
     3558                                </File>
     3559                                <File
     3560                                        RelativePath="..\page\inspector\inspector.js"
     3561                                        >
     3562                                </File>
     3563                                <File
     3564                                        RelativePath="..\page\inspector\MetricsSidebarPane.js"
     3565                                        >
     3566                                </File>
     3567                                <File
     3568                                        RelativePath="..\page\inspector\Panel.js"
     3569                                        >
     3570                                </File>
     3571                                <File
     3572                                        RelativePath="..\page\inspector\PropertiesSection.js"
     3573                                        >
     3574                                </File>
     3575                                <File
     3576                                        RelativePath="..\page\inspector\PropertiesSidebarPane.js"
     3577                                        >
     3578                                </File>
     3579                                <File
     3580                                        RelativePath="..\page\inspector\Resource.js"
     3581                                        >
     3582                                </File>
     3583                                <File
     3584                                        RelativePath="..\page\inspector\ResourceCategory.js"
     3585                                        >
     3586                                </File>
     3587                                <File
     3588                                        RelativePath="..\page\inspector\ResourcesPanel.js"
     3589                                        >
     3590                                </File>
     3591                                <File
     3592                                        RelativePath="..\page\inspector\ResourceView.js"
     3593                                        >
     3594                                </File>
     3595                                <File
     3596                                        RelativePath="..\page\inspector\SidebarPane.js"
     3597                                        >
     3598                                </File>
     3599                                <File
     3600                                        RelativePath="..\page\inspector\SidebarTreeElement.js"
     3601                                        >
     3602                                </File>
     3603                                <File
     3604                                        RelativePath="..\page\inspector\SourceView.js"
     3605                                        >
     3606                                </File>
     3607                                <File
     3608                                        RelativePath="..\page\inspector\StylesSidebarPane.js"
     3609                                        >
     3610                                </File>
     3611                                <File
    35243612                                        RelativePath="..\page\inspector\TextPrompt.js"
    35253613                                        >
    35263614                                </File>
    35273615                                <File
    3528                                         RelativePath="..\page\inspector\Database.js"
    3529                                         >
    3530                                 </File>
    3531                                 <File
    3532                                         RelativePath="..\page\inspector\DatabasesPanel.js"
     3616                                        RelativePath="..\page\inspector\treeoutline.js"
     3617                                        >
     3618                                </File>
     3619                                <File
     3620                                        RelativePath="..\page\inspector\utilities.js"
    35333621                                        >
    35343622                                </File>
    35353623                                <File
    35363624                                        RelativePath="..\page\inspector\View.js"
    3537                                         >
    3538                                 </File>
    3539                                 <File
    3540                                         RelativePath="..\page\inspector\DatabaseTableView.js"
    3541                                         >
    3542                                 </File>
    3543                                 <File
    3544                                         RelativePath="..\page\inspector\DatabaseQueryView.js"
    3545                                         >
    3546                                 </File>
    3547                                 <File
    3548                                         RelativePath="..\page\inspector\ElementsPanel.js"
    3549                                         >
    3550                                 </File>
    3551                                 <File
    3552                                         RelativePath="..\page\inspector\FontView.js"
    3553                                         >
    3554                                 </File>
    3555                                 <File
    3556                                         RelativePath="..\page\inspector\ImageView.js"
    3557                                         >
    3558                                 </File>
    3559                                 <File
    3560                                         RelativePath="..\page\inspector\inspector.css"
    3561                                         >
    3562                                 </File>
    3563                                 <File
    3564                                         RelativePath="..\page\inspector\inspector.html"
    3565                                         >
    3566                                 </File>
    3567                                 <File
    3568                                         RelativePath="..\page\inspector\inspector.js"
    3569                                         >
    3570                                 </File>
    3571                                 <File
    3572                                         RelativePath="..\page\inspector\MetricsSidebarPane.js"
    3573                                         >
    3574                                 </File>
    3575                                 <File
    3576                                         RelativePath="..\page\inspector\Panel.js"
    3577                                         >
    3578                                 </File>
    3579                                 <File
    3580                                         RelativePath="..\page\inspector\PropertiesSection.js"
    3581                                         >
    3582                                 </File>
    3583                                 <File
    3584                                         RelativePath="..\page\inspector\PropertiesSidebarPane.js"
    3585                                         >
    3586                                 </File>
    3587                                 <File
    3588                                         RelativePath="..\page\inspector\Resource.js"
    3589                                         >
    3590                                 </File>
    3591                                 <File
    3592                                         RelativePath="..\page\inspector\ResourceCategory.js"
    3593                                         >
    3594                                 </File>
    3595                                 <File
    3596                                         RelativePath="..\page\inspector\ResourcesPanel.js"
    3597                                         >
    3598                                 </File>
    3599                                 <File
    3600                                         RelativePath="..\page\inspector\ResourceView.js"
    3601                                         >
    3602                                 </File>
    3603                                 <File
    3604                                         RelativePath="..\page\inspector\SidebarPane.js"
    3605                                         >
    3606                                 </File>
    3607                                 <File
    3608                                         RelativePath="..\page\inspector\SidebarTreeElement.js"
    3609                                         >
    3610                                 </File>
    3611                                 <File
    3612                                         RelativePath="..\page\inspector\SourceView.js"
    3613                                         >
    3614                                 </File>
    3615                                 <File
    3616                                         RelativePath="..\page\inspector\StylesSidebarPane.js"
    3617                                         >
    3618                                 </File>
    3619                                 <File
    3620                                         RelativePath="..\page\inspector\treeoutline.js"
    3621                                         >
    3622                                 </File>
    3623                                 <File
    3624                                         RelativePath="..\page\inspector\utilities.js"
    36253625                                        >
    36263626                                </File>
     
    1329513295                                </File>
    1329613296                                <File
     13297                                        RelativePath="..\bindings\js\JSInspectedObjectWrapper.cpp"
     13298                                        >
     13299                                </File>
     13300                                <File
     13301                                        RelativePath="..\bindings\js\JSInspectedObjectWrapper.h"
     13302                                        >
     13303                                </File>
     13304                                <File
     13305                                        RelativePath="..\bindings\js\JSInspectorCallbackWrapper.cpp"
     13306                                        >
     13307                                </File>
     13308                                <File
     13309                                        RelativePath="..\bindings\js\JSInspectorCallbackWrapper.h"
     13310                                        >
     13311                                </File>
     13312                                <File
    1329713313                                        RelativePath="..\bindings\js\JSLocationCustom.cpp"
    1329813314                                        >
     
    1334813364                                <File
    1334913365                                        RelativePath="..\bindings\js\JSPluginCustom.cpp"
     13366                                        >
     13367                                </File>
     13368                                <File
     13369                                        RelativePath="..\bindings\js\JSQuarantinedObjectWrapper.cpp"
     13370                                        >
     13371                                </File>
     13372                                <File
     13373                                        RelativePath="..\bindings\js\JSQuarantinedObjectWrapper.h"
    1335013374                                        >
    1335113375                                </File>
     
    1475114775                                >
    1475214776                                <File
    14753                                     RelativePath="..\svg\animation\SMILTime.cpp"
    14754                                     >
    14755                                 </File>
    14756                                 <File
    14757                                     RelativePath="..\svg\animation\SMILTime.h"
    14758                                     >
    14759                                 </File>
    14760                                 <File
    14761                                     RelativePath="..\svg\animation\SMILTimeContainer.cpp"
    14762                                     >
    14763                                 </File>
    14764                                 <File
    14765                                     RelativePath="..\svg\animation\SMILTimeContainer.h"
    14766                                     >
    14767                                 </File>
    14768                                 <File
    14769                                     RelativePath="..\svg\animation\SVGSMILElement.cpp"
    14770                                     >
    14771                                 </File>
    14772                                 <File
    14773                                     RelativePath="..\svg\animation\SVGSMILElement.h"
    14774                                     >
    14775                                 </File>
    14776             </Filter>
     14777                                        RelativePath="..\svg\animation\SMILTime.cpp"
     14778                                        >
     14779                                </File>
     14780                                <File
     14781                                        RelativePath="..\svg\animation\SMILTime.h"
     14782                                        >
     14783                                </File>
     14784                                <File
     14785                                        RelativePath="..\svg\animation\SMILTimeContainer.cpp"
     14786                                        >
     14787                                </File>
     14788                                <File
     14789                                        RelativePath="..\svg\animation\SMILTimeContainer.h"
     14790                                        >
     14791                                </File>
     14792                                <File
     14793                                        RelativePath="..\svg\animation\SVGSMILElement.cpp"
     14794                                        >
     14795                                </File>
     14796                                <File
     14797                                        RelativePath="..\svg\animation\SVGSMILElement.h"
     14798                                        >
     14799                                </File>
     14800                        </Filter>
    1477714801                        <Filter
    1477814802                                Name="graphics"
     
    1584015864                        </File>
    1584115865                        <File
     15866                                RelativePath="..\storage\SessionStorage.cpp"
     15867                                >
     15868                        </File>
     15869                        <File
     15870                                RelativePath="..\storage\SessionStorage.h"
     15871                                >
     15872                        </File>
     15873                        <File
    1584215874                                RelativePath="..\storage\SQLCallback.h"
    1584315875                                >
     
    1592515957                        <File
    1592615958                                RelativePath="..\storage\StorageMap.h"
    15927                                 >
    15928                         </File>
    15929                         <File
    15930                                 RelativePath="..\storage\SessionStorage.cpp"
    15931                                 >
    15932                         </File>
    15933                         <File
    15934                                 RelativePath="..\storage\SessionStorage.h"
    1593515959                                >
    1593615960                        </File>
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r31873 r31890  
    38273827                C02B14C30D81E02A00D8A970 /* JavaScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C02B14C00D81E02A00D8A970 /* JavaScriptDebugServer.cpp */; };
    38283828                C02B14C40D81E02A00D8A970 /* JavaScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = C02B14C10D81E02A00D8A970 /* JavaScriptDebugServer.h */; };
     3829                C091588A0DB4209200E55AF4 /* JSInspectedObjectWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C09158840DB4209200E55AF4 /* JSInspectedObjectWrapper.cpp */; };
     3830                C091588B0DB4209200E55AF4 /* JSInspectedObjectWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = C09158850DB4209200E55AF4 /* JSInspectedObjectWrapper.h */; };
     3831                C091588C0DB4209200E55AF4 /* JSInspectorCallbackWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C09158860DB4209200E55AF4 /* JSInspectorCallbackWrapper.cpp */; };
     3832                C091588D0DB4209200E55AF4 /* JSInspectorCallbackWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = C09158870DB4209200E55AF4 /* JSInspectorCallbackWrapper.h */; };
     3833                C091588E0DB4209200E55AF4 /* JSQuarantinedObjectWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C09158880DB4209200E55AF4 /* JSQuarantinedObjectWrapper.cpp */; };
     3834                C091588F0DB4209200E55AF4 /* JSQuarantinedObjectWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = C09158890DB4209200E55AF4 /* JSQuarantinedObjectWrapper.h */; };
    38293835                C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */ = {isa = PBXBuildFile; fileRef = C6D74AD309AA282E000B0A52 /* ModifySelectionListLevel.h */; };
    38303836                C6D74AE409AA290A000B0A52 /* ModifySelectionListLevel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6D74AE309AA290A000B0A52 /* ModifySelectionListLevel.cpp */; };
     
    80958101                C02B14C00D81E02A00D8A970 /* JavaScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JavaScriptDebugServer.cpp; sourceTree = "<group>"; };
    80968102                C02B14C10D81E02A00D8A970 /* JavaScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptDebugServer.h; sourceTree = "<group>"; };
     8103                C09158840DB4209200E55AF4 /* JSInspectedObjectWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectedObjectWrapper.cpp; sourceTree = "<group>"; };
     8104                C09158850DB4209200E55AF4 /* JSInspectedObjectWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInspectedObjectWrapper.h; sourceTree = "<group>"; };
     8105                C09158860DB4209200E55AF4 /* JSInspectorCallbackWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectorCallbackWrapper.cpp; sourceTree = "<group>"; };
     8106                C09158870DB4209200E55AF4 /* JSInspectorCallbackWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInspectorCallbackWrapper.h; sourceTree = "<group>"; };
     8107                C09158880DB4209200E55AF4 /* JSQuarantinedObjectWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSQuarantinedObjectWrapper.cpp; sourceTree = "<group>"; };
     8108                C09158890DB4209200E55AF4 /* JSQuarantinedObjectWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSQuarantinedObjectWrapper.h; sourceTree = "<group>"; };
    80978109                C6D74AD309AA282E000B0A52 /* ModifySelectionListLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModifySelectionListLevel.h; sourceTree = "<group>"; };
    80988110                C6D74AE309AA290A000B0A52 /* ModifySelectionListLevel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModifySelectionListLevel.cpp; sourceTree = "<group>"; };
     
    1192711939                                A826E8AD0A1A8F2300CD1BB6 /* JSHTMLOptionElementConstructor.cpp */,
    1192811940                                A826E8AC0A1A8F2300CD1BB6 /* JSHTMLOptionElementConstructor.h */,
     11941                                C09158840DB4209200E55AF4 /* JSInspectedObjectWrapper.cpp */,
     11942                                C09158850DB4209200E55AF4 /* JSInspectedObjectWrapper.h */,
     11943                                C09158860DB4209200E55AF4 /* JSInspectorCallbackWrapper.cpp */,
     11944                                C09158870DB4209200E55AF4 /* JSInspectorCallbackWrapper.h */,
    1192911945                                BC6C49F10D7DBA0500FFA558 /* JSImageConstructor.cpp */,
    1193011946                                BC6C49F20D7DBA0500FFA558 /* JSImageConstructor.h */,
     
    1193311949                                BCB7735E0C17853D00132BA4 /* JSNodeFilterCondition.cpp */,
    1193411950                                BCB7735F0C17853D00132BA4 /* JSNodeFilterCondition.h */,
     11951                                C09158880DB4209200E55AF4 /* JSQuarantinedObjectWrapper.cpp */,
     11952                                C09158890DB4209200E55AF4 /* JSQuarantinedObjectWrapper.h */,
    1193511953                                BC3452410D7E00EA0016574A /* JSRGBColor.cpp */,
    1193611954                                BC3452420D7E00EA0016574A /* JSRGBColor.h */,
     
    1481014828                                3744570F0DB05FA500AE0992 /* SVGGlyphMap.h in Headers */,
    1481114829                                BCB4F8900DB28DD60039139B /* RenderImageGeneratedContent.h in Headers */,
     14830                                C091588B0DB4209200E55AF4 /* JSInspectedObjectWrapper.h in Headers */,
     14831                                C091588D0DB4209200E55AF4 /* JSInspectorCallbackWrapper.h in Headers */,
     14832                                C091588F0DB4209200E55AF4 /* JSQuarantinedObjectWrapper.h in Headers */,
    1481214833                        );
    1481314834                        runOnlyForDeploymentPostprocessing = 0;
     
    1649816519                                E4AFD00F0DAF335500F5F55C /* SVGSMILElement.cpp in Sources */,
    1649916520                                BCB4F8930DB28E530039139B /* RenderImageGeneratedContent.cpp in Sources */,
     16521                                C091588A0DB4209200E55AF4 /* JSInspectedObjectWrapper.cpp in Sources */,
     16522                                C091588C0DB4209200E55AF4 /* JSInspectorCallbackWrapper.cpp in Sources */,
     16523                                C091588E0DB4209200E55AF4 /* JSQuarantinedObjectWrapper.cpp in Sources */,
    1650016524                        );
    1650116525                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/WebCoreSources.bkl

    r31873 r31890  
    7575        bindings/js/JSHTMLSelectElementCustom.cpp
    7676        bindings/js/JSImageConstructor.cpp
     77        bindings/js/JSInspectedObjectWrapper.cpp
     78        bindings/js/JSInspectorCallbackWrapper.cpp
    7779        bindings/js/JSLocationCustom.cpp
    7880        bindings/js/JSMimeTypeArrayCustom.cpp
     
    8789        bindings/js/JSPluginCustom.cpp
    8890        bindings/js/JSPluginArrayCustom.cpp
     91        bindings/js/JSQuarantinedObjectWrapper.cpp
    8992        bindings/js/JSRGBColor.cpp
    9093        bindings/js/JSSQLResultSetRowListCustom.cpp
  • trunk/WebCore/page/InspectorController.cpp

    r31746 r31890  
    4646#include "InspectorClient.h"
    4747#include "JSDOMWindow.h"
     48#include "JSInspectedObjectWrapper.h"
     49#include "JSInspectorCallbackWrapper.h"
    4850#include "JSNode.h"
    4951#include "JSRange.h"
     
    6971#include "JSDatabase.h"
    7072#endif
     73
     74using namespace KJS;
    7175
    7276namespace WebCore {
     
    417421        return undefined;
    418422
     423    ExecState* exec = toJSDOMWindowWrapper(resource->frame.get())->window()->globalExec();
     424
    419425    KJS::JSLock lock;
    420     JSValueRef documentValue = toRef(toJS(toJSDOMWindowWrapper(frame)->window()->globalExec(), document));
     426    JSValueRef documentValue = toRef(JSInspectedObjectWrapper::wrap(exec, toJS(exec, document)));
    421427    return documentValue;
    422428}
     
    430436        return undefined;
    431437
    432     Node* node = toNode(toJS(arguments[0]));
     438    JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(toJS(arguments[0]));
     439    if (!wrapper)
     440        return undefined;
     441    Node* node = toNode(wrapper->unwrappedObject());
    433442    if (!node)
    434443        return undefined;
     
    571580        return JSValueMakeUndefined(ctx);
    572581
    573     Database* database = toDatabase(toJS(arguments[0]));
     582    JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(toJS(arguments[0]));
     583    if (!wrapper)
     584        return JSValueMakeUndefined(ctx);
     585
     586    Database* database = toDatabase(wrapper->unwrappedObject());
    574587    if (!database)
    575588        return JSValueMakeUndefined(ctx);
     
    622635        return JSValueMakeUndefined(ctx);
    623636
    624     return toRef(toJS(toJS(ctx), controller->inspectedPage()->mainFrame()));
     637    JSDOMWindow* inspectedWindow = toJSDOMWindow(controller->inspectedPage()->mainFrame());
     638    JSLock lock;
     639    return toRef(JSInspectedObjectWrapper::wrap(inspectedWindow->globalExec(), inspectedWindow));
    625640}
    626641
     
    687702}
    688703
     704static JSValueRef wrapCallback(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     705{
     706    InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
     707    if (!controller)
     708        return JSValueMakeUndefined(ctx);
     709
     710    if (argumentCount < 1)
     711        return JSValueMakeUndefined(ctx);
     712
     713    JSLock lock;
     714    return toRef(JSInspectorCallbackWrapper::wrap(toJS(ctx), toJS(arguments[0])));
     715}
     716
    689717#pragma mark -
    690718#pragma mark InspectorController Class
     
    786814        return;
    787815
     816    ExecState* exec = toJSDOMWindow(frame)->globalExec();
     817
    788818    JSValueRef arg0;
    789819
    790820    {
    791821        KJS::JSLock lock;
    792         arg0 = toRef(toJS(toJSDOMWindow(frame)->globalExec(), m_nodeToFocus.get()));
     822        arg0 = toRef(JSInspectedObjectWrapper::wrap(exec, toJS(exec, m_nodeToFocus.get())));
    793823    }
    794824
     
    910940        { "platform", platform, kJSPropertyAttributeNone },
    911941        { "moveByUnrestricted", moveByUnrestricted, kJSPropertyAttributeNone },
     942        { "wrapCallback", wrapCallback, kJSPropertyAttributeNone },
    912943        { 0, 0, 0 }
    913944    };
     
    14251456        return 0;
    14261457
     1458    ExecState* exec = toJSDOMWindow(frame)->globalExec();
     1459
    14271460    JSValueRef database;
    14281461
    14291462    {
    14301463        KJS::JSLock lock;
    1431         database = toRef(toJS(toJSDOMWindow(frame)->globalExec(), resource->database.get()));
     1464        database = toRef(JSInspectedObjectWrapper::wrap(exec, toJS(exec, resource->database.get())));
    14321465    }
    14331466
  • trunk/WebCore/page/inspector/DatabaseQueryView.js

    r31736 r31890  
    143143        function queryTransaction(tx)
    144144        {
    145             tx.executeSql(query, [], this._queryFinished.bind(this, query), this._queryError.bind(this, query));
    146         }
    147 
    148         this.database.database.transaction(queryTransaction.bind(this), this._queryError.bind(this, query));
     145            tx.executeSql(query, null, InspectorController.wrapCallback(this._queryFinished.bind(this, query)), InspectorController.wrapCallback(this._queryError.bind(this, query)));
     146        }
     147
     148        this.database.database.transaction(InspectorController.wrapCallback(queryTransaction.bind(this)), InspectorController.wrapCallback(this._queryError.bind(this, query)));
    149149    },
    150150
  • trunk/WebCore/page/inspector/DatabaseTableView.js

    r31736 r31890  
    4646        function queryTransaction(tx)
    4747        {
    48             tx.executeSql("SELECT * FROM " + this.tableName, [], this._queryFinished.bind(this), this._queryError.bind(this));
     48            tx.executeSql("SELECT * FROM " + this.tableName, null, InspectorController.wrapCallback(this._queryFinished.bind(this)), InspectorController.wrapCallback(this._queryError.bind(this)));
    4949        }
    5050
    51         this.database.database.transaction(queryTransaction.bind(this), this._queryError.bind(this));
     51        this.database.database.transaction(InspectorController.wrapCallback(queryTransaction.bind(this)), InspectorController.wrapCallback(this._queryError.bind(this)));
    5252    },
    5353
  • trunk/WebCore/page/inspector/ElementsPanel.js

    r31889 r31890  
    139139
    140140            var elementsPanel = this;
    141             function contentLoaded()
     141            var contentLoaded = InspectorController.wrapCallback(function()
    142142            {
    143143                // This function will be called in the inspected page's context.
    144144                elementsPanel._domContentLoaded = true;
    145             }
     145            });
    146146
    147147            function checkContentLoaded()
Note: See TracChangeset for help on using the changeset viewer.