Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Closes #528 Making script+dependency download errors more visible and…

… easier to understand.
  • Loading branch information...
commit a772196da68f658f689a77b1e6e28c619c0c9b5f 1 parent 9d0fb7b
@supahgreg supahgreg authored
View
3  extension/locale/de/scriptish.properties
@@ -23,13 +23,16 @@ error.hash.algorithm=Ungültiger Hash-Algorithmus angegeben.
error.icon.dataURL=Ungültige data:-URL für @icon
error.icon.notImage=Fehler! @icon hat keinen Bild MIME-Typ
error.icon.URL=Ungültige URL für @icon
+error.invalidCert=
error.isInvalidValue=ist ein ungültiger Wert
error.matchPattern.rules=@match Muster hält sich nicht an die Regeln für Muster
error.matchPattern.rules.file=File-Schema @match Muster hält sich nicht an die Regeln für Muster
+error.notSecure=
error.notSupported.Firefox=wird nicht in dieser Version von Firefox unterstützt
error.openingFile=Konnte Datei nicht öffnen
error.pattern.parsing=Muster konnte nicht verarbeitet werden
error.pref.type=Nicht unterstützter Einstellungstyp. Gültige Typen sind: string, bool und 32-bit int.
+error.remoteVersionOlder=
error.resource.dupName=ist ein doppelter Resourcenname. Jede @resource muss einen eindeutigen Namen tragen.
error.resource.syntax=Ungültige Syntax für @resource Deklaration
error.retrieving=Fehler beim Abrufen
View
3  extension/locale/en-US/scriptish.properties
@@ -23,13 +23,16 @@ error.hash.algorithm=Invalid hash algorithm specified.
error.icon.dataURL=Invalid data: URL for @icon
error.icon.notImage=Error! @icon does not have an image MIME type
error.icon.URL=Invalid URL for @icon
+error.invalidCert=Invalid SSL certificate.\nIf desired, allow all certificates by enabling the option in Scriptish Options / Advanced / Update Security.
error.isInvalidValue=is an invalid value
error.matchPattern.rules=@match pattern does not conform to pattern rules
error.matchPattern.rules.file=File scheme @match pattern does not conform to pattern rules
+error.notSecure=Insecure URI.\nIf desired, allow non-HTTPS updates by enabling the option in Scriptish Options / Advanced / Update Security.
error.notSupported.Firefox=is not supported by this version of Firefox
error.openingFile=Could not open file
error.pattern.parsing=Pattern could not be parsed
error.pref.type=Unsupported preference type. Valid types are: string, bool, and 32-bit integers.
+error.remoteVersionOlder=The remote script does not have a newer version number than your current script.
error.resource.dupName=is a duplicate resource name. Each @resource must have a unique name.
error.resource.syntax=Invalid syntax for @resource declaration
error.retrieving=Failed to retrieve
View
3  extension/locale/es-ES/scriptish.properties
@@ -23,13 +23,16 @@ error.hash.algorithm=Especificado algoritmo de hash no válido.
error.icon.dataURL=URL de tipo datos para @ICON no válido
error.icon.notImage=¡Error!: @ICON no tiene un tipo MIME de imagen
error.icon.URL=URL para @ICON no válido
+error.invalidCert=
error.isInvalidValue=es un valor no permitido
error.matchPattern.rules=el filtro @match no se ajusta a las reglas para filtros
error.matchPattern.rules.file=El filtro @match del esquema File no se ajusta a las reglas para filtros
+error.notSecure=
error.notSupported.Firefox=no soportado por esta versión de Firefox
error.openingFile=Error abriendo el archivo
error.pattern.parsing=Error interpretando el filtro
error.pref.type=Tipo de preferencia no soportado. Tipos válidos: cadena, booleano y entero de 32 bits.
+error.remoteVersionOlder=
error.resource.dupName=es un nombre de recurso duplicado. Cada declaración @Resource debe tener un nombre único.
error.resource.syntax=Sintaxis no válida para la declaración @Resource
error.retrieving=Error al descargar
View
3  extension/locale/ja-JP/scriptish.properties
@@ -23,13 +23,16 @@ error.hash.algorithm=不正なハッシュ・アルゴリズムが指定され
error.icon.dataURL=不正なデータ: @icon 用 URL
error.icon.notImage=エラー! @icon が画像の MIME タイプではありません
error.icon.URL=@icon の URL が不正です
+error.invalidCert=
error.isInvalidValue=は不正な値です
error.matchPattern.rules=@match のパターンが記法に適合していません
error.matchPattern.rules.file=ファイル・スキーム(scheme)の @match パターンが記法に適合していません
+error.notSecure=
error.notSupported.Firefox=はこのバージョンの Firefox でサポートされていません
error.openingFile=ファイルを開くことが出来ませんでした
error.pattern.parsing=パターンを構文解析(parse)できませんでした
error.pref.type=サポートしてない設定の型です。正しい型は次の通り: string, bool, 32-bit integers
+error.remoteVersionOlder=
error.resource.dupName=はリソース名として重複しています。@resource の名前は一意でなければなりません
error.resource.syntax=@resource 宣言の構文が不正です
error.retrieving=取得に失敗しました
View
3  extension/locale/pt-BR/scriptish.properties
@@ -23,13 +23,16 @@ error.hash.algorithm=O algoritmo de hash especificado é inválido.
error.icon.dataURL=Dados inválidos: endereço para @icon
error.icon.notImage=Erro! @icon não tem um tipo MIME de imagem
error.icon.URL=Endereço inválido para @icon
+error.invalidCert=
error.isInvalidValue=é um nome inválido
error.matchPattern.rules=o padrão de @match não está de acordo com as regras.
error.matchPattern.rules.file=o padrão de @match do esquema "file:" não está de acordo com as regras.
+error.notSecure=
error.notSupported.Firefox=não é suportado por esta versão do Firefox
error.openingFile=Não foi possível abrir o arquivo
error.pattern.parsing=Não foi possível analisar o padrão
error.pref.type=Tipo de preferência não suportado. Os tipos válidos são: string, bool e integers de 32 bits.
+error.remoteVersionOlder=
error.resource.dupName=é um nome de recurso duplicado. Cada item de @resource precisa ter um nome exclusivo.
error.resource.syntax=sintaxe inválida para a declaração @resource.
error.retrieving=Falha ao obter
View
3  extension/locale/ru-RU/scriptish.properties
@@ -23,13 +23,16 @@ error.hash.algorithm=Неверный алгоритм хеширования.
error.icon.dataURL=Неверный URL для @icon
error.icon.notImage=
error.icon.URL=Неверный URL для @icon
+error.invalidCert=
error.isInvalidValue= - неверное значение
error.matchPattern.rules=шаблон @match не соответствует правилам
error.matchPattern.rules.file=Шаблон @match схемы file:// не соответствует правилам
+error.notSecure=
error.notSupported.Firefox=не поддерживается в этой версии Огненного Лиса
error.openingFile=Не могу открыть файл
error.pattern.parsing=Шаблон не парсится
error.pref.type=Неподдерживаемый тип настройки. Правильные типы: строка, булев и 32хбитное целое.
+error.remoteVersionOlder=
error.resource.dupName= - повторяющееся имя для ресурса. Имена ресурсов должны быть уникальными.
error.resource.syntax=Неправильный синтаксис в обьявлении @resource
error.retrieving=Failed to retrieve
View
3  extension/locale/sv-SE/scriptish.properties
@@ -23,13 +23,16 @@ error.hash.algorithm=Ogiltig hashalgoritm angavs.
error.icon.dataURL=Ogiltig data: URL för @icon
error.icon.notImage=Fel! @icon har ingen MIME-bildtyp
error.icon.URL=Ogiltig URL för @icon
+error.invalidCert=
error.isInvalidValue=är ett ogiltigt värde
error.matchPattern.rules=@match-mönster uppfyller inte mönsterreglerna
error.matchPattern.rules.file=@match-mönstret för filschema uppfyller inte mönsterreglerna
+error.notSecure=
error.notSupported.Firefox=stöds inte i denna version av Firefox
error.openingFile=Det gick inte att öppna filen
error.pattern.parsing=Det gick inte att parsa mönstret
error.pref.type=Inställningstypen stöds inte. Giltiga typer är: sträng, boolesk och 32-bitars heltal.
+error.remoteVersionOlder=
error.resource.dupName=är en resursnamnsdubblett. Varje @resource måste ha ett unikt namn.
error.resource.syntax=Ogiltig syntax för @resource-deklaration
error.retrieving=Det gick inte att hämta
View
3  extension/locale/zh-CN/scriptish.properties
@@ -23,13 +23,16 @@ error.hash.algorithm=指定的散列算法无效
error.icon.dataURL=无效的数据:@icon 的 URL
error.icon.notImage=错误!@icon 没有图像 MIME 类型
error.icon.URL=无效的 @icon URL
+error.invalidCert=
error.isInvalidValue=是个无效的值
error.matchPattern.rules=@match 模式不符合模式规则
error.matchPattern.rules.file=文件 scheme @match 模式不符合模式规则
+error.notSecure=
error.notSupported.Firefox=不支持这一版本的 Firefox
error.openingFile=无法打开文件
error.pattern.parsing=模式不能被解析
error.pref.type=不支持的首选项类型。有效的类型有:字符串、布尔和32位整数。
+error.remoteVersionOlder=
error.resource.dupName=是一个重复的资源名称。每一个 @resource 都必须有唯一的名称。
error.resource.syntax=无效的 @resource 声明语法
error.retrieving=检索失败
View
3  extension/locale/zh-TW/scriptish.properties
@@ -23,13 +23,16 @@ error.hash.algorithm=指定的雜湊演算法無效。
error.icon.dataURL=無效的資料: @icon 網址
error.icon.notImage=錯誤!@icon 沒有圖像 MIME 類型
error.icon.URL=無效的 @icon 網址
+error.invalidCert=
error.isInvalidValue=是無效的值
error.matchPattern.rules=@match 樣式不符合樣式規則
error.matchPattern.rules.file=檔案協定 @match 樣式不符合樣式規則
+error.notSecure=
error.notSupported.Firefox=不支援此版本的 Firefox
error.openingFile=無法開啟檔案
error.pattern.parsing=樣式無法解析
error.pref.type=不支援的選項類型。有效的類型有:字串、真假值和32位元整數。
+error.remoteVersionOlder=
error.resource.dupName=是一個重複的資源名稱。每一個 @resource 名稱必須唯一。
error.resource.syntax=無效的 @resource 宣告語法
error.retrieving=檢索失敗
View
53 extension/modules/script/scriptdownloader.js
@@ -63,8 +63,19 @@ ScriptDownloader.prototype.startDownload = function(bypassCache) {
req.onload = this.handleScriptDownloadComplete.bind(this);
req.send(null);
}
-ScriptDownloader.prototype.handleErr = function() {
- if (this.scriptInstaller) this.scriptInstaller.changed("DownloadFailed");
+ScriptDownloader.prototype.handleErr = function(aEvent, aMsg) {
+ let errMsg = Scriptish_stringBundle("error.script.loading") + ":\n"
+ + this.uri_.spec;
+ if (aEvent) {
+ errMsg += "\nHTTP " + aEvent.target.status;
+ } else if (aMsg) {
+ errMsg += "\n" + aMsg;
+ }
+ Scriptish_alert(errMsg);
+ Scriptish_log(errMsg);
+ if (this.scriptInstaller) {
+ this.scriptInstaller.changed("DownloadFailed");
+ }
}
ScriptDownloader.prototype.chkContentTypeB4DL = function() {
if (this.req_.readyState != 2
@@ -82,30 +93,31 @@ ScriptDownloader.prototype.handleScriptDownloadComplete = function() {
try {
// If loading from file, status might be zero on success
if (req.status != 200 && req.status != 0) {
- Scriptish_alert(Scriptish_stringBundle("error.script.loading") + ":\n" +
- req.status + ": " + req.statusText);
+ this.handleErr(null, req.status + ": " + req.statusText);
return;
}
if (this.secure) {
// make sure that the final URI is a https url
if ("https" != req.channel.URI.scheme)
- return this.handleErr();
+ return this.handleErr(null, Scriptish_stringBundle("error.notSecure"));
// make sure that the final URI's certificate is valid
try {
checkCert(req.channel, !Scriptish_prefRoot.getValue("update.requireBuiltInCerts"));
}
catch (e) {
- return this.handleErr();
+ return this.handleErr(null, Scriptish_stringBundle("error.invalidCert"));
}
}
if (this.scriptInstaller) {
// make sure that the new version is greater than the old version
var remoteVersion = Script.parseVersion(req.responseText);
- if (!remoteVersion || Services.vc.compare(this.scriptInstaller._script.version, remoteVersion) >= 0)
- return this.handleErr();
+ if (!remoteVersion || Services.vc.compare(this.scriptInstaller._script.version, remoteVersion) >= 0) {
+ return this.handleErr(
+ null, Scriptish_stringBundle("error.remoteVersionOlder"));
+ }
}
var source = req.responseText;
@@ -195,7 +207,8 @@ ScriptDownloader.prototype.downloadNextDependency = function() {
if (this.secure) {
// make sure that the dependency's URI is a https url
if ("https" != sourceUri.scheme)
- return this.errorInstallDependency(dep, "Insecure dependency URI");
+ return this.errorInstallDependency(
+ dep, Scriptish_stringBundle("error.notSecure"));
}
var sourceChannel = Services.io.newChannelFromURI(sourceUri);
@@ -230,15 +243,18 @@ ScriptDownloader.prototype.handleDependencyDownloadComplete =
if (this.secure) {
// make sure that the final URI is a https url
- if ("https" != channel.URI.scheme)
- return this.errorInstallDependency(dep, "Insecure dependency URI");
+ if ("https" != channel.URI.scheme) {
+ return this.errorInstallDependency(
+ dep, Scriptish_stringBundle("error.notSecure"));
+ }
// make sure that the final URI's certificate is valid
try {
checkCert(channel, !Scriptish_prefRoot.getValue("update.requireBuiltInCerts"));
}
catch (e) {
- return this.errorInstallDependency(dep, "Invalid dependency SSL certificate");
+ return this.errorInstallDependency(
+ dep, Scriptish_stringBundle("error.invalidCert"));
}
}
@@ -317,11 +333,16 @@ ScriptDownloader.prototype.finishInstall = function() {
}
}
ScriptDownloader.prototype.errorInstallDependency = function(dep, msg) {
- this.dependencyError = Scriptish_stringBundle("error.dependency.loading") + ": "
- + dep.urlToDownload + "\n" + msg;
+ this.dependencyError = Scriptish_stringBundle("error.dependency.loading")
+ + ": " + dep.urlToDownload + "\n" + msg;
Scriptish_log(this.dependencyError);
- if (this.scriptInstaller) return this.scriptInstaller.changed("DownloadFailed");
- if (this.installOnCompletion_) Scriptish_alert(this.dependencyError);
+ if (this.scriptInstaller) {
+ Scriptish_alert(this.dependencyError);
+ return this.scriptInstaller.changed("DownloadFailed");
+ }
+ if (this.installOnCompletion_) {
+ Scriptish_alert(this.dependencyError);
+ }
this._callback && this._callback();
}
ScriptDownloader.prototype.installScript = function() {
Please sign in to comment.
Something went wrong with that request. Please try again.