Commit 2aadf6dc authored by yurys@chromium.org's avatar yurys@chromium.org
Browse files

2009-12-02 Yury Semikhatsky <yurys@chromium.org>

        Reviewed by Pavel Feldman.

        Code clean up: remove ScriptObjectQuarantine.* as a whole.

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

        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * WebCoreSources.bkl:
        * bindings/js/JSBindingsAllInOne.cpp:
        * bindings/js/ScriptObjectQuarantine.cpp: Removed.
        * bindings/js/ScriptObjectQuarantine.h: Removed.
        * bindings/js/ScriptValue.cpp:
        (WebCore::ScriptValue::quarantineValue):
        * bindings/js/ScriptValue.h:
        * bindings/v8/ScriptObjectQuarantine.cpp: Removed.
        * bindings/v8/ScriptObjectQuarantine.h: Removed.
        * bindings/v8/ScriptValue.h:
        (WebCore::ScriptValue::quarantineValue):
        * inspector/ConsoleMessage.cpp:
        (WebCore::ConsoleMessage::ConsoleMessage):
        * inspector/InspectorController.cpp:
        * inspector/InspectorDatabaseResource.cpp:
        (WebCore::InspectorDatabaseResource::bind):
        * inspector/InspectorFrontend.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51598 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 38dd27ea
2009-12-02 Yury Semikhatsky <yurys@chromium.org>
Reviewed by Pavel Feldman.
Code clean up: remove ScriptObjectQuarantine.* as a whole.
https://bugs.webkit.org/show_bug.cgi?id=32060
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* WebCoreSources.bkl:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/ScriptObjectQuarantine.cpp: Removed.
* bindings/js/ScriptObjectQuarantine.h: Removed.
* bindings/js/ScriptValue.cpp:
(WebCore::ScriptValue::quarantineValue):
* bindings/js/ScriptValue.h:
* bindings/v8/ScriptObjectQuarantine.cpp: Removed.
* bindings/v8/ScriptObjectQuarantine.h: Removed.
* bindings/v8/ScriptValue.h:
(WebCore::ScriptValue::quarantineValue):
* inspector/ConsoleMessage.cpp:
(WebCore::ConsoleMessage::ConsoleMessage):
* inspector/InspectorController.cpp:
* inspector/InspectorDatabaseResource.cpp:
(WebCore::InspectorDatabaseResource::bind):
* inspector/InspectorFrontend.cpp:
2009-12-02 Fumitoshi Ukai <ukai@chromium.org>
 
