diff options
| author | Ben Murdoch <benm@google.com> | 2011-05-24 11:24:40 +0100 | 
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2011-06-02 09:53:15 +0100 | 
| commit | 81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch) | |
| tree | 7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebCore/bindings/v8/custom | |
| parent | 94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff) | |
| download | external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2 | |
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebCore/bindings/v8/custom')
5 files changed, 58 insertions, 37 deletions
| diff --git a/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp index 14f13cb..f260cff 100755 --- a/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp @@ -36,7 +36,10 @@ namespace WebCore {  v8::Handle<v8::Value> V8DataView::constructorCallback(const v8::Arguments& args)  { -    INC_STATS("DOM.ArrayBuffer.Constructor"); +    INC_STATS("DOM.DataView.Constructor"); + +    if (!args.IsConstructCall()) +        return throwError("DOM object constructor cannot be called as a function", V8Proxy::SyntaxError);      if (args[0]->IsNull() || !V8ArrayBuffer::HasInstance(args[0]))          return V8Proxy::throwTypeError(); diff --git a/Source/WebCore/bindings/v8/custom/V8EventCustom.cpp b/Source/WebCore/bindings/v8/custom/V8EventCustom.cpp index ff9b98b..abb7d4c 100644 --- a/Source/WebCore/bindings/v8/custom/V8EventCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8EventCustom.cpp @@ -44,8 +44,7 @@  #include "V8DeviceOrientationEvent.h"  #include "V8ErrorEvent.h"  #include "V8HashChangeEvent.h" -#include "V8IDBErrorEvent.h" -#include "V8IDBSuccessEvent.h" +#include "V8IDBVersionChangeEvent.h"  #include "V8KeyboardEvent.h"  #include "V8MessageEvent.h"  #include "V8MouseEvent.h" @@ -156,10 +155,8 @@ v8::Handle<v8::Value> toV8(Event* impl)          return toV8(static_cast<StorageEvent*>(impl));  #endif  #if ENABLE(INDEXED_DATABASE) -    if (impl->isIDBErrorEvent()) -        return toV8(static_cast<IDBErrorEvent*>(impl)); -    if (impl->isIDBSuccessEvent()) -        return toV8(static_cast<IDBSuccessEvent*>(impl)); +    if (impl->isIDBVersionChangeEvent()) +        return toV8(static_cast<IDBVersionChangeEvent*>(impl));  #endif      if (impl->isBeforeLoadEvent())          return toV8(static_cast<BeforeLoadEvent*>(impl)); diff --git a/Source/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp b/Source/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp index fd6f1a5..ccd6fb2 100644 --- a/Source/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp @@ -33,6 +33,7 @@  #include "SerializedScriptValue.h"  #include "V8IDBCursor.h" +#include "V8IDBCursorWithValue.h"  #include "V8IDBDatabase.h"  #include "V8IDBFactory.h"  #include "V8IDBIndex.h" @@ -54,6 +55,8 @@ v8::Handle<v8::Value> toV8(IDBAny* impl)          return v8::Null();      case IDBAny::IDBCursorType:          return toV8(impl->idbCursor()); +    case IDBAny::IDBCursorWithValueType: +        return toV8(impl->idbCursorWithValue());      case IDBAny::IDBDatabaseType:          return toV8(impl->idbDatabase());      case IDBAny::IDBFactoryType: diff --git a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp index ce1732b..7a33ed0 100644 --- a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp @@ -40,6 +40,7 @@  #include "Node.h"  #include "Page.h"  #include "ScriptDebugServer.h" +#include "ScriptValue.h"  #include "V8Binding.h"  #include "V8BindingState.h" @@ -54,6 +55,22 @@  namespace WebCore { +Node* InjectedScriptHost::scriptValueAsNode(ScriptValue value) +{ +    if (!value.isObject() || value.isNull()) +        return 0; +    return V8Node::toNative(v8::Handle<v8::Object>::Cast(value.v8Value())); +} + +ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* state, Node* node) +{ +    v8::HandleScope scope; +    v8::Local<v8::Context> context = state->context(); +    v8::Context::Scope contextScope(context); + +    return ScriptValue(toV8(node)); +} +  static void WeakReferenceCallback(v8::Persistent<v8::Value> object, void* parameter)  {      InjectedScriptHost* nativeObject = static_cast<InjectedScriptHost*>(parameter); @@ -134,21 +151,18 @@ void InjectedScriptHost::discardInjectedScript(ScriptState* inspectedScriptState      global->DeleteHiddenValue(key);  } -v8::Handle<v8::Value> V8InjectedScriptHost::nodeForIdCallback(const v8::Arguments& args) +v8::Handle<v8::Value> V8InjectedScriptHost::inspectedNodeCallback(const v8::Arguments& args)  { -    INC_STATS("InjectedScriptHost.nodeForId()"); +    INC_STATS("InjectedScriptHost.inspectedNode()");      if (args.Length() < 1)          return v8::Undefined();      InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); -    Node* node = host->nodeForId(args[0]->ToInt32()->Value()); +    Node* node = host->inspectedNode(args[0]->ToInt32()->Value());      if (!node)          return v8::Undefined(); -    if (!host->inspectorAgent()) -        return v8::Undefined(); -      return toV8(node);  } @@ -164,61 +178,58 @@ v8::Handle<v8::Value> V8InjectedScriptHost::internalConstructorNameCallback(cons      return args[0]->ToObject()->GetConstructorName();  } -v8::Handle<v8::Value> V8InjectedScriptHost::pushNodePathToFrontendCallback(const v8::Arguments& args) +v8::Handle<v8::Value> V8InjectedScriptHost::inspectCallback(const v8::Arguments& args)  { -    INC_STATS("InjectedScriptHost.pushNodePathToFrontend()"); -    if (args.Length() < 3) +    INC_STATS("InjectedScriptHost.inspect()"); +    if (args.Length() < 2)          return v8::Undefined();      InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); -    Node* node = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])); -    bool withChildren = args[1]->ToBoolean()->Value(); -    bool selectInUI = args[2]->ToBoolean()->Value(); -    if (node) -        return v8::Number::New(host->pushNodePathToFrontend(node, withChildren, selectInUI)); +    ScriptValue objectId(args[0]); +    ScriptValue hints(args[1]); +    host->inspectImpl(objectId.toInspectorValue(ScriptState::current()), hints.toInspectorValue(ScriptState::current()));      return v8::Undefined();  } -#if ENABLE(JAVASCRIPT_DEBUGGER)  v8::Handle<v8::Value> V8InjectedScriptHost::currentCallFrameCallback(const v8::Arguments& args)  { +#if ENABLE(JAVASCRIPT_DEBUGGER)      INC_STATS("InjectedScriptHost.currentCallFrame()");      return toV8(ScriptDebugServer::shared().currentCallFrame()); -} +#else +    UNUSED_PARAM(args); +    return v8::Undefined();  #endif +} -#if ENABLE(DATABASE) -v8::Handle<v8::Value> V8InjectedScriptHost::selectDatabaseCallback(const v8::Arguments& args) +v8::Handle<v8::Value> V8InjectedScriptHost::databaseIdCallback(const v8::Arguments& args)  { -    INC_STATS("InjectedScriptHost.selectDatabase()"); +    INC_STATS("InjectedScriptHost.databaseId()");      if (args.Length() < 1)          return v8::Undefined(); - +#if ENABLE(DATABASE)      InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());      Database* database = V8Database::toNative(v8::Handle<v8::Object>::Cast(args[0]));      if (database) -        host->selectDatabase(database); - +        return v8::Number::New(host->databaseIdImpl(database)); +#endif      return v8::Undefined();  } -#endif -#if ENABLE(DOM_STORAGE) -v8::Handle<v8::Value> V8InjectedScriptHost::selectDOMStorageCallback(const v8::Arguments& args) +v8::Handle<v8::Value> V8InjectedScriptHost::storageIdCallback(const v8::Arguments& args)  { -    INC_STATS("InjectedScriptHost.selectDOMStorage()");      if (args.Length() < 1)          return v8::Undefined(); - +#if ENABLE(DOM_STORAGE) +    INC_STATS("InjectedScriptHost.storageId()");      InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());      Storage* storage = V8Storage::toNative(v8::Handle<v8::Object>::Cast(args[0]));      if (storage) -        host->selectDOMStorage(storage); - +        return v8::Number::New(host->storageIdImpl(storage)); +#endif      return v8::Undefined();  } -#endif  InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* inspectedScriptState)  { diff --git a/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp index 5a3f873..af81a41 100644 --- a/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp @@ -50,6 +50,7 @@  #include "V8Int8Array.h"  #include "V8OESStandardDerivatives.h"  #include "V8OESTextureFloat.h" +#include "V8OESVertexArrayObject.h"  #include "V8Proxy.h"  #include "V8Uint16Array.h"  #include "V8Uint32Array.h" @@ -61,6 +62,7 @@  #include "V8WebGLShader.h"  #include "V8WebGLTexture.h"  #include "V8WebGLUniformLocation.h" +#include "V8WebGLVertexArrayObjectOES.h"  #include "WebGLRenderingContext.h"  #include <wtf/FastMalloc.h> @@ -146,6 +148,8 @@ static v8::Handle<v8::Value> toV8Object(const WebGLGetInfo& info)          return toV8(info.getWebGLTexture());      case WebGLGetInfo::kTypeWebGLUnsignedByteArray:          return toV8(info.getWebGLUnsignedByteArray()); +    case WebGLGetInfo::kTypeWebGLVertexArrayObjectOES: +        return toV8(info.getWebGLVertexArrayObjectOES());      default:          notImplemented();          return v8::Undefined(); @@ -167,6 +171,9 @@ static v8::Handle<v8::Value> toV8Object(WebGLExtension* extension, v8::Handle<v8      case WebGLExtension::OESTextureFloatName:          extensionObject = toV8(static_cast<OESTextureFloat*>(extension));          break; +    case WebGLExtension::OESVertexArrayObjectName: +        extensionObject = toV8(static_cast<OESVertexArrayObject*>(extension)); +        break;      }      ASSERT(!extensionObject.IsEmpty());      V8DOMWrapper::setHiddenReference(contextObject, extensionObject); | 
