Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are |
| 6 | * met: |
| 7 | * |
| 8 | * * Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * * Redistributions in binary form must reproduce the above |
| 11 | * copyright notice, this list of conditions and the following disclaimer |
| 12 | * in the documentation and/or other materials provided with the |
| 13 | * distribution. |
| 14 | * * Neither the name of Google Inc. nor the names of its |
| 15 | * contributors may be used to endorse or promote products derived from |
| 16 | * this software without specific prior written permission. |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | */ |
| 30 | |
| 31 | #include "config.h" |
| 32 | #include "WebBindings.h" |
| 33 | |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 34 | #include "V8Element.h" |
| 35 | #include "V8Range.h" |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 36 | #include "WebArrayBufferView.h" |
| 37 | #include "WebElement.h" |
| 38 | #include "WebRange.h" |
| 39 | #include "bindings/v8/NPV8Object.h" // for PrivateIdentifier |
| 40 | #include "bindings/v8/ScriptController.h" |
| 41 | #include "bindings/v8/V8DOMWrapper.h" |
| 42 | #include "bindings/v8/V8NPUtils.h" |
| 43 | #include "bindings/v8/custom/V8ArrayBufferCustom.h" |
Ben Murdoch | 3c9e4ae | 2013-08-12 14:20:44 +0100 | [diff] [blame] | 44 | #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 45 | #include "bindings/v8/npruntime_impl.h" |
| 46 | #include "bindings/v8/npruntime_priv.h" |
| 47 | #include "core/dom/Range.h" |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 48 | #include "core/frame/DOMWindow.h" |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame] | 49 | #include "core/frame/LocalFrame.h" |
Ben Murdoch | 0019e4e | 2013-07-18 11:57:54 +0100 | [diff] [blame] | 50 | #include "public/platform/WebArrayBuffer.h" |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 51 | #include "wtf/ArrayBufferView.h" |
| 52 | |
| 53 | using namespace WebCore; |
| 54 | |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 55 | namespace blink { |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 56 | |
| 57 | bool WebBindings::construct(NPP npp, NPObject* object, const NPVariant* args, uint32_t argCount, NPVariant* result) |
| 58 | { |
| 59 | return _NPN_Construct(npp, object, args, argCount, result); |
| 60 | } |
| 61 | |
| 62 | NPObject* WebBindings::createObject(NPP npp, NPClass* npClass) |
| 63 | { |
| 64 | return _NPN_CreateObject(npp, npClass); |
| 65 | } |
| 66 | |
| 67 | bool WebBindings::enumerate(NPP npp, NPObject* object, NPIdentifier** identifier, uint32_t* identifierCount) |
| 68 | { |
| 69 | return _NPN_Enumerate(npp, object, identifier, identifierCount); |
| 70 | } |
| 71 | |
| 72 | bool WebBindings::evaluate(NPP npp, NPObject* object, NPString* script, NPVariant* result) |
| 73 | { |
| 74 | return _NPN_Evaluate(npp, object, script, result); |
| 75 | } |
| 76 | |
| 77 | bool WebBindings::evaluateHelper(NPP npp, bool popupsAllowed, NPObject* object, NPString* script, NPVariant* result) |
| 78 | { |
| 79 | return _NPN_EvaluateHelper(npp, popupsAllowed, object, script, result); |
| 80 | } |
| 81 | |
| 82 | NPIdentifier WebBindings::getIntIdentifier(int32_t number) |
| 83 | { |
| 84 | return _NPN_GetIntIdentifier(number); |
| 85 | } |
| 86 | |
| 87 | bool WebBindings::getProperty(NPP npp, NPObject* object, NPIdentifier property, NPVariant* result) |
| 88 | { |
| 89 | return _NPN_GetProperty(npp, object, property, result); |
| 90 | } |
| 91 | |
| 92 | NPIdentifier WebBindings::getStringIdentifier(const NPUTF8* string) |
| 93 | { |
| 94 | return _NPN_GetStringIdentifier(string); |
| 95 | } |
| 96 | |
| 97 | void WebBindings::getStringIdentifiers(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers) |
| 98 | { |
| 99 | _NPN_GetStringIdentifiers(names, nameCount, identifiers); |
| 100 | } |
| 101 | |
| 102 | bool WebBindings::hasMethod(NPP npp, NPObject* object, NPIdentifier method) |
| 103 | { |
| 104 | return _NPN_HasMethod(npp, object, method); |
| 105 | } |
| 106 | |
| 107 | bool WebBindings::hasProperty(NPP npp, NPObject* object, NPIdentifier property) |
| 108 | { |
| 109 | return _NPN_HasProperty(npp, object, property); |
| 110 | } |
| 111 | |
| 112 | bool WebBindings::identifierIsString(NPIdentifier identifier) |
| 113 | { |
| 114 | return _NPN_IdentifierIsString(identifier); |
| 115 | } |
| 116 | |
| 117 | int32_t WebBindings::intFromIdentifier(NPIdentifier identifier) |
| 118 | { |
| 119 | return _NPN_IntFromIdentifier(identifier); |
| 120 | } |
| 121 | |
| 122 | void WebBindings::initializeVariantWithStringCopy(NPVariant* variant, const NPString* value) |
| 123 | { |
| 124 | _NPN_InitializeVariantWithStringCopy(variant, value); |
| 125 | } |
| 126 | |
| 127 | bool WebBindings::invoke(NPP npp, NPObject* object, NPIdentifier method, const NPVariant* args, uint32_t argCount, NPVariant* result) |
| 128 | { |
| 129 | return _NPN_Invoke(npp, object, method, args, argCount, result); |
| 130 | } |
| 131 | |
| 132 | bool WebBindings::invokeDefault(NPP npp, NPObject* object, const NPVariant* args, uint32_t argCount, NPVariant* result) |
| 133 | { |
| 134 | return _NPN_InvokeDefault(npp, object, args, argCount, result); |
| 135 | } |
| 136 | |
| 137 | void WebBindings::releaseObject(NPObject* object) |
| 138 | { |
| 139 | return _NPN_ReleaseObject(object); |
| 140 | } |
| 141 | |
| 142 | void WebBindings::releaseVariantValue(NPVariant* variant) |
| 143 | { |
| 144 | _NPN_ReleaseVariantValue(variant); |
| 145 | } |
| 146 | |
| 147 | bool WebBindings::removeProperty(NPP npp, NPObject* object, NPIdentifier identifier) |
| 148 | { |
| 149 | return _NPN_RemoveProperty(npp, object, identifier); |
| 150 | } |
| 151 | |
| 152 | NPObject* WebBindings::retainObject(NPObject* object) |
| 153 | { |
| 154 | return _NPN_RetainObject(object); |
| 155 | } |
| 156 | |
| 157 | void WebBindings::setException(NPObject* object, const NPUTF8* message) |
| 158 | { |
| 159 | _NPN_SetException(object, message); |
| 160 | } |
| 161 | |
| 162 | bool WebBindings::setProperty(NPP npp, NPObject* object, NPIdentifier identifier, const NPVariant* value) |
| 163 | { |
| 164 | return _NPN_SetProperty(npp, object, identifier, value); |
| 165 | } |
| 166 | |
| 167 | void WebBindings::registerObjectOwner(NPP) |
| 168 | { |
| 169 | } |
| 170 | |
| 171 | void WebBindings::unregisterObjectOwner(NPP) |
| 172 | { |
| 173 | } |
| 174 | |
| 175 | NPP WebBindings::getObjectOwner(NPObject*) |
| 176 | { |
| 177 | return 0; |
| 178 | } |
| 179 | |
| 180 | void WebBindings::unregisterObject(NPObject* object) |
| 181 | { |
| 182 | _NPN_UnregisterObject(object); |
| 183 | } |
| 184 | |
| 185 | NPUTF8* WebBindings::utf8FromIdentifier(NPIdentifier identifier) |
| 186 | { |
| 187 | return _NPN_UTF8FromIdentifier(identifier); |
| 188 | } |
| 189 | |
| 190 | void WebBindings::extractIdentifierData(const NPIdentifier& identifier, const NPUTF8*& string, int32_t& number, bool& isString) |
| 191 | { |
| 192 | PrivateIdentifier* data = static_cast<PrivateIdentifier*>(identifier); |
| 193 | if (!data) { |
| 194 | isString = false; |
| 195 | number = 0; |
| 196 | return; |
| 197 | } |
| 198 | |
| 199 | isString = data->isString; |
| 200 | if (isString) |
| 201 | string = data->value.string; |
| 202 | else |
| 203 | number = data->value.number; |
| 204 | } |
| 205 | |
| 206 | static bool getRangeImpl(NPObject* object, WebRange* webRange, v8::Isolate* isolate) |
| 207 | { |
| 208 | if (!object) |
| 209 | return false; |
| 210 | |
| 211 | V8NPObject* v8NPObject = npObjectToV8NPObject(object); |
| 212 | if (!v8NPObject) |
| 213 | return false; |
| 214 | |
| 215 | v8::HandleScope handleScope(isolate); |
| 216 | v8::Handle<v8::Object> v8Object = v8::Local<v8::Object>::New(isolate, v8NPObject->v8Object); |
| 217 | if (v8Object.IsEmpty()) |
| 218 | return false; |
Torne (Richard Coles) | f79f16f | 2013-10-31 11:16:44 +0000 | [diff] [blame] | 219 | if (!V8Range::wrapperTypeInfo.equals(toWrapperTypeInfo(v8Object))) |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 220 | return false; |
| 221 | |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 222 | Range* native = V8Range::hasInstance(v8Object, isolate) ? V8Range::toNative(v8Object) : 0; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 223 | if (!native) |
| 224 | return false; |
| 225 | |
| 226 | *webRange = WebRange(native); |
| 227 | return true; |
| 228 | } |
| 229 | |
| 230 | static bool getNodeImpl(NPObject* object, WebNode* webNode, v8::Isolate* isolate) |
| 231 | { |
| 232 | if (!object) |
| 233 | return false; |
| 234 | |
| 235 | V8NPObject* v8NPObject = npObjectToV8NPObject(object); |
| 236 | if (!v8NPObject) |
| 237 | return false; |
| 238 | |
| 239 | v8::HandleScope handleScope(isolate); |
| 240 | v8::Handle<v8::Object> v8Object = v8::Local<v8::Object>::New(isolate, v8NPObject->v8Object); |
| 241 | if (v8Object.IsEmpty()) |
| 242 | return false; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 243 | Node* native = V8Node::hasInstance(v8Object, isolate) ? V8Node::toNative(v8Object) : 0; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 244 | if (!native) |
| 245 | return false; |
| 246 | |
| 247 | *webNode = WebNode(native); |
| 248 | return true; |
| 249 | } |
| 250 | |
| 251 | static bool getElementImpl(NPObject* object, WebElement* webElement, v8::Isolate* isolate) |
| 252 | { |
| 253 | if (!object) |
| 254 | return false; |
| 255 | |
| 256 | V8NPObject* v8NPObject = npObjectToV8NPObject(object); |
| 257 | if (!v8NPObject) |
| 258 | return false; |
| 259 | |
| 260 | v8::HandleScope handleScope(isolate); |
| 261 | v8::Handle<v8::Object> v8Object = v8::Local<v8::Object>::New(isolate, v8NPObject->v8Object); |
| 262 | if (v8Object.IsEmpty()) |
| 263 | return false; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 264 | Element* native = V8Element::hasInstance(v8Object, isolate) ? V8Element::toNative(v8Object) : 0; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 265 | if (!native) |
| 266 | return false; |
| 267 | |
| 268 | *webElement = WebElement(native); |
| 269 | return true; |
| 270 | } |
| 271 | |
| 272 | static bool getArrayBufferImpl(NPObject* object, WebArrayBuffer* arrayBuffer, v8::Isolate* isolate) |
| 273 | { |
| 274 | if (!object) |
| 275 | return false; |
| 276 | |
| 277 | V8NPObject* v8NPObject = npObjectToV8NPObject(object); |
| 278 | if (!v8NPObject) |
| 279 | return false; |
| 280 | |
| 281 | v8::HandleScope handleScope(isolate); |
| 282 | v8::Handle<v8::Object> v8Object = v8::Local<v8::Object>::New(isolate, v8NPObject->v8Object); |
| 283 | if (v8Object.IsEmpty()) |
| 284 | return false; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 285 | ArrayBuffer* native = V8ArrayBuffer::hasInstance(v8Object, isolate) ? V8ArrayBuffer::toNative(v8Object) : 0; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 286 | if (!native) |
| 287 | return false; |
| 288 | |
| 289 | *arrayBuffer = WebArrayBuffer(native); |
| 290 | return true; |
| 291 | } |
| 292 | |
| 293 | static bool getArrayBufferViewImpl(NPObject* object, WebArrayBufferView* arrayBufferView, v8::Isolate* isolate) |
| 294 | { |
| 295 | if (!object) |
| 296 | return false; |
| 297 | |
| 298 | V8NPObject* v8NPObject = npObjectToV8NPObject(object); |
| 299 | if (!v8NPObject) |
| 300 | return false; |
| 301 | |
| 302 | v8::HandleScope handleScope(isolate); |
| 303 | v8::Handle<v8::Object> v8Object = v8::Local<v8::Object>::New(isolate, v8NPObject->v8Object); |
| 304 | if (v8Object.IsEmpty()) |
| 305 | return false; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 306 | ArrayBufferView* native = V8ArrayBufferView::hasInstance(v8Object, isolate) ? V8ArrayBufferView::toNative(v8Object) : 0; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 307 | if (!native) |
| 308 | return false; |
| 309 | |
| 310 | *arrayBufferView = WebArrayBufferView(native); |
| 311 | return true; |
| 312 | } |
| 313 | |
Torne (Richard Coles) | 8abfc58 | 2013-09-12 12:10:38 +0100 | [diff] [blame] | 314 | static NPObject* makeIntArrayImpl(const WebVector<int>& data, v8::Isolate* isolate) |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 315 | { |
Torne (Richard Coles) | 8abfc58 | 2013-09-12 12:10:38 +0100 | [diff] [blame] | 316 | v8::HandleScope handleScope(isolate); |
Torne (Richard Coles) | a854de0 | 2013-12-18 16:25:25 +0000 | [diff] [blame] | 317 | v8::Handle<v8::Array> result = v8::Array::New(isolate, data.size()); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 318 | for (size_t i = 0; i < data.size(); ++i) |
Torne (Richard Coles) | 8abfc58 | 2013-09-12 12:10:38 +0100 | [diff] [blame] | 319 | result->Set(i, v8::Number::New(isolate, data[i])); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 320 | |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame] | 321 | DOMWindow* window = currentDOMWindow(isolate); |
Torne (Richard Coles) | 9bbd2f5 | 2013-09-19 22:37:05 +0100 | [diff] [blame] | 322 | return npCreateV8ScriptObject(0, result, window, isolate); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 323 | } |
| 324 | |
Torne (Richard Coles) | 8abfc58 | 2013-09-12 12:10:38 +0100 | [diff] [blame] | 325 | static NPObject* makeStringArrayImpl(const WebVector<WebString>& data, v8::Isolate* isolate) |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 326 | { |
Torne (Richard Coles) | 8abfc58 | 2013-09-12 12:10:38 +0100 | [diff] [blame] | 327 | v8::HandleScope handleScope(isolate); |
Torne (Richard Coles) | a854de0 | 2013-12-18 16:25:25 +0000 | [diff] [blame] | 328 | v8::Handle<v8::Array> result = v8::Array::New(isolate, data.size()); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 329 | for (size_t i = 0; i < data.size(); ++i) |
Torne (Richard Coles) | a854de0 | 2013-12-18 16:25:25 +0000 | [diff] [blame] | 330 | result->Set(i, v8String(isolate, data[i])); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 331 | |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame] | 332 | DOMWindow* window = currentDOMWindow(isolate); |
Torne (Richard Coles) | 9bbd2f5 | 2013-09-19 22:37:05 +0100 | [diff] [blame] | 333 | return npCreateV8ScriptObject(0, result, window, isolate); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 334 | } |
| 335 | |
| 336 | bool WebBindings::getRange(NPObject* range, WebRange* webRange) |
| 337 | { |
| 338 | return getRangeImpl(range, webRange, v8::Isolate::GetCurrent()); |
| 339 | } |
| 340 | |
| 341 | bool WebBindings::getArrayBuffer(NPObject* arrayBuffer, WebArrayBuffer* webArrayBuffer) |
| 342 | { |
| 343 | return getArrayBufferImpl(arrayBuffer, webArrayBuffer, v8::Isolate::GetCurrent()); |
| 344 | } |
| 345 | |
| 346 | bool WebBindings::getArrayBufferView(NPObject* arrayBufferView, WebArrayBufferView* webArrayBufferView) |
| 347 | { |
| 348 | return getArrayBufferViewImpl(arrayBufferView, webArrayBufferView, v8::Isolate::GetCurrent()); |
| 349 | } |
| 350 | |
| 351 | bool WebBindings::getNode(NPObject* node, WebNode* webNode) |
| 352 | { |
| 353 | return getNodeImpl(node, webNode, v8::Isolate::GetCurrent()); |
| 354 | } |
| 355 | |
| 356 | bool WebBindings::getElement(NPObject* element, WebElement* webElement) |
| 357 | { |
| 358 | return getElementImpl(element, webElement, v8::Isolate::GetCurrent()); |
| 359 | } |
| 360 | |
| 361 | NPObject* WebBindings::makeIntArray(const WebVector<int>& data) |
| 362 | { |
Torne (Richard Coles) | 8abfc58 | 2013-09-12 12:10:38 +0100 | [diff] [blame] | 363 | return makeIntArrayImpl(data, v8::Isolate::GetCurrent()); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 364 | } |
| 365 | |
| 366 | NPObject* WebBindings::makeStringArray(const WebVector<WebString>& data) |
| 367 | { |
Torne (Richard Coles) | 8abfc58 | 2013-09-12 12:10:38 +0100 | [diff] [blame] | 368 | return makeStringArrayImpl(data, v8::Isolate::GetCurrent()); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 369 | } |
| 370 | |
| 371 | void WebBindings::pushExceptionHandler(ExceptionHandler handler, void* data) |
| 372 | { |
| 373 | WebCore::pushExceptionHandler(handler, data); |
| 374 | } |
| 375 | |
| 376 | void WebBindings::popExceptionHandler() |
| 377 | { |
| 378 | WebCore::popExceptionHandler(); |
| 379 | } |
| 380 | |
| 381 | void WebBindings::toNPVariant(v8::Local<v8::Value> object, NPObject* root, NPVariant* result) |
| 382 | { |
Torne (Richard Coles) | 9bbd2f5 | 2013-09-19 22:37:05 +0100 | [diff] [blame] | 383 | WebCore::convertV8ObjectToNPVariant(object, root, result, v8::Isolate::GetCurrent()); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 384 | } |
| 385 | |
| 386 | v8::Handle<v8::Value> WebBindings::toV8Value(const NPVariant* variant) |
| 387 | { |
| 388 | v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 389 | if (variant->type == NPVariantType_Object) { |
| 390 | NPObject* object = NPVARIANT_TO_OBJECT(*variant); |
| 391 | V8NPObject* v8Object = npObjectToV8NPObject(object); |
| 392 | if (!v8Object) |
Torne (Richard Coles) | 9bbd2f5 | 2013-09-19 22:37:05 +0100 | [diff] [blame] | 393 | return v8::Undefined(isolate); |
Torne (Richard Coles) | f79f16f | 2013-10-31 11:16:44 +0000 | [diff] [blame] | 394 | return convertNPVariantToV8Object(variant, v8Object->rootObject->frame()->script().windowScriptNPObject(), isolate); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 395 | } |
| 396 | // Safe to pass 0 since we have checked the script object class to make sure the |
| 397 | // argument is a primitive v8 type. |
| 398 | return convertNPVariantToV8Object(variant, 0, isolate); |
| 399 | } |
| 400 | |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 401 | } // namespace blink |