为什么 chrome 应用无法加载我的离线缓存清单

Why can chrome app not load my offline cache manifest

我的 chrome 应用程序无法加载我的离线缓存清单,而常规 chrome 选项卡可以正常加载。由于某种原因,它在仅下载了几个项目后就停止了。

未指定 "resource fetch failed" 的原因(在错误本身中读取 "unknown",见图)

chrome 应用程序中的缓存资源是否可能存在内存限制?我用谷歌搜索,但发现关于 chrome 应用程序的这类事情的概述很少。

如果您找到概述这些内容的资源,请 link 加入。

我已尝试按照此处所述添加权限 "unlimitedStorage" (https://developer.chrome.com/apps/declare_permissions),但没有任何区别。

    quickstore1:1 Creating Application Cache with manifest http://localhost/cloudsign/web/manifests/24/quickstore1.appcache
    quickstore1:1 Application Cache Checking event
    quickstore1:1 Application Cache Downloading event
    quickstore1:1 Application Cache Progress event (0 of 111) http://localhost/cloudsign/web/uploads/images/6/e69ac4205935739701697ea1c0bf1d7e62a1dc0c.png
    quickstore1:1 Application Cache Progress event (1 of 111) http://localhost/cloudsign/web/uploads/images/6/88881d8511deeb99eb542c147d45ab507c445e5e.png
    quickstore1:1 Application Cache Progress event (2 of 111) http://localhost/cloudsign/web/uploads/images/6/646215b8d3c74f84e19b4d3a853bf24ae75d94d8.png
    quickstore1:1 Application Cache Progress event (3 of 111) http://localhost/cloudsign/web/uploads/images/6/51737da269f814a34d362dcf90ba5d5f07a23529.png
    quickstore1:1 Application Cache Progress event (4 of 111) http://localhost/cloudsign/web/uploads/images/6/3cb1e1b34fcaa3176a7a2b40d3fa491d3460d356.png
    quickstore1:1 Application Cache Progress event (5 of 111) http://localhost/cloudsign/web/uploads/images/24/eb451585360f63292c132013b2c1538a7874939e.png
    quickstore1:1 Application Cache Progress event (6 of 111) http://localhost/cloudsign/web/uploads/images/24/eb0d6bb5f21f134a199c38e7ab15e129aef41e71.jpeg
    quickstore1:1 Application Cache Progress event (7 of 111) http://localhost/cloudsign/web/uploads/images/24/dbeccb61e74710e35a05c9668e40a4b80a32e402.gif
    quickstore1:1 Application Cache Progress event (8 of 111) http://localhost/cloudsign/web/fonts/Gruppo/Gruppo-Regular.ttf
    quickstore1:1 Application Cache Progress event (9 of 111) http://localhost/cloudsign/web/uploads/images/24/dbd3746b08e371516b90b576103e5817e9d244f6.jpeg
    quickstore1:1 Application Cache Progress event (10 of 111) http://localhost/cloudsign/web/uploads/images/6/979e98bd5f23f26f8d22d5d93840f81e3cbec62f.png
    quickstore1:1 Application Cache Error event: Resource fetch failed (2) http://localhost/cloudsign/web/uploads/images/6/979e98bd5f23f26f8d22d5d93840f81e3cbec62f.png
    appCacheHandlers.js:67 Cache error detected (MS)
    cacheError @ appCacheHandlers.js:67
    appCacheHandlers.js:68 error is:
    appCacheHandlers.js:69 ApplicationCacheErrorEventbubbles: falsecancelBubble: falsecancelable: falsecomposed: falsecurrentTarget: ApplicationCache {status: 0, onchecking: null, onerror: null, onnoupdate: null, ondownloading: null, …}defaultPrevented: falseeventPhase: 0isTrusted: truemessage: "Resource fetch failed (2) http://localhost/cloudsign/web/uploads/images/6/979e98bd5f23f26f8d22d5d93840f81e3cbec62f.png"path: []length: 0__proto__: Array(0)concat: ƒ concat()constructor: ƒ Array()copyWithin: ƒ copyWithin()entries: ƒ entries()every: ƒ every()fill: ƒ fill()filter: ƒ filter()find: ƒ find()findIndex: ƒ findIndex()forEach: ƒ forEach()includes: ƒ includes()indexOf: ƒ indexOf()join: ƒ join()keys: ƒ keys()lastIndexOf: ƒ lastIndexOf()length: 0map: ƒ map()pop: ƒ pop()push: ƒ push()reduce: ƒ reduce()reduceRight: ƒ reduceRight()reverse: ƒ reverse()shift: ƒ shift()slice: ƒ slice()some: ƒ some()sort: ƒ sort()splice: ƒ splice()toLocaleString: ƒ toLocaleString()toString: ƒ toString()unshift: ƒ unshift()Symbol(Symbol.iterator): ƒ values()Symbol(Symbol.unscopables): {copyWithin: true, entries: true, fill: true, find: true, findIndex: true, …}__proto__: Objectreason: "unknown"returnValue: truesrcElement: ApplicationCache {status: 0, onchecking: null, onerror: null, onnoupdate: null, ondownloading: null, …}status: 0target: ApplicationCache {status: 0, onchecking: null, onerror: null, onnoupdate: null, ondownloading: null, …}timeStamp: 1501.0700000000002type: "error"url: ""__proto__: ApplicationCacheErrorEventbubbles: (...)cancelBubble: (...)cancelable: (...)composed: (...)currentTarget: (...)defaultPrevented: (...)eventPhase: (...)message: (...)path: (...)reason: (...)returnValue: (...)srcElement: (...)status: (...)target: (...)timeStamp: (...)type: (...)url: (...)constructor: ƒ ApplicationCacheErrorEvent()Symbol(Symbol.toStringTag): "ApplicationCacheErrorEvent"get message: ƒ ()get reason: ƒ ()get status: ƒ ()get url: ƒ ()__proto__: Event

所有代码都是由 chrome 应用程序生成器生成的,因此它是标准代码,但我将其包含在下面以防我遗漏某些设置等...

Chrome 应用清单:

{  
     "name":"Cloudsign-dev",
     "version":"0.1",
     "manifest_version":2,
     "minimum_chrome_version":"37.0.0.0",
     "permissions":[  
        "webview",
        "power",
        "storage",
        "unlimitedStorage",
        "videoCapture",
        "geolocation",
        "pointerLock",
        "system.display",
        {  
           "fileSystem":[  
              "write",
              "retainEntries",
              "directory"
           ]
        },
        "accessibilityFeatures.read",
        "accessibilityFeatures.modify"
     ],
     "app":{  
        "background":{  
           "scripts":[  
              "js/foam.js",
              "js/cab.js",
              "config.js",
              "background_main.js"
           ]
        }
     },
     "kiosk_enabled":true,
     "default_locale":"en",
     "icons":{  
        "128":"img/128.png"
     }
  }

配置文件:

window.config = {
       "model_": "AppConfig",
       "id": 1,
       "appName": "Cloudsign-dev",
       "homepage": "http://localhost/cloudsign/web/app_dev.php/mp/quickstore1",
       "enableNavBttns": false,
       "enableHomeBttn": false,
       "enableReloadBttn": false,
       "enableLogoutBttn": false,
       "kioskEnabled": true
    };

background_main.js

/**
 * Creates the window for the application.
 *
 * @see http://developer.chrome.com/trunk/apps/app.window.html
 */
var runApp = function() {
  if (chrome.power) {
    chrome.power.requestKeepAwake('display');
  }
  console.log(config);
  chrome.app.window.create(
      config ?
      'exported_app_view.html' :
      'designer_view.html',
      {
        id: 'KioskDesignerWindow',
        width: 1100,
        height: 720,
        minWidth: 800,
        minHeight: 600
      },
      function(win) {
        if (!this.X) { return; }
        var window = win.contentWindow;
        window.onload = function() {
          this.$addWindow(window);
          var Y = this.X.subWindow(window, 'Kiosk Designer Window');
          this.DOM.init(Y);
        }.bind(this);
        win.onClosed.addListener(function() {
          this.$removeWindow(window);
        }.bind(this));
      }.bind(this));
}.bind(this);

/**
 * Listens for the app launching then creates the window
 *
 * @see http://developer.chrome.com/trunk/apps/app.runtime.html
 * @see http://developer.chrome.com/trunk/apps/app.window.html
 */
chrome.app.runtime.onLaunched.addListener(function() {
  runApp();
});


/**
 * Listens for the app restarting then re-creates the window.
 *
 * @see http://developer.chrome.com/trunk/apps/app.runtime.html
 */
chrome.app.runtime.onRestarted.addListener(function() {
  runApp();
});

好吧,原因似乎是存在内存限制(5 MB?),我无法以任何方式更改 Web 应用程序。如果我将所有代码移动到应用程序而不是网站,我想我可以使用无限存储,但应用程序缓存似乎不受支持 chrome-app-side 在任何情况下都需要重新编码 =(