show a clear error when trying to use preloaded data not on the web; #3219

This commit is contained in:
Alon Zakai 2015-03-02 15:57:12 -08:00
Родитель 2715d0e2a7
Коммит 47aa499ad7
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -484,9 +484,11 @@ if has_preloaded:
var PACKAGE_PATH;
if (typeof window === 'object') {
PACKAGE_PATH = window['encodeURIComponent'](window.location.pathname.toString().substring(0, window.location.pathname.toString().lastIndexOf('/')) + '/');
} else {
} else if (typeof location !== 'undefined') {
// worker
PACKAGE_PATH = encodeURIComponent(location.pathname.toString().substring(0, location.pathname.toString().lastIndexOf('/')) + '/');
} else {
throw 'using preloaded data can only be done on a web page or in a web worker';
}
var PACKAGE_NAME = '%s';
var REMOTE_PACKAGE_BASE = '%s';