【问题标题】:Why is it not possible to define non configurable properties in the global window object?为什么不能在全局窗口对象中定义不可配置的属性?
【发布时间】:2017-05-21 19:19:36
【问题描述】:

当我尝试为窗口对象设置不可配置属性时,我在 Firefox 52.0a2 (2017-01-06) 中收到以下错误。

TypeError: Not allowed to define a non-configurable property on the WindowProxy object

但是它在最新的 Firefox 版本 (50.1.0) 中运行没有任何问题。 (顺便说一句,它也适用于 Opera 和 Chrome)

示例代码:

Object.defineProperty(window, 'test', {
  enumerable: false,
  configurable: false,
  writable: false,
  value: 'value'
});

【问题讨论】:

    标签: firefox-developer-edition


    【解决方案1】:

    从 Firefox 53 开始,无论构建类型如何,它都可以正常工作。 更多信息:https://bugzilla.mozilla.org/show_bug.cgi?id=1329323

    【讨论】:

      猜你喜欢
      • 2010-12-22
      • 1970-01-01
      • 2020-03-06
      • 2019-10-31
      • 1970-01-01
      • 2012-03-29
      • 1970-01-01
      • 2014-09-22
      • 2021-04-11
      相关资源
      最近更新 更多