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

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

Issue 1945563002: Set currentScript for SVGScriptElements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary include Created 4 years, 7 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 reserv ed. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } else if (sourceCode.resource()->passesAccessControlCheck(m_element->do cument().getSecurityOrigin())) { 418 } else if (sourceCode.resource()->passesAccessControlCheck(m_element->do cument().getSecurityOrigin())) {
419 accessControlStatus = SharableCrossOrigin; 419 accessControlStatus = SharableCrossOrigin;
420 } 420 }
421 } 421 }
422 422
423 const bool isImportedScript = contextDocument != elementDocument; 423 const bool isImportedScript = contextDocument != elementDocument;
424 // http://www.whatwg.org/specs/web-apps/current-work/#execute-the-script-blo ck step 2.3 424 // http://www.whatwg.org/specs/web-apps/current-work/#execute-the-script-blo ck step 2.3
425 // with additional support for HTML imports. 425 // with additional support for HTML imports.
426 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncremente r(m_isExternalScript || isImportedScript ? contextDocument : 0); 426 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncremente r(m_isExternalScript || isImportedScript ? contextDocument : 0);
427 427
428 if (isHTMLScriptLoader(m_element)) 428 if (isHTMLScriptLoader(m_element) || isSVGScriptLoader(m_element))
429 contextDocument->pushCurrentScript(toHTMLScriptElement(m_element)); 429 contextDocument->pushCurrentScript(m_element);
430 430
431 // Create a script from the script element node, using the script 431 // Create a script from the script element node, using the script
432 // block's source and the script block's type. 432 // block's source and the script block's type.
433 // Note: This is where the script is compiled and actually executed. 433 // Note: This is where the script is compiled and actually executed.
434 frame->script().executeScriptInMainWorld(sourceCode, accessControlStatus, co mpilationFinishTime); 434 frame->script().executeScriptInMainWorld(sourceCode, accessControlStatus, co mpilationFinishTime);
435 435
436 if (isHTMLScriptLoader(m_element)) { 436 if (isHTMLScriptLoader(m_element) || isSVGScriptLoader(m_element)) {
437 DCHECK(contextDocument->currentScript() == m_element); 437 DCHECK(contextDocument->currentScript() == m_element);
438 contextDocument->popCurrentScript(); 438 contextDocument->popCurrentScript();
439 } 439 }
440 440
441 return true; 441 return true;
442 } 442 }
443 443
444 void ScriptLoader::execute() 444 void ScriptLoader::execute()
445 { 445 {
446 DCHECK(!m_willBeParserExecuted); 446 DCHECK(!m_willBeParserExecuted);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 if (isHTMLScriptLoader(element)) 523 if (isHTMLScriptLoader(element))
524 return toHTMLScriptElement(element)->loader(); 524 return toHTMLScriptElement(element)->loader();
525 525
526 if (isSVGScriptLoader(element)) 526 if (isSVGScriptLoader(element))
527 return toSVGScriptElement(element)->loader(); 527 return toSVGScriptElement(element)->loader();
528 528
529 return 0; 529 return 0;
530 } 530 }
531 531
532 } // namespace blink 532 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698