Commit 0545e207 authored by pfeldman@chromium.org's avatar pfeldman@chromium.org

2010-01-27 Pavel Feldman <pfeldman@chromium.org>

        Reviewed by Timothy Hatcher.

        Web Inspector: nuke quarantine wrappers.

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

        * Android.jscbindings.mk:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * bindings/js/JSBindingsAllInOne.cpp:
        * bindings/js/JSInspectedObjectWrapper.cpp: Removed.
        * bindings/js/JSInspectedObjectWrapper.h: Removed.
        * bindings/js/JSInspectorCallbackWrapper.cpp: Removed.
        * bindings/js/JSInspectorCallbackWrapper.h: Removed.
        * bindings/js/JSQuarantinedObjectWrapper.cpp: Removed.
        * bindings/js/JSQuarantinedObjectWrapper.h: Removed.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53915 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fe28194a
......@@ -118,7 +118,6 @@ LOCAL_SRC_FILES += \
bindings/js/JSHistoryCustom.cpp \
bindings/js/JSImageConstructor.cpp \
bindings/js/JSImageDataCustom.cpp \
bindings/js/JSInspectedObjectWrapper.cpp \
bindings/js/JSLazyEventListener.cpp \
bindings/js/JSLocationCustom.cpp \
bindings/js/JSMessageChannelConstructor.cpp \
......
2010-01-27 Pavel Feldman <pfeldman@chromium.org>
Reviewed by Timothy Hatcher.
Web Inspector: nuke quarantine wrappers.
https://bugs.webkit.org/show_bug.cgi?id=34203
* Android.jscbindings.mk:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSInspectedObjectWrapper.cpp: Removed.
* bindings/js/JSInspectedObjectWrapper.h: Removed.
* bindings/js/JSInspectorCallbackWrapper.cpp: Removed.
* bindings/js/JSInspectorCallbackWrapper.h: Removed.
* bindings/js/JSQuarantinedObjectWrapper.cpp: Removed.
* bindings/js/JSQuarantinedObjectWrapper.h: Removed.
2010-01-27 Alexey Proskuryakov <ap@apple.com>
Revert r53899 (HashMap<AtomicStringImpl*, Value> key checks) and subsequent build fixes,
......@@ -423,10 +423,6 @@ webcore_sources += \
WebCore/bindings/js/JSImageDataCustom.cpp \
WebCore/bindings/js/JSInjectedScriptHostCustom.cpp \
WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp \
WebCore/bindings/js/JSInspectedObjectWrapper.cpp \
WebCore/bindings/js/JSInspectedObjectWrapper.h \
WebCore/bindings/js/JSInspectorCallbackWrapper.cpp \
WebCore/bindings/js/JSInspectorCallbackWrapper.h \
WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp \
WebCore/bindings/js/JSLazyEventListener.cpp \
WebCore/bindings/js/JSLazyEventListener.h \
......@@ -454,8 +450,6 @@ webcore_sources += \
WebCore/bindings/js/JSPluginElementFunctions.cpp \
WebCore/bindings/js/JSPluginElementFunctions.h \
WebCore/bindings/js/JSPopStateEventCustom.cpp \
WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp \
WebCore/bindings/js/JSQuarantinedObjectWrapper.h \
WebCore/bindings/js/JSStorageCustom.h \
WebCore/bindings/js/JSStyleSheetCustom.cpp \
WebCore/bindings/js/JSStyleSheetListCustom.cpp \
......
......@@ -538,10 +538,6 @@
'bindings/js/JSImageConstructor.cpp',
'bindings/js/JSImageConstructor.h',
'bindings/js/JSImageDataCustom.cpp',
'bindings/js/JSInspectedObjectWrapper.cpp',
'bindings/js/JSInspectedObjectWrapper.h',
'bindings/js/JSInspectorCallbackWrapper.cpp',
'bindings/js/JSInspectorCallbackWrapper.h',
'bindings/js/JSInjectedScriptHostCustom.cpp',
'bindings/js/JSInspectorFrontendHostCustom.cpp',
'bindings/js/JSJavaScriptCallFrameCustom.cpp',
......@@ -572,8 +568,6 @@
'bindings/js/JSPluginCustom.cpp',
'bindings/js/JSPluginElementFunctions.cpp',
'bindings/js/JSPluginElementFunctions.h',
'bindings/js/JSQuarantinedObjectWrapper.cpp',
'bindings/js/JSQuarantinedObjectWrapper.h',
'bindings/js/JSRGBColor.cpp',
'bindings/js/JSRGBColor.h',
'bindings/js/JSSharedWorkerConstructor.cpp',
......
......@@ -300,9 +300,7 @@ SOURCES += \
bindings/js/JSImageConstructor.cpp \
bindings/js/JSImageDataCustom.cpp \
bindings/js/JSInjectedScriptHostCustom.cpp \
bindings/js/JSInspectedObjectWrapper.cpp \
bindings/js/JSInspectorFrontendHostCustom.cpp \
bindings/js/JSInspectorCallbackWrapper.cpp \
bindings/js/JSLocationCustom.cpp \
bindings/js/JSNamedNodeMapCustom.cpp \
bindings/js/JSNavigatorCustom.cpp \
......@@ -312,7 +310,6 @@ SOURCES += \
bindings/js/JSNodeIteratorCustom.cpp \
bindings/js/JSNodeListCustom.cpp \
bindings/js/JSOptionConstructor.cpp \
bindings/js/JSQuarantinedObjectWrapper.cpp \
bindings/js/JSStyleSheetCustom.cpp \
bindings/js/JSStyleSheetListCustom.cpp \
bindings/js/JSTextCustom.cpp \
......@@ -1002,15 +999,12 @@ HEADERS += \
bindings/js/JSHTMLObjectElementCustom.h \
bindings/js/JSHTMLSelectElementCustom.h \
bindings/js/JSImageConstructor.h \
bindings/js/JSInspectedObjectWrapper.h \
bindings/js/JSInspectorCallbackWrapper.h \
bindings/js/JSLazyEventListener.h \
bindings/js/JSLocationCustom.h \
bindings/js/JSMessageChannelConstructor.h \
bindings/js/JSNodeFilterCondition.h \
bindings/js/JSOptionConstructor.h \
bindings/js/JSPluginElementFunctions.h \
bindings/js/JSQuarantinedObjectWrapper.h \
bindings/js/JSSharedWorkerConstructor.h \
bindings/js/JSStorageCustom.h \
bindings/js/JSWebKitCSSMatrixConstructor.h \
......
......@@ -37403,70 +37403,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\bindings\js\JSInspectedObjectWrapper.cpp"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug_Internal|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug_Cairo|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release_Cairo|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug_All|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\bindings\js\JSInspectedObjectWrapper.h"
>
</File>
<File
RelativePath="..\bindings\js\JSInspectorCallbackWrapper.cpp"
>
</File>
<File
RelativePath="..\bindings\js\JSInspectorCallbackWrapper.h"
>
</File>
<File
RelativePath="..\bindings\js\JSInspectorFrontendHostCustom.cpp"
>
......@@ -38535,62 +38471,6 @@
RelativePath="..\bindings\js\JSPopStateEventCustom.cpp"
>
</File>
<File
RelativePath="..\bindings\js\JSQuarantinedObjectWrapper.cpp"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug_Internal|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug_Cairo|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release_Cairo|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug_All|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\bindings\js\JSQuarantinedObjectWrapper.h"
>
</File>
<File
RelativePath="..\bindings\js\JSSharedWorkerConstructor.cpp"
>
......
......@@ -4614,12 +4614,6 @@
BCFE2F120C1B58380020235F /* JSRect.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFE2F100C1B58370020235F /* JSRect.h */; };
BCFF64910EAD15C200C1D6F7 /* LengthBox.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFF648F0EAD15C200C1D6F7 /* LengthBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCFF64920EAD15C200C1D6F7 /* LengthSize.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFF64900EAD15C200C1D6F7 /* LengthSize.h */; settings = {ATTRIBUTES = (Private, ); }; };
C091588A0DB4209200E55AF4 /* JSInspectedObjectWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C09158840DB4209200E55AF4 /* JSInspectedObjectWrapper.cpp */; };
C091588B0DB4209200E55AF4 /* JSInspectedObjectWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = C09158850DB4209200E55AF4 /* JSInspectedObjectWrapper.h */; };
C091588C0DB4209200E55AF4 /* JSInspectorCallbackWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C09158860DB4209200E55AF4 /* JSInspectorCallbackWrapper.cpp */; };
C091588D0DB4209200E55AF4 /* JSInspectorCallbackWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = C09158870DB4209200E55AF4 /* JSInspectorCallbackWrapper.h */; };
C091588E0DB4209200E55AF4 /* JSQuarantinedObjectWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C09158880DB4209200E55AF4 /* JSQuarantinedObjectWrapper.cpp */; };
C091588F0DB4209200E55AF4 /* JSQuarantinedObjectWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = C09158890DB4209200E55AF4 /* JSQuarantinedObjectWrapper.h */; };
C0DFC8700DB6841A003EAE7C /* JSConsoleCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0DFC86F0DB6841A003EAE7C /* JSConsoleCustom.cpp */; };
C105DA620F3AA68F001DD44F /* TextEncodingDetectorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C105DA610F3AA68F001DD44F /* TextEncodingDetectorICU.cpp */; };
C105DA640F3AA6B8001DD44F /* TextEncodingDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = C105DA630F3AA6B8001DD44F /* TextEncodingDetector.h */; };
......@@ -9879,12 +9873,6 @@
BE91FC8B06133666005E3790 /* Position.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Position.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
BE91FC8C06133666005E3790 /* Position.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Position.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
BE983D95052A2E0A00892D85 /* WebCoreKeyboardUIMode.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreKeyboardUIMode.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
C09158840DB4209200E55AF4 /* JSInspectedObjectWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectedObjectWrapper.cpp; sourceTree = "<group>"; };
C09158850DB4209200E55AF4 /* JSInspectedObjectWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInspectedObjectWrapper.h; sourceTree = "<group>"; };
C09158860DB4209200E55AF4 /* JSInspectorCallbackWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectorCallbackWrapper.cpp; sourceTree = "<group>"; };
C09158870DB4209200E55AF4 /* JSInspectorCallbackWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInspectorCallbackWrapper.h; sourceTree = "<group>"; };
C09158880DB4209200E55AF4 /* JSQuarantinedObjectWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSQuarantinedObjectWrapper.cpp; sourceTree = "<group>"; };
C09158890DB4209200E55AF4 /* JSQuarantinedObjectWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSQuarantinedObjectWrapper.h; sourceTree = "<group>"; };
C0DFC86F0DB6841A003EAE7C /* JSConsoleCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSConsoleCustom.cpp; sourceTree = "<group>"; };
C105DA610F3AA68F001DD44F /* TextEncodingDetectorICU.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextEncodingDetectorICU.cpp; sourceTree = "<group>"; };
C105DA630F3AA6B8001DD44F /* TextEncodingDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextEncodingDetector.h; sourceTree = "<group>"; };
......@@ -14587,14 +14575,8 @@
BC60901D0E91B8EC000C68B5 /* JSEventTarget.h */,
3314ACE910892086000F0E56 /* JSExceptionBase.cpp */,
3314ACEA10892086000F0E56 /* JSExceptionBase.h */,
C09158840DB4209200E55AF4 /* JSInspectedObjectWrapper.cpp */,
C09158850DB4209200E55AF4 /* JSInspectedObjectWrapper.h */,
C09158860DB4209200E55AF4 /* JSInspectorCallbackWrapper.cpp */,
C09158870DB4209200E55AF4 /* JSInspectorCallbackWrapper.h */,
93B70D4F09EB0C7C009D8468 /* JSPluginElementFunctions.cpp */,
93B70D5009EB0C7C009D8468 /* JSPluginElementFunctions.h */,
C09158880DB4209200E55AF4 /* JSQuarantinedObjectWrapper.cpp */,
C09158890DB4209200E55AF4 /* JSQuarantinedObjectWrapper.h */,
415B7C550FF598E6006770F7 /* JSSharedWorkerConstructor.cpp */,
415B7C620FF5A767006770F7 /* JSSharedWorkerConstructor.h */,
14CD8D81106B529000A46D23 /* JSSharedWorkerCustom.cpp */,
......@@ -17432,9 +17414,7 @@
E44614170CD6826900FADA75 /* JSHTMLVideoElement.h in Headers */,
BC6C49F40D7DBA0500FFA558 /* JSImageConstructor.h in Headers */,
A77979290D6B9E64003851B9 /* JSImageData.h in Headers */,
C091588B0DB4209200E55AF4 /* JSInspectedObjectWrapper.h in Headers */,
41F060CE0F5EEB2B00A07EAC /* JSInspectorBackend.h in Headers */,
C091588D0DB4209200E55AF4 /* JSInspectorCallbackWrapper.h in Headers */,
1C5FAED20DCFD90100D58F78 /* JSJavaScriptCallFrame.h in Headers */,
A86629D309DA2B48009633A5 /* JSKeyboardEvent.h in Headers */,
935F45430F7C3B5F00D7C1FB /* JSLazyEventListener.h in Headers */,
......@@ -17469,7 +17449,6 @@
FE80DA720E9C472F000D6F75 /* JSPositionError.h in Headers */,
65DF320009D1CC60000BE325 /* JSProcessingInstruction.h in Headers */,
E44613EE0CD681BB00FADA75 /* JSProgressEvent.h in Headers */,
C091588F0DB4209200E55AF4 /* JSQuarantinedObjectWrapper.h in Headers */,
65DF320209D1CC60000BE325 /* JSRange.h in Headers */,
D23CA55D0AB0EAAE005108A5 /* JSRangeException.h in Headers */,
BCFE2F120C1B58380020235F /* JSRect.h in Headers */,
......@@ -19676,10 +19655,8 @@
BC6C49F30D7DBA0500FFA558 /* JSImageConstructor.cpp in Sources */,
A77979280D6B9E64003851B9 /* JSImageData.cpp in Sources */,
A7D0318E0E93540300E24ACD /* JSImageDataCustom.cpp in Sources */,
C091588A0DB4209200E55AF4 /* JSInspectedObjectWrapper.cpp in Sources */,
41F060CD0F5EEB2B00A07EAC /* JSInspectorBackend.cpp in Sources */,
7A74ECBD101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp in Sources */,
C091588C0DB4209200E55AF4 /* JSInspectorCallbackWrapper.cpp in Sources */,
1C5FAED10DCFD90100D58F78 /* JSJavaScriptCallFrame.cpp in Sources */,
1C5FAEE70DCFDA6800D58F78 /* JSJavaScriptCallFrameCustom.cpp in Sources */,
A86629D409DA2B48009633A5 /* JSKeyboardEvent.cpp in Sources */,
......@@ -19728,7 +19705,6 @@
FE80DA710E9C472F000D6F75 /* JSPositionError.cpp in Sources */,
65DF31FF09D1CC60000BE325 /* JSProcessingInstruction.cpp in Sources */,
E44613ED0CD681BA00FADA75 /* JSProgressEvent.cpp in Sources */,
C091588E0DB4209200E55AF4 /* JSQuarantinedObjectWrapper.cpp in Sources */,
65DF320109D1CC60000BE325 /* JSRange.cpp in Sources */,
D23CA55F0AB0EAB6005108A5 /* JSRangeException.cpp in Sources */,
BCFE2F110C1B58370020235F /* JSRect.cpp in Sources */,
......@@ -86,7 +86,6 @@
#include "JSImageConstructor.cpp"
#include "JSImageDataCustom.cpp"
#include "JSInjectedScriptHostCustom.cpp"
#include "JSInspectedObjectWrapper.cpp"
#include "JSInspectorFrontendHostCustom.cpp"
#include "JSJavaScriptCallFrameCustom.cpp"
#include "JSLazyEventListener.cpp"
......@@ -107,7 +106,6 @@
#include "JSPluginArrayCustom.cpp"
#include "JSPluginCustom.cpp"
#include "JSPluginElementFunctions.cpp"
#include "JSQuarantinedObjectWrapper.cpp"
#include "JSSQLResultSetRowListCustom.cpp"
#include "JSSQLTransactionCustom.cpp"
#include "JSSVGElementInstanceCustom.cpp"
......
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "JSInspectedObjectWrapper.h"
#if ENABLE(INSPECTOR)
#include "JSInspectorCallbackWrapper.h"
#include <runtime/JSGlobalObject.h>
#include <runtime/WeakGCMap.h>
#include <wtf/StdLibExtras.h>
using namespace JSC;
namespace WebCore {
ASSERT_CLASS_FITS_IN_CELL(JSInspectedObjectWrapper);
typedef WeakGCMap<JSObject*, JSInspectedObjectWrapper*> WrapperMap;
typedef HashMap<JSGlobalObject*, WrapperMap*> GlobalObjectWrapperMap;
static GlobalObjectWrapperMap& wrappers()
{
DEFINE_STATIC_LOCAL(GlobalObjectWrapperMap, map, ());
return map;
}
const ClassInfo JSInspectedObjectWrapper::s_info = { "JSInspectedObjectWrapper", &JSQuarantinedObjectWrapper::s_info, 0, 0 };
JSValue JSInspectedObjectWrapper::wrap(ExecState* unwrappedExec, JSValue unwrappedValue)
{
if (!unwrappedValue.isObject())
return unwrappedValue;
JSObject* unwrappedObject = asObject(unwrappedValue);
if (unwrappedObject->inherits(&JSInspectedObjectWrapper::s_info))
return unwrappedObject;
if (WrapperMap* wrapperMap = wrappers().get(unwrappedExec->lexicalGlobalObject()))
if (JSInspectedObjectWrapper* wrapper = wrapperMap->get(unwrappedObject))
return wrapper;
JSValue prototype = unwrappedObject->prototype();
ASSERT(prototype.isNull() || prototype.isObject());
if (prototype.isNull())
return new (unwrappedExec) JSInspectedObjectWrapper(unwrappedExec, unwrappedObject, JSQuarantinedObjectWrapper::createStructure(jsNull()));
ProtectedJSValue wrappedProto = wrap(unwrappedExec, prototype);
return new (unwrappedExec) JSInspectedObjectWrapper(unwrappedExec, unwrappedObject, JSQuarantinedObjectWrapper::createStructure(asObject(wrappedProto)));
}
JSInspectedObjectWrapper::JSInspectedObjectWrapper(ExecState* unwrappedExec, JSObject* unwrappedObject, NonNullPassRefPtr<Structure> structure)
: JSQuarantinedObjectWrapper(unwrappedExec, unwrappedObject, structure)
{
WrapperMap* wrapperMap = wrappers().get(unwrappedGlobalObject());
if (!wrapperMap) {
wrapperMap = new WrapperMap;
wrappers().set(unwrappedGlobalObject(), wrapperMap);
}
pair<WrapperMap::iterator, bool> result = wrapperMap->set(unwrappedObject, this);
ASSERT(result.second);
UNUSED_PARAM(result);
}
JSInspectedObjectWrapper::~JSInspectedObjectWrapper()
{
WrapperMap* wrapperMap = wrappers().get(unwrappedGlobalObject());
ASSERT(wrapperMap);
wrapperMap->uncheckedRemove(unwrappedObject(), this);
if (wrapperMap->isEmpty()) {
wrappers().remove(unwrappedGlobalObject());
delete wrapperMap;
}
}
JSValue JSInspectedObjectWrapper::prepareIncomingValue(ExecState*, JSValue value) const
{
// The Inspector is only allowed to pass primitive values and wrapped objects to objects from the inspected page.
if (!value.isObject())
return value;
JSQuarantinedObjectWrapper* wrapper = asWrapper(value);
ASSERT_WITH_MESSAGE(wrapper, "Objects passed to JSInspectedObjectWrapper must be wrapped");
if (!wrapper)
return jsUndefined();
if (wrapper->allowsUnwrappedAccessFrom(unwrappedExecState())) {
ASSERT_WITH_MESSAGE(wrapper->inherits(&s_info), "A wrapper contains an object from the inspected page but is not a JSInspectedObjectWrapper");
if (!wrapper->inherits(&s_info))
return jsUndefined();
// Return the unwrapped object so the inspected page never sees one of its own objects in wrapped form.
return wrapper->unwrappedObject();
}
ASSERT_WITH_MESSAGE(wrapper->inherits(&JSInspectorCallbackWrapper::s_info), "A wrapper that was not from the inspected page and is not an Inspector callback was passed to a JSInspectedObjectWrapper");
if (!wrapper->inherits(&JSInspectorCallbackWrapper::s_info))
return jsUndefined();
return wrapper;
}
} // namespace WebCore
#endif // ENABLE(INSPECTOR)
/*
* Copyright (C) 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef JSInspectedObjectWrapper_h
#define JSInspectedObjectWrapper_h
#include "JSQuarantinedObjectWrapper.h"
namespace WebCore {
class JSInspectedObjectWrapper : public JSQuarantinedObjectWrapper {
public:
static JSC::JSValue wrap(JSC::ExecState* unwrappedExec, JSC::JSValue unwrappedValue);
virtual ~JSInspectedObjectWrapper();
static const JSC::ClassInfo s_info;
private:
JSInspectedObjectWrapper(JSC::ExecState* unwrappedExec, JSC::JSObject* unwrappedObject, NonNullPassRefPtr<JSC::Structure>);
virtual bool allowsGetProperty() const { return true; }
virtual bool allowsSetProperty() const { return true; }
virtual bool allowsDeleteProperty() const { return true; }
virtual bool allowsConstruct() const { return true; }
virtual bool allowsHasInstance() const { return true; }
virtual bool allowsCallAsFunction() const { return true; }
virtual bool allowsGetPropertyNames() const { return true; }
virtual JSC::JSValue prepareIncomingValue(JSC::ExecState* unwrappedExec, JSC::JSValue unwrappedValue) const;
virtual JSC::JSValue wrapOutgoingValue(JSC::ExecState* unwrappedExec, JSC::JSValue unwrappedValue) const { return wrap(unwrappedExec, unwrappedValue); }
virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
};
} // namespace WebCore
#endif // JSInspectedObjectWrapper_h
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "JSInspectorCallbackWrapper.h"
#if ENABLE(INSPECTOR)
#include "JSInspectedObjectWrapper.h"
#include <runtime/Protect.h>
#include <wtf/StdLibExtras.h>
using namespace JSC;
namespace WebCore {
ASSERT_CLASS_FITS_IN_CELL(JSInspectorCallbackWrapper);
typedef HashMap<JSObject*, JSInspectorCallbackWrapper*> WrapperMap;
static WrapperMap& wrappers()
{
DEFINE_STATIC_LOCAL(WrapperMap, map, ());
return map;
}
const ClassInfo JSInspectorCallbackWrapper::s_info = { "JSInspectorCallbackWrapper", &JSQuarantinedObjectWrapper::s_info, 0, 0 };
static Structure* leakInspectorCallbackWrapperStructure()
{
Structure::startIgnoringLeaks();
Structure* structure = JSInspectorCallbackWrapper::createStructure(jsNull()).releaseRef();
Structure::stopIgnoringLeaks();
return structure;
}
JSValue JSInspectorCallbackWrapper::wrap(ExecState* unwrappedExec, JSValue unwrappedValue)
{
if (!unwrappedValue.isObject())
return unwrappedValue;
JSObject* unwrappedObject = asObject(unwrappedValue);
if (unwrappedObject->inherits(&JSInspectorCallbackWrapper::s_info))
return unwrappedObject;
if (JSInspectorCallbackWrapper* wrapper = wrappers().get(unwrappedObject))
return wrapper;
JSValue prototype = unwrappedObject->prototype();
ASSERT(prototype.isNull() || prototype.isObject());
if (prototype.isNull()) {
static Structure* structure = leakInspectorCallbackWrapperStructure();
return new (unwrappedExec) JSInspectorCallbackWrapper(unwrappedExec, unwrappedObject, structure);
}
ProtectedJSValue wrappedProto = wrap(unwrappedExec, prototype);
return new (unwrappedExec) JSInspectorCallbackWrapper(unwrappedExec, unwrappedObject, createStructure(wrappedProto.get()));
}
JSInspectorCallbackWrapper::JSInspectorCallbackWrapper(ExecState* unwrappedExec, JSObject* unwrappedObject, NonNullPassRefPtr<Structure> structure)
: JSQuarantinedObjectWrapper(unwrappedExec, unwrappedObject, structure)
{
ASSERT(!wrappers().contains(unwrappedObject));
wrappers().set(unwrappedObject, this);
}
JSInspectorCallbackWrapper::~JSInspectorCallbackWrapper()
{
wrappers().remove(unwrappedObject());
}
JSValue JSInspectorCallbackWrapper::prepareIncomingValue(ExecState* unwrappedExec, JSValue unwrappedValue) const
{
if (JSQuarantinedObjectWrapper* wrapper = asWrapper(unwrappedValue)) {
// The only time a wrapper should be passed into a JSInspectorCallbackWrapper is when a client-side storage callback
// is called. (The client-side storage API calls the callback with the `this` object set to the callback itself.)
ASSERT_WITH_MESSAGE(wrapper == this, "A different wrapper was passed into a JSInspectorCallbackWrapper");
if (wrapper != this)
return jsUndefined();
return wrapper->unwrappedObject();
}
// Any value being passed to the Inspector from the inspected page should be wrapped in a JSInspectedObjectWrapper.
return JSInspectedObjectWrapper::wrap(unwrappedExec, unwrappedValue);
}
} // namespace WebCore
#endif // ENABLE(INSPECTOR)
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef JSInspectorCallbackWrapper_h
#define JSInspectorCallbackWrapper_h
#include "JSQuarantinedObjectWrapper.h"
namespace WebCore {
class JSInspectorCallbackWrapper : public JSQuarantinedObjectWrapper {
public: