OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 if (!frame) | 455 if (!frame) |
456 return v8::Local<v8::Object>(); | 456 return v8::Local<v8::Object>(); |
457 | 457 |
458 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) | 458 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) |
459 return v8::Local<v8::Object>(); | 459 return v8::Local<v8::Object>(); |
460 | 460 |
461 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 461 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
462 if (!scriptState->contextIsValid()) | 462 if (!scriptState->contextIsValid()) |
463 return v8::Local<v8::Object>(); | 463 return v8::Local<v8::Object>(); |
464 | 464 |
465 v8::Handle<v8::Value> v8value = toV8(m_element.get(), scriptState->context()
->Global(), scriptState->isolate()); | 465 v8::Local<v8::Value> v8value = toV8(m_element.get(), scriptState->context()-
>Global(), scriptState->isolate()); |
466 ASSERT(v8value->IsObject()); | 466 ASSERT(v8value->IsObject()); |
467 | 467 |
468 return v8::Handle<v8::Object>::Cast(v8value); | 468 return v8::Local<v8::Object>::Cast(v8value); |
469 } | 469 } |
470 | 470 |
471 WebString WebPluginContainerImpl::executeScriptURL(const WebURL& url, bool popup
sAllowed) | 471 WebString WebPluginContainerImpl::executeScriptURL(const WebURL& url, bool popup
sAllowed) |
472 { | 472 { |
473 LocalFrame* frame = m_element->document().frame(); | 473 LocalFrame* frame = m_element->document().frame(); |
474 if (!frame) | 474 if (!frame) |
475 return WebString(); | 475 return WebString(); |
476 | 476 |
477 const KURL& kurl = url; | 477 const KURL& kurl = url; |
478 ASSERT(kurl.protocolIs("javascript")); | 478 ASSERT(kurl.protocolIs("javascript")); |
479 | 479 |
480 String script = decodeURLEscapeSequences( | 480 String script = decodeURLEscapeSequences( |
481 kurl.string().substring(strlen("javascript:"))); | 481 kurl.string().substring(strlen("javascript:"))); |
482 | 482 |
483 UserGestureIndicator gestureIndicator(popupsAllowed ? DefinitelyProcessingNe
wUserGesture : PossiblyProcessingUserGesture); | 483 UserGestureIndicator gestureIndicator(popupsAllowed ? DefinitelyProcessingNe
wUserGesture : PossiblyProcessingUserGesture); |
484 v8::HandleScope handleScope(toIsolate(frame)); | 484 v8::HandleScope handleScope(toIsolate(frame)); |
485 v8::Local<v8::Value> result = frame->script().executeScriptInMainWorldAndRet
urnValue(ScriptSourceCode(script)); | 485 v8::Local<v8::Value> result = frame->script().executeScriptInMainWorldAndRet
urnValue(ScriptSourceCode(script)); |
486 | 486 |
487 // Failure is reported as a null string. | 487 // Failure is reported as a null string. |
488 if (result.IsEmpty() || !result->IsString()) | 488 if (result.IsEmpty() || !result->IsString()) |
489 return WebString(); | 489 return WebString(); |
490 return toCoreString(v8::Handle<v8::String>::Cast(result)); | 490 return toCoreString(v8::Local<v8::String>::Cast(result)); |
491 } | 491 } |
492 | 492 |
493 void WebPluginContainerImpl::loadFrameRequest(const WebURLRequest& request, cons
t WebString& target, bool notifyNeeded, void* notifyData) | 493 void WebPluginContainerImpl::loadFrameRequest(const WebURLRequest& request, cons
t WebString& target, bool notifyNeeded, void* notifyData) |
494 { | 494 { |
495 LocalFrame* frame = m_element->document().frame(); | 495 LocalFrame* frame = m_element->document().frame(); |
496 if (!frame || !frame->loader().documentLoader()) | 496 if (!frame || !frame->loader().documentLoader()) |
497 return; // FIXME: send a notification in this case? | 497 return; // FIXME: send a notification in this case? |
498 | 498 |
499 if (notifyNeeded) { | 499 if (notifyNeeded) { |
500 // FIXME: This is a bit of hack to allow us to observe completion of | 500 // FIXME: This is a bit of hack to allow us to observe completion of |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 for (size_t i = 0; i < cutOutRects.size(); i++) | 1011 for (size_t i = 0; i < cutOutRects.size(); i++) |
1012 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 1012 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
1013 } | 1013 } |
1014 | 1014 |
1015 bool WebPluginContainerImpl::pluginShouldPersist() const | 1015 bool WebPluginContainerImpl::pluginShouldPersist() const |
1016 { | 1016 { |
1017 return m_webPlugin->shouldPersist(); | 1017 return m_webPlugin->shouldPersist(); |
1018 } | 1018 } |
1019 | 1019 |
1020 } // namespace blink | 1020 } // namespace blink |
OLD | NEW |