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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 return 0; | 376 return 0; |
377 } | 377 } |
378 | 378 |
379 static NPObject* createScriptObject(LocalFrame* frame, v8::Isolate* isolate) | 379 static NPObject* createScriptObject(LocalFrame* frame, v8::Isolate* isolate) |
380 { | 380 { |
381 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 381 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
382 if (!scriptState->contextIsValid()) | 382 if (!scriptState->contextIsValid()) |
383 return createNoScriptObject(); | 383 return createNoScriptObject(); |
384 | 384 |
385 ScriptState::Scope scope(scriptState); | 385 ScriptState::Scope scope(scriptState); |
386 LocalDOMWindow* window = frame->domWindow(); | 386 LocalDOMWindow* window = frame->localDOMWindow(); |
387 v8::Handle<v8::Value> global = toV8(window, scriptState->context()->Global()
, scriptState->isolate()); | 387 v8::Handle<v8::Value> global = toV8(window, scriptState->context()->Global()
, scriptState->isolate()); |
388 ASSERT(global->IsObject()); | 388 ASSERT(global->IsObject()); |
389 return npCreateV8ScriptObject(isolate, 0, v8::Handle<v8::Object>::Cast(globa
l), window); | 389 return npCreateV8ScriptObject(isolate, 0, v8::Handle<v8::Object>::Cast(globa
l), window); |
390 } | 390 } |
391 | 391 |
392 NPObject* ScriptController::windowScriptNPObject() | 392 NPObject* ScriptController::windowScriptNPObject() |
393 { | 393 { |
394 if (m_windowScriptNPObject) | 394 if (m_windowScriptNPObject) |
395 return m_windowScriptNPObject; | 395 return m_windowScriptNPObject; |
396 | 396 |
(...skipping 15 matching lines...) Expand all Loading... |
412 { | 412 { |
413 // Can't create NPObjects when JavaScript is disabled. | 413 // Can't create NPObjects when JavaScript is disabled. |
414 if (!canExecuteScripts(NotAboutToExecuteScript)) | 414 if (!canExecuteScripts(NotAboutToExecuteScript)) |
415 return createNoScriptObject(); | 415 return createNoScriptObject(); |
416 | 416 |
417 ScriptState* scriptState = ScriptState::forMainWorld(m_frame); | 417 ScriptState* scriptState = ScriptState::forMainWorld(m_frame); |
418 if (!scriptState->contextIsValid()) | 418 if (!scriptState->contextIsValid()) |
419 return createNoScriptObject(); | 419 return createNoScriptObject(); |
420 | 420 |
421 ScriptState::Scope scope(scriptState); | 421 ScriptState::Scope scope(scriptState); |
422 LocalDOMWindow* window = m_frame->domWindow(); | 422 LocalDOMWindow* window = m_frame->localDOMWindow(); |
423 v8::Handle<v8::Value> v8plugin = toV8(plugin, scriptState->context()->Global
(), scriptState->isolate()); | 423 v8::Handle<v8::Value> v8plugin = toV8(plugin, scriptState->context()->Global
(), scriptState->isolate()); |
424 if (!v8plugin->IsObject()) | 424 if (!v8plugin->IsObject()) |
425 return createNoScriptObject(); | 425 return createNoScriptObject(); |
426 | 426 |
427 return npCreateV8ScriptObject(scriptState->isolate(), 0, v8::Handle<v8::Obje
ct>::Cast(v8plugin), window); | 427 return npCreateV8ScriptObject(scriptState->isolate(), 0, v8::Handle<v8::Obje
ct>::Cast(v8plugin), window); |
428 } | 428 } |
429 | 429 |
430 void ScriptController::clearWindowProxy() | 430 void ScriptController::clearWindowProxy() |
431 { | 431 { |
432 double start = currentTime(); | 432 double start = currentTime(); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 resultArray->Set(i, evaluationResult); | 644 resultArray->Set(i, evaluationResult); |
645 } | 645 } |
646 | 646 |
647 if (results) { | 647 if (results) { |
648 for (size_t i = 0; i < resultArray->Length(); ++i) | 648 for (size_t i = 0; i < resultArray->Length(); ++i) |
649 results->append(handleScope.Escape(resultArray->Get(i))); | 649 results->append(handleScope.Escape(resultArray->Get(i))); |
650 } | 650 } |
651 } | 651 } |
652 | 652 |
653 } // namespace blink | 653 } // namespace blink |
OLD | NEW |