google-chromegoogle-chrome-apphtml5-appcache

Why can chrome app not load my offline cache manifest


My chrome app fails to load my offline cache manifest while a regular chrome tab does it just fine. For some reason it stops after only a few items have been downloaded.

The reason for "resource fetch failed" is not specified (reads "unknown" in the error itself, see image)

Is there perhaps a memory limit to the cached resources in a chrome app? I have googled but found very little overviews on these kinds of things regarding chrome apps.

If you find a resource outlining these things please link to it.

I have tried adding the permission "unlimitedStorage" as described here (https://developer.chrome.com/apps/declare_permissions) but it makes no difference.

    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

enter image description here

All code is generatd by the chrome app builder so it's standard, but I include it below in case I am missing some setting or such...

Chrome app manifest:

{  
     "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"
     }
  }

config file:

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();
});

Solution

  • OK the reason seems to be that there is a memory limit (of 5 mb?) which I can not change in any way for a webapp. If I move all my code to the app instead of the site I suppose I could use unlimited storage, but application cache seems unsupported chrome-app-side so much re-coding in any event =(