]> git.parisson.com Git - pdf.js.git/commitdiff
Fix strict mode syntax error in Safari
authorIonuț G. Stan <ionut.g.stan@gmail.com>
Wed, 26 Oct 2011 23:47:18 +0000 (02:47 +0300)
committerIonuț G. Stan <ionut.g.stan@gmail.com>
Wed, 26 Oct 2011 23:47:18 +0000 (02:47 +0300)
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.

pdf.js

diff --git a/pdf.js b/pdf.js
index f45993210657171ea0068a55b661902c76732acb..05a21538d9a62008cd96b9b8e4bd1030a5a4badb 100644 (file)
--- 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);
       }
     },