Issue metadata
Sign in to add a comment
|
json file content differently parsed for windows and mac
Reported by
tarip...@googlemail.com,
Jan 4 2018
|
||||||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36 Steps to reproduce the problem: 1. ajax call a json file 2. output result in console (inspector console) 3. What is the expected behavior? console log should output the same for chrome on windows and chrome on macs. What went wrong? chrome logs the requests result on windows as a json string chrome logs the requests result on mac as a json object Did this work before? Yes sometime in november Chrome version: 63.0.3239.84 Channel: stable OS Version: 10.0 Flash Version: In our project (developed on windows pc) we load the json and then JSON.parse(result) to get the json object for further use. Since chrome on macs seems to automatically convert the files content and parses the reult as a json object the JSON.parse() will fail because the input already is object and not json string.
,
Jan 5 2018
Thanks for filing the issue! @Reporter: Could you please share a sample test file/URL which helps us to triage the issue in a better way. Any further inputs from your end may help us.
,
Jan 5 2018
Attached a shortened version of our json file. Here is the code from the section where the different behaviour occures.
$.ajax({
url: chrome.runtime.getURL(self.getLocalizationBasePath() + self.getLocalization() + '/transifex.json'),
success: function (result) {
self.setLanguageConfig(JSON.parse(result));
},
error: function () {
//DO STUFF
}
});
It is part of a chrome extension so "chrome.runtime.getURL(self.getLocalizationBasePath() + self.getLocalization() + '/transifex.json')" would point to the location of the file.
With Chrome on Mac the result variable would be of type object already and cause the JSON.parse(result) to fail.With Chrome on Windows result will be of type string. Nothing special.
Tried it on several MacBook Pros and MacBook Airs and different Windows Notebooks (win 10). I doubt it is hardware related tho.
,
Jan 5 2018
Thank you for providing more feedback. Adding requester "vamshi.kommuri@techmahindra.com" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jan 5 2018
Tried to set up a fiddle. https://jsfiddle.net/yoj5bhyj/ Here it seems that i get the same behaviour on my windows machine as the macs did in our extension. The loaded file is already an object.
,
Jan 5 2018
jQuery v3.1.1
,
Jan 5 2018
It's if on mac the ajax call automatically add the "dataType: 'json'" parameter.
,
Jan 5 2018
This behavior only happens in the extension, correct? I'm guessing that the Windows machine you are using has a MIME type mapping for the .json file type that's not application/json, or perhaps it doesn't have a mapping at all. File type lookups for files bundled with extensions are sensitive to local configuration.
,
Jan 5 2018
See also issue 797712 .
,
Jan 5 2018
,
Jan 8 2018
Unable to reproduce the issue on reported chrome version 63.0.3239.84 and on the latest canary 65.0.3312.0 using windows 10 with the below mentioned steps. 1. Launched chrome 2. Navigated to https://jsfiddle.net/yoj5bhyj/ 3. Opened Dev tools>console We are able to see the result as an object. Attaching the screen cast of the same. @Reporter: Could you please check the screen cast and let us know if we have missed any steps. And please respond to comment#8. Thanks!
,
Jan 8 2018
Sry I might have been a bit confusing. I got the same result in the fiddle as you. The thing mentioned in Comment 8 might be the reason for the wierd behaviour. I can just reproduce the different result formats in chrome extensions. Made a small test extension for you to try out. My console on windows looks like the screenshot. In the example i have 2 ajax calls one with dataType specified and one without.
,
Jan 8 2018
Thank you for providing more feedback. Adding requester "vamshi.kommuri@techmahindra.com" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jan 9 2018
Unable to reproduce the issue on chrome reported version 63.0.3239.84 and latest canary 65.0.3316.0 with steps mentioned below: 1) Launched chrome reported version and added extension provided in comment# 12 2) Navigated to fiddle: https://jsfiddle.net/yoj5bhyj/ 3) Open Devtools -> console, we are seeing output in the console as "request failed > Object" Now we are seeing the same behaviour of the fiddle without adding the extension provided in comment# 12 @Reporter: Please find the attached screen cast for your reference and let us know if we missed anything in reproducing the issue, please provide your inputs on it. Thanks!
,
Jan 9 2018
,
Jan 9 2018
,
Jan 9 2018
Sry I was unclear once more. With the installed extension just open up any page that matches "https://mail.google.com/*" or "https://inbox.google.com/* In the console drawer of the dev tools you should then hopefully be able to see the logs as in my screenshot. 1. install and enable the extension 2. navigate to "https://mail.google.com/" 3. if redirected to login page ("https://accounts.google.com") sign into any account ("https://accounts.google.com" not included for the content script, sry) 4. Opened Dev tools>console
,
Jan 9 2018
Thank you for providing more feedback. Adding requester "sc00335628@techmahindra.com" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jan 10 2018
We are able to see a similar output with a slight difference in console as per attachment in comment#12 by reporter. Checked the issue on windows 10 on chrome version 63.0.3239.84 with the below mentioned steps. 1. Launched chrome 2. Downloaded/added extension 3. Navigated to https://mail.google.com/ 4. Opened Dev Tools>Console Attaching the screen shot for confirmation. @Reporter: We got the output result as "Object", Clearly shown/marked in attached file. Could you please have a look at the attachment and let us know whether that is the expected result or is it an issue. Thanks!
,
Jan 10 2018
This is correct, the second part of the log should always be object (hence "should be object").
,
Jan 10 2018
Thank you for providing more feedback. Adding requester "vamshi.kommuri@techmahindra.com" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jan 11 2018
@Reporter: Thanks for the confirmation given about the screen shot attached in comment#19. As the issue is not reproducible from TE end, hence removing Needs-Bisect label and requesting you to try the same issue on a fresh profile/new person. Please let us know if the issue still persists even after checking in a new profile. Thanks!
,
Jan 17 2018
Merging into issue 797712 which addresses the same root cause. |
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by krajshree@chromium.org
, Jan 4 2018