Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| 11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
| 19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
| 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #include "core/dom/ScriptLoader.h" | 24 #include "core/dom/ScriptLoader.h" |
| 25 | 25 |
| 26 #include "bindings/core/v8/ScriptController.h" | 26 #include "bindings/core/v8/ScriptController.h" |
| 27 #include "bindings/core/v8/ScriptSourceCode.h" | 27 #include "bindings/core/v8/ScriptSourceCode.h" |
| 28 #include "bindings/core/v8/UnionTypesCore.h" | |
|
fs
2016/05/04 10:35:21
Nit: Don't think this include is needed any longer
ramya.v
2016/05/04 10:41:18
Done.
| |
| 28 #include "core/HTMLNames.h" | 29 #include "core/HTMLNames.h" |
| 29 #include "core/SVGNames.h" | 30 #include "core/SVGNames.h" |
| 30 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
| 31 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" | 32 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" |
| 32 #include "core/dom/ScriptLoaderClient.h" | 33 #include "core/dom/ScriptLoaderClient.h" |
| 33 #include "core/dom/ScriptRunner.h" | 34 #include "core/dom/ScriptRunner.h" |
| 34 #include "core/dom/ScriptableDocumentParser.h" | 35 #include "core/dom/ScriptableDocumentParser.h" |
| 35 #include "core/dom/Text.h" | 36 #include "core/dom/Text.h" |
| 36 #include "core/events/Event.h" | 37 #include "core/events/Event.h" |
| 37 #include "core/fetch/AccessControlStatus.h" | 38 #include "core/fetch/AccessControlStatus.h" |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 } else if (sourceCode.resource()->passesAccessControlCheck(m_element->do cument().getSecurityOrigin())) { | 419 } else if (sourceCode.resource()->passesAccessControlCheck(m_element->do cument().getSecurityOrigin())) { |
| 419 accessControlStatus = SharableCrossOrigin; | 420 accessControlStatus = SharableCrossOrigin; |
| 420 } | 421 } |
| 421 } | 422 } |
| 422 | 423 |
| 423 const bool isImportedScript = contextDocument != elementDocument; | 424 const bool isImportedScript = contextDocument != elementDocument; |
| 424 // http://www.whatwg.org/specs/web-apps/current-work/#execute-the-script-blo ck step 2.3 | 425 // http://www.whatwg.org/specs/web-apps/current-work/#execute-the-script-blo ck step 2.3 |
| 425 // with additional support for HTML imports. | 426 // with additional support for HTML imports. |
| 426 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncremente r(m_isExternalScript || isImportedScript ? contextDocument : 0); | 427 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncremente r(m_isExternalScript || isImportedScript ? contextDocument : 0); |
| 427 | 428 |
| 428 if (isHTMLScriptLoader(m_element)) | 429 if (isHTMLScriptLoader(m_element) || isSVGScriptLoader(m_element)) |
| 429 contextDocument->pushCurrentScript(toHTMLScriptElement(m_element)); | 430 contextDocument->pushCurrentScript(m_element); |
| 430 | 431 |
| 431 // Create a script from the script element node, using the script | 432 // Create a script from the script element node, using the script |
| 432 // block's source and the script block's type. | 433 // block's source and the script block's type. |
| 433 // Note: This is where the script is compiled and actually executed. | 434 // Note: This is where the script is compiled and actually executed. |
| 434 frame->script().executeScriptInMainWorld(sourceCode, accessControlStatus, co mpilationFinishTime); | 435 frame->script().executeScriptInMainWorld(sourceCode, accessControlStatus, co mpilationFinishTime); |
| 435 | 436 |
| 436 if (isHTMLScriptLoader(m_element)) { | 437 if (isHTMLScriptLoader(m_element) || isSVGScriptLoader(m_element)) { |
| 437 DCHECK(contextDocument->currentScript() == m_element); | 438 DCHECK(contextDocument->currentScript() == m_element); |
| 438 contextDocument->popCurrentScript(); | 439 contextDocument->popCurrentScript(); |
| 439 } | 440 } |
| 440 | 441 |
| 441 return true; | 442 return true; |
| 442 } | 443 } |
| 443 | 444 |
| 444 void ScriptLoader::execute() | 445 void ScriptLoader::execute() |
| 445 { | 446 { |
| 446 DCHECK(!m_willBeParserExecuted); | 447 DCHECK(!m_willBeParserExecuted); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 523 if (isHTMLScriptLoader(element)) | 524 if (isHTMLScriptLoader(element)) |
| 524 return toHTMLScriptElement(element)->loader(); | 525 return toHTMLScriptElement(element)->loader(); |
| 525 | 526 |
| 526 if (isSVGScriptLoader(element)) | 527 if (isSVGScriptLoader(element)) |
| 527 return toSVGScriptElement(element)->loader(); | 528 return toSVGScriptElement(element)->loader(); |
| 528 | 529 |
| 529 return 0; | 530 return 0; |
| 530 } | 531 } |
| 531 | 532 |
| 532 } // namespace blink | 533 } // namespace blink |
| OLD | NEW |