From: IonuČ› G. Stan Date: Wed, 26 Oct 2011 23:47:18 +0000 (+0300) Subject: Fix strict mode syntax error in Safari X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=a17b13019b17f71a55c47e829dbbc59b815eb158;p=pdf.js.git Fix strict mode syntax error in Safari This happens in Safari 5.1 and Mobile Safari on iOS 5. Apparently, Safari considers the function name as part of the ECMA's FormalParameterList and applies the strict mode rules from section 13.1 of the specification. > It is a SyntaxError if any Identifier value occurs more than once > within a FormalParameterList of a strict mode > FunctionDeclaration or FunctionExpression. --- diff --git a/pdf.js b/pdf.js index f459932..05a2153 100644 --- a/pdf.js +++ b/pdf.js @@ -7522,19 +7522,19 @@ var Promise = (function() { Promise.prototype = { hasData: false, - set data(data) { - if (data === undefined) { + set data(value) { + if (value === undefined) { return; } if (this._data !== EMPTY_PROMISE) { throw 'Promise ' + this.name + ': Cannot set the data of a promise twice'; } - this._data = data; + this._data = value; this.hasData = true; if (this.onDataCallback) { - this.onDataCallback(data); + this.onDataCallback(value); } },