Skip to content

Conversation

darind
Copy link
Collaborator

@darind darind commented Oct 15, 2020

Related to #63.

Steps to reproduce:

var worker = new Worker("./tests/shared/Workers/EvalWorker.js");

worker.onmessage = (msg) => {
    worker.terminate();
    NSNotificationCenter.defaultCenter.postNotificationNameObject("MyNotification", null);
};

const workerScript = `
  var NotificationObserver = /** @class */ (function (_super) {
    __extends(NotificationObserver, _super);
    function NotificationObserver() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    NotificationObserver.initWithCallback = function (onReceiveCallback) {
        var observer = _super.new.call(this);
        observer._onReceiveCallback = onReceiveCallback;
        return observer;
    };
    NotificationObserver.prototype.onReceive = function (notification) {
        this._onReceiveCallback(notification);
    };
    NotificationObserver.ObjCExposedMethods = {
        onReceive: { returns: interop.types.void, params: [NSNotification] },
    };
    return NotificationObserver;
  }(NSObject));

  const observer = NotificationObserver.initWithCallback(notification => {
  });

  NSNotificationCenter.defaultCenter.addObserverSelectorNameObject(observer, "onReceive", "MyNotification", null);

  postMessage(self === global);`;

worker.postMessage({ eval: workerScript });

@cla-bot cla-bot bot added the cla: yes label Oct 15, 2020
@darind darind self-assigned this Oct 15, 2020
@darind darind force-pushed the darind/isolate-aliveness-check branch from 0076296 to eebf95f Compare October 15, 2020 10:09
@NathanaelA

This comment was marked as abuse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS app crash after permission request when I use a worker

2 participants