| OLD | NEW |
| 1 // Copyright (c) 2013, Google Inc. | 1 // Copyright (c) 2013, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | 29 |
| 30 #include "config.h" | 30 #include "config.h" |
| 31 #include "bindings/dart/DartAsyncLoader.h" | 31 #include "bindings/dart/DartAsyncLoader.h" |
| 32 | 32 |
| 33 #include "FetchInitiatorTypeNames.h" | 33 #include "FetchInitiatorTypeNames.h" |
| 34 #include "bindings/dart/DartApplicationLoader.h" | 34 #include "bindings/dart/DartApplicationLoader.h" |
| 35 #include "bindings/dart/DartNativeExtensions.h" |
| 35 #include "bindings/dart/DartUtilities.h" | 36 #include "bindings/dart/DartUtilities.h" |
| 36 #include "bindings/v8/ScriptSourceCode.h" | 37 #include "bindings/v8/ScriptSourceCode.h" |
| 37 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
| 38 #include "core/dom/ScriptLoader.h" | 39 #include "core/dom/ScriptLoader.h" |
| 39 #include "core/dom/ScriptLoaderClient.h" | 40 #include "core/dom/ScriptLoaderClient.h" |
| 40 #include "core/fetch/FetchRequest.h" | 41 #include "core/fetch/FetchRequest.h" |
| 41 #include "core/fetch/ResourceClient.h" | 42 #include "core/fetch/ResourceClient.h" |
| 42 #include "core/fetch/ResourceFetcher.h" | 43 #include "core/fetch/ResourceFetcher.h" |
| 43 #include "core/fetch/ScriptResource.h" | 44 #include "core/fetch/ScriptResource.h" |
| 44 #include "core/html/HTMLScriptElement.h" | 45 #include "core/html/HTMLScriptElement.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 return Dart_NewApiError("The requested built-in library is not available
on Dartium."); | 324 return Dart_NewApiError("The requested built-in library is not available
on Dartium."); |
| 324 } | 325 } |
| 325 | 326 |
| 326 RefPtr<DartAsyncLoader> loader = DartDOMData::current()->applicationLoader()
->asyncLoader(); | 327 RefPtr<DartAsyncLoader> loader = DartDOMData::current()->applicationLoader()
->asyncLoader(); |
| 327 ASSERT(loader); | 328 ASSERT(loader); |
| 328 | 329 |
| 329 // Fetch non-system URLs. | 330 // Fetch non-system URLs. |
| 330 if (tag == Dart_kImportTag) { | 331 if (tag == Dart_kImportTag) { |
| 331 if (loader->m_pendingLibraries.contains(url)) | 332 if (loader->m_pendingLibraries.contains(url)) |
| 332 return Dart_True(); | 333 return Dart_True(); |
| 334 if (url.startsWith("dart-ext:")) { |
| 335 return DartNativeExtensions::loadExtension(url, library); |
| 336 } |
| 333 loader->m_pendingLibraries.add(url); | 337 loader->m_pendingLibraries.add(url); |
| 334 } else if (tag == Dart_kSourceTag) { | 338 } else if (tag == Dart_kSourceTag) { |
| 335 Dart_PersistentHandle importer = Dart_NewPersistentHandle(library); | 339 Dart_PersistentHandle importer = Dart_NewPersistentHandle(library); |
| 336 HandleSet* importers; | 340 HandleSet* importers; |
| 337 if (loader->m_pendingSource.contains(url)) { | 341 if (loader->m_pendingSource.contains(url)) { |
| 338 // We have already requested this url. It is a part of more than one
library. | 342 // We have already requested this url. It is a part of more than one
library. |
| 339 importers = loader->m_pendingSource.get(url); | 343 importers = loader->m_pendingSource.get(url); |
| 340 importers->append(importer); | 344 importers->append(importer); |
| 341 return Dart_True(); | 345 return Dart_True(); |
| 342 } | 346 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 ResourcePtr<ScriptResource> scriptResource = m_loadCallback->requestScript(r
equest); | 433 ResourcePtr<ScriptResource> scriptResource = m_loadCallback->requestScript(r
equest); |
| 430 if (scriptResource) { | 434 if (scriptResource) { |
| 431 scriptResource->addClient(new ScriptLoadedCallback(m_loadCallback->compl
eteURL(url), this, scriptResource)); | 435 scriptResource->addClient(new ScriptLoadedCallback(m_loadCallback->compl
eteURL(url), this, scriptResource)); |
| 432 } else { | 436 } else { |
| 433 m_error = true; | 437 m_error = true; |
| 434 m_loadCallback->reportError(String("File request error"), url); | 438 m_loadCallback->reportError(String("File request error"), url); |
| 435 } | 439 } |
| 436 } | 440 } |
| 437 | 441 |
| 438 } | 442 } |
| OLD | NEW |