Issue metadata
Sign in to add a comment
|
chrome.runtime not exposed/undefined
Reported by
priya.tr...@gmail.com,
Apr 20 2018
|
||||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36
Steps to reproduce the problem:
1.
2.
3.
What is the expected behavior?
What went wrong?
In my extension, I use chrome.runtime.onMessage, it works well on privious chome version but i am updated chome now its not working
Did this work before? Yes on privious version its working but now its not current version is Version 66.0.3359.117 (Official Build) (32-bit)
Does this work in other browsers? Yes
Chrome version: 66.0.3359.117 Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version:
Version 66.0.3359.117 (Official Build) (32-bit)
I am using this java script code
chrome.runtime.sendMessage(this.extensionId, messageToken,
function(response) {
if (!response.success)
handleError(url);
});
it was working before
,
Apr 20 2018
this.extensionId have value this was working before update
,
Apr 20 2018
PFA
,
Apr 20 2018
,
Apr 22 2018
,
Apr 23 2018
Thanks for filing the issue! @Reporter: Could you please provide sample extension/test file that reproduces the issue which helps us in further triaging it from our end. Thanks!
,
Apr 23 2018
Thanks for reverting on issue ,
java script code using at my end :
const VFD = {
extensionId: "myid",
strPort: port,
strFirstLine: " WELCOME",
strSecondLine: "",
write: function(strFirstLine, strSecondLine) {
if (typeof chrome != "undefined") {
this.strFirstLine = strFirstLine;
this.strSecondLine = strSecondLine;
if (this.strPort != "" && this.strFirstLine != "") {
var messageToken = {
"port": this.strPort,
"firstLine": this.strFirstLine,
"secondLine": this.strSecondLine,
}
chrome.runtime.sendMessage(this.extensionId, messageToken, this.onSend);
}
}
},
onSend: function(response) {
},
};
chrome extension code :
PFA for chrome extension files
,
Apr 23 2018
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
,
Apr 23 2018
please look in to files and let know where is the issue because before updating chrome all working fine after i update chrome to Version 66.0.3359.117 the chrome.runtime.sendMessage gives Type error i tried other methods and properties also but it gives error for all chrome.runtime methods and properties e.g chrome.runtime.id this also gives same error
,
Apr 23 2018
,
Apr 24 2018
Tried checking the issue on reported chrome version 66.0.3359.117 using Windows 10 with the below mentioned steps. 1. Launched chrome 2. Downloaded files scripts.js and manifest.json 3. Placed the above mentioned files in a folder. 4. Navigated to Chrome://extensions 5. Turned on Developer mode and tried loading the unpacked extension. We are getting an error while loading extension. Attaching the screenshot of the same. @Reporter: Could you please share sample test extension which helps us to triage the issue in a better way.
,
Apr 24 2018
#9 - the files you attached failed to load as an unpacked application (side note - this is a Chrome application, not a Chrome extension and it will not work for long on Windows anyway, because Chrome applications are deprecated everywhere but Chrome OS). scripts.js versus background.js Also, it uses onMessageExternal and not onMessage. Please, be explicit, specific and accurate in your reproduction steps and attachments, otherwise the test team will simply ask for correct reproduction until you do.
,
Apr 24 2018
java script code using at my end :
const VFD = {
extensionId: "myid",
strPort: port,
strFirstLine: " WELCOME",
strSecondLine: "",
write: function(strFirstLine, strSecondLine) {
if (typeof chrome != "undefined") {
this.strFirstLine = strFirstLine;
this.strSecondLine = strSecondLine;
if (this.strPort != "" && this.strFirstLine != "") {
var messageToken = {
"port": this.strPort,
"firstLine": this.strFirstLine,
"secondLine": this.strSecondLine,
}
chrome.runtime.sendMessage(this.extensionId, messageToken, this.onSend);
}
}
},
onSend: function(response) {
},
};
chrome extension code :
PFA for chrome extension files
The error occur in my client side(javascript) code on chrome.runtime.sendMessage(this.extensionId, messageToken, this.onSend); this line
even i am trying to access any methos or properties of chrome.runtime it gives type error
i think problem is not with the extention code problem is with "chrome.runtime"
,
Apr 24 2018
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
,
Apr 24 2018
#13 - what is supposed to be done with the code you mentioned under "java script code using at my end :"? Where and how should it run? I cannot find it within the ZIP. Separate code and ZIP without instructions are really hard to work with. Please, attach a complete example.
,
Apr 24 2018
the zip contains chrome extension code. and the separate code is calling that extension from webpage. even u can try at u r end ======> u can try at u r end only call "chrome.runtime.id" in javascript it also gives type error
,
Apr 24 2018
Hopefully this summary is more informative and defines the actual problem. (I have not tried to reproduce it)
,
Apr 24 2018
please do not complicate both the things extension is working fine. have u tried to call "chrome.runtime.id" in u r plain JavaScript file . please do that u got problem automatically.
,
Apr 24 2018
actual problem is with chrome.runtime because before chrome update its working fine we are using this from jan 2017 to till date but i have updated chrome and it stopped working . if i use any method or property of chrome.runtime it gives me this error ===> TypeError: Cannot read property 'sendMessage' of undefined u can try any of method or property from this link https://developer.chrome.com/apps/runtime it is not working on chrome Version 66.0.3359.117
,
Apr 25 2018
Issue 836707 has been merged into this issue.
,
Apr 25 2018
,
Apr 25 2018
,
Apr 25 2018
Issue 831821 has been merged into this issue.
,
Apr 25 2018
Whats the solution?? on my issue
,
Apr 25 2018
,
Apr 25 2018
Tested the issue on chrome reported version 66.0.3359.117 using Windows-10 with steps mentioned below: 1) Launched chrome version, added the extension provided in comment# 13 2) Clicked on "background page" link on chrome://extensions for provided extension, Developers tools winodow got opened and didn't observed any error as shown in screenshot provided in comment#3 3) Opened Devtools for chrome://extensions page and in console didn't observed any error messages. Observations: Also tested the issue by giving "chrome.runtime.id" in console, didn't observed any error messages @Reporter: Please find the attached screencast for your reference and let us know if we missed anything in reproducing the issue, provide your feedback on it which help in further triaging it, if possible could you please provide screencast of the issue which help in better understanding. Thanks!
,
Apr 25 2018
,
Apr 25 2018
For at least some of these cases from the duped bugs, I think this was caused by revision 39f8939309fe39bccc17fa1280b6c7f25c411947. This modified the externally_connectable property of the cryptotoken component extension (automatically built into Chrome) to only accept incoming connections from https URLs, whereas previously it was all URLs. When it was set to all URLs, chrome.runtime.sendMessage would always be available because any URL could potentially send a message to the cryptotoken component extension. However, this is working as intended. The cryptotoken extension only accepts connections from https origins (so any others would be ignored), and sending a message to any other extension would require the receiving extension to list the URL in the externally_connectable options. Additionally, this means that before, any extension relying on this behavior would likely have failed to send the message, but done so asynchronously (once the message failed to find an appropriate receiver) rather than synchronously (since runtime is undefined). If the extension lists the URL in externally_connectable, then chrome.runtime should still be present. If the extension does not list the site in externally_connectable, then chrome.runtime not being available is intended behavior. Is there any case in which chrome.runtime is undefined for non-sandboxed chrome-extension:// pages, or for web pages where an installed extension specifies that web page's URL in the externally_connectable field of the manifest? If so, please attach an extension that demonstrates this issue. If not, this sounds like it's WAI.
,
Apr 26 2018
yes in my case if i try console.log(chrome.runtime); it gives me undefined in my web pages
,
Apr 26 2018
reference from comment No 29 : Is chrome fixing that issue revision 39f8939309fe39bccc17fa1280b6c7f25c411947. because on before this Version 66.0.3359.117 it was working for externally_connectable to <all_urls> .
,
Apr 26 2018
Revision 39f8939309fe39bccc17fa1280b6c7f25c411947 is working as intended. If there is no extension with a matching externally_connectable entry in the manifest, chrome.runtime should not be defined. The cryptotoken extension only accepts connections from https origins (and only in a defined format). Web pages should not rely on chrome.runtime being available if there is not a connectable extension installed.
,
Apr 26 2018
,
Apr 27 2018
Issue 837429 has been merged into this issue.
,
Apr 27 2018
Able to reproduce the issue as per Issue 837429 on reported version 66.0.3359.117 & on latest canary chrome 68.0.3406.0 using Ubuntu 14.04, Windows 10 and Mac OS 10.13. Below is the Bisect Info: ================ Good build: 66.0.3345.0 Bad build: 66.0.3347.0 You are probably looking for a change made after 536225 (known good), but no later than 536241 (first known bad). CHANGELOG URL: https://chromium.googlesource.com/chromium/src/+log/0bd695d8d6dcbb04eef8c2ef6ef65769ea539026..592ce94596639204c1b9e21fa7de7e3953f568b3 suspect: https://chromium.googlesource.com/chromium/src/+/39f8939309fe39bccc17fa1280b6c7f25c411947 @rdevlin: Could you please take a look at this. Thanks! Note: not adding blocker as this seems to be WAI as per C#32.
,
Apr 27 2018
@35 Please see previous comments. This so far seems to be WAI, thus not a regression, nor targeting a specific milestone.
,
Apr 27 2018
@rdevlin.cronin - See the ZIP attached to comment 13 - it does mention "externally_connectable": "<all_urls>" (or similar, I do not remember the syntax). (Sorry for perhaps merging different issues into this one)
,
Apr 27 2018
Normal extensions are not allowed to specify <all_urls> (or other patterns that match all hosts under a given eTLD). <all_urls>, *://*/*, *://*.com/*, etc, are all disallowed. This is documented here at https://developer.chrome.com/extensions/manifest/externally_connectable, and when the extension is loaded, a warning is shown: "Wildcard domain patterns such as "<all_urls>" are not allowed" The cryptotoken extension was whitelisted to be able to do this as a component extension.
,
Apr 27 2018
#38 - That must have been it. My hunch says that this is working as intended, then.
,
Apr 27 2018
#0 - try to be more specific with your host names in externally_connected and see if you still have an issue.
,
Apr 30 2018
The NextAction date has arrived: 2018-04-30
,
Apr 30 2018
regarding comment 41 "The NextAction date has arrived: 2018-04-30" means what??
,
Apr 30 2018
@42 crbug allows setting "alarms" on bugs (e.g., to ensure they don't get lost in the shuffle). I did so in #33. Given there have been no reports of this where it isn't WAI, I'm going to close this out. If anyone sees a case where chrome.runtime is unavailable in a situation in which it should be available (i.e., an extension page, content script, or web page that is specifically listed in an installed extension's "externally_connectable" manifest entry), please let me know on this bug, and we can re-open. Thank you all for bringing this up, and thank you phistuck@ for the de-duping!
,
May 7 2018
regarding comment 43 u did not fixed that bug , but tell me what can i use instead of <all_urls> if i want to access all url type because in my application i want to use all type of urls which compatible with extention
,
May 7 2018
because refrence from comment 38 currently i am not allowed to use any format of all url (Normal extensions are not allowed to specify <all_urls> (or other patterns that match all hosts under a given eTLD). <all_urls>, *://*/*, *://*.com/*, etc, are all disallowed.)
,
May 7 2018
You cannot let all of the URLs communicate with your extension using chrome.runtime.sendMessage. Instead, you can use content script on all of the URLs (this is allowed) and let the pages communicate with it in a different way. |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 Deleted