Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 254553 Details for
Bug 470500
Investigate decreasing the number of scripts loaded by requirejs in the worker at dev-time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
requirejs patched to use xhr and blob urls instead of just importScripts
asBlob_importScripts_requirejs.txt (text/plain), 2.96 KB, created by
Simon Kaegi
on 2015-06-18 12:26:46 EDT
(
hide
)
Description:
requirejs patched to use xhr and blob urls instead of just importScripts
Filename:
MIME Type:
Creator:
Simon Kaegi
Created:
2015-06-18 12:26:46 EDT
Size:
2.96 KB
patch
obsolete
>diff --git a/bundles/org.eclipse.orion.client.core/web/requirejs/require.js b/bundles/org.eclipse.orion.client.core/web/requirejs/require.js >index 77a5bb1..878b415 100644 >--- a/bundles/org.eclipse.orion.client.core/web/requirejs/require.js >+++ b/bundles/org.eclipse.orion.client.core/web/requirejs/require.js >@@ -1830,6 +1830,24 @@ > return node; > }; > >+ function _asBlobURL(url, cb) { >+ var xhr = new XMLHttpRequest(); >+ xhr.open('GET', url, true); >+ xhr.responseType = 'blob'; >+ >+ xhr.onload = function(e) { >+ if (this.status == 200) { >+ // Note: .response instead of .responseText >+ var blob = new Blob([this.response], {type: 'text/javascript'}); >+ var blobURL = URL.createObjectURL(blob); >+ cb(blobURL); >+ URL.revokeObjectURL(blobURL); >+ } >+ }; >+ xhr.send(); >+ } >+ >+ > /** > * Does the request to load a module for the browser case. > * Make this a separate function to allow other environments >@@ -1906,24 +1924,27 @@ > > return node; > } else if (isWebWorker) { >- try { >- //In a web worker, use importScripts. This is not a very >- //efficient use of importScripts, importScripts will block until >- //its script is downloaded and evaluated. However, if web workers >- //are in play, the expectation that a build has been done so that >- //only one script needs to be loaded anyway. This may need to be >- //reevaluated if other use cases become common. >- importScripts(url); >- >- //Account for anonymous modules >- context.completeLoad(moduleName); >- } catch (e) { >- context.onError(makeError('importscripts', >- 'importScripts failed for ' + >- moduleName + ' at ' + url, >- e, >- [moduleName])); >- } >+ _asBlobURL(url, function(url) { >+ try { >+ //In a web worker, use importScripts. This is not a very >+ //efficient use of importScripts, importScripts will block until >+ //its script is downloaded and evaluated. However, if web workers >+ //are in play, the expectation that a build has been done so that >+ //only one script needs to be loaded anyway. This may need to be >+ //reevaluated if other use cases become common. >+ importScripts(url); >+ >+ //Account for anonymous modules >+ context.completeLoad(moduleName); >+ >+ } catch (e) { >+ context.onError(makeError('importscripts', >+ 'importScripts failed for ' + >+ moduleName + ' at ' + url, >+ e, >+ [moduleName])); >+ } >+ }); > } > }; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 470500
: 254553