為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Creating new window in webExtension failes in Firefox ESR

  • 6 回覆
  • 1 有這個問題
  • 1 次檢視
  • 最近回覆由 bmossavari

more options

I'm trying to create a new window in WebExtension (https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/windows/create) by using code below:

var creating = browser.windows.create();

As documentation said "createData" object is optional, above code works on Firefox quantum(57.0.0), but it fails in Firefox ESR (52.5.0) with below error:

createData is null

I'm trying to create a new window in WebExtension (https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/windows/create) by using code below: var creating = browser.windows.create(); As documentation said "createData" object is optional, above code works on Firefox quantum(57.0.0), but it fails in Firefox ESR (52.5.0) with below error: createData is null

由 bmossavari 於 修改

被選擇的解決方法

More generally, there is extension developer support over here:

https://discourse.mozilla.org/c/add-ons/development

This forum focuses on end-user issues.

從原來的回覆中察看解決方案 👍 1

所有回覆 (6)

more options

Hello, this is because Firefox 57 is more optimized for WebExtensions. Firefox 52 ESR was back when Firefox had more support for old XUL based 'legacy' add-ons.

more options

Thank you Mkll, I know firefox ESR supports legacy addons, but I think it should supports WebExtension too and it did (other parts of my addons works as expected only create window return 'createData is null' ) Maybe it's a bug in browser.window.create API, maybe i should report it as a bug on bugzilla

more options

When Firefox 52 ESR was released not all all the new API's needed for WebExtensions were completed. Version by version the new API's were added, and the older API's were deprecated.

bmossavari said

Maybe it's a bug in browser.window.create API, maybe i should report it as a bug on bugzilla

Have you tested it in Firefox 57? Don't report it as a bug if it works in 57.

more options

What happens if you pass an empty object:

var creating = browser.windows.create({}); 

Not that you should have to, just wondering whether Firefox is looking for something in particular and that might provide a more helpful error message.

For reference: https://developer.mozilla.org/Add-ons/WebExtensions/API/windows/create

由 jscher2000 - Support Volunteer 於 修改

more options

選擇的解決方法

More generally, there is extension developer support over here:

https://discourse.mozilla.org/c/add-ons/development

This forum focuses on end-user issues.

more options

Thank you jscher2000 for clarification

jscher2000 said

What happens if you pass an empty object: var creating = browser.windows.create({}); Not that you should have to, just wondering whether Firefox is looking for something in particular and that might provide a more helpful error message. For reference: https://developer.mozilla.org/Add-ons/WebExtensions/API/windows/create

passing empty object did the trick