Reviewed by Alexey Proskuryakov.
......@@ -469,8 +469,6 @@ webcore_sources += \
WebCore/bindings/js/ScriptInstance.h \
WebCore/bindings/js/ScriptObject.cpp \
WebCore/bindings/js/ScriptObject.h \
WebCore/bindings/js/ScriptObjectQuarantine.cpp \
WebCore/bindings/js/ScriptObjectQuarantine.h \
WebCore/bindings/js/ScriptSourceCode.h \
WebCore/bindings/js/ScriptSourceProvider.h \
WebCore/bindings/js/ScriptState.cpp \
......
......@@ -622,8 +622,6 @@
'bindings/js/ScriptInstance.h',
'bindings/js/ScriptObject.cpp',
'bindings/js/ScriptObject.h',
'bindings/js/ScriptObjectQuarantine.cpp',
'bindings/js/ScriptObjectQuarantine.h',
'bindings/js/ScriptSourceCode.h',
'bindings/js/ScriptSourceProvider.h',
'bindings/js/ScriptState.cpp',
......@@ -779,8 +777,6 @@
'bindings/v8/ScriptInstance.h',
'bindings/v8/ScriptObject.cpp',
'bindings/v8/ScriptObject.h',
'bindings/v8/ScriptObjectQuarantine.cpp',
'bindings/v8/ScriptObjectQuarantine.h',
'bindings/v8/ScriptScope.cpp',
'bindings/v8/ScriptScope.h',
'bindings/v8/ScriptSourceCode.h',
......
......@@ -764,7 +764,6 @@ SOURCES += \
bindings/js/ScriptEventListener.cpp \
bindings/js/ScriptFunctionCall.cpp \
bindings/js/ScriptObject.cpp \
bindings/js/ScriptObjectQuarantine.cpp \
bindings/js/ScriptState.cpp \
bindings/js/ScriptValue.cpp \
bindings/js/ScheduledAction.cpp \
......@@ -1444,7 +1443,6 @@ HEADERS += \
bindings/js/ScriptEventListener.h \
bindings/js/ScriptFunctionCall.h \
bindings/js/ScriptObject.h \
bindings/js/ScriptObjectQuarantine.h \
bindings/js/ScriptSourceCode.h \
bindings/js/ScriptSourceProvider.h \
bindings/js/ScriptState.h \
......
......@@ -40345,62 +40345,6 @@
RelativePath="..\bindings\js\ScriptObject.h"
>
</File>
<File
RelativePath="..\bindings\js\ScriptObjectQuarantine.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\ScriptObjectQuarantine.h"
>
</File>
<File
RelativePath="..\bindings\js\ScriptSourceCode.h"
>
......
......@@ -700,7 +700,6 @@
411046410FA222A600BA436A /* ScriptEventListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 4110463F0FA222A600BA436A /* ScriptEventListener.h */; };
411046420FA222A600BA436A /* ScriptEventListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 411046400FA222A600BA436A /* ScriptEventListener.cpp */; };
4127D5370F8AAB1D00E424F5 /* ScriptState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */; };
412A68470F6B03DD000EA66E /* ScriptObjectQuarantine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 412A68460F6B03DD000EA66E /* ScriptObjectQuarantine.cpp */; };
415B7C570FF598E6006770F7 /* JSAbstractWorkerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 415B7C540FF598E6006770F7 /* JSAbstractWorkerCustom.cpp */; };
415B7C580FF598E6006770F7 /* JSSharedWorkerConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 415B7C550FF598E6006770F7 /* JSSharedWorkerConstructor.cpp */; };
415B7C630FF5A767006770F7 /* JSSharedWorkerConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 415B7C620FF5A767006770F7 /* JSSharedWorkerConstructor.h */; };
......@@ -719,7 +718,6 @@
416F45F00ED7B311008215B6 /* ScriptString.h in Headers */ = {isa = PBXBuildFile; fileRef = 416F45EF0ED7B311008215B6 /* ScriptString.h */; settings = {ATTRIBUTES = (Private, ); }; };
418F88040FF957AE0080F045 /* JSAbstractWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 418F88020FF957AE0080F045 /* JSAbstractWorker.cpp */; };
418F88050FF957AF0080F045 /* JSAbstractWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = 418F88030FF957AE0080F045 /* JSAbstractWorker.h */; };
419536510F68222400D0C679 /* ScriptObjectQuarantine.h in Headers */ = {isa = PBXBuildFile; fileRef = 419536500F68222400D0C679 /* ScriptObjectQuarantine.h */; };
41A3D58E101C152D00316D07 /* DedicatedWorkerThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41A3D58C101C152D00316D07 /* DedicatedWorkerThread.cpp */; };
41A3D58F101C152D00316D07 /* DedicatedWorkerThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 41A3D58D101C152D00316D07 /* DedicatedWorkerThread.h */; };
41BF700B0FE86F49005E8DEC /* MessagePortChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41BF70090FE86F49005E8DEC /* MessagePortChannel.cpp */; };
......@@ -5948,7 +5946,6 @@
4110463F0FA222A600BA436A /* ScriptEventListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptEventListener.h; sourceTree = "<group>"; };
411046400FA222A600BA436A /* ScriptEventListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptEventListener.cpp; sourceTree = "<group>"; };
4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptState.cpp; sourceTree = "<group>"; };
412A68460F6B03DD000EA66E /* ScriptObjectQuarantine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptObjectQuarantine.cpp; sourceTree = "<group>"; };
415B7C540FF598E6006770F7 /* JSAbstractWorkerCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAbstractWorkerCustom.cpp; sourceTree = "<group>"; };
415B7C550FF598E6006770F7 /* JSSharedWorkerConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSharedWorkerConstructor.cpp; sourceTree = "<group>"; };
415B7C620FF5A767006770F7 /* JSSharedWorkerConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSharedWorkerConstructor.h; sourceTree = "<group>"; };
......@@ -5968,7 +5965,6 @@
416F45EF0ED7B311008215B6 /* ScriptString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptString.h; sourceTree = "<group>"; };
418F88020FF957AE0080F045 /* JSAbstractWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAbstractWorker.cpp; sourceTree = "<group>"; };
418F88030FF957AE0080F045 /* JSAbstractWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAbstractWorker.h; sourceTree = "<group>"; };
419536500F68222400D0C679 /* ScriptObjectQuarantine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptObjectQuarantine.h; sourceTree = "<group>"; };
41A3D58C101C152D00316D07 /* DedicatedWorkerThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DedicatedWorkerThread.cpp; path = workers/DedicatedWorkerThread.cpp; sourceTree = "<group>"; };
41A3D58D101C152D00316D07 /* DedicatedWorkerThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DedicatedWorkerThread.h; path = workers/DedicatedWorkerThread.h; sourceTree = "<group>"; };
41BF70090FE86F49005E8DEC /* MessagePortChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MessagePortChannel.cpp; sourceTree = "<group>"; };
......@@ -14416,8 +14412,6 @@
934CC1160EDCAC7300A658F2 /* ScriptInstance.h */,
41F066E30F64BCF600A07EAC /* ScriptObject.cpp */,
41F066E20F64BCF600A07EAC /* ScriptObject.h */,
412A68460F6B03DD000EA66E /* ScriptObjectQuarantine.cpp */,
419536500F68222400D0C679 /* ScriptObjectQuarantine.h */,
934CC1090EDB223900A658F2 /* ScriptSourceCode.h */,
CE54FD371016D9A6008B44C8 /* ScriptSourceProvider.h */,
4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */,
......@@ -17710,7 +17704,6 @@
41002CCD0F66EDEF009E660D /* ScriptFunctionCall.h in Headers */,
934CC1170EDCAC7300A658F2 /* ScriptInstance.h in Headers */,
41F066E40F64BCF600A07EAC /* ScriptObject.h in Headers */,
419536510F68222400D0C679 /* ScriptObjectQuarantine.h in Headers */,
934CC10A0EDB223900A658F2 /* ScriptSourceCode.h in Headers */,
CE54FD381016D9A6008B44C8 /* ScriptSourceProvider.h in Headers */,
41C760B10EDE03D300C1655F /* ScriptState.h in Headers */,
......@@ -19918,7 +19911,6 @@
E11C9DB00EB3699500E409DB /* ScriptExecutionContext.cpp in Sources */,
41002CCE0F66EDEF009E660D /* ScriptFunctionCall.cpp in Sources */,
41F066E50F64BCF600A07EAC /* ScriptObject.cpp in Sources */,
412A68470F6B03DD000EA66E /* ScriptObjectQuarantine.cpp in Sources */,
4127D5370F8AAB1D00E424F5 /* ScriptState.cpp in Sources */,
934CC0E10ED39D6F00A658F2 /* ScriptValue.cpp in Sources */,
BCAA90C30A7EBA60008B1229 /* Scrollbar.cpp in Sources */,
......@@ -156,7 +156,6 @@ This file contains the list of files needed to build WebCore.
bindings/js/ScriptEventListener.cpp
bindings/js/ScriptFunctionCall.cpp
bindings/js/ScriptObject.cpp
bindings/js/ScriptObjectQuarantine.cpp
bindings/js/ScriptState.cpp
bindings/js/ScriptValue.cpp
bindings/js/ScheduledAction.cpp
......
......@@ -145,7 +145,6 @@
#include "ScriptControllerWin.cpp"
#include "ScriptEventListener.cpp"
#include "ScriptFunctionCall.cpp"
#include "ScriptObjectQuarantine.cpp"
#include "ScriptState.cpp"
#include "SerializedScriptValue.cpp"
#include "WorkerScriptController.cpp"
/*
* Copyright (C) 2009 Google 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:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * 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.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT
* OWNER 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 "ScriptObjectQuarantine.h"
#if ENABLE(INSPECTOR)
#include "Document.h"
#include "Frame.h"
#include "JSDOMBinding.h"
#include "JSInspectedObjectWrapper.h"
#include "JSNode.h"
#include "ScriptObject.h"
#include "ScriptValue.h"
#include "Storage.h"
#include <runtime/JSLock.h>
#if ENABLE(DATABASE)
#include "Database.h"
#include "JSDatabase.h"
#endif
#if ENABLE(DOM_STORAGE)
#include "JSStorage.h"
#endif
using namespace JSC;
namespace WebCore {
ScriptValue quarantineValue(ScriptState* scriptState, const ScriptValue& value)
{
JSLock lock(SilenceAssertionsOnly);
return ScriptValue(JSInspectedObjectWrapper::wrap(scriptState, value.jsValue()));
}
#if ENABLE(DATABASE)
bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObject)
{
ASSERT(database);
Frame* frame = database->document()->frame();
if (!frame)
return false;
JSDOMGlobalObject* globalObject = toJSDOMWindow(frame, debuggerWorld());
ExecState* exec = globalObject->globalExec();
JSLock lock(SilenceAssertionsOnly);
quarantinedObject = ScriptObject(exec, asObject(JSInspectedObjectWrapper::wrap(exec, toJS(exec, globalObject, database))));
return true;
}
#endif
#if ENABLE(DOM_STORAGE)
bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject)
{
ASSERT(storage);
Frame* frame = storage->frame();
ASSERT(frame);
JSDOMGlobalObject* globalObject = toJSDOMWindow(frame, debuggerWorld());
ExecState* exec = globalObject->globalExec();
JSLock lock(SilenceAssertionsOnly);
quarantinedObject = ScriptObject(exec, asObject(JSInspectedObjectWrapper::wrap(exec, toJS(exec, globalObject, storage))));
return true;
}
#endif
bool getQuarantinedScriptObject(Node* node, ScriptObject& quarantinedObject)
{
ExecState* exec = scriptStateFromNode(debuggerWorld(), node);
if (!exec)
return false;
JSLock lock(SilenceAssertionsOnly);
// FIXME: Should use some sort of globalObjectFromNode()
quarantinedObject = ScriptObject(exec, asObject(JSInspectedObjectWrapper::wrap(exec, toJS(exec, deprecatedGlobalObjectForPrototype(exec), node))));
return true;
}
bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject& quarantinedObject)
{
ASSERT(domWindow);
JSDOMWindow* window = toJSDOMWindow(domWindow->frame(), debuggerWorld());
ExecState* exec = window->globalExec();
JSLock lock(SilenceAssertionsOnly);
quarantinedObject = ScriptObject(exec, asObject(JSInspectedObjectWrapper::wrap(exec, window)));
return true;
}
} // namespace WebCore
#endif // ENABLE(INSPECTOR)
/*
* Copyright (C) 2009 Google 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:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * 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.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT
* OWNER 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 ScriptObjectQuarantine_h
#define ScriptObjectQuarantine_h
#include "ScriptState.h"
namespace WebCore {
class Database;
class DOMWindow;
class Node;
class ScriptObject;
class ScriptValue;
class Storage;
ScriptValue quarantineValue(ScriptState*, const ScriptValue&);
#if ENABLE(DATABASE)
bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObject);
#endif
#if ENABLE(DOM_STORAGE)
bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject);
#endif
bool getQuarantinedScriptObject(Node* node, ScriptObject& quarantinedObject);
bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject& quarantinedObject);
}
#endif // ScriptObjectQuarantine_h
......@@ -32,6 +32,8 @@
#include <JavaScriptCore/APICast.h>
#include <JavaScriptCore/JSValueRef.h>
#include "JSInspectedObjectWrapper.h"
#include <runtime/JSLock.h>
#include <runtime/Protect.h>
#include <runtime/UString.h>
......@@ -40,6 +42,12 @@ using namespace JSC;
namespace WebCore {
ScriptValue ScriptValue::quarantineValue(ScriptState* scriptState, const ScriptValue& value)
{
JSLock lock(SilenceAssertionsOnly);
return ScriptValue(JSInspectedObjectWrapper::wrap(scriptState, value.jsValue()));
}
bool ScriptValue::getString(String& result) const
{
if (!m_value)
......
......@@ -41,6 +41,8 @@ class String;
class ScriptValue {
public:
static ScriptValue quarantineValue(ScriptState* scriptState, const ScriptValue& value);
ScriptValue(JSC::JSValue value = JSC::JSValue()) : m_value(value) {}
virtual ~ScriptValue() {}
......
/*
* Copyright (C) 2009 Google 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:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * 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.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT
* OWNER 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 "ScriptObjectQuarantine.h"
#include "Database.h"
#include "Document.h"
#include "DOMWindow.h"
#include "Frame.h"
#include "InspectorController.h"
#include "Page.h"
#include "ScriptObject.h"
#include "ScriptValue.h"
#include "Storage.h"
#include "V8Binding.h"
#include "V8Proxy.h"
#include <v8.h>
namespace WebCore {
ScriptValue quarantineValue(ScriptState* scriptState, const ScriptValue& value)
{
return value;
}
bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObject)
{
ASSERT(database);
#if ENABLE(DATABASE)
v8::HandleScope handleScope;
Frame* frame = database->document()->frame();
if (!frame)
return false;
v8::Local<v8::Context> context = V8Proxy::context(frame);
if (context.IsEmpty())
return false;
v8::Context::Scope scope(context);
v8::Handle<v8::Value> v8Database = V8DOMWrapper::convertToV8Object(V8ClassIndex::DATABASE, database);
ScriptState* scriptState = frame->page()->inspectorController()->frontendScriptState();
quarantinedObject = ScriptObject(scriptState, v8::Local<v8::Object>(v8::Object::Cast(*v8Database)));
#else
ASSERT_NOT_REACHED();
quarantinedObject = ScriptObject();
#endif
return true;
}
bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject)
{
ASSERT(storage);
Frame* frame = storage->frame();
ASSERT(frame);
#if ENABLE(DOM_STORAGE)
v8::HandleScope handleScope;
v8::Local<v8::Context> context = V8Proxy::context(frame);
if (context.IsEmpty())
return false;
v8::Context::Scope scope(context);
v8::Handle<v8::Value> v8Storage = V8DOMWrapper::convertToV8Object(V8ClassIndex::STORAGE, storage);
ScriptState* scriptState = frame->page()->inspectorController()->frontendScriptState();
quarantinedObject = ScriptObject(scriptState, v8::Local<v8::Object>(v8::Object::Cast(*v8Storage)));
#else
ASSERT_NOT_REACHED();
quarantinedObject = ScriptObject();
#endif
return true;
}
bool getQuarantinedScriptObject(Node* node, ScriptObject& quarantinedObject)
{
ASSERT(node);
v8::HandleScope handleScope;
// FIXME: What if document() is null?
// FIXME: Why are we grabbing the mainFrame?
Frame* frame = node->document()->page()->mainFrame();
v8::Local<v8::Context> context = V8Proxy::context(frame);
// FIXME: What if context.IsEmpty()?
v8::Context::Scope scope(context);
v8::Handle<v8::Value> v8Node = V8DOMWrapper::convertNodeToV8Object(node);
ScriptState* scriptState = frame->page()->inspectorController()->frontendScriptState();
quarantinedObject = ScriptObject(scriptState, v8::Local<v8::Object>(v8::Object::Cast(*v8Node)));
return true;
}
bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject& quarantinedObject)
{
ASSERT(domWindow);
v8::HandleScope handleScope;
Frame* frame = domWindow->frame();
// FIXME: What if frame is null?
v8::Local<v8::Context> context = V8Proxy::context(frame);
// FIXME: What if context.IsEmpty()?
v8::Context::Scope scope(context);
v8::Handle<v8::Value> v8DomWindow = V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, domWindow);
ScriptState* scriptState = frame->page()->inspectorController()->frontendScriptState();
quarantinedObject = ScriptObject(scriptState, v8::Local<v8::Object>(v8::Object::Cast(*v8DomWindow)));
return true;
}
} // namespace WebCore
/*
* Copyright (C) 2009 Google 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:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * 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.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT
* OWNER 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.