Issue metadata
Sign in to add a comment
|
chrome.webRequest.onBeforeSendHeaders fails to modify some request headers
Reported by
derj...@googlemail.com,
Oct 5
|
||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.45 Safari/537.36 Steps to reproduce the problem: 1. Install Tampermonkey (https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo) 2. Install the script from here (by entering this URL) http://test.tampermonkey.net/chrome.webRequest.onBeforeSendHeaders_issues.user.js or copy and paste the code from below 3. Go to http://test.tampermonkey.net/empty.html ##### script start ### // ==UserScript== // @name chrome.webRequest.onBeforeSendHeaders issues // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match http://test.tampermonkey.net/empty.html // @grant GM_xmlhttpRequest // @connect self // ==/UserScript== (function() { return new Promise(function(resolve, reject) { var t = Date.now(); GM_xmlhttpRequest({ method: 'GET', url: 'http://test.tampermonkey.net/headers.php', headers: { cookie: 'test=' + t }, onload: function(response) { var rt = response.responseText; console.log(rt); var j = JSON.parse(response.responseText); if (j.cookie && j.cookie.indexOf("test=" + t) != -1) { alert('Setting cookie header works', rt); } else { alert('Setting cookie header did NOT work', rt); debugger; } resolve(); } }); }) })() .then(function() { return new Promise(function(resolve, reject) { GM_xmlhttpRequest({ method: 'GET', url: 'http://test.tampermonkey.net/headers.php', headers: { 'user-agent': 'Tampermonkey' }, onload: function(response) { var rt = response.responseText; console.log(rt); var j = JSON.parse(response.responseText); if (j['user-agent'] == 'Tampermonkey') { alert('Setting user-agent header works', rt); } else { alert('Setting user-agent header did NOT work', rt); debugger; } resolve(); } }); }); }) .then(function() { return new Promise(function(resolve, reject) { GM_xmlhttpRequest({ method: 'GET', url: 'http://test.tampermonkey.net/headers.php', headers: { 'user-agent': '' }, onload: function(response) { var rt = response.responseText; console.log(rt); var j = JSON.parse(response.responseText); if (j['user-agent'] === undefined) { alert('Removing user-agent header works', rt); } else { alert('Removing user-agent header did NOT work', rt); debugger; } resolve(); } }); }); }) ###### script end #### What is the expected behavior? Tampermonkey first tries to set a "Cookie" request header, but this fails. Second Tampermonkey set the "User-Agent" request header, this is working fine. And finally Tampermonkey tries to delete the "User-Agent" request header, but this is not working as again. All header modifications are done via chrome.webRequest.onBeforeSendHeaders. You can check the request headers at the extension's background page dev tools at the network tab. What went wrong? Some headers are not set or removed. This is working fine at Version 69.0.3497.100 and was working in the recent past at the dev and beta Chrome versions as well. WebStore page: https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo Did this work before? Yes Version 69.0.3497.100 (Offizieller Build) (64-Bit) Chrome version: 70.0.3538.45 Channel: beta OS Version: 10.0 Flash Version:
,
Oct 8
derjanb@ Thanks for filling the issue... Tried to reproduce the issue on reported chrome version 70.0.3538.45 using Windows 10. Attaching screen-cast for reference. Steps: --------- 1. Launched reported chrome 2. Navigate to https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo > Added to chrome 3. Navigate to http://test.tampermonkey.net/chrome.webRequest.onBeforeSendHeaders_issues.user.js > Insatlled 4. Navigated to http://test.tampermonkey.net/empty.html As we are observed that > 1. Setting cookie header works, 2. Setting user-agent header works and 3.Removing user-agent header works @Reporter: Could you please check the attached screen cast and please let us know if anything missed from our end. Thanks..!
,
Oct 8
Hi, thanks for looking into this. The screencast is fine. My Windows 10 Home PC (Build 17134) is working as fine well :-(, but I can still reproduce the issue at 2 different Windows 10 virtual machines (Windows 10 Pro - Build 18252 and 17744). I did some more testing I could reproduce the issue at Ubuntu 18.04 (again), but it was gone after a Chrome Beta restart. So the issue seems to happen more flaky than I thought initially. However, at the two Windows VMs it's happing all the time. I'm also sure that it's not related to another extension, because Chrome Beta was installed at the VMs in order to test this. Sorry for not being more helpful. Some more OS/Chrome versions failing here: Windows 10 Build 17744 + Version 71.0.3571.0 (Offizieller Build) canary (64-Bit) Windows 10 Build 17744 + Version 71.0.3573.0 (Offizieller Build) canary (64-Bit)
,
Oct 8
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Oct 9
derjanb@ Thanks for the feedback... As per comment #3 this issue seems to happen more flaky and reproducible on virtual machines. Hence requesting someone from Inhouse to look into it for further triaging and adding TE-NeedsTriageFromHYD label to it. Thanks...!
,
Oct 11
Tested this issue on windows 10 VM build 15025 using chrome reported version #70.0.3538.45 & latest canary #71.0.3577.1 as per steps mentioned in c#0. Observed header set or remove working as expected. Attaching screen cast for reference. @Reporter: Please refer to the screen cast and let us know if anything missed from our end. Thanks!
,
Oct 12
"Unfortunately" you're doing it right, even though you can not reproduce the issue. I just tried it again and could not reproduce it with 70.0.3538.45 anymore, then I've updated Chrome beta to 70.0.3538.54 and it happened again. Please find the screen cast attached.
,
Oct 12
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Oct 12
I discovered one more thing: if there is no _ga cookie set, then setting the cookie header works. However, removing the User-Agent still doesn't work when Chrome is in this "mode". It looks to me like there is a race condition of two methods that are working on the request headers. First the extension and second Chrome's internal request header preparation code. Depending on the timing the extension's modification will become a part of the final headers or not.
,
Oct 22
As per above comment#6 & #7,seems issue is not reproducible on Virtual machines too hence removing needs-bisect & TE-NeedsTriageFromHYD lable for now & as per C#9, requesting someone from extensions team please take a look into this issue. Thanks..!
,
Oct 22
Since TE doesn't able to reproduce the issue, adding TE-NeedsTriageHelp label for further triage. Thanks..!
,
Jan 1
@derjan - your issue is likely be related to this - https://bugs.chromium.org/p/chromium/issues/detail?id=827582#c25 |
|||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||
Comment 1 by krajshree@chromium.org
, Oct 7