| 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" |
| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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)) |
| 429 contextDocument->pushCurrentScript(toHTMLScriptElement(m_element)); | 430 contextDocument->pushCurrentScript(HTMLScriptElementOrSVGScriptElement::
fromHTMLScriptElement(toHTMLScriptElement(m_element))); |
| 431 else if (isSVGScriptLoader(m_element)) |
| 432 contextDocument->pushCurrentScript(HTMLScriptElementOrSVGScriptElement::
fromSVGScriptElement(toSVGScriptElement(m_element))); |
| 430 | 433 |
| 431 // Create a script from the script element node, using the script | 434 // Create a script from the script element node, using the script |
| 432 // block's source and the script block's type. | 435 // block's source and the script block's type. |
| 433 // Note: This is where the script is compiled and actually executed. | 436 // Note: This is where the script is compiled and actually executed. |
| 434 frame->script().executeScriptInMainWorld(sourceCode, accessControlStatus, co
mpilationFinishTime); | 437 frame->script().executeScriptInMainWorld(sourceCode, accessControlStatus, co
mpilationFinishTime); |
| 435 | 438 |
| 436 if (isHTMLScriptLoader(m_element)) { | 439 if (isHTMLScriptLoader(m_element) || isSVGScriptLoader(m_element)) { |
| 437 DCHECK(contextDocument->currentScript() == m_element); | 440 DCHECK(contextDocument->currentScript() == m_element); |
| 438 contextDocument->popCurrentScript(); | 441 contextDocument->popCurrentScript(); |
| 439 } | 442 } |
| 440 | 443 |
| 441 return true; | 444 return true; |
| 442 } | 445 } |
| 443 | 446 |
| 444 void ScriptLoader::execute() | 447 void ScriptLoader::execute() |
| 445 { | 448 { |
| 446 DCHECK(!m_willBeParserExecuted); | 449 DCHECK(!m_willBeParserExecuted); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 if (isHTMLScriptLoader(element)) | 526 if (isHTMLScriptLoader(element)) |
| 524 return toHTMLScriptElement(element)->loader(); | 527 return toHTMLScriptElement(element)->loader(); |
| 525 | 528 |
| 526 if (isSVGScriptLoader(element)) | 529 if (isSVGScriptLoader(element)) |
| 527 return toSVGScriptElement(element)->loader(); | 530 return toSVGScriptElement(element)->loader(); |
| 528 | 531 |
| 529 return 0; | 532 return 0; |
| 530 } | 533 } |
| 531 | 534 |
| 532 } // namespace blink | 535 } // namespace blink |
| OLD | NEW |