Issue metadata
Sign in to add a comment
|
Unable to access Global variables in chrome extension through chrome.tabs.executescript in Chrome version 55.0.2883.75
Reported by
rakeshad...@gmail.com,
Dec 13 2016
|
||||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36
Steps to reproduce the problem:
1.Store any value in global variable of chrome extension javascript
2.Access it in the method "chrome.tabs.executescript"
3.You cant access it.
What is the expected behavior?
You should be able to access global variables in the same javascript defined outside, into "chrome.tabs.executescript" method.
My Code Below :
Step 1 :
chrome.extension.onRequest.addListener(
function (request, sender, sendResponse) {
parser = new DOMParser();
htmlDoc = parser.parseFromString(request.content, "text/html");
//outputJson is a global variable which is Populated here
outputJson = parseMyPage(outputJson, htmlDoc);
});
Step 2:
chrome.tabs.getSelected(null, function (tab) {
// Now inject a script onto the page
chrome.tabs.executeScript(tab.id,{
code: "chrome.extension.sendRequest({content: document.body.innerHTML}, function(response) { console.log('success'); });"
}, function () {
//my code to access global variables
if (outputJson && null != outputJson) {
// other stuff
}
});
});
What went wrong?
The value in the variable is empty when I try to access it inside "chrome.tabs.executescript"
Did this work before? Yes Chrome Version 54
Does this work in other browsers? N/A
Chrome version: 55.0.2883.75 Channel: n/a
OS Version: 14.04
Flash Version: Shockwave Flash 23.0.0.207
It was working fine untill Chrome version 54. When I updated to version 55, it doesnt work.
,
Dec 14 2016
Hi there, Sorry, I didnt get what does the reply "Labels: M-55 prestable-55.0.2883.75" means actually ?? Can you please elaborate ?
,
Dec 15 2016
rakeshadak137@g In order to triage this issue could you please provide the sample extension file and the steps to reproduce the issue. Thank you...
,
Dec 15 2016
,
Feb 12 2018
Issue has not been modified or commented on in the last 365 days, please re-open or file a new bug if this is still an issue. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by ranjitkan@chromium.org
, Dec 14 2016