Changeset 31890 in webkit
- Timestamp:
- Apr 14, 2008 4:46:40 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 17 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r31889 r31890 1 2008-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 1 169 2008-04-14 Adam Roben <aroben@apple.com> 2 170 -
trunk/WebCore/GNUmakefile.am
r31878 r31890 488 488 WebCore/bindings/js/JSHistoryCustom.cpp \ 489 489 WebCore/bindings/js/JSImageConstructor.cpp \ 490 WebCore/bindings/js/JSInspectedObjectWrapper.cpp \ 491 WebCore/bindings/js/JSInspectorCallbackWrapper.cpp \ 490 492 WebCore/bindings/js/JSLocationCustom.cpp \ 491 493 WebCore/bindings/js/JSEventTargetNode.cpp \ … … 514 516 WebCore/bindings/js/JSNodeIteratorCustom.cpp \ 515 517 WebCore/bindings/js/JSNodeListCustom.cpp \ 518 WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp \ 516 519 WebCore/bindings/js/JSRGBColor.cpp \ 517 520 WebCore/bindings/js/JSPluginArrayCustom.cpp \ -
trunk/WebCore/WebCore.pro
r31873 r31890 436 436 bindings/js/JSHTMLSelectElementCustom.cpp \ 437 437 bindings/js/JSImageConstructor.cpp \ 438 bindings/js/JSInspectedObjectWrapper.cpp \ 439 bindings/js/JSInspectorCallbackWrapper.cpp \ 438 440 bindings/js/JSLocationCustom.cpp \ 439 441 bindings/js/JSNamedNodeMapCustom.cpp \ … … 445 447 bindings/js/JSNodeIteratorCustom.cpp \ 446 448 bindings/js/JSNodeListCustom.cpp \ 449 bindings/js/JSQuarantinedObjectWrapper.cpp \ 447 450 bindings/js/JSRGBColor.cpp \ 448 451 bindings/js/JSStyleSheetCustom.cpp \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r31873 r31890 3522 3522 </File> 3523 3523 <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 3524 3612 RelativePath="..\page\inspector\TextPrompt.js" 3525 3613 > 3526 3614 </File> 3527 3615 <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" 3533 3621 > 3534 3622 </File> 3535 3623 <File 3536 3624 RelativePath="..\page\inspector\View.js" 3537 >3538 </File>3539 <File3540 RelativePath="..\page\inspector\DatabaseTableView.js"3541 >3542 </File>3543 <File3544 RelativePath="..\page\inspector\DatabaseQueryView.js"3545 >3546 </File>3547 <File3548 RelativePath="..\page\inspector\ElementsPanel.js"3549 >3550 </File>3551 <File3552 RelativePath="..\page\inspector\FontView.js"3553 >3554 </File>3555 <File3556 RelativePath="..\page\inspector\ImageView.js"3557 >3558 </File>3559 <File3560 RelativePath="..\page\inspector\inspector.css"3561 >3562 </File>3563 <File3564 RelativePath="..\page\inspector\inspector.html"3565 >3566 </File>3567 <File3568 RelativePath="..\page\inspector\inspector.js"3569 >3570 </File>3571 <File3572 RelativePath="..\page\inspector\MetricsSidebarPane.js"3573 >3574 </File>3575 <File3576 RelativePath="..\page\inspector\Panel.js"3577 >3578 </File>3579 <File3580 RelativePath="..\page\inspector\PropertiesSection.js"3581 >3582 </File>3583 <File3584 RelativePath="..\page\inspector\PropertiesSidebarPane.js"3585 >3586 </File>3587 <File3588 RelativePath="..\page\inspector\Resource.js"3589 >3590 </File>3591 <File3592 RelativePath="..\page\inspector\ResourceCategory.js"3593 >3594 </File>3595 <File3596 RelativePath="..\page\inspector\ResourcesPanel.js"3597 >3598 </File>3599 <File3600 RelativePath="..\page\inspector\ResourceView.js"3601 >3602 </File>3603 <File3604 RelativePath="..\page\inspector\SidebarPane.js"3605 >3606 </File>3607 <File3608 RelativePath="..\page\inspector\SidebarTreeElement.js"3609 >3610 </File>3611 <File3612 RelativePath="..\page\inspector\SourceView.js"3613 >3614 </File>3615 <File3616 RelativePath="..\page\inspector\StylesSidebarPane.js"3617 >3618 </File>3619 <File3620 RelativePath="..\page\inspector\treeoutline.js"3621 >3622 </File>3623 <File3624 RelativePath="..\page\inspector\utilities.js"3625 3625 > 3626 3626 </File> … … 13295 13295 </File> 13296 13296 <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 13297 13313 RelativePath="..\bindings\js\JSLocationCustom.cpp" 13298 13314 > … … 13348 13364 <File 13349 13365 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" 13350 13374 > 13351 13375 </File> … … 14751 14775 > 14752 14776 <File 14753 14754 14755 </File> 14756 <File 14757 14758 14759 </File> 14760 <File 14761 14762 14763 </File> 14764 <File 14765 14766 14767 </File> 14768 <File 14769 14770 14771 </File> 14772 <File 14773 14774 14775 </File> 14776 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> 14777 14801 <Filter 14778 14802 Name="graphics" … … 15840 15864 </File> 15841 15865 <File 15866 RelativePath="..\storage\SessionStorage.cpp" 15867 > 15868 </File> 15869 <File 15870 RelativePath="..\storage\SessionStorage.h" 15871 > 15872 </File> 15873 <File 15842 15874 RelativePath="..\storage\SQLCallback.h" 15843 15875 > … … 15925 15957 <File 15926 15958 RelativePath="..\storage\StorageMap.h" 15927 >15928 </File>15929 <File15930 RelativePath="..\storage\SessionStorage.cpp"15931 >15932 </File>15933 <File15934 RelativePath="..\storage\SessionStorage.h"15935 15959 > 15936 15960 </File> -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r31873 r31890 3827 3827 C02B14C30D81E02A00D8A970 /* JavaScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C02B14C00D81E02A00D8A970 /* JavaScriptDebugServer.cpp */; }; 3828 3828 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 */; }; 3829 3835 C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */ = {isa = PBXBuildFile; fileRef = C6D74AD309AA282E000B0A52 /* ModifySelectionListLevel.h */; }; 3830 3836 C6D74AE409AA290A000B0A52 /* ModifySelectionListLevel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6D74AE309AA290A000B0A52 /* ModifySelectionListLevel.cpp */; }; … … 8095 8101 C02B14C00D81E02A00D8A970 /* JavaScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JavaScriptDebugServer.cpp; sourceTree = "<group>"; }; 8096 8102 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>"; }; 8097 8109 C6D74AD309AA282E000B0A52 /* ModifySelectionListLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModifySelectionListLevel.h; sourceTree = "<group>"; }; 8098 8110 C6D74AE309AA290A000B0A52 /* ModifySelectionListLevel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModifySelectionListLevel.cpp; sourceTree = "<group>"; }; … … 11927 11939 A826E8AD0A1A8F2300CD1BB6 /* JSHTMLOptionElementConstructor.cpp */, 11928 11940 A826E8AC0A1A8F2300CD1BB6 /* JSHTMLOptionElementConstructor.h */, 11941 C09158840DB4209200E55AF4 /* JSInspectedObjectWrapper.cpp */, 11942 C09158850DB4209200E55AF4 /* JSInspectedObjectWrapper.h */, 11943 C09158860DB4209200E55AF4 /* JSInspectorCallbackWrapper.cpp */, 11944 C09158870DB4209200E55AF4 /* JSInspectorCallbackWrapper.h */, 11929 11945 BC6C49F10D7DBA0500FFA558 /* JSImageConstructor.cpp */, 11930 11946 BC6C49F20D7DBA0500FFA558 /* JSImageConstructor.h */, … … 11933 11949 BCB7735E0C17853D00132BA4 /* JSNodeFilterCondition.cpp */, 11934 11950 BCB7735F0C17853D00132BA4 /* JSNodeFilterCondition.h */, 11951 C09158880DB4209200E55AF4 /* JSQuarantinedObjectWrapper.cpp */, 11952 C09158890DB4209200E55AF4 /* JSQuarantinedObjectWrapper.h */, 11935 11953 BC3452410D7E00EA0016574A /* JSRGBColor.cpp */, 11936 11954 BC3452420D7E00EA0016574A /* JSRGBColor.h */, … … 14810 14828 3744570F0DB05FA500AE0992 /* SVGGlyphMap.h in Headers */, 14811 14829 BCB4F8900DB28DD60039139B /* RenderImageGeneratedContent.h in Headers */, 14830 C091588B0DB4209200E55AF4 /* JSInspectedObjectWrapper.h in Headers */, 14831 C091588D0DB4209200E55AF4 /* JSInspectorCallbackWrapper.h in Headers */, 14832 C091588F0DB4209200E55AF4 /* JSQuarantinedObjectWrapper.h in Headers */, 14812 14833 ); 14813 14834 runOnlyForDeploymentPostprocessing = 0; … … 16498 16519 E4AFD00F0DAF335500F5F55C /* SVGSMILElement.cpp in Sources */, 16499 16520 BCB4F8930DB28E530039139B /* RenderImageGeneratedContent.cpp in Sources */, 16521 C091588A0DB4209200E55AF4 /* JSInspectedObjectWrapper.cpp in Sources */, 16522 C091588C0DB4209200E55AF4 /* JSInspectorCallbackWrapper.cpp in Sources */, 16523 C091588E0DB4209200E55AF4 /* JSQuarantinedObjectWrapper.cpp in Sources */, 16500 16524 ); 16501 16525 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/WebCoreSources.bkl
r31873 r31890 75 75 bindings/js/JSHTMLSelectElementCustom.cpp 76 76 bindings/js/JSImageConstructor.cpp 77 bindings/js/JSInspectedObjectWrapper.cpp 78 bindings/js/JSInspectorCallbackWrapper.cpp 77 79 bindings/js/JSLocationCustom.cpp 78 80 bindings/js/JSMimeTypeArrayCustom.cpp … … 87 89 bindings/js/JSPluginCustom.cpp 88 90 bindings/js/JSPluginArrayCustom.cpp 91 bindings/js/JSQuarantinedObjectWrapper.cpp 89 92 bindings/js/JSRGBColor.cpp 90 93 bindings/js/JSSQLResultSetRowListCustom.cpp -
trunk/WebCore/page/InspectorController.cpp
r31746 r31890 46 46 #include "InspectorClient.h" 47 47 #include "JSDOMWindow.h" 48 #include "JSInspectedObjectWrapper.h" 49 #include "JSInspectorCallbackWrapper.h" 48 50 #include "JSNode.h" 49 51 #include "JSRange.h" … … 69 71 #include "JSDatabase.h" 70 72 #endif 73 74 using namespace KJS; 71 75 72 76 namespace WebCore { … … 417 421 return undefined; 418 422 423 ExecState* exec = toJSDOMWindowWrapper(resource->frame.get())->window()->globalExec(); 424 419 425 KJS::JSLock lock; 420 JSValueRef documentValue = toRef( toJS(toJSDOMWindowWrapper(frame)->window()->globalExec(), document));426 JSValueRef documentValue = toRef(JSInspectedObjectWrapper::wrap(exec, toJS(exec, document))); 421 427 return documentValue; 422 428 } … … 430 436 return undefined; 431 437 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()); 433 442 if (!node) 434 443 return undefined; … … 571 580 return JSValueMakeUndefined(ctx); 572 581 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()); 574 587 if (!database) 575 588 return JSValueMakeUndefined(ctx); … … 622 635 return JSValueMakeUndefined(ctx); 623 636 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)); 625 640 } 626 641 … … 687 702 } 688 703 704 static 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 689 717 #pragma mark - 690 718 #pragma mark InspectorController Class … … 786 814 return; 787 815 816 ExecState* exec = toJSDOMWindow(frame)->globalExec(); 817 788 818 JSValueRef arg0; 789 819 790 820 { 791 821 KJS::JSLock lock; 792 arg0 = toRef( toJS(toJSDOMWindow(frame)->globalExec(), m_nodeToFocus.get()));822 arg0 = toRef(JSInspectedObjectWrapper::wrap(exec, toJS(exec, m_nodeToFocus.get()))); 793 823 } 794 824 … … 910 940 { "platform", platform, kJSPropertyAttributeNone }, 911 941 { "moveByUnrestricted", moveByUnrestricted, kJSPropertyAttributeNone }, 942 { "wrapCallback", wrapCallback, kJSPropertyAttributeNone }, 912 943 { 0, 0, 0 } 913 944 }; … … 1425 1456 return 0; 1426 1457 1458 ExecState* exec = toJSDOMWindow(frame)->globalExec(); 1459 1427 1460 JSValueRef database; 1428 1461 1429 1462 { 1430 1463 KJS::JSLock lock; 1431 database = toRef( toJS(toJSDOMWindow(frame)->globalExec(), resource->database.get()));1464 database = toRef(JSInspectedObjectWrapper::wrap(exec, toJS(exec, resource->database.get()))); 1432 1465 } 1433 1466 -
trunk/WebCore/page/inspector/DatabaseQueryView.js
r31736 r31890 143 143 function queryTransaction(tx) 144 144 { 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))); 149 149 }, 150 150 -
trunk/WebCore/page/inspector/DatabaseTableView.js
r31736 r31890 46 46 function queryTransaction(tx) 47 47 { 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))); 49 49 } 50 50 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))); 52 52 }, 53 53 -
trunk/WebCore/page/inspector/ElementsPanel.js
r31889 r31890 139 139 140 140 var elementsPanel = this; 141 function contentLoaded()141 var contentLoaded = InspectorController.wrapCallback(function() 142 142 { 143 143 // This function will be called in the inspected page's context. 144 144 elementsPanel._domContentLoaded = true; 145 } 145 }); 146 146 147 147 function checkContentLoaded()
Note: See TracChangeset
for help on using the changeset viewer.