#26 closed defect (fixed)
dojo.io.bind doesnt allow gettings files from harddrive only through a server
Reported by: | Owned by: | alex | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Core | Version: | |
Keywords: | bind.io | Cc: | |
Blocked By: | Blocking: |
Description
I couldnt get your test_combobox.html to work until I tried to upload the hole chabang to a webserver.
And when I did that it still didnt work in konqueror 3.4.1 turned out that Konq. asked the server if the file comboBoxData.js had changed since last time it was downloaded. the server retured a status 304 (not changed). so the file was never loaded.
I tried to set every requestHeader I could think of but no go, it still sent the same If-notModified-since... header (Header spelled something like that).
I made some workarounds in BrowserIO.js (from rev 825) to get around this.
in function: doLoad
change row 189 from:
if(http.status==200) {
to:
if((http.status==200) (http.getAllResponseHeaders.length==0)){
so that we can get file from disk as well as from web
in function: this.bind
changed async check in row 483 from: if(async){
http.onreadystatechange = function(){
if((4==http.readyState)&&(http.status)){
if(received){ return; } Opera 7.6 is foo-bar'd received = true; doLoad(kwArgs, http, url, query, useCache);
}
}
}
to:
if(async){
http.onreadystatechange = function(){
if((4==http.readyState)){ server returns not modified despite our intention to not question for cache
if((http.status==304)&&(useCache==false)&&(!kwArgsretry?){ call ourselfs one more time but with post instead of GET
quick and dirty hack to get konqueror 3.4.1 running, maybe other versions to kwArgsretry? = true; kwArgsmethod? = "post"; _this.bind(kwArgs); return;
}else if(http.status){
if(received){ return; } Opera 7.6 is foo-bar'd received = true; doLoad(kwArgs, http, url, query, useCache);
}else if((http.getAllResponseHeaders.length==0)){ if we have zero resonseHeaders we are propably requesting a file from filesystem not webserver (usefull when developing a site)
if(received){ return; } Opera 7.6 is foo-bar'd received = true; doLoad(kwArgs, http, url, query, useCache);
}
}
}
}
You propably have some other ideas about how to implement theese changes, anyways I hope they help you in some way.
Best Regards
Fredrik Johansson Sweden
Attachments (1)
Change History (8)
Changed 16 years ago by
Attachment: | BrowserIO.js added |
---|
comment:1 Changed 16 years ago by
Status: | new → assigned |
---|
Does this patch work on Mozilla as well as IE? If so, we'll apply it immediately, since it'll make loading the whole toolkit from disk feasible.
Thank you so much for the patch.
Regards
comment:2 Changed 16 years ago by
Sorry for the late answer, I had to reinstall my win Xp partition so I could test.
Anyways I see you had solved in a much more elegant way.
However when I try this on konqueror it fails.
if I change line 189 From:
if(http.status==200 (location.protocol=="file:" && http.status==0)) {
To:
if(http.status==200 (location.protocol=="file:")) {
then it works on MSIE, Mozilla and Konqueror!
http.status returns undefined in konqueror at this stage. is there a reason for checking http.status when browsing from files, or could this perhaps be changed.
I now that konqueror (KHTML) isnt as widespread as MSIE or Mozilla, but it would be fun if dojo could support it!
comment:3 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Thanks to Paul and David, this is now fixed. From-file loading works on IE, Safari, Moz, and Konq (3.4). Nice work everyone.
comment:4 Changed 15 years ago by
Milestone: | → 0.1alpha |
---|
comment:5 Changed 15 years ago by
Milestone: | 0.1alpha → 0.3release |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
Did some basic testing today on Konq and it seems like this problem has somehow gotten into the codebase again. So I'm reopening this bug.
If the check for http status==0 when file browsing realy is needed, suppose it is as it as gotten inserted again, then you also need to check for undefined as it breaks io.bind on konqueror othervise.
Index: BrowserIO.js =================================================================== --- BrowserIO.js (revision 2994) +++ BrowserIO.js (arbetskopia) @@ -259,7 +259,8 @@
moved successful load stuff here function doLoad(kwArgs, http, url, query, useCache) {
(location.protocol=="file:" && http.status==0)) { |
+ to make khtml work when browsing from disk you need to check for undefined
(location.protocol=="file:" && (http.status==0) | http.status==undefined)) { |
var ret; if(kwArgs.method.toLowerCase() == "head"){
var headers = http.getAllResponseHeaders();
regards / Fredrik Johansson
comment:6 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
This works in trunk now, dont know from what rev.
Setting this as fixed.
/ Fredrik Johansson
support for disk io and workaround for konqueror cache setting