Marshalling Proxy From Extension Background Page to Popup doesn't work

Won’t fix Issue #12227553

Details

Author
Kyle S.
Created
Jun 3, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
38.14393
Reports
Reported by 2 people

Sign in to watch or report this issue.

Steps to reproduce

I have re-created a simple extension with an AngularJS popup (browserAction) that reproduces the problem in my larger app. Find the repo here: https://github.com/kspearrin/angular-edge-proxy

Trying to access a proxy from a background page instance does not work. It always returns undefined. This is only a problem in Edge and all other web extension browsers accept it (Firefox, Chrome, Opera).

Popup Controller

myApp.controller('myController', function ($scope){
    var bg = chrome.extension.getBackgroundPage();
    var locali18nService = new Locali18nService();
    
    // works
    $scope.bar = bg.myService.foo();
    
    // works
    $scope.directHello = chrome.i18n.getMessage('hello');
    // works
    $scope.localHello = locali18nService.hello;
    // DOES NOT work in Edge
    $scope.bgProxyHello = bg.myProxyi18nService.hello;
    // works
    $scope.bgFunctionHello = bg.myFunctioni18nService.get('hello');

    $scope.firstName = "John";
    $scope.lastName = "Doe";
});

function Locali18nService() {
    return new Proxy({}, {
        get: function (target, name) {
            return chrome.i18n.getMessage(name);
        },
        set: function (target, name, value) {
            throw 'set not allowed for i18n';
        }
    });
};

Popup HTML

<div ng-controller="myController">
    <p>Foo: {{bar}}</p>
    <p>
        direct: {{directHello}}<br>
        local proxy: {{localHello}}<br>
        bg proxy: {{bgProxyHello}}<br>
        bg function: {{bgFunctionHello}}
    </p>
</div>

Background

var myService = new MyService();
var myProxyi18nService = new MyProxyi18nService();
var myFunctioni18nService = new MyFunctioni18nService();

function MyService() {
    MyService.prototype.foo = function () {
        return 'bar';
    };
};

function MyProxyi18nService() {
    return new Proxy({}, {
        get: function (target, name) {
            return chrome.i18n.getMessage(name);
        },
        set: function (target, name, value) {
            throw 'set not allowed for i18n';
        }
    });
};

function MyFunctioni18nService() {
    MyFunctioni18nService.prototype.get = function (name) {
        return chrome.i18n.getMessage(name);
    };
};

messages.json

{
  "appName": {
    "message": "My AngulatJS App",
    "description": "The app name"
  },
  "hello": {
    "message": "hello!",
    "description": "-"
  }
}

Results

Opera/Chrome

Foo: bar
direct: hello!
local proxy: hello!
bg proxy: hello!
bg function: hello! 

Edge

Foo: bar
direct: hello!
local proxy: hello!
bg proxy:
bg function: hello!

Attachments

1 attachment

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “Kiril S.”

    Changed Assigned To from “Kiril S.” to “Jaikishan R.”

    Changed Assigned To from “Jaikishan R.” to “Scott S.”

    Changed Status to “Confirmed”

    Changed Title from “Proxy Does Not Work From Extension Background Page” to “Proxy Does Not Work From Extension Background Page”

    Changed Title from “Proxy Does Not Work From Extension Background Page” to “Marshalling Proxy From Extension Background Page to Popup doesn't work”

    Changed Status from “Confirmed” to “In progress”

    Changed Status from “In progress” to “Won’t fix”

  • Hi!

    Currently, we are only servicing security bugs for EdgeHTML as we make the transition to Chormium Edge. Because of this, the issue has been resolved as "Won’t Fix". Thank you for taking the time to report this issue.

    Zach

You need to sign in to your Microsoft account to add a comment.

Sign in