| 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 17 matching lines...) Expand all Loading... |
| 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 */ | 31 */ |
| 32 | 32 |
| 33 #include "bindings/core/v8/ScriptController.h" | 33 #include "bindings/core/v8/ScriptController.h" |
| 34 | 34 |
| 35 #include "bindings/core/v8/BindingSecurity.h" | 35 #include "bindings/core/v8/BindingSecurity.h" |
| 36 #include "bindings/core/v8/ScriptSourceCode.h" | 36 #include "bindings/core/v8/ScriptSourceCode.h" |
| 37 #include "bindings/core/v8/ScriptValue.h" | 37 #include "bindings/core/v8/ScriptValue.h" |
| 38 #include "bindings/core/v8/SourceLocation.h" |
| 38 #include "bindings/core/v8/V8Binding.h" | 39 #include "bindings/core/v8/V8Binding.h" |
| 39 #include "bindings/core/v8/V8Event.h" | 40 #include "bindings/core/v8/V8Event.h" |
| 40 #include "bindings/core/v8/V8GCController.h" | 41 #include "bindings/core/v8/V8GCController.h" |
| 41 #include "bindings/core/v8/V8HTMLElement.h" | 42 #include "bindings/core/v8/V8HTMLElement.h" |
| 42 #include "bindings/core/v8/V8PerContextData.h" | 43 #include "bindings/core/v8/V8PerContextData.h" |
| 43 #include "bindings/core/v8/V8ScriptRunner.h" | 44 #include "bindings/core/v8/V8ScriptRunner.h" |
| 44 #include "bindings/core/v8/V8Window.h" | 45 #include "bindings/core/v8/V8Window.h" |
| 45 #include "bindings/core/v8/WindowProxy.h" | 46 #include "bindings/core/v8/WindowProxy.h" |
| 46 #include "core/dom/Document.h" | 47 #include "core/dom/Document.h" |
| 47 #include "core/dom/Node.h" | 48 #include "core/dom/Node.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 bool ScriptController::canExecuteScripts(ReasonForCallingCanExecuteScripts reaso
n) | 307 bool ScriptController::canExecuteScripts(ReasonForCallingCanExecuteScripts reaso
n) |
| 307 { | 308 { |
| 308 // For performance reasons, we check isInPrivateScriptIsolateWorld() only if | 309 // For performance reasons, we check isInPrivateScriptIsolateWorld() only if |
| 309 // canExecuteScripts is going to return false. | 310 // canExecuteScripts is going to return false. |
| 310 | 311 |
| 311 if (frame()->document() && frame()->document()->isSandboxed(SandboxScripts))
{ | 312 if (frame()->document() && frame()->document()->isSandboxed(SandboxScripts))
{ |
| 312 if (isInPrivateScriptIsolateWorld(isolate())) | 313 if (isInPrivateScriptIsolateWorld(isolate())) |
| 313 return true; | 314 return true; |
| 314 // FIXME: This message should be moved off the console once a solution t
o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. | 315 // FIXME: This message should be moved off the console once a solution t
o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. |
| 315 if (reason == AboutToExecuteScript) | 316 if (reason == AboutToExecuteScript) |
| 316 frame()->document()->addConsoleMessage(ConsoleMessage::create(Securi
tyMessageSource, ErrorMessageLevel, "Blocked script execution in '" + frame()->d
ocument()->url().elidedString() + "' because the document's frame is sandboxed a
nd the 'allow-scripts' permission is not set.")); | 317 frame()->document()->addConsoleMessage(ConsoleMessage::create(Securi
tyMessageSource, ErrorMessageLevel, "Blocked script execution in '" + frame()->d
ocument()->url().elidedString() + "' because the document's frame is sandboxed a
nd the 'allow-scripts' permission is not set.", SourceLocation::capture(frame()-
>document()))); |
| 317 return false; | 318 return false; |
| 318 } | 319 } |
| 319 | 320 |
| 320 if (frame()->document() && frame()->document()->isViewSource()) { | 321 if (frame()->document() && frame()->document()->isViewSource()) { |
| 321 ASSERT(frame()->document()->getSecurityOrigin()->isUnique()); | 322 ASSERT(frame()->document()->getSecurityOrigin()->isUnique()); |
| 322 return true; | 323 return true; |
| 323 } | 324 } |
| 324 | 325 |
| 325 FrameLoaderClient* client = frame()->loader().client(); | 326 FrameLoaderClient* client = frame()->loader().client(); |
| 326 if (!client) | 327 if (!client) |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 for (size_t i = 0; i < resultArray->Length(); ++i) { | 443 for (size_t i = 0; i < resultArray->Length(); ++i) { |
| 443 v8::Local<v8::Value> value; | 444 v8::Local<v8::Value> value; |
| 444 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) | 445 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) |
| 445 return; | 446 return; |
| 446 results->append(value); | 447 results->append(value); |
| 447 } | 448 } |
| 448 } | 449 } |
| 449 } | 450 } |
| 450 | 451 |
| 451 } // namespace blink | 452 } // namespace blink |
| OLD | NEW |