The default bug view has changed. See this FAQ.

runtime.sendMessage does not handle the three-argument form correctly.

NEW
Unassigned

Status

()

Toolkit
WebExtensions: General
P3
normal
a year ago
7 hours ago

People

(Reporter: michael.oneill, Unassigned)

Tracking

48 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [runtime]triaged)

(Reporter)

Description

a year ago
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36

Steps to reproduce:

I had to change a call to chrome.runtime.sendMessage from: 
    //
    // Chrome version
    //chrome.runtime.sendMessage(properties, {}, function (originContext) {
to:

// Firefox version
    chrome.runtime.sendMessage(undefined, properties, undefined, function (originContext) {


   I also had to check for "??" returned from chrome.i18n.getMeaage:

// Chrome version
//function T(text) {
//    return chrome.i18n.getMessage(text.startsWith("__MSG__")?text.substring(7):text);
//}

// Firefox version (works)
function T(text) {
    var s = text.startsWith("__MSG__") ? text.substring(7) : text;
    var locs = chrome.i18n.getMessage(s);
    if (locs == "??")
        return s;
    return locs;
}


Actual results:

the call to sendMessage failed, no error message
the call to i18n.getMessage reyurned "??", the Chrome one returns the input string
(In reply to michael.oneill from comment #0)
>    I also had to check for "??" returned from chrome.i18n.getMeaage:
> 
> // Chrome version
> //function T(text) {
> //    return
> chrome.i18n.getMessage(text.startsWith("__MSG__")?text.substring(7):text);
> //}
> 
> // Firefox version (works)
> function T(text) {
>     var s = text.startsWith("__MSG__") ? text.substring(7) : text;
>     var locs = chrome.i18n.getMessage(s);
>     if (locs == "??")
>         return s;
>     return locs;
> }
> 
> 
> Actual results:
> 
> the call to sendMessage failed, no error message
> the call to i18n.getMessage reyurned "??", the Chrome one returns the input
> string

This is bug 1258199. We're going to change the return value for missing keys,
but we're not planning to remove the reported error. I suggest that you
looking up keys that you don't expect to exist.
Summary: I found 2 issues porting a blink extension to Firefox webextensions → runtime.sendMessage does not handle the three-argument form correctly.
Whiteboard: [runtime]
Status: UNCONFIRMED → NEW
Ever confirmed: true

Updated

a year ago
Priority: -- → P3
Whiteboard: [runtime] → [runtime]triaged

Updated

6 months ago
Component: WebExtensions: Untriaged → WebExtensions: General

Updated

9 hours ago
webextensions: --- → ?

Updated

7 hours ago
webextensions: ? → +
You need to log in before you can comment on or make changes to this bug.