javascript - 卸载在沙盒 Chrome 应用程序中不可用

标签 javascript google-chrome dojo google-chrome-extension google-chrome-app

我正在使用 Dijit(Dojo 工具包)在沙盒页面中生成 HTML 布局,但每次我调用 dijit 文件时,我都会得到 Uncaught unload is not available in packaged apps..

现在我不确定这是 Dojo 的问题还是新安全策略对 Chrome 的限制。

我的文件:

/** manifest.json **/
{
  "name": "Hello App",
  "version": "2.0",
  "manifest_version": 2,
  "description": "A app that says hello",
  "app": {
    "background": {
      "scripts" : ["js/app.js"]
    }
  },
  "permissions": [

  ],
  "sandbox": {
    "pages" : ["live.html"]
  }
}

/** js/app.js **/
chrome.app.runtime.onLaunched.addListener(function(){
  chrome.app.window.create('live.html', {width:screen.width,
    height: screen.height});
});

/** js/helloapp/app.js **/
/** This is the file that actually calls Dijit to build the layout **/
define(function(){
  require(["dijit/layout/ContentPane",
    "dijit/layout/BorderContainer"]);
});

我将 live.html 排除在外,因为它基本上只是 HTML 结构、对 dojo 加载程序的调用和对 helloapp/app.js 文件的要求。

如果这是 CSP 世界的限制,我是否可以通过其他方式在新的 Chrome 应用程序上使用 Dijit,或者我是否遗漏了什么?

谢谢你的时间

最佳答案

您必须修改 Dojo Core、Dojo Base 和 Dijit 中的所有核心源代码,以删除卸载事件或重新定义它。

close()unload() 非常相似,您可以在此处查看有关为何未实现的线程:

http://code.google.com/p/chromium/issues/detail?id=147674

http://code.google.com/p/chromium/issues/detail?id=130465

关于javascript - 卸载在沙盒 Chrome 应用程序中不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13514863/

相关文章:

javascript - 让一个输入字段自动更新另一个输入字段,反之亦然(可能使用 JavaScript)

java - 无论我使用什么元素查询类型,Selenium 程序都会返回 NoSuchElementException?

linux - 如何禁止更新命令来查找 google-chrome 依赖项

javascript - 在 Dojo 中,为什么 require() 一个已经被定义的模块()?

select - 如何更改 dijit.form.Select 中元素的顺序

javascript - 我如何调整(不完全是海峡缩放)道场向量的大小?

javascript - 如何在ajax上重新加载数据表并触发新的分页

javascript - 如何围绕边旋转三 Angular 形?

javascript - 在 Robo3T 中,如何添加自定义功能

css - 在 Chrome 中变换偏移输入边框