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

Side by Side Diff: third_party/WebKit/Source/core/dom/ScriptLoader.cpp

Issue 2644143005: Adjust the <script nonce>-hiding experiment (Closed)
Patch Set: webexposed Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 7 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 // Create a script from the script element node, using the script 540 // Create a script from the script element node, using the script
541 // block's source and the script block's type. 541 // block's source and the script block's type.
542 // Note: This is where the script is compiled and actually executed. 542 // Note: This is where the script is compiled and actually executed.
543 frame->script().executeScriptInMainWorld(sourceCode, accessControlStatus); 543 frame->script().executeScriptInMainWorld(sourceCode, accessControlStatus);
544 544
545 if (isHTMLScriptLoader(m_element) || isSVGScriptLoader(m_element)) { 545 if (isHTMLScriptLoader(m_element) || isSVGScriptLoader(m_element)) {
546 DCHECK(contextDocument->currentScript() == m_element); 546 DCHECK(contextDocument->currentScript() == m_element);
547 contextDocument->popCurrentScript(); 547 contextDocument->popCurrentScript();
548 } 548 }
549 549
550 // "Number used _once_", so, clear it out after execution.
551 if (RuntimeEnabledFeatures::hideNonceContentAttributeEnabled())
552 client()->clearNonce();
553
554 return true; 550 return true;
555 } 551 }
556 552
557 void ScriptLoader::execute() { 553 void ScriptLoader::execute() {
558 DCHECK(!m_willBeParserExecuted); 554 DCHECK(!m_willBeParserExecuted);
559 DCHECK(m_asyncExecType != ScriptRunner::None); 555 DCHECK(m_asyncExecType != ScriptRunner::None);
560 DCHECK(m_pendingScript->resource()); 556 DCHECK(m_pendingScript->resource());
561 bool errorOccurred = false; 557 bool errorOccurred = false;
562 ScriptSourceCode source = m_pendingScript->getSource(KURL(), errorOccurred); 558 ScriptSourceCode source = m_pendingScript->getSource(KURL(), errorOccurred);
563 m_pendingScript->dispose(); 559 m_pendingScript->dispose();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 if (isHTMLScriptLoader(element)) 642 if (isHTMLScriptLoader(element))
647 return toHTMLScriptElement(element)->loader(); 643 return toHTMLScriptElement(element)->loader();
648 644
649 if (isSVGScriptLoader(element)) 645 if (isSVGScriptLoader(element))
650 return toSVGScriptElement(element)->loader(); 646 return toSVGScriptElement(element)->loader();
651 647
652 return 0; 648 return 0;
653 } 649 }
654 650
655 } // namespace blink 651 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698