Diff
Modified: trunk/Source/WebCore/ChangeLog (125492 => 125493)
--- trunk/Source/WebCore/ChangeLog 2012-08-14 01:34:06 UTC (rev 125492)
+++ trunk/Source/WebCore/ChangeLog 2012-08-14 01:39:32 UTC (rev 125493)
@@ -1,5 +1,30 @@
2012-08-13 Kentaro Hara <[email protected]>
+ [V8] Move checkNewLegal() from V8Proxy.h to SafeAllocation.h
+ https://bugs.webkit.org/show_bug.cgi?id=93830
+
+ Reviewed by Adam Barth.
+
+ This patch moves checkNewLegal() from V8Proxy.h to SafeAllocation.h.
+ In addition, this patch renames checkNewLegal() to isValidConstructorMode()
+ for clarification.
+
+ No tests. No change in behavior.
+
+ * UseV8.cmake:
+ * WebCore.gypi:
+ * bindings/v8/SafeAllocation.cpp: Added.
+ * bindings/v8/SafeAllocation.h:
+ (WebCore::SafeAllocation::newInstance):
+ (WebCore):
+ * bindings/v8/V8Binding.cpp:
+ (WebCore::createRawTemplate):
+ * bindings/v8/V8Proxy.cpp:
+ * bindings/v8/V8Proxy.h:
+ (V8Proxy):
+
+2012-08-13 Kentaro Hara <[email protected]>
+
[V8] Remove unused methods from V8Binding.h
https://bugs.webkit.org/show_bug.cgi?id=93836
Modified: trunk/Source/WebCore/UseV8.cmake (125492 => 125493)
--- trunk/Source/WebCore/UseV8.cmake 2012-08-14 01:34:06 UTC (rev 125492)
+++ trunk/Source/WebCore/UseV8.cmake 2012-08-14 01:39:32 UTC (rev 125493)
@@ -29,6 +29,7 @@
bindings/v8/Dictionary.cpp
bindings/v8/PageScriptDebugServer.cpp
bindings/v8/RetainedDOMInfo.cpp
+ bindings/v8/SafeAllocation.cpp
bindings/v8/ScheduledAction.cpp
bindings/v8/ScopedDOMDataStore.cpp
bindings/v8/ScriptCachedFrameData.cpp
Modified: trunk/Source/WebCore/WebCore.gypi (125492 => 125493)
--- trunk/Source/WebCore/WebCore.gypi 2012-08-14 01:34:06 UTC (rev 125492)
+++ trunk/Source/WebCore/WebCore.gypi 2012-08-14 01:39:32 UTC (rev 125493)
@@ -2191,6 +2191,7 @@
'bindings/v8/RetainedDOMInfo.cpp',
'bindings/v8/RetainedDOMInfo.h',
'bindings/v8/RetainedObjectInfo.h',
+ 'bindings/v8/SafeAllocation.cpp',
'bindings/v8/SafeAllocation.h',
'bindings/v8/ScheduledAction.cpp',
'bindings/v8/ScheduledAction.h',
Added: trunk/Source/WebCore/bindings/v8/SafeAllocation.cpp (0 => 125493)
--- trunk/Source/WebCore/bindings/v8/SafeAllocation.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/v8/SafeAllocation.cpp 2012-08-14 01:39:32 UTC (rev 125493)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2012 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:
+ * 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. AND ITS 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 APPLE INC. OR ITS 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 "SafeAllocation.h"
+
+#include "V8Proxy.h"
+
+namespace WebCore {
+
+v8::Handle<v8::Value> SafeAllocation::isValidConstructorMode(const v8::Arguments& args)
+{
+ if (ConstructorMode::current() == ConstructorMode::CreateNewObject)
+ return V8Proxy::throwTypeError("Illegal constructor", args.GetIsolate());
+ return args.This();
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/v8/SafeAllocation.h (125492 => 125493)
--- trunk/Source/WebCore/bindings/v8/SafeAllocation.h 2012-08-14 01:34:06 UTC (rev 125492)
+++ trunk/Source/WebCore/bindings/v8/SafeAllocation.h 2012-08-14 01:39:32 UTC (rev 125493)
@@ -69,6 +69,8 @@
static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::Function>);
static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::ObjectTemplate>);
static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]);
+
+ static v8::Handle<v8::Value> isValidConstructorMode(const v8::Arguments&);
};
v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::Function> function)
Modified: trunk/Source/WebCore/bindings/v8/V8Binding.cpp (125492 => 125493)
--- trunk/Source/WebCore/bindings/v8/V8Binding.cpp 2012-08-14 01:34:06 UTC (rev 125492)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.cpp 2012-08-14 01:39:32 UTC (rev 125493)
@@ -37,6 +37,7 @@
#include "MemoryInstrumentation.h"
#include "PlatformString.h"
#include "QualifiedName.h"
+#include "SafeAllocation.h"
#include "V8DOMStringList.h"
#include "V8Element.h"
#include "V8Proxy.h"
@@ -291,7 +292,7 @@
v8::Persistent<v8::FunctionTemplate> createRawTemplate()
{
v8::HandleScope scope;
- v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(V8Proxy::checkNewLegal);
+ v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(SafeAllocation::isValidConstructorMode);
return v8::Persistent<v8::FunctionTemplate>::New(result);
}
Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (125492 => 125493)
--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2012-08-14 01:34:06 UTC (rev 125492)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2012-08-14 01:39:32 UTC (rev 125493)
@@ -547,14 +547,6 @@
return frame->script()->proxy()->mainWorldContext();
}
-v8::Handle<v8::Value> V8Proxy::checkNewLegal(const v8::Arguments& args)
-{
- if (ConstructorMode::current() == ConstructorMode::CreateNewObject)
- return throwError(TypeError, "Illegal constructor", args.GetIsolate());
-
- return args.This();
-}
-
V8Extensions& V8Proxy::extensions()
{
DEFINE_STATIC_LOCAL(V8Extensions, extensions, ());
Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.h (125492 => 125493)
--- trunk/Source/WebCore/bindings/v8/V8Proxy.h 2012-08-14 01:34:06 UTC (rev 125492)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.h 2012-08-14 01:39:32 UTC (rev 125493)
@@ -139,8 +139,6 @@
// is disabled and it returns true.
static bool handleOutOfMemory();
- static v8::Handle<v8::Value> checkNewLegal(const v8::Arguments&);
-
static v8::Handle<v8::Script> compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition& scriptStartPosition, v8::ScriptData* = 0);
// If the exception code is different from zero, a DOM exception is