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 * | 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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 if (reason == AboutToExecuteScript) | 492 if (reason == AboutToExecuteScript) |
493 m_frame->document()->addConsoleMessage(SecurityMessageSource, ErrorM
essageLevel, "Blocked script execution in '" + m_frame->document()->url().elided
String() + "' because the document's frame is sandboxed and the 'allow-scripts'
permission is not set."); | 493 m_frame->document()->addConsoleMessage(SecurityMessageSource, ErrorM
essageLevel, "Blocked script execution in '" + m_frame->document()->url().elided
String() + "' because the document's frame is sandboxed and the 'allow-scripts'
permission is not set."); |
494 return false; | 494 return false; |
495 } | 495 } |
496 | 496 |
497 if (m_frame->document() && m_frame->document()->isViewSource()) { | 497 if (m_frame->document() && m_frame->document()->isViewSource()) { |
498 ASSERT(m_frame->document()->securityOrigin()->isUnique()); | 498 ASSERT(m_frame->document()->securityOrigin()->isUnique()); |
499 return true; | 499 return true; |
500 } | 500 } |
501 | 501 |
502 const bool allowed = m_frame->document()->scriptEnabled() | 502 Settings* settings = m_frame->settings(); |
| 503 const bool allowed = m_frame->loader().client()->allowScript(settings && set
tings->scriptEnabled()) |
503 || isInPrivateScriptIsolateWorld(m_isolate); | 504 || isInPrivateScriptIsolateWorld(m_isolate); |
504 if (!allowed && reason == AboutToExecuteScript) | 505 if (!allowed && reason == AboutToExecuteScript) |
505 m_frame->loader().client()->didNotAllowScript(); | 506 m_frame->loader().client()->didNotAllowScript(); |
506 return allowed; | 507 return allowed; |
507 } | 508 } |
508 | 509 |
509 bool ScriptController::executeScriptIfJavaScriptURL(const KURL& url) | 510 bool ScriptController::executeScriptIfJavaScriptURL(const KURL& url) |
510 { | 511 { |
511 if (!protocolIsJavaScript(url)) | 512 if (!protocolIsJavaScript(url)) |
512 return false; | 513 return false; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 resultArray->Set(i, evaluationResult); | 622 resultArray->Set(i, evaluationResult); |
622 } | 623 } |
623 | 624 |
624 if (results) { | 625 if (results) { |
625 for (size_t i = 0; i < resultArray->Length(); ++i) | 626 for (size_t i = 0; i < resultArray->Length(); ++i) |
626 results->append(handleScope.Escape(resultArray->Get(i))); | 627 results->append(handleScope.Escape(resultArray->Get(i))); |
627 } | 628 } |
628 } | 629 } |
629 | 630 |
630 } // namespace WebCore | 631 } // namespace WebCore |
OLD | NEW |