Opened 11 years ago
Closed 9 years ago
#11230 closed defect (fixed)
Dojo fails to detect successfully loaded resources (chrome-extension)
Reported by: | yveskurz | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.7 |
Component: | Core | Version: | 1.4.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
I'm writing a Chrome Web App which is using an embedded version of Dojo. This currently does not work as dojo.js fails to load with the following error:
Uncaught Error: Could not load 'dojo._base.lang'; last tried './_base/lang.js'
The cause for this is that xhr returns status code 0 on a successfully loaded resources with the consequence that dojo._isDocumentOk() (hostenv_browser.js) returns false.
The problem can be easily fixed by adding "chrome-extension:" to the list of stange behaving protocols.
I have no idea if that is the correct fix but changing the function as follows allows me to use Dojo in my Chrome Web App.
d._isDocumentOk = function(http){ var stat = http.status || 0, lp = location.protocol; return (stat >= 200 && stat < 300) || // Boolean stat == 304 || // allow any 2XX stat == 1223 || // cache (!stat && (lp == "file:" || lp == "chrome:" || lp == "app:" || lp == "chrome-extension:")); }
Change History (15)
comment:1 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 Changed 11 years ago by
Milestone: | tbd → 1.5 |
---|
comment:3 Changed 11 years ago by
James, it strikes me that you're testing location.protocol
, which is the protocol for the host environment resource (i.e. chrome-extension://uniqueid/background.html
) rather than the protocol of the requested URL.
comment:4 Changed 11 years ago by
came in a regression report via github: http://github.com/dojo/dojo/commit/4b7b06157413a98b88b814ee307543a9ffa0ce34#commitcomment-86882
comment:5 Changed 11 years ago by
markwubben: yes, this is by design, the 0 status should depend on the page/host environment resource. I am tempted to just treat a non-existent status as just OK though and remove all those checks. I am not sure though if there is a case where status is legitimately 0 and indicates an error though.
dante: I read that comment as saying they were having a general problem in Chrome on OSX even before this change and asking if this change would fix their issue. I left a comment for them and hopefully we can get clarification.
comment:6 Changed 10 years ago by
comment:7 Changed 10 years ago by
comment:8 Changed 10 years ago by
comment:9 Changed 10 years ago by
Milestone: | 1.5 → tbd |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
comment:10 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:11 Changed 10 years ago by
Milestone: | tbd → 1.6.1 |
---|
comment:12 Changed 10 years ago by
Milestone: | 1.6.1 → tbd |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
oops. meant to close #12516. leave this open.
comment:13 Changed 10 years ago by
Owner: | anonymous deleted |
---|
comment:14 Changed 9 years ago by
Keywords: | needsreview added |
---|---|
Priority: | high → low |
comment:15 Changed 9 years ago by
Keywords: | needsreview removed |
---|---|
Milestone: | tbd → 1.7 |
Resolution: | → fixed |
Status: | reopened → closed |
This ticket doesn't really make sense anymore, because in the AMD world we load via <script> tags not via XHR. So I'm going to close it as fixed w/the introduction of AMD.
(In [22260]) Fixes #11230, allow dojo loader to work in chrome extension.