Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: Source/bindings/v8/ScriptController.cpp

Issue 313173012: HTMLParser should use current value of scriptEnabled flag (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@WebKit-ADD
Patch Set: New approach Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/dom/Document.h » ('j') | Source/core/dom/ExecutionContext.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 if (reason == AboutToExecuteScript) 490 if (reason == AboutToExecuteScript)
491 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."); 491 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.");
492 return false; 492 return false;
493 } 493 }
494 494
495 if (m_frame->document() && m_frame->document()->isViewSource()) { 495 if (m_frame->document() && m_frame->document()->isViewSource()) {
496 ASSERT(m_frame->document()->securityOrigin()->isUnique()); 496 ASSERT(m_frame->document()->securityOrigin()->isUnique());
497 return true; 497 return true;
498 } 498 }
499 499
500 Settings* settings = m_frame->settings(); 500 const bool allowed = m_frame->document()->scriptEnabled();
501 const bool allowed = m_frame->loader().client()->allowScript(settings && set tings->scriptEnabled());
502 if (!allowed && reason == AboutToExecuteScript) 501 if (!allowed && reason == AboutToExecuteScript)
503 m_frame->loader().client()->didNotAllowScript(); 502 m_frame->loader().client()->didNotAllowScript();
504 return allowed; 503 return allowed;
505 } 504 }
506 505
507 bool ScriptController::executeScriptIfJavaScriptURL(const KURL& url) 506 bool ScriptController::executeScriptIfJavaScriptURL(const KURL& url)
508 { 507 {
509 if (!protocolIsJavaScript(url)) 508 if (!protocolIsJavaScript(url))
510 return false; 509 return false;
511 510
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 resultArray->Set(i, evaluationResult); 615 resultArray->Set(i, evaluationResult);
617 } 616 }
618 617
619 if (results) { 618 if (results) {
620 for (size_t i = 0; i < resultArray->Length(); ++i) 619 for (size_t i = 0; i < resultArray->Length(); ++i)
621 results->append(ScriptValue(ScriptState::from(context), resultArray- >Get(i))); 620 results->append(ScriptValue(ScriptState::from(context), resultArray- >Get(i)));
622 } 621 }
623 } 622 }
624 623
625 } // namespace WebCore 624 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/Document.h » ('j') | Source/core/dom/ExecutionContext.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698