OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
3 * Copyright (C) 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009 Apple Inc. All rights reserved. |
4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
8 * met: | 8 * met: |
9 * | 9 * |
10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 return 0; | 377 return 0; |
378 } | 378 } |
379 | 379 |
380 static NPObject* createScriptObject(LocalFrame* frame, v8::Isolate* isolate) | 380 static NPObject* createScriptObject(LocalFrame* frame, v8::Isolate* isolate) |
381 { | 381 { |
382 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 382 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
383 if (!scriptState->contextIsValid()) | 383 if (!scriptState->contextIsValid()) |
384 return createNoScriptObject(); | 384 return createNoScriptObject(); |
385 | 385 |
386 ScriptState::Scope scope(scriptState); | 386 ScriptState::Scope scope(scriptState); |
387 LocalDOMWindow* window = frame->domWindow(); | 387 LocalDOMWindow* window = frame->localDOMWindow(); |
388 v8::Handle<v8::Value> global = toV8(window, scriptState->context()->Global()
, scriptState->isolate()); | 388 v8::Handle<v8::Value> global = toV8(window, scriptState->context()->Global()
, scriptState->isolate()); |
389 ASSERT(global->IsObject()); | 389 ASSERT(global->IsObject()); |
390 return npCreateV8ScriptObject(isolate, 0, v8::Handle<v8::Object>::Cast(globa
l), window); | 390 return npCreateV8ScriptObject(isolate, 0, v8::Handle<v8::Object>::Cast(globa
l), window); |
391 } | 391 } |
392 | 392 |
393 NPObject* ScriptController::windowScriptNPObject() | 393 NPObject* ScriptController::windowScriptNPObject() |
394 { | 394 { |
395 if (m_windowScriptNPObject) | 395 if (m_windowScriptNPObject) |
396 return m_windowScriptNPObject; | 396 return m_windowScriptNPObject; |
397 | 397 |
(...skipping 15 matching lines...) Expand all Loading... |
413 { | 413 { |
414 // Can't create NPObjects when JavaScript is disabled. | 414 // Can't create NPObjects when JavaScript is disabled. |
415 if (!canExecuteScripts(NotAboutToExecuteScript)) | 415 if (!canExecuteScripts(NotAboutToExecuteScript)) |
416 return createNoScriptObject(); | 416 return createNoScriptObject(); |
417 | 417 |
418 ScriptState* scriptState = ScriptState::forMainWorld(m_frame); | 418 ScriptState* scriptState = ScriptState::forMainWorld(m_frame); |
419 if (!scriptState->contextIsValid()) | 419 if (!scriptState->contextIsValid()) |
420 return createNoScriptObject(); | 420 return createNoScriptObject(); |
421 | 421 |
422 ScriptState::Scope scope(scriptState); | 422 ScriptState::Scope scope(scriptState); |
423 LocalDOMWindow* window = m_frame->domWindow(); | 423 LocalDOMWindow* window = m_frame->localDOMWindow(); |
424 v8::Handle<v8::Value> v8plugin = toV8(plugin, scriptState->context()->Global
(), scriptState->isolate()); | 424 v8::Handle<v8::Value> v8plugin = toV8(plugin, scriptState->context()->Global
(), scriptState->isolate()); |
425 if (!v8plugin->IsObject()) | 425 if (!v8plugin->IsObject()) |
426 return createNoScriptObject(); | 426 return createNoScriptObject(); |
427 | 427 |
428 return npCreateV8ScriptObject(scriptState->isolate(), 0, v8::Handle<v8::Obje
ct>::Cast(v8plugin), window); | 428 return npCreateV8ScriptObject(scriptState->isolate(), 0, v8::Handle<v8::Obje
ct>::Cast(v8plugin), window); |
429 } | 429 } |
430 | 430 |
431 void ScriptController::clearWindowProxy() | 431 void ScriptController::clearWindowProxy() |
432 { | 432 { |
433 double start = currentTime(); | 433 double start = currentTime(); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 resultArray->Set(i, evaluationResult); | 648 resultArray->Set(i, evaluationResult); |
649 } | 649 } |
650 | 650 |
651 if (results) { | 651 if (results) { |
652 for (size_t i = 0; i < resultArray->Length(); ++i) | 652 for (size_t i = 0; i < resultArray->Length(); ++i) |
653 results->append(handleScope.Escape(resultArray->Get(i))); | 653 results->append(handleScope.Escape(resultArray->Get(i))); |
654 } | 654 } |
655 } | 655 } |
656 | 656 |
657 } // namespace blink | 657 } // namespace blink |
OLD | NEW |