Unable to access Global variables in chrome.tabs.executescript in V.55.0.2883.75

610 views
Skip to first unread message

Rakesh Adak

unread,
Dec 11, 2016, 9:15:37 AM12/11/16
to Chromium-discuss
Hello,

I recently updated Chrome to version 55.0.2883.75.
I am using a self developed Chrome Plugin to parse my HTML files wherein I use chrome.tabs.executescript to get data from background HTML page.
So when I execute chrome.extension.onRequest, I save the background page's parsed data to a global variable and access it in the callback function of chrome.tabs.executescript and process it.

This was working fine till I update to Version 55.0.2883.75.
How can I access the global variables in the new version ??

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
}

});
}); 

PhistucK

unread,
Dec 11, 2016, 9:18:17 AM12/11/16
to rakesh...@gmail.com, Chromium-discuss
Please, use stackoverflow.com for extension development questions.

If you are pretty sure that this is indeed a Chrome issue, or a backward incompatible change made to Chrome, you can search crbug.com for an existing issue and star it. If you cannot find one, file a new issue using the "New issue" link on the same page.
Please, do not add a "+1" or "Me too" or "Confirmed" (or similar) comment. It just wastes the time of Chrome engineers and sends unnecessary e-mails to all of the people who starred the issue.

You can reply with a link to the found or created issue and might get triaged (and fixed) faster.

Thank you.



PhistucK

--
--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+unsubscribe@chromium.org.

Reply all
Reply to author
Forward
0 new messages