Value is not a sequence Safari exception

六眼飞鱼酱① 提交于 2019-12-04 00:17:58
Jonathan Cole

You need to disable the "WebDriver" extension.

I had this same problem, and my stack trace included a resource called "Script element" which was making this call:

b.initMessageEvent("safaridriver.message", !1, !1, a, window.location.origin, "0", window, null);

Maybe there's a SafariDriver update out there that also fixes this?

The main answer here, led me down the wrong path.

Some notes:

  • My console.log works just fine in Safari 12.0.3 with no issues what so ever
  • The original error of "Value is not a sequence" can be encountered for several different reasons
  • I found I was getting the error because my self.postMessage() had two arguments instead of one
    • TypeScript thinks self.postMessage() is supposed to have two arguments
    • Safari threw error because my second postMessage argument was null

My code was:

self.postMessage(data,null)

Now my working code is:

const selfie: Worker = self as any;

selfie.postMessage(data)

I find my answer to be relevant because others will use TypeScript and think self.postMessage() needs to have two arguments... And then Safari will break if the second argument is null like several online articles recommend to use.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!