Opened 13 years ago

Closed 10 years ago

#7757 closed enhancement (fixed)

extensible hostenv configuration

Reported by: Adam Peller Owned by: Rawld Gill
Priority: high Milestone: 1.7
Component: Loader Version: 1.2beta
Keywords: needsreview Cc: dante, James Burke, Eugene Lazutkin
Blocked By: Blocking:


Bring back support for wsh from 0.4, the possibility to support new scripting engines. Rather than bake detection schemes in the bootstrap, use a djConfig property to load a new hostenv. Perhaps we can reduce some of the existing autodetection code to further minimize the bootstrap in the long run?

Attachments (1)

hostenv.patch (4.7 KB) - added by Adam Peller 13 years ago.
add djConfig.hostEnv, and try to reduce some code

Download all attachments as: .zip

Change History (13)

Changed 13 years ago by Adam Peller

Attachment: hostenv.patch added

add djConfig.hostEnv, and try to reduce some code

comment:1 Changed 13 years ago by Eugene Lazutkin

Cc: Eugene Lazutkin added

comment:2 Changed 13 years ago by Adam Peller

Milestone: 1.31.4

comment:3 Changed 12 years ago by Adam Peller

Milestone: 1.4future

comment:4 Changed 12 years ago by James Burke

Milestone: future1.5

We'll use this ticket to go a different route for hostenvs. Auto-detection is getting harder to reliably across hostenvs, so we will go with the following model:

  • Change the source dojo.js to be a file that merges _/base/loader/boostrap.js _base/loader/loader.js and _base/loader/hostenv_browser.js. The browser hostenv stuff will be protected by an if(isBrowser) sort of test.
  • When loading in a non-browser environment, you manually load the right hostenv for your env after loading dojo.js

Be sure the build process still holds together, also, I believe loader_xd.js had to be injected before hostenv_browser, but confirm, that might be a wrinkle.

comment:5 Changed 12 years ago by James Burke

Owner: changed from Adam Peller to James Burke

comment:6 Changed 12 years ago by James Burke

(In [22130]) Refs #7757 and Fixes #11090, do not throw an error for just running dojo.js from source in firefox with firebug gbreaking on all errors. Start the migration to hostenvs explicitly indicated by the user as it will be increasingly hard to detect the correct hostenv anyway. \!strict

comment:7 Changed 12 years ago by Adam Peller

Milestone: 1.51.6

comment:8 Changed 12 years ago by Mark Wubben


This does assume there is a djConfig in the global scope, i.e. for Node support that would be annoying.

By the way, there are now unused isRhino etc variables in dojo.js.

comment:9 Changed 12 years ago by James Burke

markwubben: I believe it will just make more sense to build a dojo.js with the target hostenv in mind. While there is some flexibility lost there, I do not see dynamic hostenv detection to be viable going forward though, unless you see another path for it? For CommonJS containers it may work to have one hostenv adapter, but that will assume a common file system module. If we use the sync file system module that may work, but we could get false positives for generic CommonJS detection, if used in the browser.

comment:10 Changed 11 years ago by bill

Milestone: 1.6future

(sadly) punting seemingly abandoned ticket and meta tickets to future

comment:11 Changed 10 years ago by bill

Component: GeneralLoader
Keywords: needsreview added
Milestone: future1.7
Owner: changed from James Burke to Rawld Gill
Status: newassigned

Rawld, didn't you already address this one way or the other in the AMD conversion of 1.7?

comment:12 Changed 10 years ago by Rawld Gill

Resolution: fixed
Status: assignedclosed

The current loader (dojo.js) has the ability to configure it's environment according to either the defaultConfig (baked into dojo.js in either the source or built version) or userConfig as set by one of the global variables dojoConfig, djConfig, or require on entry to the loader.

See the has-protected initialization for the features has-node and has-rhino for examples.

For yet another environment, initialize dojoConfig.loaderPatch as required for the target environment (see examples in dojo/_base/configNode or dojo/_base/configRhino), and set has-node and has-rhino to false.

Note: See TracTickets for help on using tickets.