Merge inbound to central, a=merge
authorWes Kocher <wkocher@mozilla.com>
Mon, 30 Jan 2017 15:44:58 -0800
changeset 331721 1fe66bd0efba89df59d2046e8c91418eb5ae10b8
parent 331686 2b11b3e60ca6342b04f4f4ac0ba979769dc98cf8 (current diff)
parent 331720 3b7d96464366abd6b5a8c45cfec0444510d2f602 (diff)
child 331722 1257b7e442feff063b6aa433b5c310bee33e2303
child 331748 5e854fd37f6c72e70ea3c7e8bc38127883fee69e
child 331773 f1cb197803ed6fb71123a3c076ed0af40e08a6c9
push id31281
push userkwierso@gmail.com
push dateMon, 30 Jan 2017 23:45:09 +0000
treeherdermozilla-central@1fe66bd0efba [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to central, a=merge MozReview-Commit-ID: 4GYZ5Pzy7BY
browser/extensions/shield-recipe-client/data/EventEmitter.js
python/mozbuild/mozbuild/backend/recursivemake.py
python/mozbuild/mozbuild/test/backend/data/sdk-files/bar.ico
python/mozbuild/mozbuild/test/backend/data/sdk-files/foo.ico
python/mozbuild/mozbuild/test/backend/data/sdk-files/moz.build
python/mozbuild/mozbuild/test/backend/data/sdk-files/sub/quux.png
python/mozbuild/mozbuild/test/backend/test_recursivemake.py
python/mozbuild/mozbuild/test/frontend/data/sdk-files/bar.ico
python/mozbuild/mozbuild/test/frontend/data/sdk-files/baz.png
python/mozbuild/mozbuild/test/frontend/data/sdk-files/foo.xpm
python/mozbuild/mozbuild/test/frontend/data/sdk-files/moz.build
python/mozbuild/mozbuild/test/frontend/data/sdk-files/quux.icns
--- a/.eslintignore
+++ b/.eslintignore
@@ -63,17 +63,18 @@ browser/base/content/test/general/file_c
 browser/base/content/test/urlbar/file_blank_but_not_blank.html
 browser/base/content/newtab/**
 browser/components/downloads/**
 browser/components/privatebrowsing/**
 browser/components/sessionstore/**
 browser/components/tabview/**
 # generated files in cld2
 browser/components/translation/cld2/cld-worker.js
-browser/extensions/pdfjs/content/**
+browser/extensions/pdfjs/content/build**
+browser/extensions/pdfjs/content/web**
 # generated or library files in pocket
 browser/extensions/pocket/content/panels/js/tmpl.js
 browser/extensions/pocket/content/panels/js/vendor/**
 browser/locales/**
 # imported from chromium
 browser/extensions/mortar/**
 
 # devtools/ exclusions
--- a/b2g/config/mozconfigs/linux32_gecko/nightly
+++ b/b2g/config/mozconfigs/linux32_gecko/nightly
@@ -1,12 +1,11 @@
 MOZ_AUTOMATION_L10N_CHECK=0
 MOZ_AUTOMATION_UPLOAD_SYMBOLS=0
 MOZ_AUTOMATION_UPDATE_PACKAGING=0
-MOZ_AUTOMATION_SDK=0
 . "$topsrcdir/b2g/config/mozconfigs/common"
 . "$topsrcdir/build/unix/mozconfig.linux32"
 
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --enable-signmar
 
 # This will overwrite the default of stripping everything and keep the symbol table.
 # This is useful for profiling and debugging and only increases the package size
--- a/b2g/config/mozconfigs/linux64_gecko/nightly
+++ b/b2g/config/mozconfigs/linux64_gecko/nightly
@@ -1,12 +1,11 @@
 MOZ_AUTOMATION_L10N_CHECK=0
 MOZ_AUTOMATION_UPLOAD_SYMBOLS=0
 MOZ_AUTOMATION_UPDATE_PACKAGING=0
-MOZ_AUTOMATION_SDK=0
 . "$topsrcdir/b2g/config/mozconfigs/common"
 . "$topsrcdir/build/unix/mozconfig.linux"
 
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --enable-signmar
 
 # This will overwrite the default of stripping everything and keep the symbol table.
 # This is useful for profiling and debugging and only increases the package size
--- a/b2g/config/mozconfigs/macosx64_gecko/nightly
+++ b/b2g/config/mozconfigs/macosx64_gecko/nightly
@@ -1,11 +1,10 @@
 MOZ_AUTOMATION_UPLOAD_SYMBOLS=0
 MOZ_AUTOMATION_UPDATE_PACKAGING=0
-MOZ_AUTOMATION_SDK=0
 . "$topsrcdir/b2g/config/mozconfigs/common"
 
 # Use sccache
 no_sccache=
 
 . $topsrcdir/build/macosx/mozconfig.common
 
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
--- a/b2g/config/mozconfigs/win32_gecko/nightly
+++ b/b2g/config/mozconfigs/win32_gecko/nightly
@@ -1,12 +1,11 @@
 MOZ_AUTOMATION_L10N_CHECK=0
 MOZ_AUTOMATION_UPLOAD_SYMBOLS=0
 MOZ_AUTOMATION_UPDATE_PACKAGING=0
-MOZ_AUTOMATION_SDK=0
 . "$topsrcdir/b2g/config/mozconfigs/common"
 
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --enable-jemalloc
 ac_add_options --enable-signmar
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
--- a/b2g/dev/config/mozconfigs/linux64/mulet
+++ b/b2g/dev/config/mozconfigs/linux64/mulet
@@ -1,10 +1,9 @@
 MOZ_AUTOMATION_L10N_CHECK=0
 MOZ_AUTOMATION_UPLOAD_SYMBOLS=0
 MOZ_AUTOMATION_UPDATE_PACKAGING=0
-MOZ_AUTOMATION_SDK=0
 . "$topsrcdir/browser/config/mozconfigs/linux64/nightly"
 
 ac_add_options --enable-application=b2g/dev
 
 # Include Firefox OS fonts.
 MOZTTDIR=$topsrcdir/moz-tt
--- a/b2g/dev/config/mozconfigs/linux64/mulet-hazards
+++ b/b2g/dev/config/mozconfigs/linux64/mulet-hazards
@@ -1,12 +1,11 @@
 MOZ_AUTOMATION_L10N_CHECK=0
 MOZ_AUTOMATION_UPLOAD_SYMBOLS=0
 MOZ_AUTOMATION_UPDATE_PACKAGING=0
-MOZ_AUTOMATION_SDK=0
 . "$topsrcdir/browser/config/mozconfigs/linux64/nightly"
 
 ac_add_options --enable-application=b2g/dev
 ac_add_options --with-compiler-wrapper=$TOOLTOOL_DIR/sixgill/usr/libexec/sixgill/scripts/wrap_gcc/basecc
 ac_add_options --without-ccache
 ac_add_options --disable-warnings-as-errors
 
 # Include Firefox OS fonts.
--- a/b2g/dev/config/mozconfigs/linux64/mulet_dbg
+++ b/b2g/dev/config/mozconfigs/linux64/mulet_dbg
@@ -1,12 +1,11 @@
 MOZ_AUTOMATION_L10N_CHECK=0
 MOZ_AUTOMATION_UPLOAD_SYMBOLS=0
 MOZ_AUTOMATION_UPDATE_PACKAGING=0
-MOZ_AUTOMATION_SDK=0
 . "$topsrcdir/browser/config/mozconfigs/linux64/nightly"
 
 ac_add_options --enable-application=b2g/dev
 ac_add_options --enable-debug
 MOZ_DEMANGLE_SYMBOLS=1
 MOZ_DEBUG=1
 MOZ_DEBUG_SYMBOLS=1
 
--- a/b2g/dev/config/mozconfigs/macosx64/mulet
+++ b/b2g/dev/config/mozconfigs/macosx64/mulet
@@ -1,13 +1,12 @@
 MOZ_AUTOMATION_BUILD_SYMBOLS=0
 MOZ_AUTOMATION_PACKAGE_TESTS=0
 MOZ_AUTOMATION_UPLOAD_SYMBOLS=0
 MOZ_AUTOMATION_UPDATE_PACKAGING=0
-MOZ_AUTOMATION_SDK=0
 . $topsrcdir/build/macosx/mozconfig.common
 
 ac_add_options --enable-application=b2g/dev
 ac_add_options --disable-install-strip
 ac_add_options --enable-signmar
 ac_add_options --enable-profiling
 ac_add_options --enable-instruments
 ac_add_options --enable-dtrace
--- a/b2g/dev/config/mozconfigs/win32/mulet
+++ b/b2g/dev/config/mozconfigs/win32/mulet
@@ -1,13 +1,12 @@
 MOZ_AUTOMATION_BUILD_SYMBOLS=0
 MOZ_AUTOMATION_L10N_CHECK=0
 MOZ_AUTOMATION_PACKAGE_TESTS=0
 MOZ_AUTOMATION_INSTALLER=0
 MOZ_AUTOMATION_UPLOAD_SYMBOLS=0
 MOZ_AUTOMATION_UPDATE_PACKAGING=0
-MOZ_AUTOMATION_SDK=0
 . "$topsrcdir/browser/config/mozconfigs/win32/nightly"
 
 ac_add_options --enable-application=b2g/dev
 
 # Include Firefox OS fonts.
 MOZTTDIR=$topsrcdir/moz-tt
--- a/b2g/graphene/config/horizon-mozconfigs/common
+++ b/b2g/graphene/config/horizon-mozconfigs/common
@@ -1,17 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # Disable the l10n-check target, which isn't relevant to b2g builds at all.
 # This needs to be set prior to the next include for it to take effect.
 MOZ_AUTOMATION_PACKAGE_TESTS=0
 MOZ_AUTOMATION_L10N_CHECK=0
-MOZ_AUTOMATION_SDK=0
 
 . "$topsrcdir/build/mozconfig.common"
 
 # Normally, we'd set this unconditionally, but this file is also used
 # for local builds and there is no other mozconfig in this tree that
 # is included on device builds.
 if test -d $topsrcdir/../gcc/bin; then
     HOST_CC="$topsrcdir/../gcc/bin/gcc"
--- a/b2g/graphene/config/mozconfigs/common
+++ b/b2g/graphene/config/mozconfigs/common
@@ -1,17 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # Disable the l10n-check target, which isn't relevant to b2g builds at all.
 # This needs to be set prior to the next include for it to take effect.
 MOZ_AUTOMATION_PACKAGE_TESTS=0
 MOZ_AUTOMATION_L10N_CHECK=0
-MOZ_AUTOMATION_SDK=0
 
 . "$topsrcdir/build/mozconfig.common"
 
 # Normally, we'd set this unconditionally, but this file is also used
 # for local builds and there is no other mozconfig in this tree that
 # is included on device builds.
 if test -d $topsrcdir/../gcc/bin; then
     HOST_CC="$topsrcdir/../gcc/bin/gcc"
--- a/browser/build.mk
+++ b/browser/build.mk
@@ -9,19 +9,16 @@ package:
 	@$(MAKE) -C browser/installer
 
 package-compare:
 	@$(MAKE) -C browser/installer package-compare
 
 stage-package:
 	@$(MAKE) -C browser/installer stage-package
 
-sdk:
-	@$(MAKE) -C browser/installer make-sdk
-
 install::
 	@$(MAKE) -C browser/installer install
 
 clean::
 	@$(MAKE) -C browser/installer clean
 
 distclean::
 	@$(MAKE) -C browser/installer distclean
--- a/browser/config/mozconfigs/linux32/beta
+++ b/browser/config/mozconfigs/linux32/beta
@@ -1,9 +1,8 @@
-MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
 if [ -n "$ENABLE_RELEASE_PROMOTION" ]; then
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-1}
   MOZ_AUTOMATION_UPDATE_PACKAGING=1
 fi
 
 . "$topsrcdir/browser/config/mozconfigs/linux32/common-opt"
 
 ac_add_options --enable-official-branding
--- a/browser/config/mozconfigs/linux32/release
+++ b/browser/config/mozconfigs/linux32/release
@@ -1,11 +1,10 @@
 # This make file should be identical to the beta mozconfig, apart from the
 # safeguard below
-MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
 
 if [ -n "$ENABLE_RELEASE_PROMOTION" ]; then
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-1}
   MOZ_AUTOMATION_UPDATE_PACKAGING=1
 fi
 
 . "$topsrcdir/browser/config/mozconfigs/linux32/common-opt"
 
--- a/browser/config/mozconfigs/linux64/beta
+++ b/browser/config/mozconfigs/linux64/beta
@@ -1,9 +1,8 @@
-MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
 if [ -n "$ENABLE_RELEASE_PROMOTION" ]; then
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-1}
   MOZ_AUTOMATION_UPDATE_PACKAGING=1
 fi
 
 . "$topsrcdir/browser/config/mozconfigs/linux64/common-opt"
 
 ac_add_options --enable-official-branding
--- a/browser/config/mozconfigs/linux64/release
+++ b/browser/config/mozconfigs/linux64/release
@@ -1,11 +1,10 @@
 # This make file should be identical to the beta mozconfig, apart from the
 # safeguard below
-MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
 
 if [ -n "$ENABLE_RELEASE_PROMOTION" ]; then
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-1}
   MOZ_AUTOMATION_UPDATE_PACKAGING=1
 fi
 
 . "$topsrcdir/browser/config/mozconfigs/linux64/common-opt"
 
--- a/browser/config/mozconfigs/macosx-universal/beta
+++ b/browser/config/mozconfigs/macosx-universal/beta
@@ -1,10 +1,8 @@
-MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
-
 if [ -n "$ENABLE_RELEASE_PROMOTION" ]; then
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-1}
   MOZ_AUTOMATION_UPDATE_PACKAGING=1
 fi
 
 . "$topsrcdir/browser/config/mozconfigs/macosx-universal/common-opt"
 
 ac_add_options --enable-official-branding
--- a/browser/config/mozconfigs/macosx-universal/release
+++ b/browser/config/mozconfigs/macosx-universal/release
@@ -1,11 +1,10 @@
 # This make file should be identical to the beta mozconfig, apart from the
 # safeguard below
-MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
 
 if [ -n "$ENABLE_RELEASE_PROMOTION" ]; then
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-1}
   MOZ_AUTOMATION_UPDATE_PACKAGING=1
 fi
 
 . "$topsrcdir/browser/config/mozconfigs/macosx-universal/common-opt"
 
--- a/browser/config/mozconfigs/macosx64/beta
+++ b/browser/config/mozconfigs/macosx64/beta
@@ -1,10 +1,8 @@
-MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
-
 if [ -n "$ENABLE_RELEASE_PROMOTION" ]; then
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
   MOZ_AUTOMATION_UPDATE_PACKAGING=1
 fi
 
 . "$topsrcdir/browser/config/mozconfigs/macosx64/common-opt"
 
 ac_add_options --enable-official-branding
--- a/browser/config/mozconfigs/macosx64/release
+++ b/browser/config/mozconfigs/macosx64/release
@@ -1,11 +1,10 @@
 # This make file should be identical to the beta mozconfig, apart from the
 # safeguard below
-MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
 
 if [ -n "$ENABLE_RELEASE_PROMOTION" ]; then
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
   MOZ_AUTOMATION_UPDATE_PACKAGING=1
 fi
 
 . "$topsrcdir/browser/config/mozconfigs/macosx64/common-opt"
 
--- a/browser/config/mozconfigs/whitelist
+++ b/browser/config/mozconfigs/whitelist
@@ -73,17 +73,16 @@ for platform in all_platforms:
         'ac_add_options --enable-update-channel=release',
         'ac_add_options --enable-official-branding',
         'mk_add_options MOZ_MAKE_FLAGS="-j4"',
         'export BUILDING_RELEASE=1',
         'if [ -n "$ENABLE_RELEASE_PROMOTION" ]; then',
         'MOZ_AUTOMATION_UPLOAD_SYMBOLS=1',
         'MOZ_AUTOMATION_UPDATE_PACKAGING=1',
         'fi',
-        'MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}',
     ]
 whitelist['release']['win32'] += ['mk_add_options MOZ_PGO=1']
 whitelist['release']['win64'] += ['mk_add_options MOZ_PGO=1']
 
 whitelist['release']['linux32'] += [
     'export MOZILLA_OFFICIAL=1',
     'export MOZ_TELEMETRY_REPORTING=1',
     'mk_add_options MOZ_PGO=1',
--- a/browser/config/mozconfigs/win32/beta
+++ b/browser/config/mozconfigs/win32/beta
@@ -1,10 +1,8 @@
-MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
-
 if [ -n "$ENABLE_RELEASE_PROMOTION" ]; then
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
   MOZ_AUTOMATION_UPDATE_PACKAGING=1
 fi
 
 . "$topsrcdir/build/mozconfig.win-common"
 . "$topsrcdir/browser/config/mozconfigs/win32/common-opt"
 
--- a/browser/config/mozconfigs/win32/release
+++ b/browser/config/mozconfigs/win32/release
@@ -1,11 +1,10 @@
 # This make file should be identical to the beta mozconfig, apart from the
 # safeguard below
-MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
 
 if [ -n "$ENABLE_RELEASE_PROMOTION" ]; then
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
   MOZ_AUTOMATION_UPDATE_PACKAGING=1
 fi
 
 . "$topsrcdir/build/mozconfig.win-common"
 . "$topsrcdir/browser/config/mozconfigs/win32/common-opt"
--- a/browser/config/mozconfigs/win64/beta
+++ b/browser/config/mozconfigs/win64/beta
@@ -1,10 +1,8 @@
-MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
-
 if [ -n "$ENABLE_RELEASE_PROMOTION" ]; then
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
   MOZ_AUTOMATION_UPDATE_PACKAGING=1
 fi
 
 . "$topsrcdir/build/mozconfig.win-common"
 . "$topsrcdir/browser/config/mozconfigs/win64/common-win64"
 . "$topsrcdir/browser/config/mozconfigs/win64/common-opt"
--- a/browser/config/mozconfigs/win64/release
+++ b/browser/config/mozconfigs/win64/release
@@ -1,11 +1,10 @@
 # This make file should be identical to the beta mozconfig, apart from the
 # safeguard below
-MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
 
 if [ -n "$ENABLE_RELEASE_PROMOTION" ]; then
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
   MOZ_AUTOMATION_UPDATE_PACKAGING=1
 fi
 
 . "$topsrcdir/build/mozconfig.win-common"
 . "$topsrcdir/browser/config/mozconfigs/win64/common-win64"
--- a/browser/extensions/pdfjs/README.mozilla
+++ b/browser/extensions/pdfjs/README.mozilla
@@ -1,3 +1,3 @@
 This is the pdf.js project output, https://github.com/mozilla/pdf.js
 
-Current extension version is: 1.7.227
+Current extension version is: 1.7.235
--- a/browser/extensions/pdfjs/content/PdfJs.jsm
+++ b/browser/extensions/pdfjs/content/PdfJs.jsm
@@ -10,52 +10,52 @@
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 /* globals Components, Services, XPCOMUtils, PdfjsChromeUtils,
            PdfjsContentUtils, PdfStreamConverter */
 
-'use strict';
+"use strict";
 
-var EXPORTED_SYMBOLS = ['PdfJs'];
+var EXPORTED_SYMBOLS = ["PdfJs"];
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cm = Components.manager;
 const Cu = Components.utils;
 
-const PREF_PREFIX = 'pdfjs';
-const PREF_DISABLED = PREF_PREFIX + '.disabled';
-const PREF_MIGRATION_VERSION = PREF_PREFIX + '.migrationVersion';
-const PREF_PREVIOUS_ACTION = PREF_PREFIX + '.previousHandler.preferredAction';
+const PREF_PREFIX = "pdfjs";
+const PREF_DISABLED = PREF_PREFIX + ".disabled";
+const PREF_MIGRATION_VERSION = PREF_PREFIX + ".migrationVersion";
+const PREF_PREVIOUS_ACTION = PREF_PREFIX + ".previousHandler.preferredAction";
 const PREF_PREVIOUS_ASK = PREF_PREFIX +
-                          '.previousHandler.alwaysAskBeforeHandling';
-const PREF_DISABLED_PLUGIN_TYPES = 'plugin.disable_full_page_plugin_for_types';
-const TOPIC_PDFJS_HANDLER_CHANGED = 'pdfjs:handlerChanged';
-const TOPIC_PLUGINS_LIST_UPDATED = 'plugins-list-updated';
-const TOPIC_PLUGIN_INFO_UPDATED = 'plugin-info-updated';
-const PDF_CONTENT_TYPE = 'application/pdf';
+                          ".previousHandler.alwaysAskBeforeHandling";
+const PREF_DISABLED_PLUGIN_TYPES = "plugin.disable_full_page_plugin_for_types";
+const TOPIC_PDFJS_HANDLER_CHANGED = "pdfjs:handlerChanged";
+const TOPIC_PLUGINS_LIST_UPDATED = "plugins-list-updated";
+const TOPIC_PLUGIN_INFO_UPDATED = "plugin-info-updated";
+const PDF_CONTENT_TYPE = "application/pdf";
 
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
 
 var Svc = {};
-XPCOMUtils.defineLazyServiceGetter(Svc, 'mime',
-                                   '@mozilla.org/mime;1',
-                                   'nsIMIMEService');
-XPCOMUtils.defineLazyServiceGetter(Svc, 'pluginHost',
-                                   '@mozilla.org/plugin/host;1',
-                                   'nsIPluginHost');
-XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsChromeUtils',
-                                  'resource://pdf.js/PdfjsChromeUtils.jsm');
-XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsContentUtils',
-                                  'resource://pdf.js/PdfjsContentUtils.jsm');
+XPCOMUtils.defineLazyServiceGetter(Svc, "mime",
+                                   "@mozilla.org/mime;1",
+                                   "nsIMIMEService");
+XPCOMUtils.defineLazyServiceGetter(Svc, "pluginHost",
+                                   "@mozilla.org/plugin/host;1",
+                                   "nsIPluginHost");
+XPCOMUtils.defineLazyModuleGetter(this, "PdfjsChromeUtils",
+                                  "resource://pdf.js/PdfjsChromeUtils.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "PdfjsContentUtils",
+                                  "resource://pdf.js/PdfjsContentUtils.jsm");
 
 function getBoolPref(aPref, aDefaultValue) {
   try {
     return Services.prefs.getBoolPref(aPref);
   } catch (ex) {
     return aDefaultValue;
   }
 }
@@ -93,28 +93,28 @@ function initializeDefaultPreferences() 
   "externalLinkTarget": 0,
   "enhanceTextSelection": false,
   "renderer": "canvas",
   "renderInteractiveForms": false,
   "disablePageLabels": false
 }
 
 
-  var defaultBranch = Services.prefs.getDefaultBranch(PREF_PREFIX + '.');
+  var defaultBranch = Services.prefs.getDefaultBranch(PREF_PREFIX + ".");
   var defaultValue;
   for (var key in DEFAULT_PREFERENCES) {
     defaultValue = DEFAULT_PREFERENCES[key];
     switch (typeof defaultValue) {
-      case 'boolean':
+      case "boolean":
         defaultBranch.setBoolPref(key, defaultValue);
         break;
-      case 'number':
+      case "number":
         defaultBranch.setIntPref(key, defaultValue);
         break;
-      case 'string':
+      case "string":
         defaultBranch.setCharPref(key, defaultValue);
         break;
     }
   }
 }
 
 // Register/unregister a constructor as a factory.
 function Factory() {}
@@ -150,18 +150,18 @@ Factory.prototype = {
 var PdfJs = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
   _registered: false,
   _initialized: false,
 
   init: function init(remote) {
     if (Services.appinfo.processType !==
         Services.appinfo.PROCESS_TYPE_DEFAULT) {
-      throw new Error('PdfJs.init should only get called ' +
-                      'in the parent process.');
+      throw new Error("PdfJs.init should only get called " +
+                      "in the parent process.");
     }
     PdfjsChromeUtils.init();
     if (!remote) {
       PdfjsContentUtils.init();
     }
     this.initPrefs();
     this.updateRegistration();
   },
@@ -214,70 +214,70 @@ var PdfJs = {
       return;
     }
     // Make pdf.js the default pdf viewer on the first migration.
     if (currentVersion < 1) {
       this._becomeHandler();
     }
     if (currentVersion < 2) {
       // cleaning up of unused database preference (see #3994)
-      Services.prefs.clearUserPref(PREF_PREFIX + '.database');
+      Services.prefs.clearUserPref(PREF_PREFIX + ".database");
     }
     Services.prefs.setIntPref(PREF_MIGRATION_VERSION, VERSION);
   },
 
   _becomeHandler: function _becomeHandler() {
-    let handlerInfo = Svc.mime.getFromTypeAndExtension(PDF_CONTENT_TYPE, 'pdf');
+    let handlerInfo = Svc.mime.getFromTypeAndExtension(PDF_CONTENT_TYPE, "pdf");
     let prefs = Services.prefs;
     if (handlerInfo.preferredAction !== Ci.nsIHandlerInfo.handleInternally &&
         handlerInfo.preferredAction !== false) {
       // Store the previous settings of preferredAction and
       // alwaysAskBeforeHandling in case we need to revert them in a hotfix that
       // would turn pdf.js off.
       prefs.setIntPref(PREF_PREVIOUS_ACTION, handlerInfo.preferredAction);
       prefs.setBoolPref(PREF_PREVIOUS_ASK, handlerInfo.alwaysAskBeforeHandling);
     }
 
-    let handlerService = Cc['@mozilla.org/uriloader/handler-service;1'].
+    let handlerService = Cc["@mozilla.org/uriloader/handler-service;1"].
                          getService(Ci.nsIHandlerService);
 
     // Change and save mime handler settings.
     handlerInfo.alwaysAskBeforeHandling = false;
     handlerInfo.preferredAction = Ci.nsIHandlerInfo.handleInternally;
     handlerService.store(handlerInfo);
 
     // Also disable any plugins for pdfs.
-    var stringTypes = '';
+    var stringTypes = "";
     var types = [];
     if (prefs.prefHasUserValue(PREF_DISABLED_PLUGIN_TYPES)) {
       stringTypes = prefs.getCharPref(PREF_DISABLED_PLUGIN_TYPES);
     }
-    if (stringTypes !== '') {
-      types = stringTypes.split(',');
+    if (stringTypes !== "") {
+      types = stringTypes.split(",");
     }
 
     if (types.indexOf(PDF_CONTENT_TYPE) === -1) {
       types.push(PDF_CONTENT_TYPE);
     }
-    prefs.setCharPref(PREF_DISABLED_PLUGIN_TYPES, types.join(','));
+    prefs.setCharPref(PREF_DISABLED_PLUGIN_TYPES, types.join(","));
 
     // Update the category manager in case the plugins are already loaded.
-    let categoryManager = Cc['@mozilla.org/categorymanager;1'];
+    let categoryManager = Cc["@mozilla.org/categorymanager;1"];
     categoryManager.getService(Ci.nsICategoryManager).
-                    deleteCategoryEntry('Gecko-Content-Viewers',
+                    deleteCategoryEntry("Gecko-Content-Viewers",
                                         PDF_CONTENT_TYPE,
                                         false);
   },
 
   // nsIObserver
   observe: function observe(aSubject, aTopic, aData) {
     this.updateRegistration();
     if (Services.appinfo.processType ===
         Services.appinfo.PROCESS_TYPE_DEFAULT) {
-      let jsm = 'resource://pdf.js/PdfjsChromeUtils.jsm';
+      let jsm = "resource://pdf.js/PdfjsChromeUtils.jsm";
       let PdfjsChromeUtils = Components.utils.import(jsm, {}).PdfjsChromeUtils;
       PdfjsChromeUtils.notifyChildOfSettingsChange();
     }
   },
 
   /**
    * pdf.js is only enabled if it is both selected as the pdf viewer and if the
    * global switch enabling it is true.
@@ -292,26 +292,26 @@ var PdfJs = {
     // Check if the 'application/pdf' preview handler is configured properly.
     if (!isDefaultHandler()) {
       return false;
     }
 
     // Check if we have disabled plugin handling of 'application/pdf' in prefs
     if (Services.prefs.prefHasUserValue(PREF_DISABLED_PLUGIN_TYPES)) {
       let disabledPluginTypes =
-        Services.prefs.getCharPref(PREF_DISABLED_PLUGIN_TYPES).split(',');
+        Services.prefs.getCharPref(PREF_DISABLED_PLUGIN_TYPES).split(",");
       if (disabledPluginTypes.indexOf(PDF_CONTENT_TYPE) >= 0) {
         return true;
       }
     }
 
     // Check if there is an enabled pdf plugin.
     // Note: this check is performed last because getPluginTags() triggers
     // costly plugin list initialization (bug 881575)
-    let tags = Cc['@mozilla.org/plugin/host;1'].
+    let tags = Cc["@mozilla.org/plugin/host;1"].
                   getService(Ci.nsIPluginHost).
                   getPluginTags();
     let enabledPluginFound = tags.some(function(tag) {
       if (tag.disabled) {
         return false;
       }
       let mimeTypes = tag.getMimeTypes();
       return mimeTypes.some(function(mimeType) {
@@ -323,26 +323,26 @@ var PdfJs = {
     return !enabledPluginFound;
   },
 
   _ensureRegistered: function _ensureRegistered() {
     if (this._registered) {
       return;
     }
     this._pdfStreamConverterFactory = new Factory();
-    Cu.import('resource://pdf.js/PdfStreamConverter.jsm');
+    Cu.import("resource://pdf.js/PdfStreamConverter.jsm");
     this._pdfStreamConverterFactory.register(PdfStreamConverter);
 
     this._registered = true;
   },
 
   _ensureUnregistered: function _ensureUnregistered() {
     if (!this._registered) {
       return;
     }
     this._pdfStreamConverterFactory.unregister();
-    Cu.unload('resource://pdf.js/PdfStreamConverter.jsm');
+    Cu.unload("resource://pdf.js/PdfStreamConverter.jsm");
     delete this._pdfStreamConverterFactory;
 
     this._registered = false;
   }
 };
 
--- a/browser/extensions/pdfjs/content/PdfJsNetwork.jsm
+++ b/browser/extensions/pdfjs/content/PdfJsNetwork.jsm
@@ -9,35 +9,35 @@
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 /* globals Components, Services */
 
-'use strict';
+"use strict";
 
-Components.utils.import('resource://gre/modules/Services.jsm');
+Components.utils.import("resource://gre/modules/Services.jsm");
 
-var EXPORTED_SYMBOLS = ['NetworkManager'];
+var EXPORTED_SYMBOLS = ["NetworkManager"];
 
 function log(aMsg) {
-  var msg = 'PdfJsNetwork.jsm: ' + (aMsg.join ? aMsg.join('') : aMsg);
+  var msg = "PdfJsNetwork.jsm: " + (aMsg.join ? aMsg.join("") : aMsg);
   Services.console.logStringMessage(msg);
 }
 
 var NetworkManager = (function NetworkManagerClosure() {
 
   const OK_RESPONSE = 200;
   const PARTIAL_CONTENT_RESPONSE = 206;
 
   function getArrayBuffer(xhr) {
     var data = xhr.response;
-    if (typeof data !== 'string') {
+    if (typeof data !== "string") {
       return data;
     }
     var length = data.length;
     var array = new Uint8Array(length);
     for (var i = 0; i < length; i++) {
       array[i] = data.charCodeAt(i) & 0xFF;
     }
     return array.buffer;
@@ -77,40 +77,40 @@ var NetworkManager = (function NetworkMa
 
     request(args) {
       var xhr = this.getXhr();
       var xhrId = this.currXhrId++;
       var pendingRequest = this.pendingRequests[xhrId] = {
         xhr,
       };
 
-      xhr.open('GET', this.url);
+      xhr.open("GET", this.url);
       xhr.withCredentials = this.withCredentials;
       for (var property in this.httpHeaders) {
         var value = this.httpHeaders[property];
-        if (typeof value === 'undefined') {
+        if (typeof value === "undefined") {
           continue;
         }
         xhr.setRequestHeader(property, value);
       }
-      if (this.isHttp && 'begin' in args && 'end' in args) {
-        var rangeStr = args.begin + '-' + (args.end - 1);
-        xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
+      if (this.isHttp && "begin" in args && "end" in args) {
+        var rangeStr = args.begin + "-" + (args.end - 1);
+        xhr.setRequestHeader("Range", "bytes=" + rangeStr);
         pendingRequest.expectedStatus = 206;
       } else {
         pendingRequest.expectedStatus = 200;
       }
 
       var useMozChunkedLoading = !!args.onProgressiveData;
       if (useMozChunkedLoading) {
-        xhr.responseType = 'moz-chunked-arraybuffer';
+        xhr.responseType = "moz-chunked-arraybuffer";
         pendingRequest.onProgressiveData = args.onProgressiveData;
         pendingRequest.mozChunked = true;
       } else {
-        xhr.responseType = 'arraybuffer';
+        xhr.responseType = "arraybuffer";
       }
 
       if (args.onError) {
         xhr.onerror = function(evt) {
           args.onError(xhr.status);
         };
       }
       xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
@@ -192,17 +192,17 @@ var NetworkManager = (function NetworkMa
         }
         return;
       }
 
       this.loadedRequests[xhrId] = true;
 
       var chunk = getArrayBuffer(xhr);
       if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
-        var rangeHeader = xhr.getResponseHeader('Content-Range');
+        var rangeHeader = xhr.getResponseHeader("Content-Range");
         var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
         var begin = parseInt(matches[1], 10);
         pendingRequest.onDone({
           begin,
           chunk,
         });
       } else if (pendingRequest.onProgressiveData) {
         pendingRequest.onDone(null);
--- a/browser/extensions/pdfjs/content/PdfJsTelemetry.jsm
+++ b/browser/extensions/pdfjs/content/PdfJsTelemetry.jsm
@@ -10,61 +10,61 @@
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 /* eslint max-len: ["error", 100] */
 /* globals Components, Services */
 
-'use strict';
+"use strict";
 
-this.EXPORTED_SYMBOLS = ['PdfJsTelemetry'];
+this.EXPORTED_SYMBOLS = ["PdfJsTelemetry"];
 
 const Cu = Components.utils;
-Cu.import('resource://gre/modules/Services.jsm');
+Cu.import("resource://gre/modules/Services.jsm");
 
 this.PdfJsTelemetry = {
   onViewerIsUsed() {
-    let histogram = Services.telemetry.getHistogramById('PDF_VIEWER_USED');
+    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_USED");
     histogram.add(true);
   },
   onFallback() {
-    let histogram = Services.telemetry.getHistogramById('PDF_VIEWER_FALLBACK_SHOWN');
+    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_FALLBACK_SHOWN");
     histogram.add(true);
   },
   onDocumentSize(size) {
-    let histogram = Services.telemetry.getHistogramById('PDF_VIEWER_DOCUMENT_SIZE_KB');
+    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_DOCUMENT_SIZE_KB");
     histogram.add(size / 1024);
   },
   onDocumentVersion(versionId) {
-    let histogram = Services.telemetry.getHistogramById('PDF_VIEWER_DOCUMENT_VERSION');
+    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_DOCUMENT_VERSION");
     histogram.add(versionId);
   },
   onDocumentGenerator(generatorId) {
-    let histogram = Services.telemetry.getHistogramById('PDF_VIEWER_DOCUMENT_GENERATOR');
+    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_DOCUMENT_GENERATOR");
     histogram.add(generatorId);
   },
   onEmbed(isObject) {
-    let histogram = Services.telemetry.getHistogramById('PDF_VIEWER_EMBED');
+    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_EMBED");
     histogram.add(isObject);
   },
   onFontType(fontTypeId) {
-    let histogram = Services.telemetry.getHistogramById('PDF_VIEWER_FONT_TYPES');
+    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_FONT_TYPES");
     histogram.add(fontTypeId);
   },
   onForm(isAcroform) {
-    let histogram = Services.telemetry.getHistogramById('PDF_VIEWER_FORM');
+    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_FORM");
     histogram.add(isAcroform);
   },
   onPrint() {
-    let histogram = Services.telemetry.getHistogramById('PDF_VIEWER_PRINT');
+    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_PRINT");
     histogram.add(true);
   },
   onStreamType(streamTypeId) {
-    let histogram = Services.telemetry.getHistogramById('PDF_VIEWER_STREAM_TYPES');
+    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_STREAM_TYPES");
     histogram.add(streamTypeId);
   },
   onTimeToView(ms) {
-    let histogram = Services.telemetry.getHistogramById('PDF_VIEWER_TIME_TO_VIEW_MS');
+    let histogram = Services.telemetry.getHistogramById("PDF_VIEWER_TIME_TO_VIEW_MS");
     histogram.add(ms);
   }
 };
--- a/browser/extensions/pdfjs/content/PdfStreamConverter.jsm
+++ b/browser/extensions/pdfjs/content/PdfStreamConverter.jsm
@@ -10,64 +10,64 @@
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 /* globals Components, Services, XPCOMUtils, NetUtil, PrivateBrowsingUtils,
            dump, NetworkManager, PdfJsTelemetry, PdfjsContentUtils */
 
-'use strict';
+"use strict";
 
-var EXPORTED_SYMBOLS = ['PdfStreamConverter'];
+var EXPORTED_SYMBOLS = ["PdfStreamConverter"];
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cu = Components.utils;
 // True only if this is the version of pdf.js that is included with firefox.
-const MOZ_CENTRAL = JSON.parse('true');
-const PDFJS_EVENT_ID = 'pdf.js.message';
-const PDF_CONTENT_TYPE = 'application/pdf';
-const PREF_PREFIX = 'pdfjs';
-const PDF_VIEWER_WEB_PAGE = 'resource://pdf.js/web/viewer.html';
+const MOZ_CENTRAL = JSON.parse("true");
+const PDFJS_EVENT_ID = "pdf.js.message";
+const PDF_CONTENT_TYPE = "application/pdf";
+const PREF_PREFIX = "pdfjs";
+const PDF_VIEWER_WEB_PAGE = "resource://pdf.js/web/viewer.html";
 const MAX_NUMBER_OF_PREFS = 50;
 const MAX_STRING_PREF_LENGTH = 128;
 
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
-Cu.import('resource://gre/modules/NetUtil.jsm');
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/NetUtil.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, 'NetworkManager',
-  'resource://pdf.js/PdfJsNetwork.jsm');
+XPCOMUtils.defineLazyModuleGetter(this, "NetworkManager",
+  "resource://pdf.js/PdfJsNetwork.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, 'PrivateBrowsingUtils',
-  'resource://gre/modules/PrivateBrowsingUtils.jsm');
+XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
+  "resource://gre/modules/PrivateBrowsingUtils.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, 'PdfJsTelemetry',
-  'resource://pdf.js/PdfJsTelemetry.jsm');
+XPCOMUtils.defineLazyModuleGetter(this, "PdfJsTelemetry",
+  "resource://pdf.js/PdfJsTelemetry.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsContentUtils',
-  'resource://pdf.js/PdfjsContentUtils.jsm');
+XPCOMUtils.defineLazyModuleGetter(this, "PdfjsContentUtils",
+  "resource://pdf.js/PdfjsContentUtils.jsm");
 
 var Svc = {};
-XPCOMUtils.defineLazyServiceGetter(Svc, 'mime',
-                                   '@mozilla.org/mime;1',
-                                   'nsIMIMEService');
+XPCOMUtils.defineLazyServiceGetter(Svc, "mime",
+                                   "@mozilla.org/mime;1",
+                                   "nsIMIMEService");
 
 function getContainingBrowser(domWindow) {
   return domWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                   .getInterface(Ci.nsIWebNavigation)
                   .QueryInterface(Ci.nsIDocShell)
                   .chromeEventHandler;
 }
 
 function getFindBar(domWindow) {
   if (PdfjsContentUtils.isRemote) {
-    throw new Error('FindBar is not accessible from the content process.');
+    throw new Error("FindBar is not accessible from the content process.");
   }
   try {
     var browser = getContainingBrowser(domWindow);
     var tabbrowser = browser.getTabBrowser();
     var tab = tabbrowser.getTabForBrowser(browser);
     return tabbrowser.getFindBar(tab);
   } catch (e) {
     // Suppress errors for PDF files opened in the bookmark sidebar, see
@@ -96,56 +96,56 @@ function getStringPref(pref, def) {
   try {
     return Services.prefs.getComplexValue(pref, Ci.nsISupportsString).data;
   } catch (ex) {
     return def;
   }
 }
 
 function log(aMsg) {
-  if (!getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false)) {
+  if (!getBoolPref(PREF_PREFIX + ".pdfBugEnabled", false)) {
     return;
   }
-  var msg = 'PdfStreamConverter.js: ' + (aMsg.join ? aMsg.join('') : aMsg);
+  var msg = "PdfStreamConverter.js: " + (aMsg.join ? aMsg.join("") : aMsg);
   Services.console.logStringMessage(msg);
-  dump(msg + '\n');
+  dump(msg + "\n");
 }
 
 function getDOMWindow(aChannel) {
   var requestor = aChannel.notificationCallbacks ?
                   aChannel.notificationCallbacks :
                   aChannel.loadGroup.notificationCallbacks;
   var win = requestor.getInterface(Components.interfaces.nsIDOMWindow);
   return win;
 }
 
 function getLocalizedStrings(path) {
-  var stringBundle = Cc['@mozilla.org/intl/stringbundle;1'].
+  var stringBundle = Cc["@mozilla.org/intl/stringbundle;1"].
       getService(Ci.nsIStringBundleService).
-      createBundle('chrome://pdf.js/locale/' + path);
+      createBundle("chrome://pdf.js/locale/" + path);
 
   var map = {};
   var enumerator = stringBundle.getSimpleEnumeration();
   while (enumerator.hasMoreElements()) {
     var string = enumerator.getNext().QueryInterface(Ci.nsIPropertyElement);
-    var key = string.key, property = 'textContent';
-    var i = key.lastIndexOf('.');
+    var key = string.key, property = "textContent";
+    var i = key.lastIndexOf(".");
     if (i >= 0) {
       property = key.substring(i + 1);
       key = key.substring(0, i);
     }
     if (!(key in map)) {
       map[key] = {};
     }
     map[key][property] = string.value;
   }
   return map;
 }
 function getLocalizedString(strings, id, property) {
-  property = property || 'textContent';
+  property = property || "textContent";
   if (id in strings) {
     return strings[id][property];
   }
   return id;
 }
 
 // PDF data storage
 function PdfDataListener(length) {
@@ -228,73 +228,73 @@ class ChromeActions {
   download(data, sendResponse) {
     var self = this;
     var originalUrl = data.originalUrl;
     var blobUrl = data.blobUrl || originalUrl;
     // The data may not be downloaded so we need just retry getting the pdf with
     // the original url.
     var originalUri = NetUtil.newURI(originalUrl);
     var filename = data.filename;
-    if (typeof filename !== 'string' ||
+    if (typeof filename !== "string" ||
         (!/\.pdf$/i.test(filename) && !data.isAttachment)) {
-      filename = 'document.pdf';
+      filename = "document.pdf";
     }
     var blobUri = NetUtil.newURI(blobUrl);
     var extHelperAppSvc =
-          Cc['@mozilla.org/uriloader/external-helper-app-service;1'].
+          Cc["@mozilla.org/uriloader/external-helper-app-service;1"].
              getService(Ci.nsIExternalHelperAppService);
 
     var docIsPrivate = this.isInPrivateBrowsing();
     var netChannel = NetUtil.newChannel({
       uri: blobUri,
       loadUsingSystemPrincipal: true,
     });
-    if ('nsIPrivateBrowsingChannel' in Ci &&
+    if ("nsIPrivateBrowsingChannel" in Ci &&
         netChannel instanceof Ci.nsIPrivateBrowsingChannel) {
       netChannel.setPrivate(docIsPrivate);
     }
     NetUtil.asyncFetch(netChannel, function(aInputStream, aResult) {
       if (!Components.isSuccessCode(aResult)) {
         if (sendResponse) {
           sendResponse(true);
         }
         return;
       }
       // Create a nsIInputStreamChannel so we can set the url on the channel
       // so the filename will be correct.
-      var channel = Cc['@mozilla.org/network/input-stream-channel;1'].
+      var channel = Cc["@mozilla.org/network/input-stream-channel;1"].
                        createInstance(Ci.nsIInputStreamChannel);
       channel.QueryInterface(Ci.nsIChannel);
       try {
         // contentDisposition/contentDispositionFilename is readonly before FF18
         channel.contentDisposition = Ci.nsIChannel.DISPOSITION_ATTACHMENT;
         if (self.contentDispositionFilename && !data.isAttachment) {
           channel.contentDispositionFilename = self.contentDispositionFilename;
         } else {
           channel.contentDispositionFilename = filename;
         }
       } catch (e) {}
       channel.setURI(originalUri);
       channel.loadInfo = netChannel.loadInfo;
       channel.contentStream = aInputStream;
-      if ('nsIPrivateBrowsingChannel' in Ci &&
+      if ("nsIPrivateBrowsingChannel" in Ci &&
           channel instanceof Ci.nsIPrivateBrowsingChannel) {
         channel.setPrivate(docIsPrivate);
       }
 
       var listener = {
         extListener: null,
         onStartRequest(aRequest, aContext) {
           var loadContext = self.domWindow
                                 .QueryInterface(Ci.nsIInterfaceRequestor)
                                 .getInterface(Ci.nsIWebNavigation)
                                 .QueryInterface(Ci.nsILoadContext);
           this.extListener = extHelperAppSvc.doContent(
-            (data.isAttachment ? 'application/octet-stream' :
-                                 'application/pdf'),
+            (data.isAttachment ? "application/octet-stream" :
+                                 "application/pdf"),
             aRequest, loadContext, false);
           this.extListener.onStartRequest(aRequest, aContext);
         },
         onStopRequest(aRequest, aContext, aStatusCode) {
           if (this.extListener) {
             this.extListener.onStopRequest(aRequest, aContext, aStatusCode);
           }
           // Notify the content code we're done downloading.
@@ -308,92 +308,92 @@ class ChromeActions {
         }
       };
 
       channel.asyncOpen2(listener);
     });
   }
 
   getLocale() {
-    return getStringPref('general.useragent.locale', 'en-US');
+    return getStringPref("general.useragent.locale", "en-US");
   }
 
   getStrings(data) {
     try {
       // Lazy initialization of localizedStrings
-      if (!('localizedStrings' in this)) {
-        this.localizedStrings = getLocalizedStrings('viewer.properties');
+      if (!("localizedStrings" in this)) {
+        this.localizedStrings = getLocalizedStrings("viewer.properties");
       }
       var result = this.localizedStrings[data];
       return JSON.stringify(result || null);
     } catch (e) {
-      log('Unable to retrieve localized strings: ' + e);
-      return 'null';
+      log("Unable to retrieve localized strings: " + e);
+      return "null";
     }
   }
 
   supportsIntegratedFind() {
     // Integrated find is only supported when we're not in a frame
     if (this.domWindow.frameElement !== null) {
       return false;
     }
 
     // ... and we are in a child process
     if (PdfjsContentUtils.isRemote) {
       return true;
     }
 
     // ... or when the new find events code exists.
     var findBar = getFindBar(this.domWindow);
-    return !!findBar && ('updateControlState' in findBar);
+    return !!findBar && ("updateControlState" in findBar);
   }
 
   supportsDocumentFonts() {
-    var prefBrowser = getIntPref('browser.display.use_document_fonts', 1);
-    var prefGfx = getBoolPref('gfx.downloadable_fonts.enabled', true);
+    var prefBrowser = getIntPref("browser.display.use_document_fonts", 1);
+    var prefGfx = getBoolPref("gfx.downloadable_fonts.enabled", true);
     return (!!prefBrowser && prefGfx);
   }
 
   supportsDocumentColors() {
-    return getIntPref('browser.display.document_color_use', 0) !== 2;
+    return getIntPref("browser.display.document_color_use", 0) !== 2;
   }
 
   supportedMouseWheelZoomModifierKeys() {
     return {
-      ctrlKey: getIntPref('mousewheel.with_control.action', 3) === 3,
-      metaKey: getIntPref('mousewheel.with_meta.action', 1) === 3,
+      ctrlKey: getIntPref("mousewheel.with_control.action", 3) === 3,
+      metaKey: getIntPref("mousewheel.with_meta.action", 1) === 3,
     };
   }
 
   reportTelemetry(data) {
     var probeInfo = JSON.parse(data);
     switch (probeInfo.type) {
-      case 'documentInfo':
+      case "documentInfo":
         if (!this.telemetryState.documentInfo) {
           PdfJsTelemetry.onDocumentVersion(probeInfo.version | 0);
           PdfJsTelemetry.onDocumentGenerator(probeInfo.generator | 0);
           if (probeInfo.formType) {
-            PdfJsTelemetry.onForm(probeInfo.formType === 'acroform');
+            PdfJsTelemetry.onForm(probeInfo.formType === "acroform");
           }
           this.telemetryState.documentInfo = true;
         }
         break;
-      case 'pageInfo':
+      case "pageInfo":
         if (!this.telemetryState.firstPageInfo) {
           var duration = Date.now() - this.telemetryState.startAt;
           PdfJsTelemetry.onTimeToView(duration);
           this.telemetryState.firstPageInfo = true;
         }
         break;
-      case 'documentStats':
+      case "documentStats":
         // documentStats can be called several times for one documents.
         // if stream/font types are reported, trying not to submit the same
         // enumeration value multiple times.
         var documentStats = probeInfo.stats;
-        if (!documentStats || typeof documentStats !== 'object') {
+        if (!documentStats || typeof documentStats !== "object") {
           break;
         }
         var i, streamTypes = documentStats.streamTypes;
         if (Array.isArray(streamTypes)) {
           var STREAM_TYPE_ID_LIMIT = 20;
           for (i = 0; i < STREAM_TYPE_ID_LIMIT; i++) {
             if (streamTypes[i] &&
                 !this.telemetryState.streamTypesUsed[i]) {
@@ -409,145 +409,145 @@ class ChromeActions {
             if (fontTypes[i] &&
                 !this.telemetryState.fontTypesUsed[i]) {
               PdfJsTelemetry.onFontType(i);
               this.telemetryState.fontTypesUsed[i] = true;
             }
           }
         }
         break;
-      case 'print':
+      case "print":
         PdfJsTelemetry.onPrint();
         break;
     }
   }
 
   /**
    * @param {Object} args - Object with `featureId` and `url` properties.
    * @param {function} sendResponse - Callback function.
    */
   fallback(args, sendResponse) {
     var featureId = args.featureId;
 
     var domWindow = this.domWindow;
-    var strings = getLocalizedStrings('chrome.properties');
+    var strings = getLocalizedStrings("chrome.properties");
     var message;
-    if (featureId === 'forms') {
-      message = getLocalizedString(strings, 'unsupported_feature_forms');
+    if (featureId === "forms") {
+      message = getLocalizedString(strings, "unsupported_feature_forms");
     } else {
-      message = getLocalizedString(strings, 'unsupported_feature');
+      message = getLocalizedString(strings, "unsupported_feature");
     }
     PdfJsTelemetry.onFallback();
     PdfjsContentUtils.displayWarning(domWindow, message,
-      getLocalizedString(strings, 'open_with_different_viewer'),
-      getLocalizedString(strings, 'open_with_different_viewer', 'accessKey'));
+      getLocalizedString(strings, "open_with_different_viewer"),
+      getLocalizedString(strings, "open_with_different_viewer", "accessKey"));
 
     let winmm = domWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                          .getInterface(Ci.nsIDocShell)
                          .QueryInterface(Ci.nsIInterfaceRequestor)
                          .getInterface(Ci.nsIContentFrameMessageManager);
 
-    winmm.addMessageListener('PDFJS:Child:fallbackDownload',
+    winmm.addMessageListener("PDFJS:Child:fallbackDownload",
       function fallbackDownload(msg) {
         let data = msg.data;
         sendResponse(data.download);
 
-        winmm.removeMessageListener('PDFJS:Child:fallbackDownload',
+        winmm.removeMessageListener("PDFJS:Child:fallbackDownload",
                                     fallbackDownload);
       });
   }
 
   updateFindControlState(data) {
     if (!this.supportsIntegratedFind()) {
       return;
     }
     // Verify what we're sending to the findbar.
     var result = data.result;
     var findPrevious = data.findPrevious;
     var findPreviousType = typeof findPrevious;
-    if ((typeof result !== 'number' || result < 0 || result > 3) ||
-        (findPreviousType !== 'undefined' && findPreviousType !== 'boolean')) {
+    if ((typeof result !== "number" || result < 0 || result > 3) ||
+        (findPreviousType !== "undefined" && findPreviousType !== "boolean")) {
       return;
     }
 
     var winmm = this.domWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                               .getInterface(Ci.nsIDocShell)
                               .QueryInterface(Ci.nsIInterfaceRequestor)
                               .getInterface(Ci.nsIContentFrameMessageManager);
 
-    winmm.sendAsyncMessage('PDFJS:Parent:updateControlState', data);
+    winmm.sendAsyncMessage("PDFJS:Parent:updateControlState", data);
   }
 
   setPreferences(prefs, sendResponse) {
-    var defaultBranch = Services.prefs.getDefaultBranch(PREF_PREFIX + '.');
+    var defaultBranch = Services.prefs.getDefaultBranch(PREF_PREFIX + ".");
     var numberOfPrefs = 0;
     var prefValue, prefName;
     for (var key in prefs) {
       if (++numberOfPrefs > MAX_NUMBER_OF_PREFS) {
-        log('setPreferences - Exceeded the maximum number of preferences ' +
-            'that is allowed to be set at once.');
+        log("setPreferences - Exceeded the maximum number of preferences " +
+            "that is allowed to be set at once.");
         break;
       } else if (!defaultBranch.getPrefType(key)) {
         continue;
       }
       prefValue = prefs[key];
-      prefName = (PREF_PREFIX + '.' + key);
+      prefName = (PREF_PREFIX + "." + key);
       switch (typeof prefValue) {
-        case 'boolean':
+        case "boolean":
           PdfjsContentUtils.setBoolPref(prefName, prefValue);
           break;
-        case 'number':
+        case "number":
           PdfjsContentUtils.setIntPref(prefName, prefValue);
           break;
-        case 'string':
+        case "string":
           if (prefValue.length > MAX_STRING_PREF_LENGTH) {
-            log('setPreferences - Exceeded the maximum allowed length ' +
-                'for a string preference.');
+            log("setPreferences - Exceeded the maximum allowed length " +
+                "for a string preference.");
           } else {
             PdfjsContentUtils.setStringPref(prefName, prefValue);
           }
           break;
       }
     }
     if (sendResponse) {
       sendResponse(true);
     }
   }
 
   getPreferences(prefs, sendResponse) {
-    var defaultBranch = Services.prefs.getDefaultBranch(PREF_PREFIX + '.');
+    var defaultBranch = Services.prefs.getDefaultBranch(PREF_PREFIX + ".");
     var currentPrefs = {}, numberOfPrefs = 0;
     var prefValue, prefName;
     for (var key in prefs) {
       if (++numberOfPrefs > MAX_NUMBER_OF_PREFS) {
-        log('getPreferences - Exceeded the maximum number of preferences ' +
-            'that is allowed to be fetched at once.');
+        log("getPreferences - Exceeded the maximum number of preferences " +
+            "that is allowed to be fetched at once.");
         break;
       } else if (!defaultBranch.getPrefType(key)) {
         continue;
       }
       prefValue = prefs[key];
-      prefName = (PREF_PREFIX + '.' + key);
+      prefName = (PREF_PREFIX + "." + key);
       switch (typeof prefValue) {
-        case 'boolean':
+        case "boolean":
           currentPrefs[key] = getBoolPref(prefName, prefValue);
           break;
-        case 'number':
+        case "number":
           currentPrefs[key] = getIntPref(prefName, prefValue);
           break;
-        case 'string':
+        case "string":
           currentPrefs[key] = getStringPref(prefName, prefValue);
           break;
       }
     }
+    let result = JSON.stringify(currentPrefs);
     if (sendResponse) {
-      sendResponse(JSON.stringify(currentPrefs));
-    } else {
-      return JSON.stringify(currentPrefs);
+      sendResponse(result);
     }
+    return result;
   }
 }
 
 /**
  * This is for range requests.
  */
 class RangedChromeActions extends ChromeActions {
   constructor(domWindow, contentDispositionFilename, originalRequest,
@@ -561,17 +561,17 @@ class RangedChromeActions extends Chrome
 
     this.pdfUrl = originalRequest.URI.spec;
     this.contentLength = originalRequest.contentLength;
 
     // Pass all the headers from the original request through
     var httpHeaderVisitor = {
       headers: {},
       visitHeader(aHeader, aValue) {
-        if (aHeader === 'Range') {
+        if (aHeader === "Range") {
           // When loading the PDF from cache, firefox seems to set the Range
           // request header to fetch only the unfetched portions of the file
           // (e.g. 'Range: bytes=1024-'). However, we want to set this header
           // manually to fetch the PDF in chunks.
           return;
         }
         this.headers[aHeader] = aValue;
       }
@@ -579,39 +579,39 @@ class RangedChromeActions extends Chrome
     if (originalRequest.visitRequestHeaders) {
       originalRequest.visitRequestHeaders(httpHeaderVisitor);
     }
 
     var self = this;
     var xhr_onreadystatechange = function xhr_onreadystatechange() {
       if (this.readyState === 1) { // LOADING
         var netChannel = this.channel;
-        if ('nsIPrivateBrowsingChannel' in Ci &&
+        if ("nsIPrivateBrowsingChannel" in Ci &&
             netChannel instanceof Ci.nsIPrivateBrowsingChannel) {
           var docIsPrivate = self.isInPrivateBrowsing();
           netChannel.setPrivate(docIsPrivate);
         }
       }
     };
     var getXhr = function getXhr() {
       const XMLHttpRequest = Components.Constructor(
-          '@mozilla.org/xmlextras/xmlhttprequest;1');
+          "@mozilla.org/xmlextras/xmlhttprequest;1");
       var xhr = new XMLHttpRequest();
-      xhr.addEventListener('readystatechange', xhr_onreadystatechange);
+      xhr.addEventListener("readystatechange", xhr_onreadystatechange);
       return xhr;
     };
 
     this.networkManager = new NetworkManager(this.pdfUrl, {
       httpHeaders: httpHeaderVisitor.headers,
       getXhr,
     });
 
     // If we are in range request mode, this means we manually issued xhr
     // requests, which we need to abort when we leave the page
-    domWindow.addEventListener('unload', function unload(e) {
+    domWindow.addEventListener("unload", function unload(e) {
       domWindow.removeEventListener(e.type, unload);
       self.abortLoading();
     });
   }
 
   initPassiveLoading() {
     var data;
     if (!this.streamingEnabled) {
@@ -619,35 +619,35 @@ class RangedChromeActions extends Chrome
       this.originalRequest = null;
       data = this.dataListener.readData();
       this.dataListener = null;
     } else {
       data = this.dataListener.readData();
 
       this.dataListener.onprogress = (loaded, total) => {
         this.domWindow.postMessage({
-          pdfjsLoadAction: 'progressiveRead',
+          pdfjsLoadAction: "progressiveRead",
           loaded,
           total,
           chunk: this.dataListener.readData(),
-        }, '*');
+        }, "*");
       };
       this.dataListener.oncomplete = () => {
         this.dataListener = null;
       };
     }
 
     this.domWindow.postMessage({
-      pdfjsLoadAction: 'supportsRangedLoading',
+      pdfjsLoadAction: "supportsRangedLoading",
       rangeEnabled: this.rangeEnabled,
       streamingEnabled: this.streamingEnabled,
       pdfUrl: this.pdfUrl,
       length: this.contentLength,
       data,
-    }, '*');
+    }, "*");
 
     return true;
   }
 
   requestDataRange(args) {
     if (!this.rangeEnabled) {
       return;
     }
@@ -656,26 +656,26 @@ class RangedChromeActions extends Chrome
     var end = args.end;
     var domWindow = this.domWindow;
     // TODO(mack): Support error handler. We're not currently not handling
     // errors from chrome code for non-range requests, so this doesn't
     // seem high-pri
     this.networkManager.requestRange(begin, end, {
       onDone: function RangedChromeActions_onDone(aArgs) {
         domWindow.postMessage({
-          pdfjsLoadAction: 'range',
+          pdfjsLoadAction: "range",
           begin: aArgs.begin,
           chunk: aArgs.chunk,
-        }, '*');
+        }, "*");
       },
       onProgress: function RangedChromeActions_onProgress(evt) {
         domWindow.postMessage({
-          pdfjsLoadAction: 'rangeProgress',
+          pdfjsLoadAction: "rangeProgress",
           loaded: evt.loaded,
-        }, '*');
+        }, "*");
       }
     });
   }
 
   abortLoading() {
     this.networkManager.abortAllRequests();
     if (this.originalRequest) {
       this.originalRequest.cancel(Cr.NS_BINDING_ABORTED);
@@ -698,28 +698,28 @@ class StandardChromeActions extends Chro
 
   initPassiveLoading() {
     if (!this.dataListener) {
       return false;
     }
 
     this.dataListener.onprogress = (loaded, total) => {
       this.domWindow.postMessage({
-        pdfjsLoadAction: 'progress',
+        pdfjsLoadAction: "progress",
         loaded,
         total,
-      }, '*');
+      }, "*");
     };
 
     this.dataListener.oncomplete = (data, errorCode) => {
       this.domWindow.postMessage({
-        pdfjsLoadAction: 'complete',
+        pdfjsLoadAction: "complete",
         data,
         errorCode,
-      }, '*');
+      }, "*");
 
       this.dataListener = null;
       this.originalRequest = null;
     };
 
     return true;
   }
 
@@ -744,33 +744,33 @@ class RequestListener {
   receive(event) {
     var message = event.target;
     var doc = message.ownerDocument;
     var action = event.detail.action;
     var data = event.detail.data;
     var sync = event.detail.sync;
     var actions = this.actions;
     if (!(action in actions)) {
-      log('Unknown action: ' + action);
+      log("Unknown action: " + action);
       return;
     }
     var response;
     if (sync) {
       response = actions[action].call(this.actions, data);
       event.detail.response = Cu.cloneInto(response, doc.defaultView);
     } else {
       if (!event.detail.responseExpected) {
         doc.documentElement.removeChild(message);
         response = null;
       } else {
         response = function sendResponse(aResponse) {
           try {
-            var listener = doc.createEvent('CustomEvent');
+            var listener = doc.createEvent("CustomEvent");
             let detail = Cu.cloneInto({ response: aResponse }, doc.defaultView);
-            listener.initCustomEvent('pdf.js.response', true, false, detail);
+            listener.initCustomEvent("pdf.js.response", true, false, detail);
             return message.dispatchEvent(listener);
           } catch (e) {
             // doc is no longer accessible because the requestor is already
             // gone. unloaded content cannot receive the response anyway.
             return false;
           }
         };
       }
@@ -792,54 +792,54 @@ class FindEventManager {
                               .getInterface(Ci.nsIContentFrameMessageManager);
   }
 
   bind() {
     var unload = function(e) {
       this.unbind();
       this.contentWindow.removeEventListener(e.type, unload);
     }.bind(this);
-    this.contentWindow.addEventListener('unload', unload);
+    this.contentWindow.addEventListener("unload", unload);
 
     // We cannot directly attach listeners to for the find events
     // since the FindBar is in the parent process. Instead we're
     // asking the PdfjsChromeUtils to do it for us and forward
     // all the find events to us.
-    this.winmm.sendAsyncMessage('PDFJS:Parent:addEventListener');
-    this.winmm.addMessageListener('PDFJS:Child:handleEvent', this);
+    this.winmm.sendAsyncMessage("PDFJS:Parent:addEventListener");
+    this.winmm.addMessageListener("PDFJS:Child:handleEvent", this);
   }
 
   receiveMessage(msg) {
     var detail = msg.data.detail;
     var type = msg.data.type;
     var contentWindow = this.contentWindow;
 
     detail = Cu.cloneInto(detail, contentWindow);
-    var forward = contentWindow.document.createEvent('CustomEvent');
+    var forward = contentWindow.document.createEvent("CustomEvent");
     forward.initCustomEvent(type, true, true, detail);
     contentWindow.dispatchEvent(forward);
   }
 
   unbind() {
-    this.winmm.sendAsyncMessage('PDFJS:Parent:removeEventListener');
+    this.winmm.sendAsyncMessage("PDFJS:Parent:removeEventListener");
   }
 }
 
 function PdfStreamConverter() {
 }
 
 PdfStreamConverter.prototype = {
 
   // properties required for XPCOM registration:
-  classID: Components.ID('{d0c5195d-e798-49d4-b1d3-9324328b2291}'),
-  classDescription: 'pdf.js Component',
-  contractID: '@mozilla.org/streamconv;1?from=application/pdf&to=*/*',
+  classID: Components.ID("{d0c5195d-e798-49d4-b1d3-9324328b2291}"),
+  classDescription: "pdf.js Component",
+  contractID: "@mozilla.org/streamconv;1?from=application/pdf&to=*/*",
 
-  classID2: Components.ID('{d0c5195d-e798-49d4-b1d3-9324328b2292}'),
-  contractID2: '@mozilla.org/streamconv;1?from=application/pdf&to=text/html',
+  classID2: Components.ID("{d0c5195d-e798-49d4-b1d3-9324328b2292}"),
+  contractID2: "@mozilla.org/streamconv;1?from=application/pdf&to=text/html",
 
   QueryInterface: XPCOMUtils.generateQI([
       Ci.nsISupports,
       Ci.nsIStreamConverter,
       Ci.nsIStreamListener,
       Ci.nsIRequestObserver
   ]),
 
@@ -889,69 +889,69 @@ PdfStreamConverter.prototype = {
     try {
       aRequest.QueryInterface(Ci.nsIHttpChannel);
       isHttpRequest = true;
     } catch (e) {}
 
     var rangeRequest = false;
     var streamRequest = false;
     if (isHttpRequest) {
-      var contentEncoding = 'identity';
+      var contentEncoding = "identity";
       try {
-        contentEncoding = aRequest.getResponseHeader('Content-Encoding');
+        contentEncoding = aRequest.getResponseHeader("Content-Encoding");
       } catch (e) {}
 
       var acceptRanges;
       try {
-        acceptRanges = aRequest.getResponseHeader('Accept-Ranges');
+        acceptRanges = aRequest.getResponseHeader("Accept-Ranges");
       } catch (e) {}
 
       var hash = aRequest.URI.ref;
-      var isPDFBugEnabled = getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false);
-      rangeRequest = contentEncoding === 'identity' &&
-                     acceptRanges === 'bytes' &&
+      var isPDFBugEnabled = getBoolPref(PREF_PREFIX + ".pdfBugEnabled", false);
+      rangeRequest = contentEncoding === "identity" &&
+                     acceptRanges === "bytes" &&
                      aRequest.contentLength >= 0 &&
-                     !getBoolPref(PREF_PREFIX + '.disableRange', false) &&
+                     !getBoolPref(PREF_PREFIX + ".disableRange", false) &&
                      (!isPDFBugEnabled ||
-                      hash.toLowerCase().indexOf('disablerange=true') < 0);
-      streamRequest = contentEncoding === 'identity' &&
+                      hash.toLowerCase().indexOf("disablerange=true") < 0);
+      streamRequest = contentEncoding === "identity" &&
                       aRequest.contentLength >= 0 &&
-                      !getBoolPref(PREF_PREFIX + '.disableStream', false) &&
+                      !getBoolPref(PREF_PREFIX + ".disableStream", false) &&
                       (!isPDFBugEnabled ||
-                       hash.toLowerCase().indexOf('disablestream=true') < 0);
+                       hash.toLowerCase().indexOf("disablestream=true") < 0);
     }
 
     aRequest.QueryInterface(Ci.nsIChannel);
 
     aRequest.QueryInterface(Ci.nsIWritablePropertyBag);
 
     var contentDispositionFilename;
     try {
       contentDispositionFilename = aRequest.contentDispositionFilename;
     } catch (e) {}
 
     // Change the content type so we don't get stuck in a loop.
-    aRequest.setProperty('contentType', aRequest.contentType);
-    aRequest.contentType = 'text/html';
+    aRequest.setProperty("contentType", aRequest.contentType);
+    aRequest.contentType = "text/html";
     if (isHttpRequest) {
       // We trust PDF viewer, using no CSP
-      aRequest.setResponseHeader('Content-Security-Policy', '', false);
-      aRequest.setResponseHeader('Content-Security-Policy-Report-Only', '',
+      aRequest.setResponseHeader("Content-Security-Policy", "", false);
+      aRequest.setResponseHeader("Content-Security-Policy-Report-Only", "",
                                  false);
       // The viewer does not need to handle HTTP Refresh header.
-      aRequest.setResponseHeader('Refresh', '', false);
+      aRequest.setResponseHeader("Refresh", "", false);
     }
 
     PdfJsTelemetry.onViewerIsUsed();
     PdfJsTelemetry.onDocumentSize(aRequest.contentLength);
 
     // Creating storage for PDF data
     var contentLength = aRequest.contentLength;
     this.dataListener = new PdfDataListener(contentLength);
-    this.binaryStream = Cc['@mozilla.org/binaryinputstream;1']
+    this.binaryStream = Cc["@mozilla.org/binaryinputstream;1"]
                         .createInstance(Ci.nsIBinaryInputStream);
 
     // Create a new channel that is viewer loaded as a resource.
     var channel = NetUtil.newChannel({
       uri: PDF_VIEWER_WEB_PAGE,
       loadUsingSystemPrincipal: true,
     });
 
@@ -988,32 +988,32 @@ PdfStreamConverter.prototype = {
         }, false, true);
         if (actions.supportsIntegratedFind()) {
           var findEventManager = new FindEventManager(domWindow);
           findEventManager.bind();
         }
         listener.onStopRequest(aRequest, aContext, statusCode);
 
         if (domWindow.frameElement) {
-          var isObjectEmbed = domWindow.frameElement.tagName !== 'IFRAME' ||
-            domWindow.frameElement.className === 'previewPluginContentFrame';
+          var isObjectEmbed = domWindow.frameElement.tagName !== "IFRAME" ||
+            domWindow.frameElement.className === "previewPluginContentFrame";
           PdfJsTelemetry.onEmbed(isObjectEmbed);
         }
       }
     };
 
     // Keep the URL the same so the browser sees it as the same.
     channel.originalURI = aRequest.URI;
     channel.loadGroup = aRequest.loadGroup;
     channel.loadInfo.originAttributes = aRequest.loadInfo.originAttributes;
 
     // We can use the resource principal when data is fetched by the chrome,
     // e.g. useful for NoScript. Make make sure we reuse the origin attributes
     // from the request channel to keep isolation consistent.
-    var ssm = Cc['@mozilla.org/scriptsecuritymanager;1']
+    var ssm = Cc["@mozilla.org/scriptsecuritymanager;1"]
                 .getService(Ci.nsIScriptSecurityManager);
     var uri = NetUtil.newURI(PDF_VIEWER_WEB_PAGE);
     var resourcePrincipal =
       ssm.createCodebasePrincipal(uri, aRequest.loadInfo.originAttributes);
     aRequest.owner = resourcePrincipal;
 
     channel.asyncOpen2(proxy);
   },
--- a/browser/extensions/pdfjs/content/PdfjsChromeUtils.jsm
+++ b/browser/extensions/pdfjs/content/PdfjsChromeUtils.jsm
@@ -9,35 +9,35 @@
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 /* globals Components, Services, XPCOMUtils */
 
-'use strict';
+"use strict";
 
-var EXPORTED_SYMBOLS = ['PdfjsChromeUtils'];
+var EXPORTED_SYMBOLS = ["PdfjsChromeUtils"];
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cu = Components.utils;
 
-const PREF_PREFIX = 'pdfjs';
-const PDF_CONTENT_TYPE = 'application/pdf';
+const PREF_PREFIX = "pdfjs";
+const PDF_CONTENT_TYPE = "application/pdf";
 
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
 
 var Svc = {};
-XPCOMUtils.defineLazyServiceGetter(Svc, 'mime',
-                                   '@mozilla.org/mime;1',
-                                   'nsIMIMEService');
+XPCOMUtils.defineLazyServiceGetter(Svc, "mime",
+                                   "@mozilla.org/mime;1",
+                                   "nsIMIMEService");
 
 var DEFAULT_PREFERENCES =
 {
   "showPreviousViewOnLoad": true,
   "defaultZoomValue": "",
   "sidebarViewOnLoad": 0,
   "enableHandToolOnLoad": false,
   "enableWebGL": false,
@@ -66,56 +66,56 @@ var PdfjsChromeUtils = {
   /*
    * Public API
    */
 
   init() {
     this._browsers = new WeakSet();
     if (!this._ppmm) {
       // global parent process message manager (PPMM)
-      this._ppmm = Cc['@mozilla.org/parentprocessmessagemanager;1'].
+      this._ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"].
         getService(Ci.nsIMessageBroadcaster);
-      this._ppmm.addMessageListener('PDFJS:Parent:clearUserPref', this);
-      this._ppmm.addMessageListener('PDFJS:Parent:setIntPref', this);
-      this._ppmm.addMessageListener('PDFJS:Parent:setBoolPref', this);
-      this._ppmm.addMessageListener('PDFJS:Parent:setCharPref', this);
-      this._ppmm.addMessageListener('PDFJS:Parent:setStringPref', this);
-      this._ppmm.addMessageListener('PDFJS:Parent:isDefaultHandlerApp', this);
+      this._ppmm.addMessageListener("PDFJS:Parent:clearUserPref", this);
+      this._ppmm.addMessageListener("PDFJS:Parent:setIntPref", this);
+      this._ppmm.addMessageListener("PDFJS:Parent:setBoolPref", this);
+      this._ppmm.addMessageListener("PDFJS:Parent:setCharPref", this);
+      this._ppmm.addMessageListener("PDFJS:Parent:setStringPref", this);
+      this._ppmm.addMessageListener("PDFJS:Parent:isDefaultHandlerApp", this);
 
       // global dom message manager (MMg)
-      this._mmg = Cc['@mozilla.org/globalmessagemanager;1'].
+      this._mmg = Cc["@mozilla.org/globalmessagemanager;1"].
         getService(Ci.nsIMessageListenerManager);
-      this._mmg.addMessageListener('PDFJS:Parent:displayWarning', this);
+      this._mmg.addMessageListener("PDFJS:Parent:displayWarning", this);
 
-      this._mmg.addMessageListener('PDFJS:Parent:addEventListener', this);
-      this._mmg.addMessageListener('PDFJS:Parent:removeEventListener', this);
-      this._mmg.addMessageListener('PDFJS:Parent:updateControlState', this);
+      this._mmg.addMessageListener("PDFJS:Parent:addEventListener", this);
+      this._mmg.addMessageListener("PDFJS:Parent:removeEventListener", this);
+      this._mmg.addMessageListener("PDFJS:Parent:updateControlState", this);
 
       // observer to handle shutdown
-      Services.obs.addObserver(this, 'quit-application', false);
+      Services.obs.addObserver(this, "quit-application", false);
     }
   },
 
   uninit() {
     if (this._ppmm) {
-      this._ppmm.removeMessageListener('PDFJS:Parent:clearUserPref', this);
-      this._ppmm.removeMessageListener('PDFJS:Parent:setIntPref', this);
-      this._ppmm.removeMessageListener('PDFJS:Parent:setBoolPref', this);
-      this._ppmm.removeMessageListener('PDFJS:Parent:setCharPref', this);
-      this._ppmm.removeMessageListener('PDFJS:Parent:setStringPref', this);
-      this._ppmm.removeMessageListener('PDFJS:Parent:isDefaultHandlerApp',
+      this._ppmm.removeMessageListener("PDFJS:Parent:clearUserPref", this);
+      this._ppmm.removeMessageListener("PDFJS:Parent:setIntPref", this);
+      this._ppmm.removeMessageListener("PDFJS:Parent:setBoolPref", this);
+      this._ppmm.removeMessageListener("PDFJS:Parent:setCharPref", this);
+      this._ppmm.removeMessageListener("PDFJS:Parent:setStringPref", this);
+      this._ppmm.removeMessageListener("PDFJS:Parent:isDefaultHandlerApp",
                                        this);
 
-      this._mmg.removeMessageListener('PDFJS:Parent:displayWarning', this);
+      this._mmg.removeMessageListener("PDFJS:Parent:displayWarning", this);
 
-      this._mmg.removeMessageListener('PDFJS:Parent:addEventListener', this);
-      this._mmg.removeMessageListener('PDFJS:Parent:removeEventListener', this);
-      this._mmg.removeMessageListener('PDFJS:Parent:updateControlState', this);
+      this._mmg.removeMessageListener("PDFJS:Parent:addEventListener", this);
+      this._mmg.removeMessageListener("PDFJS:Parent:removeEventListener", this);
+      this._mmg.removeMessageListener("PDFJS:Parent:updateControlState", this);
 
-      Services.obs.removeObserver(this, 'quit-application');
+      Services.obs.removeObserver(this, "quit-application");
 
       this._mmg = null;
       this._ppmm = null;
     }
   },
 
   /*
    * Called by the main module when preference changes are picked up
@@ -126,61 +126,61 @@ var PdfjsChromeUtils = {
   notifyChildOfSettingsChange() {
     if (Services.appinfo.processType ===
         Services.appinfo.PROCESS_TYPE_DEFAULT && this._ppmm) {
       // XXX kinda bad, we want to get the parent process mm associated
       // with the content process. _ppmm is currently the global process
       // manager, which means this is going to fire to every child process
       // we have open. Unfortunately I can't find a way to get at that
       // process specific mm from js.
-      this._ppmm.broadcastAsyncMessage('PDFJS:Child:refreshSettings', {});
+      this._ppmm.broadcastAsyncMessage("PDFJS:Child:refreshSettings", {});
     }
   },
 
   /*
    * Events
    */
 
   observe(aSubject, aTopic, aData) {
-    if (aTopic === 'quit-application') {
+    if (aTopic === "quit-application") {
       this.uninit();
     }
   },
 
   receiveMessage(aMsg) {
     switch (aMsg.name) {
-      case 'PDFJS:Parent:clearUserPref':
+      case "PDFJS:Parent:clearUserPref":
         this._clearUserPref(aMsg.data.name);
         break;
-      case 'PDFJS:Parent:setIntPref':
+      case "PDFJS:Parent:setIntPref":
         this._setIntPref(aMsg.data.name, aMsg.data.value);
         break;
-      case 'PDFJS:Parent:setBoolPref':
+      case "PDFJS:Parent:setBoolPref":
         this._setBoolPref(aMsg.data.name, aMsg.data.value);
         break;
-      case 'PDFJS:Parent:setCharPref':
+      case "PDFJS:Parent:setCharPref":
         this._setCharPref(aMsg.data.name, aMsg.data.value);
         break;
-      case 'PDFJS:Parent:setStringPref':
+      case "PDFJS:Parent:setStringPref":
         this._setStringPref(aMsg.data.name, aMsg.data.value);
         break;
-      case 'PDFJS:Parent:isDefaultHandlerApp':
+      case "PDFJS:Parent:isDefaultHandlerApp":
         return this.isDefaultHandlerApp();
-      case 'PDFJS:Parent:displayWarning':
+      case "PDFJS:Parent:displayWarning":
         this._displayWarning(aMsg);
         break;
 
-
-      case 'PDFJS:Parent:updateControlState':
+      case "PDFJS:Parent:updateControlState":
         return this._updateControlState(aMsg);
-      case 'PDFJS:Parent:addEventListener':
+      case "PDFJS:Parent:addEventListener":
         return this._addEventListener(aMsg);
-      case 'PDFJS:Parent:removeEventListener':
+      case "PDFJS:Parent:removeEventListener":
         return this._removeEventListener(aMsg);
     }
+    return undefined;
   },
 
   /*
    * Internal
    */
 
   _findbarFromMessage(aMsg) {
     let browser = aMsg.target;
@@ -203,35 +203,35 @@ var PdfjsChromeUtils = {
       query: aEvent.detail.query,
       caseSensitive: aEvent.detail.caseSensitive,
       highlightAll: aEvent.detail.highlightAll,
       findPrevious: aEvent.detail.findPrevious
     };
 
     let browser = aEvent.currentTarget.browser;
     if (!this._browsers.has(browser)) {
-      throw new Error('FindEventManager was not bound ' +
-                      'for the current browser.');
+      throw new Error("FindEventManager was not bound " +
+                      "for the current browser.");
     }
     // Only forward the events if the current browser is a registered browser.
     let mm = browser.messageManager;
-    mm.sendAsyncMessage('PDFJS:Child:handleEvent', { type, detail, });
+    mm.sendAsyncMessage("PDFJS:Child:handleEvent", { type, detail, });
     aEvent.preventDefault();
   },
 
-  _types: ['find',
-           'findagain',
-           'findhighlightallchange',
-           'findcasesensitivitychange'],
+  _types: ["find",
+           "findagain",
+           "findhighlightallchange",
+           "findcasesensitivitychange"],
 
   _addEventListener(aMsg) {
     let browser = aMsg.target;
     if (this._browsers.has(browser)) {
-      throw new Error('FindEventManager was bound 2nd time ' +
-                      'without unbinding it first.');
+      throw new Error("FindEventManager was bound 2nd time " +
+                      "without unbinding it first.");
     }
 
     // Since this jsm is global, we need to store all the browsers
     // we have to forward the messages for.
     this._browsers.add(browser);
 
     // And we need to start listening to find events.
     for (var i = 0; i < this._types.length; i++) {
@@ -239,35 +239,35 @@ var PdfjsChromeUtils = {
       this._findbarFromMessage(aMsg)
           .addEventListener(type, this, true);
     }
   },
 
   _removeEventListener(aMsg) {
     let browser = aMsg.target;
     if (!this._browsers.has(browser)) {
-      throw new Error('FindEventManager was unbound without binding it first.');
+      throw new Error("FindEventManager was unbound without binding it first.");
     }
 
     this._browsers.delete(browser);
 
     // No reason to listen to find events any longer.
     for (var i = 0; i < this._types.length; i++) {
       var type = this._types[i];
       this._findbarFromMessage(aMsg)
           .removeEventListener(type, this, true);
     }
   },
 
   _ensurePreferenceAllowed(aPrefName) {
-    let unPrefixedName = aPrefName.split(PREF_PREFIX + '.');
-    if (unPrefixedName[0] !== '' ||
+    let unPrefixedName = aPrefName.split(PREF_PREFIX + ".");
+    if (unPrefixedName[0] !== "" ||
         this._allowedPrefNames.indexOf(unPrefixedName[1]) === -1) {
-      let msg = '"' + aPrefName + '" ' +
-                'can\'t be accessed from content. See PdfjsChromeUtils.';
+      let msg = "\"" + aPrefName + "\" " +
+                "can't be accessed from content. See PdfjsChromeUtils.";
       throw new Error(msg);
     }
   },
 
   _clearUserPref(aPrefName) {
     this._ensurePreferenceAllowed(aPrefName);
     Services.prefs.clearUserPref(aPrefName);
   },
@@ -284,29 +284,29 @@ var PdfjsChromeUtils = {
 
   _setCharPref(aPrefName, aPrefValue) {
     this._ensurePreferenceAllowed(aPrefName);
     Services.prefs.setCharPref(aPrefName, aPrefValue);
   },
 
   _setStringPref(aPrefName, aPrefValue) {
     this._ensurePreferenceAllowed(aPrefName);
-    let str = Cc['@mozilla.org/supports-string;1']
+    let str = Cc["@mozilla.org/supports-string;1"]
                 .createInstance(Ci.nsISupportsString);
     str.data = aPrefValue;
     Services.prefs.setComplexValue(aPrefName, Ci.nsISupportsString, str);
   },
 
   /*
    * Svc.mime doesn't have profile information in the child, so
    * we bounce this pdfjs enabled configuration check over to the
    * parent.
    */
   isDefaultHandlerApp() {
-    var handlerInfo = Svc.mime.getFromTypeAndExtension(PDF_CONTENT_TYPE, 'pdf');
+    var handlerInfo = Svc.mime.getFromTypeAndExtension(PDF_CONTENT_TYPE, "pdf");
     return (!handlerInfo.alwaysAskBeforeHandling &&
             handlerInfo.preferredAction === Ci.nsIHandlerInfo.handleInternally);
   },
 
   /*
    * Display a notification warning when the renderer isn't sure
    * a pdf displayed correctly.
    */
@@ -318,33 +318,33 @@ var PdfjsChromeUtils = {
     let notificationBox = tabbrowser.getNotificationBox(browser);
 
     // Flag so we don't send the message twice, since if the user clicks
     // "open with different viewer" both the button callback and
     // eventCallback will be called.
     let messageSent = false;
     function sendMessage(download) {
       let mm = browser.messageManager;
-      mm.sendAsyncMessage('PDFJS:Child:fallbackDownload', { download, });
+      mm.sendAsyncMessage("PDFJS:Child:fallbackDownload", { download, });
     }
     let buttons = [{
       label: data.label,
       accessKey: data.accessKey,
       callback() {
         messageSent = true;
         sendMessage(true);
       }
     }];
-    notificationBox.appendNotification(data.message, 'pdfjs-fallback', null,
+    notificationBox.appendNotification(data.message, "pdfjs-fallback", null,
                                        notificationBox.PRIORITY_INFO_LOW,
                                        buttons,
                                        function eventsCallback(eventType) {
       // Currently there is only one event "removed" but if there are any other
       // added in the future we still only care about removed at the moment.
-      if (eventType !== 'removed') {
+      if (eventType !== "removed") {
         return;
       }
       // Don't send a response again if we already responded when the button was
       // clicked.
       if (messageSent) {
         return;
       }
       sendMessage(false);
--- a/browser/extensions/pdfjs/content/PdfjsContentUtils.jsm
+++ b/browser/extensions/pdfjs/content/PdfjsContentUtils.jsm
@@ -9,27 +9,27 @@
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 /* globals Components, Services, XPCOMUtils */
 
-'use strict';
+"use strict";
 
-var EXPORTED_SYMBOLS = ['PdfjsContentUtils'];
+var EXPORTED_SYMBOLS = ["PdfjsContentUtils"];
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cu = Components.utils;
 
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
 
 var PdfjsContentUtils = {
   _mm: null,
 
   /*
    * Public API
    */
 
@@ -37,113 +37,113 @@ var PdfjsContentUtils = {
     return (Services.appinfo.processType ===
             Services.appinfo.PROCESS_TYPE_CONTENT);
   },
 
   init() {
     // child *process* mm, or when loaded into the parent for in-content
     // support the psuedo child process mm 'child PPMM'.
     if (!this._mm) {
-      this._mm = Cc['@mozilla.org/childprocessmessagemanager;1'].
+      this._mm = Cc["@mozilla.org/childprocessmessagemanager;1"].
         getService(Ci.nsISyncMessageSender);
-      this._mm.addMessageListener('PDFJS:Child:refreshSettings', this);
-      Services.obs.addObserver(this, 'quit-application', false);
+      this._mm.addMessageListener("PDFJS:Child:refreshSettings", this);
+      Services.obs.addObserver(this, "quit-application", false);
     }
   },
 
   uninit() {
     if (this._mm) {
-      this._mm.removeMessageListener('PDFJS:Child:refreshSettings', this);
-      Services.obs.removeObserver(this, 'quit-application');
+      this._mm.removeMessageListener("PDFJS:Child:refreshSettings", this);
+      Services.obs.removeObserver(this, "quit-application");
     }
     this._mm = null;
   },
 
   /*
    * prefs utilities - the child does not have write access to prefs.
    * note, the pref names here are cross-checked against a list of
    * approved pdfjs prefs in chrome utils.
    */
 
   clearUserPref(aPrefName) {
-    this._mm.sendSyncMessage('PDFJS:Parent:clearUserPref', {
+    this._mm.sendSyncMessage("PDFJS:Parent:clearUserPref", {
       name: aPrefName
     });
   },
 
   setIntPref(aPrefName, aPrefValue) {
-    this._mm.sendSyncMessage('PDFJS:Parent:setIntPref', {
+    this._mm.sendSyncMessage("PDFJS:Parent:setIntPref", {
       name: aPrefName,
       value: aPrefValue
     });
   },
 
   setBoolPref(aPrefName, aPrefValue) {
-    this._mm.sendSyncMessage('PDFJS:Parent:setBoolPref', {
+    this._mm.sendSyncMessage("PDFJS:Parent:setBoolPref", {
       name: aPrefName,
       value: aPrefValue
     });
   },
 
   setCharPref(aPrefName, aPrefValue) {
-    this._mm.sendSyncMessage('PDFJS:Parent:setCharPref', {
+    this._mm.sendSyncMessage("PDFJS:Parent:setCharPref", {
       name: aPrefName,
       value: aPrefValue
     });
   },
 
   setStringPref(aPrefName, aPrefValue) {
-    this._mm.sendSyncMessage('PDFJS:Parent:setStringPref', {
+    this._mm.sendSyncMessage("PDFJS:Parent:setStringPref", {
       name: aPrefName,
       value: aPrefValue
     });
   },
 
   /*
    * Forwards default app query to the parent where we check various
    * handler app settings only available in the parent process.
    */
   isDefaultHandlerApp() {
-    return this._mm.sendSyncMessage('PDFJS:Parent:isDefaultHandlerApp')[0];
+    return this._mm.sendSyncMessage("PDFJS:Parent:isDefaultHandlerApp")[0];
   },
 
   /*
    * Request the display of a notification warning in the associated window
    * when the renderer isn't sure a pdf displayed correctly.
    */
   displayWarning(aWindow, aMessage, aLabel, aAccessKey) {
     // the child's dom frame mm associated with the window.
     let winmm = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                        .getInterface(Ci.nsIDocShell)
                        .QueryInterface(Ci.nsIInterfaceRequestor)
                        .getInterface(Ci.nsIContentFrameMessageManager);
-    winmm.sendAsyncMessage('PDFJS:Parent:displayWarning', {
+    winmm.sendAsyncMessage("PDFJS:Parent:displayWarning", {
       message: aMessage,
       label: aLabel,
       accessKey: aAccessKey,
     });
   },
 
   /*
    * Events
    */
 
   observe(aSubject, aTopic, aData) {
-    if (aTopic === 'quit-application') {
+    if (aTopic === "quit-application") {
       this.uninit();
     }
   },
 
   receiveMessage(aMsg) {
     switch (aMsg.name) {
-      case 'PDFJS:Child:refreshSettings':
+      case "PDFJS:Child:refreshSettings":
         // Only react to this if we are remote.
         if (Services.appinfo.processType ===
             Services.appinfo.PROCESS_TYPE_CONTENT) {
-          let jsm = 'resource://pdf.js/PdfJs.jsm';
+          let jsm = "resource://pdf.js/PdfJs.jsm";
           let pdfjs = Components.utils.import(jsm, {}).PdfJs;
           pdfjs.updateRegistration();
         }
         break;
     }
   }
 };
 
--- a/browser/extensions/pdfjs/content/build/pdf.js
+++ b/browser/extensions/pdfjs/content/build/pdf.js
@@ -18,18 +18,18 @@
   define('pdfjs-dist/build/pdf', ['exports'], factory);
  } else if (typeof exports !== 'undefined') {
   factory(exports);
  } else {
   factory(root['pdfjsDistBuildPdf'] = {});
  }
 }(this, function (exports) {
  'use strict';
- var pdfjsVersion = '1.7.227';
- var pdfjsBuild = 'e132fa97';
+ var pdfjsVersion = '1.7.235';
+ var pdfjsBuild = '3f320f0b';
  var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null;
  var pdfjsLibs = {};
  (function pdfjsWrapper() {
   (function (root, factory) {
    factory(root.pdfjsSharedUtil = {});
   }(this, function (exports) {
    var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this;
    var FONT_IDENTITY_MATRIX = [
@@ -1615,17 +1615,17 @@
       document.documentElement.getElementsByTagName('head')[0].appendChild(styleElement);
      }
      var styleSheet = styleElement.sheet;
      styleSheet.insertRule(rule, styleSheet.cssRules.length);
     },
     clear: function fontLoaderClear() {
      var styleElement = this.styleElement;
      if (styleElement) {
-      styleElement.remove();
+      styleElement.parentNode.removeChild(styleElement);
       styleElement = this.styleElement = null;
      }
     }
    };
    FontLoader.prototype.bind = function fontLoaderBind(fonts, callback) {
     for (var i = 0, ii = fonts.length; i < ii; i++) {
      var font = fonts[i];
      if (font.attached) {
@@ -4688,23 +4688,17 @@
        ctx.save();
        if (this.baseTransform) {
         ctx.setTransform.apply(ctx, this.baseTransform);
        }
        ctx.fillStyle = fillColor.getPattern(ctx, this);
        needRestore = true;
       }
       if (this.pendingEOFill) {
-       if (ctx.mozFillRule !== undefined) {
-        ctx.mozFillRule = 'evenodd';
-        ctx.fill();
-        ctx.mozFillRule = 'nonzero';
-       } else {
-        ctx.fill('evenodd');
-       }
+       ctx.fill('evenodd');
        this.pendingEOFill = false;
       } else {
        ctx.fill();
       }
       if (needRestore) {
        ctx.restore();
       }
       if (consumePath) {
@@ -5526,23 +5520,17 @@
      beginCompat: function CanvasGraphics_beginCompat() {
      },
      endCompat: function CanvasGraphics_endCompat() {
      },
      consumePath: function CanvasGraphics_consumePath() {
       var ctx = this.ctx;
       if (this.pendingClip) {
        if (this.pendingClip === EO_CLIP) {
-        if (ctx.mozFillRule !== undefined) {
-         ctx.mozFillRule = 'evenodd';
-         ctx.clip();
-         ctx.mozFillRule = 'nonzero';
-        } else {
-         ctx.clip('evenodd');
-        }
+        ctx.clip('evenodd');
        } else {
         ctx.clip();
        }
        this.pendingClip = null;
       }
       ctx.beginPath();
      },
      getSinglePixelWidth: function CanvasGraphics_getSinglePixelWidth(scale) {
--- a/browser/extensions/pdfjs/content/build/pdf.worker.js
+++ b/browser/extensions/pdfjs/content/build/pdf.worker.js
@@ -18,18 +18,18 @@
   define('pdfjs-dist/build/pdf.worker', ['exports'], factory);
  } else if (typeof exports !== 'undefined') {
   factory(exports);
  } else {
   factory(root['pdfjsDistBuildPdfWorker'] = {});
  }
 }(this, function (exports) {
  'use strict';
- var pdfjsVersion = '1.7.227';
- var pdfjsBuild = 'e132fa97';
+ var pdfjsVersion = '1.7.235';
+ var pdfjsBuild = '3f320f0b';
  var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null;
  var pdfjsLibs = {};
  (function pdfjsWrapper() {
   (function (root, factory) {
    factory(root.pdfjsCoreArithmeticDecoder = {});
   }(this, function (exports) {
    var ArithmeticDecoder = function ArithmeticDecoderClosure() {
     var QeTable = [
@@ -19515,16 +19515,17 @@
     return MurmurHash3_64;
    }();
    exports.MurmurHash3_64 = MurmurHash3_64;
   }));
   (function (root, factory) {
    factory(root.pdfjsCorePrimitives = {}, root.pdfjsSharedUtil);
   }(this, function (exports, sharedUtil) {
    var isArray = sharedUtil.isArray;
+   var EOF = {};
    var Name = function NameClosure() {
     function Name(name) {
      this.name = name;
     }
     Name.prototype = {};
     var nameCache = Object.create(null);
     Name.get = function Name_get(name) {
      var nameValue = nameCache[name];
@@ -19700,16 +19701,19 @@
       }
      },
      clear: function RefSetCache_clear() {
       this.dict = Object.create(null);
      }
     };
     return RefSetCache;
    }();
+   function isEOF(v) {
+    return v === EOF;
+   }
    function isName(v, name) {
     return v instanceof Name && (name === undefined || v.name === name);
    }
    function isCmd(v, cmd) {
     return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
    }
    function isDict(v, type) {
     return v instanceof Dict && (type === undefined || isName(v.get('Type'), type));
@@ -19718,22 +19722,24 @@
     return v instanceof Ref;
    }
    function isRefsEqual(v1, v2) {
     return v1.num === v2.num && v1.gen === v2.gen;
    }
    function isStream(v) {
     return typeof v === 'object' && v !== null && v.getBytes !== undefined;
    }
+   exports.EOF = EOF;
    exports.Cmd = Cmd;
    exports.Dict = Dict;
    exports.Name = Name;
    exports.Ref = Ref;
    exports.RefSet = RefSet;
    exports.RefSetCache = RefSetCache;
+   exports.isEOF = isEOF;
    exports.isCmd = isCmd;
    exports.isDict = isDict;
    exports.isName = isName;
    exports.isRef = isRef;
    exports.isRefsEqual = isRefsEqual;
    exports.isStream = isStream;
   }));
   (function (root, factory) {
@@ -22346,16 +22352,210 @@
    }
    exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
    exports.reverseIfRtl = reverseIfRtl;
    exports.getUnicodeRangeFor = getUnicodeRangeFor;
    exports.getNormalizedUnicodes = getNormalizedUnicodes;
    exports.getUnicodeForGlyph = getUnicodeForGlyph;
   }));
   (function (root, factory) {
+   factory(root.pdfjsCorePsParser = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives);
+  }(this, function (exports, sharedUtil, corePrimitives) {
+   var error = sharedUtil.error;
+   var isSpace = sharedUtil.isSpace;
+   var EOF = corePrimitives.EOF;
+   var PostScriptParser = function PostScriptParserClosure() {
+    function PostScriptParser(lexer) {
+     this.lexer = lexer;
+     this.operators = [];
+     this.token = null;
+     this.prev = null;
+    }
+    PostScriptParser.prototype = {
+     nextToken: function PostScriptParser_nextToken() {
+      this.prev = this.token;
+      this.token = this.lexer.getToken();
+     },
+     accept: function PostScriptParser_accept(type) {
+      if (this.token.type === type) {
+       this.nextToken();
+       return true;
+      }
+      return false;
+     },
+     expect: function PostScriptParser_expect(type) {
+      if (this.accept(type)) {
+       return true;
+      }
+      error('Unexpected symbol: found ' + this.token.type + ' expected ' + type + '.');
+     },
+     parse: function PostScriptParser_parse() {
+      this.nextToken();
+      this.expect(PostScriptTokenTypes.LBRACE);
+      this.parseBlock();
+      this.expect(PostScriptTokenTypes.RBRACE);
+      return this.operators;
+     },
+     parseBlock: function PostScriptParser_parseBlock() {
+      while (true) {
+       if (this.accept(PostScriptTokenTypes.NUMBER)) {
+        this.operators.push(this.prev.value);
+       } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
+        this.operators.push(this.prev.value);
+       } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
+        this.parseCondition();
+       } else {
+        return;
+       }
+      }
+     },
+     parseCondition: function PostScriptParser_parseCondition() {
+      var conditionLocation = this.operators.length;
+      this.operators.push(null, null);
+      this.parseBlock();
+      this.expect(PostScriptTokenTypes.RBRACE);
+      if (this.accept(PostScriptTokenTypes.IF)) {
+       this.operators[conditionLocation] = this.operators.length;
+       this.operators[conditionLocation + 1] = 'jz';
+      } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
+       var jumpLocation = this.operators.length;
+       this.operators.push(null, null);
+       var endOfTrue = this.operators.length;
+       this.parseBlock();
+       this.expect(PostScriptTokenTypes.RBRACE);
+       this.expect(PostScriptTokenTypes.IFELSE);
+       this.operators[jumpLocation] = this.operators.length;
+       this.operators[jumpLocation + 1] = 'j';
+       this.operators[conditionLocation] = endOfTrue;
+       this.operators[conditionLocation + 1] = 'jz';
+      } else {
+       error('PS Function: error parsing conditional.');
+      }
+     }
+    };
+    return PostScriptParser;
+   }();
+   var PostScriptTokenTypes = {
+    LBRACE: 0,
+    RBRACE: 1,
+    NUMBER: 2,
+    OPERATOR: 3,
+    IF: 4,
+    IFELSE: 5
+   };
+   var PostScriptToken = function PostScriptTokenClosure() {
+    function PostScriptToken(type, value) {
+     this.type = type;
+     this.value = value;
+    }
+    var opCache = Object.create(null);
+    PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
+     var opValue = opCache[op];
+     if (opValue) {
+      return opValue;
+     }
+     return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
+    };
+    PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, '{');
+    PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, '}');
+    PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF');
+    PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE');
+    return PostScriptToken;
+   }();
+   var PostScriptLexer = function PostScriptLexerClosure() {
+    function PostScriptLexer(stream) {
+     this.stream = stream;
+     this.nextChar();
+     this.strBuf = [];
+    }
+    PostScriptLexer.prototype = {
+     nextChar: function PostScriptLexer_nextChar() {
+      return this.currentChar = this.stream.getByte();
+     },
+     getToken: function PostScriptLexer_getToken() {
+      var comment = false;
+      var ch = this.currentChar;
+      while (true) {
+       if (ch < 0) {
+        return EOF;
+       }
+       if (comment) {
+        if (ch === 0x0A || ch === 0x0D) {
+         comment = false;
+        }
+       } else if (ch === 0x25) {
+        comment = true;
+       } else if (!isSpace(ch)) {
+        break;
+       }
+       ch = this.nextChar();
+      }
+      switch (ch | 0) {
+      case 0x30:
+      case 0x31:
+      case 0x32:
+      case 0x33:
+      case 0x34:
+      case 0x35:
+      case 0x36:
+      case 0x37:
+      case 0x38:
+      case 0x39:
+      case 0x2B:
+      case 0x2D:
+      case 0x2E:
+       return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
+      case 0x7B:
+       this.nextChar();
+       return PostScriptToken.LBRACE;
+      case 0x7D:
+       this.nextChar();
+       return PostScriptToken.RBRACE;
+      }
+      var strBuf = this.strBuf;
+      strBuf.length = 0;
+      strBuf[0] = String.fromCharCode(ch);
+      while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) {
+       strBuf.push(String.fromCharCode(ch));
+      }
+      var str = strBuf.join('');
+      switch (str.toLowerCase()) {
+      case 'if':
+       return PostScriptToken.IF;
+      case 'ifelse':
+       return PostScriptToken.IFELSE;
+      default:
+       return PostScriptToken.getOperator(str);
+      }
+     },
+     getNumber: function PostScriptLexer_getNumber() {
+      var ch = this.currentChar;
+      var strBuf = this.strBuf;
+      strBuf.length = 0;
+      strBuf[0] = String.fromCharCode(ch);
+      while ((ch = this.nextChar()) >= 0) {
+       if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) {
+        strBuf.push(String.fromCharCode(ch));
+       } else {
+        break;
+       }
+      }
+      var value = parseFloat(strBuf.join(''));
+      if (isNaN(value)) {
+       error('Invalid floating point number: ' + value);
+      }
+      return value;
+     }
+    };
+    return PostScriptLexer;
+   }();
+   exports.PostScriptLexer = PostScriptLexer;
+   exports.PostScriptParser = PostScriptParser;
+  }));
+  (function (root, factory) {
    factory(root.pdfjsCoreStream = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreJbig2, root.pdfjsCoreJpg, root.pdfjsCoreJpx);
   }(this, function (exports, sharedUtil, corePrimitives, coreJbig2, coreJpg, coreJpx) {
    var Util = sharedUtil.Util;
    var error = sharedUtil.error;
    var info = sharedUtil.info;
    var isInt = sharedUtil.isInt;
    var isArray = sharedUtil.isArray;
    var createObjectURL = sharedUtil.createObjectURL;
@@ -33590,50 +33790,1043 @@
       }
       return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
      }
     };
    }();
    exports.FontRendererFactory = FontRendererFactory;
   }));
   (function (root, factory) {
+   factory(root.pdfjsCoreFunction = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCorePsParser);
+  }(this, function (exports, sharedUtil, corePrimitives, corePsParser) {
+   var error = sharedUtil.error;
+   var info = sharedUtil.info;
+   var isArray = sharedUtil.isArray;
+   var isBool = sharedUtil.isBool;
+   var isDict = corePrimitives.isDict;
+   var isStream = corePrimitives.isStream;
+   var PostScriptLexer = corePsParser.PostScriptLexer;
+   var PostScriptParser = corePsParser.PostScriptParser;
+   var PDFFunction = function PDFFunctionClosure() {
+    var CONSTRUCT_SAMPLED = 0;
+    var CONSTRUCT_INTERPOLATED = 2;
+    var CONSTRUCT_STICHED = 3;
+    var CONSTRUCT_POSTSCRIPT = 4;
+    return {
+     getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps, str) {
+      var i, ii;
+      var length = 1;
+      for (i = 0, ii = size.length; i < ii; i++) {
+       length *= size[i];
+      }
+      length *= outputSize;
+      var array = new Array(length);
+      var codeSize = 0;
+      var codeBuf = 0;
+      var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
+      var strBytes = str.getBytes((length * bps + 7) / 8);
+      var strIdx = 0;
+      for (i = 0; i < length; i++) {
+       while (codeSize < bps) {
+        codeBuf <<= 8;
+        codeBuf |= strBytes[strIdx++];
+        codeSize += 8;
+       }
+       codeSize -= bps;
+       array[i] = (codeBuf >> codeSize) * sampleMul;
+       codeBuf &= (1 << codeSize) - 1;
+      }
+      return array;
+     },
+     getIR: function PDFFunction_getIR(xref, fn) {
+      var dict = fn.dict;
+      if (!dict) {
+       dict = fn;
+      }
+      var types = [
+       this.constructSampled,
+       null,
+       this.constructInterpolated,
+       this.constructStiched,
+       this.constructPostScript
+      ];
+      var typeNum = dict.get('FunctionType');
+      var typeFn = types[typeNum];
+      if (!typeFn) {
+       error('Unknown type of function');
+      }
+      return typeFn.call(this, fn, dict, xref);
+     },
+     fromIR: function PDFFunction_fromIR(IR) {
+      var type = IR[0];
+      switch (type) {
+      case CONSTRUCT_SAMPLED:
+       return this.constructSampledFromIR(IR);
+      case CONSTRUCT_INTERPOLATED:
+       return this.constructInterpolatedFromIR(IR);
+      case CONSTRUCT_STICHED:
+       return this.constructStichedFromIR(IR);
+      default:
+       return this.constructPostScriptFromIR(IR);
+      }
+     },
+     parse: function PDFFunction_parse(xref, fn) {
+      var IR = this.getIR(xref, fn);
+      return this.fromIR(IR);
+     },
+     parseArray: function PDFFunction_parseArray(xref, fnObj) {
+      if (!isArray(fnObj)) {
+       return this.parse(xref, fnObj);
+      }
+      var fnArray = [];
+      for (var j = 0, jj = fnObj.length; j < jj; j++) {
+       var obj = xref.fetchIfRef(fnObj[j]);
+       fnArray.push(PDFFunction.parse(xref, obj));
+      }
+      return function (src, srcOffset, dest, destOffset) {
+       for (var i = 0, ii = fnArray.length; i < ii; i++) {
+        fnArray[i](src, srcOffset, dest, destOffset + i);
+       }
+      };
+     },
+     constructSampled: function PDFFunction_constructSampled(str, dict) {
+      function toMultiArray(arr) {
+       var inputLength = arr.length;
+       var out = [];
+       var index = 0;
+       for (var i = 0; i < inputLength; i += 2) {
+        out[index] = [
+         arr[i],
+         arr[i + 1]
+        ];
+        ++index;
+       }
+       return out;
+      }
+      var domain = dict.getArray('Domain');
+      var range = dict.getArray('Range');
+      if (!domain || !range) {
+       error('No domain or range');
+      }
+      var inputSize = domain.length / 2;
+      var outputSize = range.length / 2;
+      domain = toMultiArray(domain);
+      range = toMultiArray(range);
+      var size = dict.get('Size');
+      var bps = dict.get('BitsPerSample');
+      var order = dict.get('Order') || 1;
+      if (order !== 1) {
+       info('No support for cubic spline interpolation: ' + order);
+      }
+      var encode = dict.getArray('Encode');
+      if (!encode) {
+       encode = [];
+       for (var i = 0; i < inputSize; ++i) {
+        encode.push(0);
+        encode.push(size[i] - 1);
+       }
+      }
+      encode = toMultiArray(encode);
+      var decode = dict.getArray('Decode');
+      if (!decode) {
+       decode = range;
+      } else {
+       decode = toMultiArray(decode);
+      }
+      var samples = this.getSampleArray(size, outputSize, bps, str);
+      return [
+       CONSTRUCT_SAMPLED,
+       inputSize,
+       domain,
+       encode,
+       decode,
+       samples,
+       size,
+       outputSize,
+       Math.pow(2, bps) - 1,
+       range
+      ];
+     },
+     constructSampledFromIR: function PDFFunction_constructSampledFromIR(IR) {
+      function interpolate(x, xmin, xmax, ymin, ymax) {
+       return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
+      }
+      return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
+       var m = IR[1];
+       var domain = IR[2];
+       var encode = IR[3];
+       var decode = IR[4];
+       var samples = IR[5];
+       var size = IR[6];
+       var n = IR[7];
+       var range = IR[9];
+       var cubeVertices = 1 << m;
+       var cubeN = new Float64Array(cubeVertices);
+       var cubeVertex = new Uint32Array(cubeVertices);
+       var i, j;
+       for (j = 0; j < cubeVertices; j++) {
+        cubeN[j] = 1;
+       }
+       var k = n, pos = 1;
+       for (i = 0; i < m; ++i) {
+        var domain_2i = domain[i][0];
+        var domain_2i_1 = domain[i][1];
+        var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
+        var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
+        var size_i = size[i];
+        e = Math.min(Math.max(e, 0), size_i - 1);
+        var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
+        var n0 = e0 + 1 - e;
+        var n1 = e - e0;
+        var offset0 = e0 * k;
+        var offset1 = offset0 + k;
+        for (j = 0; j < cubeVertices; j++) {
+         if (j & pos) {
+          cubeN[j] *= n1;
+          cubeVertex[j] += offset1;
+         } else {
+          cubeN[j] *= n0;
+          cubeVertex[j] += offset0;
+         }
+        }
+        k *= size_i;
+        pos <<= 1;
+       }
+       for (j = 0; j < n; ++j) {
+        var rj = 0;
+        for (i = 0; i < cubeVertices; i++) {
+         rj += samples[cubeVertex[i] + j] * cubeN[i];
+        }
+        rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
+        dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
+       }
+      };
+     },
+     constructInterpolated: function PDFFunction_constructInterpolated(str, dict) {
+      var c0 = dict.getArray('C0') || [0];
+      var c1 = dict.getArray('C1') || [1];
+      var n = dict.get('N');
+      if (!isArray(c0) || !isArray(c1)) {
+       error('Illegal dictionary for interpolated function');
+      }
+      var length = c0.length;
+      var diff = [];
+      for (var i = 0; i < length; ++i) {
+       diff.push(c1[i] - c0[i]);
+      }
+      return [
+       CONSTRUCT_INTERPOLATED,
+       c0,
+       diff,
+       n
+      ];
+     },
+     constructInterpolatedFromIR: function PDFFunction_constructInterpolatedFromIR(IR) {
+      var c0 = IR[1];
+      var diff = IR[2];
+      var n = IR[3];
+      var length = diff.length;
+      return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
+       var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
+       for (var j = 0; j < length; ++j) {
+        dest[destOffset + j] = c0[j] + x * diff[j];
+       }
+      };
+     },
+     constructStiched: function PDFFunction_constructStiched(fn, dict, xref) {
+      var domain = dict.getArray('Domain');
+      if (!domain) {
+       error('No domain');
+      }
+      var inputSize = domain.length / 2;
+      if (inputSize !== 1) {
+       error('Bad domain for stiched function');
+      }
+      var fnRefs = dict.get('Functions');
+      var fns = [];
+      for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
+       fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i])));
+      }
+      var bounds = dict.getArray('Bounds');
+      var encode = dict.getArray('Encode');
+      return [
+       CONSTRUCT_STICHED,
+       domain,
+       bounds,
+       encode,
+       fns
+      ];
+     },
+     constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) {
+      var domain = IR[1];
+      var bounds = IR[2];
+      var encode = IR[3];
+      var fnsIR = IR[4];
+      var fns = [];
+      var tmpBuf = new Float32Array(1);
+      for (var i = 0, ii = fnsIR.length; i < ii; i++) {
+       fns.push(PDFFunction.fromIR(fnsIR[i]));
+      }
+      return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
+       var clip = function constructStichedFromIRClip(v, min, max) {
+        if (v > max) {
+         v = max;
+        } else if (v < min) {
+         v = min;
+        }
+        return v;
+       };
+       var v = clip(src[srcOffset], domain[0], domain[1]);
+       for (var i = 0, ii = bounds.length; i < ii; ++i) {
+        if (v < bounds[i]) {
+         break;
+        }
+       }
+       var dmin = domain[0];
+       if (i > 0) {
+        dmin = bounds[i - 1];
+       }
+       var dmax = domain[1];
+       if (i < bounds.length) {
+        dmax = bounds[i];
+       }
+       var rmin = encode[2 * i];
+       var rmax = encode[2 * i + 1];
+       tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
+       fns[i](tmpBuf, 0, dest, destOffset);
+      };
+     },
+     constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) {
+      var domain = dict.getArray('Domain');
+      var range = dict.getArray('Range');
+      if (!domain) {
+       error('No domain.');
+      }
+      if (!range) {
+       error('No range.');
+      }
+      var lexer = new PostScriptLexer(fn);
+      var parser = new PostScriptParser(lexer);
+      var code = parser.parse();
+      return [
+       CONSTRUCT_POSTSCRIPT,
+       domain,
+       range,
+       code
+      ];
+     },
+     constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR(IR) {
+      var domain = IR[1];
+      var range = IR[2];
+      var code = IR[3];
+      var compiled = new PostScriptCompiler().compile(code, domain, range);
+      if (compiled) {
+       return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled);
+      }
+      info('Unable to compile PS function');
+      var numOutputs = range.length >> 1;
+      var numInputs = domain.length >> 1;
+      var evaluator = new PostScriptEvaluator(code);
+      var cache = Object.create(null);
+      var MAX_CACHE_SIZE = 2048 * 4;
+      var cache_available = MAX_CACHE_SIZE;
+      var tmpBuf = new Float32Array(numInputs);
+      return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
+       var i, value;
+       var key = '';
+       var input = tmpBuf;
+       for (i = 0; i < numInputs; i++) {
+        value = src[srcOffset + i];
+        input[i] = value;
+        key += value + '_';
+       }
+       var cachedValue = cache[key];
+       if (cachedValue !== undefined) {
+        dest.set(cachedValue, destOffset);
+        return;
+       }
+       var output = new Float32Array(numOutputs);
+       var stack = evaluator.execute(input);
+       var stackIndex = stack.length - numOutputs;
+       for (i = 0; i < numOutputs; i++) {
+        value = stack[stackIndex + i];
+        var bound = range[i * 2];
+        if (value < bound) {
+         value = bound;
+        } else {
+         bound = range[i * 2 + 1];
+         if (value > bound) {
+          value = bound;
+         }
+        }
+        output[i] = value;
+       }
+       if (cache_available > 0) {
+        cache_available--;
+        cache[key] = output;
+       }
+       dest.set(output, destOffset);
+      };
+     }
+    };
+   }();
+   function isPDFFunction(v) {
+    var fnDict;
+    if (typeof v !== 'object') {
+     return false;
+    } else if (isDict(v)) {
+     fnDict = v;
+    } else if (isStream(v)) {
+     fnDict = v.dict;
+    } else {
+     return false;
+    }
+    return fnDict.has('FunctionType');
+   }
+   var PostScriptStack = function PostScriptStackClosure() {
+    var MAX_STACK_SIZE = 100;
+    function PostScriptStack(initialStack) {
+     this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
+    }
+    PostScriptStack.prototype = {
+     push: function PostScriptStack_push(value) {
+      if (this.stack.length >= MAX_STACK_SIZE) {
+       error('PostScript function stack overflow.');
+      }
+      this.stack.push(value);
+     },
+     pop: function PostScriptStack_pop() {
+      if (this.stack.length <= 0) {
+       error('PostScript function stack underflow.');
+      }
+      return this.stack.pop();
+     },
+     copy: function PostScriptStack_copy(n) {
+      if (this.stack.length + n >= MAX_STACK_SIZE) {
+       error('PostScript function stack overflow.');
+      }
+      var stack = this.stack;
+      for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
+       stack.push(stack[i]);
+      }
+     },
+     index: function PostScriptStack_index(n) {
+      this.push(this.stack[this.stack.length - n - 1]);
+     },
+     roll: function PostScriptStack_roll(n, p) {
+      var stack = this.stack;
+      var l = stack.length - n;
+      var r = stack.length - 1, c = l + (p - Math.floor(p / n) * n), i, j, t;
+      for (i = l, j = r; i < j; i++, j--) {
+       t = stack[i];
+       stack[i] = stack[j];
+       stack[j] = t;
+      }
+      for (i = l, j = c - 1; i < j; i++, j--) {
+       t = stack[i];
+       stack[i] = stack[j];
+       stack[j] = t;
+      }
+      for (i = c, j = r; i < j; i++, j--) {
+       t = stack[i];
+       stack[i] = stack[j];
+       stack[j] = t;
+      }
+     }
+    };
+    return PostScriptStack;
+   }();
+   var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
+    function PostScriptEvaluator(operators) {
+     this.operators = operators;
+    }
+    PostScriptEvaluator.prototype = {
+     execute: function PostScriptEvaluator_execute(initialStack) {
+      var stack = new PostScriptStack(initialStack);
+      var counter = 0;
+      var operators = this.operators;
+      var length = operators.length;
+      var operator, a, b;
+      while (counter < length) {
+       operator = operators[counter++];
+       if (typeof operator === 'number') {
+        stack.push(operator);
+        continue;
+       }
+       switch (operator) {
+       case 'jz':
+        b = stack.pop();
+        a = stack.pop();
+        if (!a) {
+         counter = b;
+        }
+        break;
+       case 'j':
+        a = stack.pop();
+        counter = a;
+        break;
+       case 'abs':
+        a = stack.pop();
+        stack.push(Math.abs(a));
+        break;
+       case 'add':
+        b = stack.pop();
+        a = stack.pop();
+        stack.push(a + b);
+        break;
+       case 'and':
+        b = stack.pop();
+        a = stack.pop();
+        if (isBool(a) && isBool(b)) {
+         stack.push(a && b);
+        } else {
+         stack.push(a & b);
+        }
+        break;
+       case 'atan':
+        a = stack.pop();
+        stack.push(Math.atan(a));
+        break;
+       case 'bitshift':
+        b = stack.pop();
+        a = stack.pop();
+        if (a > 0) {
+         stack.push(a << b);
+        } else {
+         stack.push(a >> b);
+        }
+        break;
+       case 'ceiling':
+        a = stack.pop();
+        stack.push(Math.ceil(a));
+        break;
+       case 'copy':
+        a = stack.pop();
+        stack.copy(a);
+        break;
+       case 'cos':
+        a = stack.pop();
+        stack.push(Math.cos(a));
+        break;
+       case 'cvi':
+        a = stack.pop() | 0;
+        stack.push(a);
+        break;
+       case 'cvr':
+        break;
+       case 'div':
+        b = stack.pop();
+        a = stack.pop();
+        stack.push(a / b);
+        break;
+       case 'dup':
+        stack.copy(1);
+        break;
+       case 'eq':
+        b = stack.pop();
+        a = stack.pop();
+        stack.push(a === b);
+        break;
+       case 'exch':
+        stack.roll(2, 1);
+        break;
+       case 'exp':
+        b = stack.pop();
+        a = stack.pop();
+        stack.push(Math.pow(a, b));
+        break;
+       case 'false':
+        stack.push(false);
+        break;
+       case 'floor':
+        a = stack.pop();
+        stack.push(Math.floor(a));
+        break;
+       case 'ge':
+        b = stack.pop();
+        a = stack.pop();
+        stack.push(a >= b);
+        break;
+       case 'gt':
+        b = stack.pop();
+        a = stack.pop();
+        stack.push(a > b);
+        break;
+       case 'idiv':
+        b = stack.pop();
+        a = stack.pop();
+        stack.push(a / b | 0);
+        break;
+       case 'index':
+        a = stack.pop();
+        stack.index(a);
+        break;
+       case 'le':
+        b = stack.pop();
+        a = stack.pop();
+        stack.push(a <= b);
+        break;
+       case 'ln':
+        a = stack.pop();
+        stack.push(Math.log(a));
+        break;
+       case 'log':
+        a = stack.pop();
+        stack.push(Math.log(a) / Math.LN10);
+        break;
+       case 'lt':
+        b = stack.pop();
+        a = stack.pop();
+        stack.push(a < b);
+        break;
+       case 'mod':
+        b = stack.pop();
+        a = stack.pop();
+        stack.push(a % b);
+        break;
+       case 'mul':
+        b = stack.pop();
+        a = stack.pop();
+        stack.push(a * b);
+        break;
+       case 'ne':
+        b = stack.pop();
+        a = stack.pop();
+        stack.push(a !== b);
+        break;
+       case 'neg':
+        a = stack.pop();
+        stack.push(-a);
+        break;
+       case 'not':
+        a = stack.pop();
+        if (isBool(a)) {
+         stack.push(!a);
+        } else {
+         stack.push(~a);
+        }
+        break;
+       case 'or':
+        b = stack.pop();
+        a = stack.pop();
+        if (isBool(a) && isBool(b)) {
+         stack.push(a || b);
+        } else {
+         stack.push(a | b);
+        }
+        break;
+       case 'pop':
+        stack.pop();
+        break;
+       case 'roll':
+        b = stack.pop();
+        a = stack.pop();
+        stack.roll(a, b);
+        break;
+       case 'round':
+        a = stack.pop();
+        stack.push(Math.round(a));
+        break;
+       case 'sin':
+        a = stack.pop();
+        stack.push(Math.sin(a));
+        break;
+       case 'sqrt':
+        a = stack.pop();
+        stack.push(Math.sqrt(a));
+        break;
+       case 'sub':
+        b = stack.pop();
+        a = stack.pop();
+        stack.push(a - b);
+        break;
+       case 'true':
+        stack.push(true);
+        break;
+       case 'truncate':
+        a = stack.pop();
+        a = a < 0 ? Math.ceil(a) : Math.floor(a);
+        stack.push(a);
+        break;
+       case 'xor':
+        b = stack.pop();
+        a = stack.pop();
+        if (isBool(a) && isBool(b)) {
+         stack.push(a !== b);
+        } else {
+         stack.push(a ^ b);
+        }
+        break;
+       default:
+        error('Unknown operator ' + operator);
+        break;
+       }
+      }
+      return stack.stack;
+     }
+    };
+    return PostScriptEvaluator;
+   }();
+   var PostScriptCompiler = function PostScriptCompilerClosure() {
+    function AstNode(type) {
+     this.type = type;
+    }
+    AstNode.prototype.visit = function (visitor) {
+     throw new Error('abstract method');
+    };
+    function AstArgument(index, min, max) {
+     AstNode.call(this, 'args');
+     this.index = index;
+     this.min = min;
+     this.max = max;
+    }
+    AstArgument.prototype = Object.create(AstNode.prototype);
+    AstArgument.prototype.visit = function (visitor) {
+     visitor.visitArgument(this);
+    };
+    function AstLiteral(number) {
+     AstNode.call(this, 'literal');
+     this.number = number;
+     this.min = number;
+     this.max = number;
+    }
+    AstLiteral.prototype = Object.create(AstNode.prototype);
+    AstLiteral.prototype.visit = function (visitor) {
+     visitor.visitLiteral(this);
+    };
+    function AstBinaryOperation(op, arg1, arg2, min, max) {
+     AstNode.call(this, 'binary');
+     this.op = op;
+     this.arg1 = arg1;
+     this.arg2 = arg2;
+     this.min = min;
+     this.max = max;
+    }
+    AstBinaryOperation.prototype = Object.create(AstNode.prototype);
+    AstBinaryOperation.prototype.visit = function (visitor) {
+     visitor.visitBinaryOperation(this);
+    };
+    function AstMin(arg, max) {
+     AstNode.call(this, 'max');
+     this.arg = arg;
+     this.min = arg.min;
+     this.max = max;
+    }
+    AstMin.prototype = Object.create(AstNode.prototype);
+    AstMin.prototype.visit = function (visitor) {
+     visitor.visitMin(this);
+    };
+    function AstVariable(index, min, max) {
+     AstNode.call(this, 'var');
+     this.index = index;
+     this.min = min;
+     this.max = max;
+    }
+    AstVariable.prototype = Object.create(AstNode.prototype);
+    AstVariable.prototype.visit = function (visitor) {
+     visitor.visitVariable(this);
+    };
+    function AstVariableDefinition(variable, arg) {
+     AstNode.call(this, 'definition');
+     this.variable = variable;
+     this.arg = arg;
+    }
+    AstVariableDefinition.prototype = Object.create(AstNode.prototype);
+    AstVariableDefinition.prototype.visit = function (visitor) {
+     visitor.visitVariableDefinition(this);
+    };
+    function ExpressionBuilderVisitor() {
+     this.parts = [];
+    }
+    ExpressionBuilderVisitor.prototype = {
+     visitArgument: function (arg) {
+      this.parts.push('Math.max(', arg.min, ', Math.min(', arg.max, ', src[srcOffset + ', arg.index, ']))');
+     },
+     visitVariable: function (variable) {
+      this.parts.push('v', variable.index);
+     },
+     visitLiteral: function (literal) {
+      this.parts.push(literal.number);
+     },
+     visitBinaryOperation: function (operation) {
+      this.parts.push('(');
+      operation.arg1.visit(this);
+      this.parts.push(' ', operation.op, ' ');
+      operation.arg2.visit(this);
+      this.parts.push(')');
+     },
+     visitVariableDefinition: function (definition) {
+      this.parts.push('var ');
+      definition.variable.visit(this);
+      this.parts.push(' = ');
+      definition.arg.visit(this);
+      this.parts.push(';');
+     },
+     visitMin: function (max) {
+      this.parts.push('Math.min(');
+      max.arg.visit(this);
+      this.parts.push(', ', max.max, ')');
+     },
+     toString: function () {
+      return this.parts.join('');
+     }
+    };
+    function buildAddOperation(num1, num2) {
+     if (num2.type === 'literal' && num2.number === 0) {
+      return num1;
+     }
+     if (num1.type === 'literal' && num1.number === 0) {
+      return num2;
+     }
+     if (num2.type === 'literal' && num1.type === 'literal') {
+      return new AstLiteral(num1.number + num2.number);
+     }
+     return new AstBinaryOperation('+', num1, num2, num1.min + num2.min, num1.max + num2.max);
+    }
+    function buildMulOperation(num1, num2) {
+     if (num2.type === 'literal') {
+      if (num2.number === 0) {
+       return new AstLiteral(0);
+      } else if (num2.number === 1) {
+       return num1;
+      } else if (num1.type === 'literal') {
+       return new AstLiteral(num1.number * num2.number);
+      }
+     }
+     if (num1.type === 'literal') {
+      if (num1.number === 0) {
+       return new AstLiteral(0);
+      } else if (num1.number === 1) {
+       return num2;
+      }
+     }
+     var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
+     var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
+     return new AstBinaryOperation('*', num1, num2, min, max);
+    }
+    function buildSubOperation(num1, num2) {
+     if (num2.type === 'literal') {
+      if (num2.number === 0) {
+       return num1;
+      } else if (num1.type === 'literal') {
+       return new AstLiteral(num1.number - num2.number);
+      }
+     }
+     if (num2.type === 'binary' && num2.op === '-' && num1.type === 'literal' && num1.number === 1 && num2.arg1.type === 'literal' && num2.arg1.number === 1) {
+      return num2.arg2;
+     }
+     return new AstBinaryOperation('-', num1, num2, num1.min - num2.max, num1.max - num2.min);
+    }
+    function buildMinOperation(num1, max) {
+     if (num1.min >= max) {
+      return new AstLiteral(max);
+     } else if (num1.max <= max) {
+      return num1;
+     }
+     return new AstMin(num1, max);
+    }
+    function PostScriptCompiler() {
+    }
+    PostScriptCompiler.prototype = {
+     compile: function PostScriptCompiler_compile(code, domain, range) {
+      var stack = [];
+      var i, ii;
+      var instructions = [];
+      var inputSize = domain.length >> 1, outputSize = range.length >> 1;
+      var lastRegister = 0;
+      var n, j;
+      var num1, num2, ast1, ast2, tmpVar, item;
+      for (i = 0; i < inputSize; i++) {
+       stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
+      }
+      for (i = 0, ii = code.length; i < ii; i++) {
+       item = code[i];
+       if (typeof item === 'number') {
+        stack.push(new AstLiteral(item));
+        continue;
+       }
+       switch (item) {
+       case 'add':
+        if (stack.length < 2) {
+         return null;
+        }
+        num2 = stack.pop();
+        num1 = stack.pop();
+        stack.push(buildAddOperation(num1, num2));
+        break;
+       case 'cvr':
+        if (stack.length < 1) {
+         return null;
+        }
+        break;
+       case 'mul':
+        if (stack.length < 2) {
+         return null;
+        }
+        num2 = stack.pop();
+        num1 = stack.pop();
+        stack.push(buildMulOperation(num1, num2));
+        break;
+       case 'sub':
+        if (stack.length < 2) {
+         return null;
+        }
+        num2 = stack.pop();
+        num1 = stack.pop();
+        stack.push(buildSubOperation(num1, num2));
+        break;
+       case 'exch':
+        if (stack.length < 2) {
+         return null;
+        }
+        ast1 = stack.pop();
+        ast2 = stack.pop();
+        stack.push(ast1, ast2);
+        break;
+       case 'pop':
+        if (stack.length < 1) {
+         return null;
+        }
+        stack.pop();
+        break;
+       case 'index':
+        if (stack.length < 1) {
+         return null;
+        }
+        num1 = stack.pop();
+        if (num1.type !== 'literal') {
+         return null;
+        }
+        n = num1.number;
+        if (n < 0 || (n | 0) !== n || stack.length < n) {
+         return null;
+        }
+        ast1 = stack[stack.length - n - 1];
+        if (ast1.type === 'literal' || ast1.type === 'var') {
+         stack.push(ast1);
+         break;
+        }
+        tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
+        stack[stack.length - n - 1] = tmpVar;
+        stack.push(tmpVar);
+        instructions.push(new AstVariableDefinition(tmpVar, ast1));
+        break;
+       case 'dup':
+        if (stack.length < 1) {
+         return null;
+        }
+        if (typeof code[i + 1] === 'number' && code[i + 2] === 'gt' && code[i + 3] === i + 7 && code[i + 4] === 'jz' && code[i + 5] === 'pop' && code[i + 6] === code[i + 1]) {
+         num1 = stack.pop();
+         stack.push(buildMinOperation(num1, code[i + 1]));
+         i += 6;
+         break;
+        }
+        ast1 = stack[stack.length - 1];
+        if (ast1.type === 'literal' || ast1.type === 'var') {
+         stack.push(ast1);
+         break;
+        }
+        tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
+        stack[stack.length - 1] = tmpVar;
+        stack.push(tmpVar);
+        instructions.push(new AstVariableDefinition(tmpVar, ast1));
+        break;
+       case 'roll':
+        if (stack.length < 2) {
+         return null;
+        }
+        num2 = stack.pop();
+        num1 = stack.pop();
+        if (num2.type !== 'literal' || num1.type !== 'literal') {
+         return null;
+        }
+        j = num2.number;
+        n = num1.number;
+        if (n <= 0 || (n | 0) !== n || (j | 0) !== j || stack.length < n) {
+         return null;
+        }
+        j = (j % n + n) % n;
+        if (j === 0) {
+         break;
+        }
+        Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
+        break;
+       default:
+        return null;
+       }
+      }
+      if (stack.length !== outputSize) {
+       return null;
+      }
+      var result = [];
+      instructions.forEach(function (instruction) {
+       var statementBuilder = new ExpressionBuilderVisitor();
+       instruction.visit(statementBuilder);
+       result.push(statementBuilder.toString());
+      });
+      stack.forEach(function (expr, i) {
+       var statementBuilder = new ExpressionBuilderVisitor();
+       expr.visit(statementBuilder);
+       var min = range[i * 2], max = range[i * 2 + 1];
+       var out = [statementBuilder.toString()];
+       if (min > expr.min) {
+        out.unshift('Math.max(', min, ', ');
+        out.push(')');
+       }
+       if (max < expr.max) {
+        out.unshift('Math.min(', max, ', ');
+        out.push(')');
+       }
+       out.unshift('dest[destOffset + ', i, '] = ');
+       out.push(';');
+       result.push(out.join(''));
+      });
+      return result.join('\n');
+     }
+    };
+    return PostScriptCompiler;
+   }();
+   exports.isPDFFunction = isPDFFunction;
+   exports.PDFFunction = PDFFunction;
+   exports.PostScriptEvaluator = PostScriptEvaluator;
+   exports.PostScriptCompiler = PostScriptCompiler;
+  }));
+  (function (root, factory) {
    factory(root.pdfjsCoreParser = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreStream);
   }(this, function (exports, sharedUtil, corePrimitives, coreStream) {
    var MissingDataException = sharedUtil.MissingDataException;
    var StreamType = sharedUtil.StreamType;
    var assert = sharedUtil.assert;
    var error = sharedUtil.error;
    var info = sharedUtil.info;
    var isArray = sharedUtil.isArray;
    var isInt = sharedUtil.isInt;
    var isNum = sharedUtil.isNum;
    var isString = sharedUtil.isString;
    var warn = sharedUtil.warn;
+   var EOF = corePrimitives.EOF;
    var Cmd = corePrimitives.Cmd;
    var Dict = corePrimitives.Dict;
    var Name = corePrimitives.Name;
    var Ref = corePrimitives.Ref;
+   var isEOF = corePrimitives.isEOF;
    var isCmd = corePrimitives.isCmd;
    var isDict = corePrimitives.isDict;
    var isName = corePrimitives.isName;
    var Ascii85Stream = coreStream.Ascii85Stream;
    var AsciiHexStream = coreStream.AsciiHexStream;
    var CCITTFaxStream = coreStream.CCITTFaxStream;
    var FlateStream = coreStream.FlateStream;
    var Jbig2Stream = coreStream.Jbig2Stream;
    var JpegStream = coreStream.JpegStream;
    var JpxStream = coreStream.JpxStream;
    var LZWStream = coreStream.LZWStream;
    var NullStream = coreStream.NullStream;
    var PredictorStream = coreStream.PredictorStream;
    var RunLengthStream = coreStream.RunLengthStream;
-   var EOF = {};
-   function isEOF(v) {
-    return v === EOF;
-   }
    var MAX_LENGTH_TO_CACHE = 1000;
    var Parser = function ParserClosure() {
     function Parser(lexer, allowStreams, xref, recoveryMode) {
      this.lexer = lexer;
      this.allowStreams = allowStreams;
      this.xref = xref;
      this.recoveryMode = recoveryMode || false;
      this.imageCache = Object.create(null);
@@ -34794,21 +35987,19 @@
       objectNumberFirst: getInt('O'),
       endFirst: getInt('E'),
       numPages: getInt('N'),
       mainXRefEntriesOffset: getInt('T'),
       pageFirst: linDict.has('P') ? getInt('P', true) : 0
      };
     }
    };
-   exports.EOF = EOF;
    exports.Lexer = Lexer;
    exports.Linearization = Linearization;
    exports.Parser = Parser;
-   exports.isEOF = isEOF;
   }));
   (function (root, factory) {
    factory(root.pdfjsCoreType1Parser = {}, root.pdfjsSharedUtil, root.pdfjsCoreStream, root.pdfjsCoreEncodings);
   }(this, function (exports, sharedUtil, coreStream, coreEncodings) {
    var warn = sharedUtil.warn;
    var isSpace = sharedUtil.isSpace;
    var Stream = coreStream.Stream;
    var getEncoding = coreEncodings.getEncoding;
@@ -35350,22 +36541,22 @@
   }(this, function (exports, sharedUtil, corePrimitives, coreStream, coreParser) {
    var Util = sharedUtil.Util;
    var assert = sharedUtil.assert;
    var warn = sharedUtil.warn;
    var error = sharedUtil.error;
    var isInt = sharedUtil.isInt;
    var isString = sharedUtil.isString;
    var MissingDataException = sharedUtil.MissingDataException;
+   var isEOF = corePrimitives.isEOF;
    var isName = corePrimitives.isName;
    var isCmd = corePrimitives.isCmd;
    var isStream = corePrimitives.isStream;
    var StringStream = coreStream.StringStream;
    var Lexer = coreParser.Lexer;
-   var isEOF = coreParser.isEOF;
    var BUILT_IN_CMAPS = [
     'Adobe-GB1-UCS2',
     'Adobe-CNS1-UCS2',
     'Adobe-Japan1-UCS2',
     'Adobe-Korea1-UCS2',
     '78-EUC-H',
     '78-EUC-V',
     '78-H',
@@ -36239,16 +37430,1032 @@
      }
     };
    }();
    exports.CMap = CMap;
    exports.CMapFactory = CMapFactory;
    exports.IdentityCMap = IdentityCMap;
   }));
   (function (root, factory) {
+   factory(root.pdfjsCoreColorSpace = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreFunction);
+  }(this, function (exports, sharedUtil, corePrimitives, coreFunction) {
+   var error = sharedUtil.error;
+   var info = sharedUtil.info;
+   var isArray = sharedUtil.isArray;
+   var isString = sharedUtil.isString;
+   var shadow = sharedUtil.shadow;
+   var warn = sharedUtil.warn;
+   var isDict = corePrimitives.isDict;
+   var isName = corePrimitives.isName;
+   var isStream = corePrimitives.isStream;
+   var PDFFunction = coreFunction.PDFFunction;
+   var ColorSpace = function ColorSpaceClosure() {
+    function resizeRgbImage(src, bpc, w1, h1, w2, h2, alpha01, dest) {
+     var COMPONENTS = 3;
+     alpha01 = alpha01 !== 1 ? 0 : alpha01;
+     var xRatio = w1 / w2;
+     var yRatio = h1 / h2;
+     var i, j, py, newIndex = 0, oldIndex;
+     var xScaled = new Uint16Array(w2);
+     var w1Scanline = w1 * COMPONENTS;
+     for (i = 0; i < w2; i++) {
+      xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
+     }
+     for (i = 0; i < h2; i++) {
+      py = Math.floor(i * yRatio) * w1Scanline;
+      for (j = 0; j < w2; j++) {
+       oldIndex = py + xScaled[j];
+       dest[newIndex++] = src[oldIndex++];
+       dest[newIndex++] = src[oldIndex++];
+       dest[newIndex++] = src[oldIndex++];
+       newIndex += alpha01;
+      }
+     }
+    }
+    function ColorSpace() {
+     error('should not call ColorSpace constructor');
+    }
+    ColorSpace.prototype = {
+     getRgb: function ColorSpace_getRgb(src, srcOffset) {
+      var rgb = new Uint8Array(3);
+      this.getRgbItem(src, srcOffset, rgb, 0);
+      return rgb;
+     },
+     getRgbItem: function ColorSpace_getRgbItem(src, srcOffset, dest, destOffset) {
+      error('Should not call ColorSpace.getRgbItem');
+     },
+     getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+      error('Should not call ColorSpace.getRgbBuffer');
+     },
+     getOutputLength: function ColorSpace_getOutputLength(inputLength, alpha01) {
+      error('Should not call ColorSpace.getOutputLength');
+     },
+     isPassthrough: function ColorSpace_isPassthrough(bits) {
+      return false;
+     },
+     fillRgb: function ColorSpace_fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
+      var count = originalWidth * originalHeight;
+      var rgbBuf = null;
+      var numComponentColors = 1 << bpc;
+      var needsResizing = originalHeight !== height || originalWidth !== width;
+      var i, ii;
+      if (this.isPassthrough(bpc)) {
+       rgbBuf = comps;
+      } else if (this.numComps === 1 && count > numComponentColors && this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') {
+       var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
+       var key;
+       for (i = 0; i < numComponentColors; i++) {
+        allColors[i] = i;
+       }
+       var colorMap = new Uint8Array(numComponentColors * 3);
+       this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
+       var destPos, rgbPos;
+       if (!needsResizing) {
+        destPos = 0;
+        for (i = 0; i < count; ++i) {
+         key = comps[i] * 3;
+         dest[destPos++] = colorMap[key];
+         dest[destPos++] = colorMap[key + 1];
+         dest[destPos++] = colorMap[key + 2];
+         destPos += alpha01;
+        }
+       } else {
+        rgbBuf = new Uint8Array(count * 3);
+        rgbPos = 0;
+        for (i = 0; i < count; ++i) {
+         key = comps[i] * 3;
+         rgbBuf[rgbPos++] = colorMap[key];
+         rgbBuf[rgbPos++] = colorMap[key + 1];
+         rgbBuf[rgbPos++] = colorMap[key + 2];
+        }
+       }
+      } else {
+       if (!needsResizing) {
+        this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
+       } else {
+        rgbBuf = new Uint8Array(count * 3);
+        this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
+       }
+      }
+      if (rgbBuf) {
+       if (needsResizing) {
+        resizeRgbImage(rgbBuf, bpc, originalWidth, originalHeight, width, height, alpha01, dest);
+       } else {
+        rgbPos = 0;
+        destPos = 0;
+        for (i = 0, ii = width * actualHeight; i < ii; i++) {
+         dest[destPos++] = rgbBuf[rgbPos++];
+         dest[destPos++] = rgbBuf[rgbPos++];
+         dest[destPos++] = rgbBuf[rgbPos++];
+         destPos += alpha01;
+        }
+       }
+      }
+     },
+     usesZeroToOneRange: true
+    };
+    ColorSpace.parse = function ColorSpace_parse(cs, xref, res) {
+     var IR = ColorSpace.parseToIR(cs, xref, res);
+     if (IR instanceof AlternateCS) {
+      return IR;
+     }
+     return ColorSpace.fromIR(IR);
+    };
+    ColorSpace.fromIR = function ColorSpace_fromIR(IR) {
+     var name = isArray(IR) ? IR[0] : IR;
+     var whitePoint, blackPoint, gamma;
+     switch (name) {
+     case 'DeviceGrayCS':
+      return this.singletons.gray;
+     case 'DeviceRgbCS':
+      return this.singletons.rgb;
+     case 'DeviceCmykCS':
+      return this.singletons.cmyk;
+     case 'CalGrayCS':
+      whitePoint = IR[1];
+      blackPoint = IR[2];
+      gamma = IR[3];
+      return new CalGrayCS(whitePoint, blackPoint, gamma);
+     case 'CalRGBCS':
+      whitePoint = IR[1];
+      blackPoint = IR[2];
+      gamma = IR[3];
+      var matrix = IR[4];
+      return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
+     case 'PatternCS':
+      var basePatternCS = IR[1];
+      if (basePatternCS) {
+       basePatternCS = ColorSpace.fromIR(basePatternCS);
+      }
+      return new PatternCS(basePatternCS);
+     case 'IndexedCS':
+      var baseIndexedCS = IR[1];
+      var hiVal = IR[2];
+      var lookup = IR[3];
+      return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup);
+     case 'AlternateCS':
+      var numComps = IR[1];
+      var alt = IR[2];
+      var tintFnIR = IR[3];
+      return new AlternateCS(numComps, ColorSpace.fromIR(alt), PDFFunction.fromIR(tintFnIR));
+     case 'LabCS':
+      whitePoint = IR[1];
+      blackPoint = IR[2];
+      var range = IR[3];
+      return new LabCS(whitePoint, blackPoint, range);
+     default:
+      error('Unknown name ' + name);
+     }
+     return null;
+    };
+    ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) {
+     if (isName(cs)) {
+      var colorSpaces = res.get('ColorSpace');
+      if (isDict(colorSpaces)) {
+       var refcs = colorSpaces.get(cs.name);
+       if (refcs) {
+        cs = refcs;
+       }
+      }
+     }
+     cs = xref.fetchIfRef(cs);
+     if (isName(cs)) {
+      switch (cs.name) {
+      case 'DeviceGray':
+      case 'G':
+       return 'DeviceGrayCS';
+      case 'DeviceRGB':
+      case 'RGB':
+       return 'DeviceRgbCS';
+      case 'DeviceCMYK':
+      case 'CMYK':
+       return 'DeviceCmykCS';
+      case 'Pattern':
+       return [
+        'PatternCS',
+        null
+       ];
+      default:
+       error('unrecognized colorspace ' + cs.name);
+      }
+     } else if (isArray(cs)) {
+      var mode = xref.fetchIfRef(cs[0]).name;
+      var numComps, params, alt, whitePoint, blackPoint, gamma;
+      switch (mode) {
+      case 'DeviceGray':
+      case 'G':
+       return 'DeviceGrayCS';
+      case 'DeviceRGB':
+      case 'RGB':
+       return 'DeviceRgbCS';
+      case 'DeviceCMYK':
+      case 'CMYK':
+       return 'DeviceCmykCS';
+      case 'CalGray':
+       params = xref.fetchIfRef(cs[1]);
+       whitePoint = params.getArray('WhitePoint');
+       blackPoint = params.getArray('BlackPoint');
+       gamma = params.get('Gamma');
+       return [
+        'CalGrayCS',
+        whitePoint,
+        blackPoint,
+        gamma
+       ];
+      case 'CalRGB':
+       params = xref.fetchIfRef(cs[1]);
+       whitePoint = params.getArray('WhitePoint');
+       blackPoint = params.getArray('BlackPoint');
+       gamma = params.getArray('Gamma');
+       var matrix = params.getArray('Matrix');
+       return [
+        'CalRGBCS',
+        whitePoint,
+        blackPoint,
+        gamma,
+        matrix
+       ];
+      case 'ICCBased':
+       var stream = xref.fetchIfRef(cs[1]);
+       var dict = stream.dict;
+       numComps = dict.get('N');
+       alt = dict.get('Alternate');
+       if (alt) {
+        var altIR = ColorSpace.parseToIR(alt, xref, res);
+        var altCS = ColorSpace.fromIR(altIR);
+        if (altCS.numComps === numComps) {
+         return altIR;
+        }
+        warn('ICCBased color space: Ignoring incorrect /Alternate entry.');
+       }
+       if (numComps === 1) {
+        return 'DeviceGrayCS';
+       } else if (numComps === 3) {
+        return 'DeviceRgbCS';
+       } else if (numComps === 4) {
+        return 'DeviceCmykCS';
+       }
+       break;
+      case 'Pattern':
+       var basePatternCS = cs[1] || null;
+       if (basePatternCS) {
+        basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res);
+       }
+       return [
+        'PatternCS',
+        basePatternCS
+       ];
+      case 'Indexed':
+      case 'I':
+       var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res);
+       var hiVal = xref.fetchIfRef(cs[2]) + 1;
+       var lookup = xref.fetchIfRef(cs[3]);
+       if (isStream(lookup)) {
+        lookup = lookup.getBytes();
+       }
+       return [
+        'IndexedCS',
+        baseIndexedCS,
+        hiVal,
+        lookup
+       ];
+      case 'Separation':
+      case 'DeviceN':
+       var name = xref.fetchIfRef(cs[1]);
+       numComps = isArray(name) ? name.length : 1;
+       alt = ColorSpace.parseToIR(cs[2], xref, res);
+       var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
+       return [
+        'AlternateCS',
+        numComps,
+        alt,
+        tintFnIR
+       ];
+      case 'Lab':
+       params = xref.fetchIfRef(cs[1]);
+       whitePoint = params.getArray('WhitePoint');
+       blackPoint = params.getArray('BlackPoint');
+       var range = params.getArray('Range');
+       return [
+        'LabCS',
+        whitePoint,
+        blackPoint,
+        range
+       ];
+      default:
+       error('unimplemented color space object "' + mode + '"');
+      }
+     } else {
+      error('unrecognized color space object: "' + cs + '"');
+     }
+     return null;
+    };
+    ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) {
+     if (!isArray(decode)) {
+      return true;
+     }
+     if (n * 2 !== decode.length) {
+      warn('The decode map is not the correct length');
+      return true;
+     }
+     for (var i = 0, ii = decode.length; i < ii; i += 2) {
+      if (decode[i] !== 0 || decode[i + 1] !== 1) {
+       return false;
+      }
+     }
+     return true;
+    };
+    ColorSpace.singletons = {
+     get gray() {
+      return shadow(this, 'gray', new DeviceGrayCS());
+     },
+     get rgb() {
+      return shadow(this, 'rgb', new DeviceRgbCS());
+     },
+     get cmyk() {
+      return shadow(this, 'cmyk', new DeviceCmykCS());
+     }
+    };
+    return ColorSpace;
+   }();
+   var AlternateCS = function AlternateCSClosure() {
+    function AlternateCS(numComps, base, tintFn) {
+     this.name = 'Alternate';
+     this.numComps = numComps;
+     this.defaultColor = new Float32Array(numComps);
+     for (var i = 0; i < numComps; ++i) {
+      this.defaultColor[i] = 1;
+     }
+     this.base = base;
+     this.tintFn = tintFn;
+     this.tmpBuf = new Float32Array(base.numComps);
+    }
+    AlternateCS.prototype = {
+     getRgb: ColorSpace.prototype.getRgb,
+     getRgbItem: function AlternateCS_getRgbItem(src, srcOffset, dest, destOffset) {
+      var tmpBuf = this.tmpBuf;
+      this.tintFn(src, srcOffset, tmpBuf, 0);
+      this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
+     },
+     getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+      var tintFn = this.tintFn;
+      var base = this.base;
+      var scale = 1 / ((1 << bits) - 1);
+      var baseNumComps = base.numComps;
+      var usesZeroToOneRange = base.usesZeroToOneRange;
+      var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
+      var pos = isPassthrough ? destOffset : 0;
+      var baseBuf = isPassthrough ? dest : new Uint8Array(baseNumComps * count);
+      var numComps = this.numComps;
+      var scaled = new Float32Array(numComps);
+      var tinted = new Float32Array(baseNumComps);
+      var i, j;
+      for (i = 0; i < count; i++) {
+       for (j = 0; j < numComps; j++) {
+        scaled[j] = src[srcOffset++] * scale;
+       }
+       tintFn(scaled, 0, tinted, 0);
+       if (usesZeroToOneRange) {
+        for (j = 0; j < baseNumComps; j++) {
+         baseBuf[pos++] = tinted[j] * 255;
+        }
+       } else {
+        base.getRgbItem(tinted, 0, baseBuf, pos);
+        pos += baseNumComps;
+       }
+      }
+      if (!isPassthrough) {
+       base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
+      }
+     },
+     getOutputLength: function AlternateCS_getOutputLength(inputLength, alpha01) {
+      return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
+     },
+     isPassthrough: ColorSpace.prototype.isPassthrough,
+     fillRgb: ColorSpace.prototype.fillRgb,
+     isDefaultDecode: function AlternateCS_isDefaultDecode(decodeMap) {
+      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
+     },
+     usesZeroToOneRange: true
+    };
+    return AlternateCS;
+   }();
+   var PatternCS = function PatternCSClosure() {
+    function PatternCS(baseCS) {
+     this.name = 'Pattern';
+     this.base = baseCS;
+    }
+    PatternCS.prototype = {};
+    return PatternCS;
+   }();
+   var IndexedCS = function IndexedCSClosure() {
+    function IndexedCS(base, highVal, lookup) {
+     this.name = 'Indexed';
+     this.numComps = 1;
+     this.defaultColor = new Uint8Array(this.numComps);
+     this.base = base;
+     this.highVal = highVal;
+     var baseNumComps = base.numComps;
+     var length = baseNumComps * highVal;
+     if (isStream(lookup)) {
+      this.lookup = new Uint8Array(length);
+      var bytes = lookup.getBytes(length);
+      this.lookup.set(bytes);
+     } else if (isString(lookup)) {
+      this.lookup = new Uint8Array(length);
+      for (var i = 0; i < length; ++i) {
+       this.lookup[i] = lookup.charCodeAt(i);
+      }
+     } else if (lookup instanceof Uint8Array || lookup instanceof Array) {
+      this.lookup = lookup;
+     } else {
+      error('Unrecognized lookup table: ' + lookup);
+     }
+    }
+    IndexedCS.prototype = {
+     getRgb: ColorSpace.prototype.getRgb,
+     getRgbItem: function IndexedCS_getRgbItem(src, srcOffset, dest, destOffset) {
+      var numComps = this.base.numComps;
+      var start = src[srcOffset] * numComps;
+      this.base.getRgbItem(this.lookup, start, dest, destOffset);
+     },
+     getRgbBuffer: function IndexedCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+      var base = this.base;
+      var numComps = base.numComps;
+      var outputDelta = base.getOutputLength(numComps, alpha01);
+      var lookup = this.lookup;
+      for (var i = 0; i < count; ++i) {
+       var lookupPos = src[srcOffset++] * numComps;
+       base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
+       destOffset += outputDelta;
+      }
+     },
+     getOutputLength: function IndexedCS_getOutputLength(inputLength, alpha01) {
+      return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
+     },
+     isPassthrough: ColorSpace.prototype.isPassthrough,
+     fillRgb: ColorSpace.prototype.fillRgb,
+     isDefaultDecode: function IndexedCS_isDefaultDecode(decodeMap) {
+      return true;
+     },
+     usesZeroToOneRange: true
+    };
+    return IndexedCS;
+   }();
+   var DeviceGrayCS = function DeviceGrayCSClosure() {
+    function DeviceGrayCS() {
+     this.name = 'DeviceGray';
+     this.numComps = 1;
+     this.defaultColor = new Float32Array(this.numComps);
+    }
+    DeviceGrayCS.prototype = {
+     getRgb: ColorSpace.prototype.getRgb,
+     getRgbItem: function DeviceGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
+      var c = src[srcOffset] * 255 | 0;
+      c = c < 0 ? 0 : c > 255 ? 255 : c;
+      dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
+     },
+     getRgbBuffer: function DeviceGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+      var scale = 255 / ((1 << bits) - 1);
+      var j = srcOffset, q = destOffset;
+      for (var i = 0; i < count; ++i) {
+       var c = scale * src[j++] | 0;
+       dest[q++] = c;
+       dest[q++] = c;
+       dest[q++] = c;
+       q += alpha01;
+      }
+     },
+     getOutputLength: function DeviceGrayCS_getOutputLength(inputLength, alpha01) {
+      return inputLength * (3 + alpha01);
+     },
+     isPassthrough: ColorSpace.prototype.isPassthrough,
+     fillRgb: ColorSpace.prototype.fillRgb,
+     isDefaultDecode: function DeviceGrayCS_isDefaultDecode(decodeMap) {
+      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
+     },
+     usesZeroToOneRange: true
+    };
+    return DeviceGrayCS;
+   }();
+   var DeviceRgbCS = function DeviceRgbCSClosure() {
+    function DeviceRgbCS() {
+     this.name = 'DeviceRGB';
+     this.numComps = 3;
+     this.defaultColor = new Float32Array(this.numComps);
+    }
+    DeviceRgbCS.prototype = {
+     getRgb: ColorSpace.prototype.getRgb,
+     getRgbItem: function DeviceRgbCS_getRgbItem(src, srcOffset, dest, destOffset) {
+      var r = src[srcOffset] * 255 | 0;
+      var g = src[srcOffset + 1] * 255 | 0;
+      var b = src[srcOffset + 2] * 255 | 0;
+      dest[destOffset] = r < 0 ? 0 : r > 255 ? 255 : r;
+      dest[destOffset + 1] = g < 0 ? 0 : g > 255 ? 255 : g;
+      dest[destOffset + 2] = b < 0 ? 0 : b > 255 ? 255 : b;
+     },
+     getRgbBuffer: function DeviceRgbCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+      if (bits === 8 && alpha01 === 0) {
+       dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
+       return;
+      }
+      var scale = 255 / ((1 << bits) - 1);
+      var j = srcOffset, q = destOffset;
+      for (var i = 0; i < count; ++i) {
+       dest[q++] = scale * src[j++] | 0;
+       dest[q++] = scale * src[j++] | 0;
+       dest[q++] = scale * src[j++] | 0;
+       q += alpha01;
+      }
+     },
+     getOutputLength: function DeviceRgbCS_getOutputLength(inputLength, alpha01) {
+      return inputLength * (3 + alpha01) / 3 | 0;
+     },
+     isPassthrough: function DeviceRgbCS_isPassthrough(bits) {
+      return bits === 8;
+     },
+     fillRgb: ColorSpace.prototype.fillRgb,
+     isDefaultDecode: function DeviceRgbCS_isDefaultDecode(decodeMap) {
+      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
+     },
+     usesZeroToOneRange: true
+    };
+    return DeviceRgbCS;
+   }();
+   var DeviceCmykCS = function DeviceCmykCSClosure() {
+    function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
+     var c = src[srcOffset + 0] * srcScale;
+     var m = src[srcOffset + 1] * srcScale;
+     var y = src[srcOffset + 2] * srcScale;
+     var k = src[srcOffset + 3] * srcScale;
+     var r = c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747) + 255 | 0;
+     var g = c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578) + 255 | 0;
+     var b = c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367) + 255 | 0;
+     dest[destOffset] = r > 255 ? 255 : r < 0 ? 0 : r;
+     dest[destOffset + 1] = g > 255 ? 255 : g < 0 ? 0 : g;
+     dest[destOffset + 2] = b > 255 ? 255 : b < 0 ? 0 : b;
+    }
+    function DeviceCmykCS() {
+     this.name = 'DeviceCMYK';
+     this.numComps = 4;
+     this.defaultColor = new Float32Array(this.numComps);
+     this.defaultColor[3] = 1;
+    }
+    DeviceCmykCS.prototype = {
+     getRgb: ColorSpace.prototype.getRgb,
+     getRgbItem: function DeviceCmykCS_getRgbItem(src, srcOffset, dest, destOffset) {
+      convertToRgb(src, srcOffset, 1, dest, destOffset);
+     },
+     getRgbBuffer: function DeviceCmykCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+      var scale = 1 / ((1 << bits) - 1);
+      for (var i = 0; i < count; i++) {
+       convertToRgb(src, srcOffset, scale, dest, destOffset);
+       srcOffset += 4;
+       destOffset += 3 + alpha01;
+      }
+     },
+     getOutputLength: function DeviceCmykCS_getOutputLength(inputLength, alpha01) {
+      return inputLength / 4 * (3 + alpha01) | 0;
+     },
+     isPassthrough: ColorSpace.prototype.isPassthrough,
+     fillRgb: ColorSpace.prototype.fillRgb,
+     isDefaultDecode: function DeviceCmykCS_isDefaultDecode(decodeMap) {
+      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
+     },
+     usesZeroToOneRange: true
+    };
+    return DeviceCmykCS;
+   }();
+   var CalGrayCS = function CalGrayCSClosure() {
+    function CalGrayCS(whitePoint, blackPoint, gamma) {
+     this.name = 'CalGray';
+     this.numComps = 1;
+     this.defaultColor = new Float32Array(this.numComps);
+     if (!whitePoint) {
+      error('WhitePoint missing - required for color space CalGray');
+     }
+     blackPoint = blackPoint || [
+      0,
+      0,
+      0
+     ];
+     gamma = gamma || 1;
+     this.XW = whitePoint[0];
+     this.YW = whitePoint[1];
+     this.ZW = whitePoint[2];
+     this.XB = blackPoint[0];
+     this.YB = blackPoint[1];
+     this.ZB = blackPoint[2];
+     this.G = gamma;
+     if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
+      error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
+     }
+     if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
+      info('Invalid BlackPoint for ' + this.name + ', falling back to default');
+      this.XB = this.YB = this.ZB = 0;
+     }
+     if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
+      warn(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB + ', ZB: ' + this.ZB + ', only default values are supported.');
+     }
+     if (this.G < 1) {
+      info('Invalid Gamma: ' + this.G + ' for ' + this.name + ', falling back to default');
+      this.G = 1;
+     }
+    }
+    function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
+     var A = src[srcOffset] * scale;
+     var AG = Math.pow(A, cs.G);
+     var L = cs.YW * AG;
+     var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0) | 0;
+     dest[destOffset] = val;
+     dest[destOffset + 1] = val;
+     dest[destOffset + 2] = val;
+    }
+    CalGrayCS.prototype = {
+     getRgb: ColorSpace.prototype.getRgb,
+     getRgbItem: function CalGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
+      convertToRgb(this, src, srcOffset, dest, destOffset, 1);
+     },
+     getRgbBuffer: function CalGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+      var scale = 1 / ((1 << bits) - 1);
+      for (var i = 0; i < count; ++i) {
+       convertToRgb(this, src, srcOffset, dest, destOffset, scale);
+       srcOffset += 1;
+       destOffset += 3 + alpha01;
+      }
+     },
+     getOutputLength: function CalGrayCS_getOutputLength(inputLength, alpha01) {
+      return inputLength * (3 + alpha01);
+     },
+     isPassthrough: ColorSpace.prototype.isPassthrough,
+     fillRgb: ColorSpace.prototype.fillRgb,
+     isDefaultDecode: function CalGrayCS_isDefaultDecode(decodeMap) {
+      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
+     },
+     usesZeroToOneRange: true
+    };
+    return CalGrayCS;
+   }();
+   var CalRGBCS = function CalRGBCSClosure() {
+    var BRADFORD_SCALE_MATRIX = new Float32Array([
+     0.8951,
+     0.2664,
+     -0.1614,
+     -0.7502,
+     1.7135,
+     0.0367,
+     0.0389,
+     -0.0685,
+     1.0296
+    ]);
+    var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([
+     0.9869929,
+     -0.1470543,
+     0.1599627,
+     0.4323053,
+     0.5183603,
+     0.0492912,
+     -0.0085287,
+     0.0400428,
+     0.9684867
+    ]);
+    var SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([
+     3.2404542,
+     -1.5371385,
+     -0.4985314,
+     -0.9692660,
+     1.8760108,
+     0.0415560,
+     0.0556434,
+     -0.2040259,
+     1.0572252
+    ]);
+    var FLAT_WHITEPOINT_MATRIX = new Float32Array([
+     1,
+     1,
+     1
+    ]);
+    var tempNormalizeMatrix = new Float32Array(3);
+    var tempConvertMatrix1 = new Float32Array(3);
+    var tempConvertMatrix2 = new Float32Array(3);
+    var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0;
+    function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
+     this.name = 'CalRGB';
+     this.numComps = 3;
+     this.defaultColor = new Float32Array(this.numComps);
+     if (!whitePoint) {
+      error('WhitePoint missing - required for color space CalRGB');
+     }
+     blackPoint = blackPoint || new Float32Array(3);
+     gamma = gamma || new Float32Array([
+      1,
+      1,
+      1
+     ]);
+     matrix = matrix || new Float32Array([
+      1,
+      0,
+      0,
+      0,
+      1,
+      0,
+      0,
+      0,
+      1
+     ]);
+     var XW = whitePoint[0];
+     var YW = whitePoint[1];
+     var ZW = whitePoint[2];
+     this.whitePoint = whitePoint;
+     var XB = blackPoint[0];
+     var YB = blackPoint[1];
+     var ZB = blackPoint[2];
+     this.blackPoint = blackPoint;
+     this.GR = gamma[0];
+     this.GG = gamma[1];
+     this.GB = gamma[2];
+     this.MXA = matrix[0];
+     this.MYA = matrix[1];
+     this.MZA = matrix[2];
+     this.MXB = matrix[3];
+     this.MYB = matrix[4];
+     this.MZB = matrix[5];
+     this.MXC = matrix[6];
+     this.MYC = matrix[7];
+     this.MZC = matrix[8];
+     if (XW < 0 || ZW < 0 || YW !== 1) {
+      error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
+     }
+     if (XB < 0 || YB < 0 || ZB < 0) {
+      info('Invalid BlackPoint for ' + this.name + ' [' + XB + ', ' + YB + ', ' + ZB + '], falling back to default');
+      this.blackPoint = new Float32Array(3);
+     }
+     if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
+      info('Invalid Gamma [' + this.GR + ', ' + this.GG + ', ' + this.GB + '] for ' + this.name + ', falling back to default');
+      this.GR = this.GG = this.GB = 1;
+     }
+     if (this.MXA < 0 || this.MYA < 0 || this.MZA < 0 || this.MXB < 0 || this.MYB < 0 || this.MZB < 0 || this.MXC < 0 || this.MYC < 0 || this.MZC < 0) {
+      info('Invalid Matrix for ' + this.name + ' [' + this.MXA + ', ' + this.MYA + ', ' + this.MZA + this.MXB + ', ' + this.MYB + ', ' + this.MZB + this.MXC + ', ' + this.MYC + ', ' + this.MZC + '], falling back to default');
+      this.MXA = this.MYB = this.MZC = 1;
+      this.MXB = this.MYA = this.MZA = this.MXC = this.MYC = this.MZB = 0;
+     }
+    }
+    function matrixProduct(a, b, result) {
+     result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
+     result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
+     result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
+    }
+    function convertToFlat(sourceWhitePoint, LMS, result) {
+     result[0] = LMS[0] * 1 / sourceWhitePoint[0];
+     result[1] = LMS[1] * 1 / sourceWhitePoint[1];
+     result[2] = LMS[2] * 1 / sourceWhitePoint[2];
+    }
+    function convertToD65(sourceWhitePoint, LMS, result) {
+     var D65X = 0.95047;
+     var D65Y = 1;
+     var D65Z = 1.08883;
+     result[0] = LMS[0] * D65X / sourceWhitePoint[0];
+     result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
+     result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
+    }
+    function sRGBTransferFunction(color) {
+     if (color <= 0.0031308) {
+      return adjustToRange(0, 1, 12.92 * color);
+     }
+     return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055);
+    }
+    function adjustToRange(min, max, value) {
+     return Math.max(min, Math.min(max, value));
+    }
+    function decodeL(L) {
+     if (L < 0) {
+      return -decodeL(-L);
+     }
+     if (L > 8.0) {
+      return Math.pow((L + 16) / 116, 3);
+     }
+     return L * DECODE_L_CONSTANT;
+    }
+    function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
+     if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
+      result[0] = XYZ_Flat[0];
+      result[1] = XYZ_Flat[1];
+      result[2] = XYZ_Flat[2];
+      return;
+     }
+     var zeroDecodeL = decodeL(0);
+     var X_DST = zeroDecodeL;
+     var X_SRC = decodeL(sourceBlackPoint[0]);
+     var Y_DST = zeroDecodeL;
+     var Y_SRC = decodeL(sourceBlackPoint[1]);
+     var Z_DST = zeroDecodeL;
+     var Z_SRC = decodeL(sourceBlackPoint[2]);
+     var X_Scale = (1 - X_DST) / (1 - X_SRC);
+     var X_Offset = 1 - X_Scale;
+     var Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
+     var Y_Offset = 1 - Y_Scale;
+     var Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
+     var Z_Offset = 1 - Z_Scale;
+     result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
+     result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
+     result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
+    }
+    function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
+     if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
+      result[0] = XYZ_In[0];
+      result[1] = XYZ_In[1];
+      result[2] = XYZ_In[2];
+      return;
+     }
+     var LMS = result;
+     matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
+     var LMS_Flat = tempNormalizeMatrix;
+     convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
+     matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
+    }
+    function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
+     var LMS = result;
+     matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
+     var LMS_D65 = tempNormalizeMatrix;
+     convertToD65(sourceWhitePoint, LMS, LMS_D65);
+     matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
+    }
+    function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
+     var A = adjustToRange(0, 1, src[srcOffset] * scale);
+     var B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
+     var C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
+     var AGR = Math.pow(A, cs.GR);
+     var BGG = Math.pow(B, cs.GG);
+     var CGB = Math.pow(C, cs.GB);
+     var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
+     var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
+     var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
+     var XYZ = tempConvertMatrix1;
+     XYZ[0] = X;
+     XYZ[1] = Y;
+     XYZ[2] = Z;
+     var XYZ_Flat = tempConvertMatrix2;
+     normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
+     var XYZ_Black = tempConvertMatrix1;
+     compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
+     var XYZ_D65 = tempConvertMatrix2;
+     normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
+     var SRGB = tempConvertMatrix1;
+     matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
+     var sR = sRGBTransferFunction(SRGB[0]);
+     var sG = sRGBTransferFunction(SRGB[1]);
+     var sB = sRGBTransferFunction(SRGB[2]);
+     dest[destOffset] = Math.round(sR * 255);
+     dest[destOffset + 1] = Math.round(sG * 255);
+     dest[destOffset + 2] = Math.round(sB * 255);
+    }
+    CalRGBCS.prototype = {
+     getRgb: function CalRGBCS_getRgb(src, srcOffset) {
+      var rgb = new Uint8Array(3);
+      this.getRgbItem(src, srcOffset, rgb, 0);
+      return rgb;
+     },
+     getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, dest, destOffset) {
+      convertToRgb(this, src, srcOffset, dest, destOffset, 1);
+     },
+     getRgbBuffer: function CalRGBCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+      var scale = 1 / ((1 << bits) - 1);
+      for (var i = 0; i < count; ++i) {
+       convertToRgb(this, src, srcOffset, dest, destOffset, scale);
+       srcOffset += 3;
+       destOffset += 3 + alpha01;
+      }
+     },
+     getOutputLength: function CalRGBCS_getOutputLength(inputLength, alpha01) {
+      return inputLength * (3 + alpha01) / 3 | 0;
+     },
+     isPassthrough: ColorSpace.prototype.isPassthrough,
+     fillRgb: ColorSpace.prototype.fillRgb,
+     isDefaultDecode: function CalRGBCS_isDefaultDecode(decodeMap) {
+      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
+     },
+     usesZeroToOneRange: true
+    };
+    return CalRGBCS;
+   }();
+   var LabCS = function LabCSClosure() {
+    function LabCS(whitePoint, blackPoint, range) {
+     this.name = 'Lab';
+     this.numComps = 3;
+     this.defaultColor = new Float32Array(this.numComps);
+     if (!whitePoint) {
+      error('WhitePoint missing - required for color space Lab');
+     }
+     blackPoint = blackPoint || [
+      0,
+      0,
+      0
+     ];
+     range = range || [
+      -100,
+      100,
+      -100,
+      100
+     ];
+     this.XW = whitePoint[0];
+     this.YW = whitePoint[1];
+     this.ZW = whitePoint[2];
+     this.amin = range[0];
+     this.amax = range[1];
+     this.bmin = range[2];
+     this.bmax = range[3];
+     this.XB = blackPoint[0];
+     this.YB = blackPoint[1];
+     this.ZB = blackPoint[2];
+     if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
+      error('Invalid WhitePoint components, no fallback available');
+     }
+     if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
+      info('Invalid BlackPoint, falling back to default');
+      this.XB = this.YB = this.ZB = 0;
+     }
+     if (this.amin > this.amax || this.bmin > this.bmax) {
+      info('Invalid Range, falling back to defaults');
+      this.amin = -100;
+      this.amax = 100;
+      this.bmin = -100;
+      this.bmax = 100;
+     }
+    }
+    function fn_g(x) {
+     var result;
+     if (x >= 6 / 29) {
+      result = x * x * x;
+     } else {
+      result = 108 / 841 * (x - 4 / 29);
+     }
+     return result;
+    }
+    function decode(value, high1, low2, high2) {
+     return low2 + value * (high2 - low2) / high1;
+    }
+    function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
+     var Ls = src[srcOffset];
+     var as = src[srcOffset + 1];
+     var bs = src[srcOffset + 2];
+     if (maxVal !== false) {
+      Ls = decode(Ls, maxVal, 0, 100);
+      as = decode(as, maxVal, cs.amin, cs.amax);
+      bs = decode(bs, maxVal, cs.bmin, cs.bmax);
+     }
+     as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as;
+     bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs;
+     var M = (Ls + 16) / 116;
+     var L = M + as / 500;
+     var N = M - bs / 200;
+     var X = cs.XW * fn_g(L);
+     var Y = cs.YW * fn_g(M);
+     var Z = cs.ZW * fn_g(N);
+     var r, g, b;
+     if (cs.ZW < 1) {
+      r = X * 3.1339 + Y * -1.6170 + Z * -0.4906;
+      g = X * -0.9785 + Y * 1.9160 + Z * 0.0333;
+      b = X * 0.0720 + Y * -0.2290 + Z * 1.4057;
+     } else {
+      r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
+      g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
+      b = X * 0.0557 + Y * -0.2040 + Z * 1.0570;
+     }
+     dest[destOffset] = r <= 0 ? 0 : r >= 1 ? 255 : Math.sqrt(r) * 255 | 0;
+     dest[destOffset + 1] = g <= 0 ? 0 : g >= 1 ? 255 : Math.sqrt(g) * 255 | 0;
+     dest[destOffset + 2] = b <= 0 ? 0 : b >= 1 ? 255 : Math.sqrt(b) * 255 | 0;
+    }
+    LabCS.prototype = {
+     getRgb: ColorSpace.prototype.getRgb,
+     getRgbItem: function LabCS_getRgbItem(src, srcOffset, dest, destOffset) {
+      convertToRgb(this, src, srcOffset, false, dest, destOffset);
+     },
+     getRgbBuffer: function LabCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+      var maxVal = (1 << bits) - 1;
+      for (var i = 0; i < count; i++) {
+       convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
+       srcOffset += 3;
+       destOffset += 3 + alpha01;
+      }
+     },
+     getOutputLength: function LabCS_getOutputLength(inputLength, alpha01) {
+      return inputLength * (3 + alpha01) / 3 | 0;
+     },
+     isPassthrough: ColorSpace.prototype.isPassthrough,
+     fillRgb: ColorSpace.prototype.fillRgb,
+     isDefaultDecode: function LabCS_isDefaultDecode(decodeMap) {
+      return true;
+     },
+     usesZeroToOneRange: false
+    };
+    return LabCS;
+   }();
+   exports.ColorSpace = ColorSpace;
+  }));
+  (function (root, factory) {
    factory(root.pdfjsCoreFonts = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreStream, root.pdfjsCoreGlyphList, root.pdfjsCoreFontRenderer, root.pdfjsCoreEncodings, root.pdfjsCoreStandardFonts, root.pdfjsCoreUnicode, root.pdfjsCoreType1Parser, root.pdfjsCoreCFFParser);
   }(this, function (exports, sharedUtil, corePrimitives, coreStream, coreGlyphList, coreFontRenderer, coreEncodings, coreStandardFonts, coreUnicode, coreType1Parser, coreCFFParser) {
    var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
    var FontType = sharedUtil.FontType;
    var assert = sharedUtil.assert;
    var bytesToString = sharedUtil.bytesToString;
    var error = sharedUtil.error;
    var info = sharedUtil.info;
@@ -39195,2221 +41402,16 @@
    exports.ErrorFont = ErrorFont;
    exports.Font = Font;
    exports.FontFlags = FontFlags;
    exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
    exports.ToUnicodeMap = ToUnicodeMap;
    exports.getFontType = getFontType;
   }));
   (function (root, factory) {
-   factory(root.pdfjsCorePsParser = {}, root.pdfjsSharedUtil, root.pdfjsCoreParser);
-  }(this, function (exports, sharedUtil, coreParser) {
-   var error = sharedUtil.error;
-   var isSpace = sharedUtil.isSpace;
-   var EOF = coreParser.EOF;
-   var PostScriptParser = function PostScriptParserClosure() {
-    function PostScriptParser(lexer) {
-     this.lexer = lexer;
-     this.operators = [];
-     this.token = null;
-     this.prev = null;
-    }
-    PostScriptParser.prototype = {
-     nextToken: function PostScriptParser_nextToken() {
-      this.prev = this.token;
-      this.token = this.lexer.getToken();
-     },
-     accept: function PostScriptParser_accept(type) {
-      if (this.token.type === type) {
-       this.nextToken();
-       return true;
-      }
-      return false;
-     },
-     expect: function PostScriptParser_expect(type) {
-      if (this.accept(type)) {
-       return true;
-      }
-      error('Unexpected symbol: found ' + this.token.type + ' expected ' + type + '.');
-     },
-     parse: function PostScriptParser_parse() {
-      this.nextToken();
-      this.expect(PostScriptTokenTypes.LBRACE);
-      this.parseBlock();
-      this.expect(PostScriptTokenTypes.RBRACE);
-      return this.operators;
-     },
-     parseBlock: function PostScriptParser_parseBlock() {
-      while (true) {
-       if (this.accept(PostScriptTokenTypes.NUMBER)) {
-        this.operators.push(this.prev.value);
-       } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
-        this.operators.push(this.prev.value);
-       } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
-        this.parseCondition();
-       } else {
-        return;
-       }
-      }
-     },
-     parseCondition: function PostScriptParser_parseCondition() {
-      var conditionLocation = this.operators.length;
-      this.operators.push(null, null);
-      this.parseBlock();
-      this.expect(PostScriptTokenTypes.RBRACE);
-      if (this.accept(PostScriptTokenTypes.IF)) {
-       this.operators[conditionLocation] = this.operators.length;
-       this.operators[conditionLocation + 1] = 'jz';
-      } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
-       var jumpLocation = this.operators.length;
-       this.operators.push(null, null);
-       var endOfTrue = this.operators.length;
-       this.parseBlock();
-       this.expect(PostScriptTokenTypes.RBRACE);
-       this.expect(PostScriptTokenTypes.IFELSE);
-       this.operators[jumpLocation] = this.operators.length;
-       this.operators[jumpLocation + 1] = 'j';
-       this.operators[conditionLocation] = endOfTrue;
-       this.operators[conditionLocation + 1] = 'jz';
-      } else {
-       error('PS Function: error parsing conditional.');
-      }
-     }
-    };
-    return PostScriptParser;
-   }();
-   var PostScriptTokenTypes = {
-    LBRACE: 0,
-    RBRACE: 1,
-    NUMBER: 2,
-    OPERATOR: 3,
-    IF: 4,
-    IFELSE: 5
-   };
-   var PostScriptToken = function PostScriptTokenClosure() {
-    function PostScriptToken(type, value) {
-     this.type = type;
-     this.value = value;
-    }
-    var opCache = Object.create(null);
-    PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
-     var opValue = opCache[op];
-     if (opValue) {
-      return opValue;
-     }
-     return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
-    };
-    PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, '{');
-    PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, '}');
-    PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF');
-    PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE');
-    return PostScriptToken;
-   }();
-   var PostScriptLexer = function PostScriptLexerClosure() {
-    function PostScriptLexer(stream) {
-     this.stream = stream;
-     this.nextChar();
-     this.strBuf = [];
-    }
-    PostScriptLexer.prototype = {
-     nextChar: function PostScriptLexer_nextChar() {
-      return this.currentChar = this.stream.getByte();
-     },
-     getToken: function PostScriptLexer_getToken() {
-      var comment = false;
-      var ch = this.currentChar;
-      while (true) {
-       if (ch < 0) {
-        return EOF;
-       }
-       if (comment) {
-        if (ch === 0x0A || ch === 0x0D) {
-         comment = false;
-        }
-       } else if (ch === 0x25) {
-        comment = true;
-       } else if (!isSpace(ch)) {
-        break;
-       }
-       ch = this.nextChar();
-      }
-      switch (ch | 0) {
-      case 0x30:
-      case 0x31:
-      case 0x32:
-      case 0x33:
-      case 0x34:
-      case 0x35:
-      case 0x36:
-      case 0x37:
-      case 0x38:
-      case 0x39:
-      case 0x2B:
-      case 0x2D:
-      case 0x2E:
-       return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
-      case 0x7B:
-       this.nextChar();
-       return PostScriptToken.LBRACE;
-      case 0x7D:
-       this.nextChar();
-       return PostScriptToken.RBRACE;
-      }
-      var strBuf = this.strBuf;
-      strBuf.length = 0;
-      strBuf[0] = String.fromCharCode(ch);
-      while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) {
-       strBuf.push(String.fromCharCode(ch));
-      }
-      var str = strBuf.join('');
-      switch (str.toLowerCase()) {
-      case 'if':
-       return PostScriptToken.IF;
-      case 'ifelse':
-       return PostScriptToken.IFELSE;
-      default:
-       return PostScriptToken.getOperator(str);
-      }
-     },
-     getNumber: function PostScriptLexer_getNumber() {
-      var ch = this.currentChar;
-      var strBuf = this.strBuf;
-      strBuf.length = 0;
-      strBuf[0] = String.fromCharCode(ch);
-      while ((ch = this.nextChar()) >= 0) {
-       if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) {
-        strBuf.push(String.fromCharCode(ch));
-       } else {
-        break;
-       }
-      }
-      var value = parseFloat(strBuf.join(''));
-      if (isNaN(value)) {
-       error('Invalid floating point number: ' + value);
-      }
-      return value;
-     }
-    };
-    return PostScriptLexer;
-   }();
-   exports.PostScriptLexer = PostScriptLexer;
-   exports.PostScriptParser = PostScriptParser;
-  }));
-  (function (root, factory) {
-   factory(root.pdfjsCoreFunction = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCorePsParser);
-  }(this, function (exports, sharedUtil, corePrimitives, corePsParser) {
-   var error = sharedUtil.error;
-   var info = sharedUtil.info;
-   var isArray = sharedUtil.isArray;
-   var isBool = sharedUtil.isBool;
-   var isDict = corePrimitives.isDict;
-   var isStream = corePrimitives.isStream;
-   var PostScriptLexer = corePsParser.PostScriptLexer;
-   var PostScriptParser = corePsParser.PostScriptParser;
-   var PDFFunction = function PDFFunctionClosure() {
-    var CONSTRUCT_SAMPLED = 0;
-    var CONSTRUCT_INTERPOLATED = 2;
-    var CONSTRUCT_STICHED = 3;
-    var CONSTRUCT_POSTSCRIPT = 4;
-    return {
-     getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps, str) {
-      var i, ii;
-      var length = 1;
-      for (i = 0, ii = size.length; i < ii; i++) {
-       length *= size[i];
-      }
-      length *= outputSize;
-      var array = new Array(length);
-      var codeSize = 0;
-      var codeBuf = 0;
-      var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
-      var strBytes = str.getBytes((length * bps + 7) / 8);
-      var strIdx = 0;
-      for (i = 0; i < length; i++) {
-       while (codeSize < bps) {
-        codeBuf <<= 8;
-        codeBuf |= strBytes[strIdx++];
-        codeSize += 8;
-       }
-       codeSize -= bps;
-       array[i] = (codeBuf >> codeSize) * sampleMul;
-       codeBuf &= (1 << codeSize) - 1;
-      }
-      return array;
-     },
-     getIR: function PDFFunction_getIR(xref, fn) {
-      var dict = fn.dict;
-      if (!dict) {
-       dict = fn;
-      }
-      var types = [
-       this.constructSampled,
-       null,
-       this.constructInterpolated,
-       this.constructStiched,
-       this.constructPostScript
-      ];
-      var typeNum = dict.get('FunctionType');
-      var typeFn = types[typeNum];
-      if (!typeFn) {
-       error('Unknown type of function');
-      }
-      return typeFn.call(this, fn, dict, xref);
-     },
-     fromIR: function PDFFunction_fromIR(IR) {
-      var type = IR[0];
-      switch (type) {
-      case CONSTRUCT_SAMPLED:
-       return this.constructSampledFromIR(IR);
-      case CONSTRUCT_INTERPOLATED:
-       return this.constructInterpolatedFromIR(IR);
-      case CONSTRUCT_STICHED:
-       return this.constructStichedFromIR(IR);
-      default:
-       return this.constructPostScriptFromIR(IR);
-      }
-     },
-     parse: function PDFFunction_parse(xref, fn) {
-      var IR = this.getIR(xref, fn);
-      return this.fromIR(IR);
-     },
-     parseArray: function PDFFunction_parseArray(xref, fnObj) {
-      if (!isArray(fnObj)) {
-       return this.parse(xref, fnObj);
-      }
-      var fnArray = [];
-      for (var j = 0, jj = fnObj.length; j < jj; j++) {
-       var obj = xref.fetchIfRef(fnObj[j]);
-       fnArray.push(PDFFunction.parse(xref, obj));
-      }
-      return function (src, srcOffset, dest, destOffset) {
-       for (var i = 0, ii = fnArray.length; i < ii; i++) {
-        fnArray[i](src, srcOffset, dest, destOffset + i);
-       }
-      };
-     },
-     constructSampled: function PDFFunction_constructSampled(str, dict) {
-      function toMultiArray(arr) {
-       var inputLength = arr.length;
-       var out = [];
-       var index = 0;
-       for (var i = 0; i < inputLength; i += 2) {
-        out[index] = [
-         arr[i],
-         arr[i + 1]
-        ];
-        ++index;
-       }
-       return out;
-      }
-      var domain = dict.getArray('Domain');
-      var range = dict.getArray('Range');
-      if (!domain || !range) {
-       error('No domain or range');
-      }
-      var inputSize = domain.length / 2;
-      var outputSize = range.length / 2;
-      domain = toMultiArray(domain);
-      range = toMultiArray(range);
-      var size = dict.get('Size');
-      var bps = dict.get('BitsPerSample');
-      var order = dict.get('Order') || 1;
-      if (order !== 1) {
-       info('No support for cubic spline interpolation: ' + order);
-      }
-      var encode = dict.getArray('Encode');
-      if (!encode) {
-       encode = [];
-       for (var i = 0; i < inputSize; ++i) {
-        encode.push(0);
-        encode.push(size[i] - 1);
-       }
-      }
-      encode = toMultiArray(encode);
-      var decode = dict.getArray('Decode');
-      if (!decode) {
-       decode = range;
-      } else {
-       decode = toMultiArray(decode);
-      }
-      var samples = this.getSampleArray(size, outputSize, bps, str);
-      return [
-       CONSTRUCT_SAMPLED,
-       inputSize,
-       domain,
-       encode,
-       decode,
-       samples,
-       size,
-       outputSize,
-       Math.pow(2, bps) - 1,
-       range
-      ];
-     },
-     constructSampledFromIR: function PDFFunction_constructSampledFromIR(IR) {
-      function interpolate(x, xmin, xmax, ymin, ymax) {
-       return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
-      }
-      return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
-       var m = IR[1];
-       var domain = IR[2];
-       var encode = IR[3];
-       var decode = IR[4];
-       var samples = IR[5];
-       var size = IR[6];
-       var n = IR[7];
-       var range = IR[9];
-       var cubeVertices = 1 << m;
-       var cubeN = new Float64Array(cubeVertices);
-       var cubeVertex = new Uint32Array(cubeVertices);
-       var i, j;
-       for (j = 0; j < cubeVertices; j++) {
-        cubeN[j] = 1;
-       }
-       var k = n, pos = 1;
-       for (i = 0; i < m; ++i) {
-        var domain_2i = domain[i][0];
-        var domain_2i_1 = domain[i][1];
-        var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
-        var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
-        var size_i = size[i];
-        e = Math.min(Math.max(e, 0), size_i - 1);
-        var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
-        var n0 = e0 + 1 - e;
-        var n1 = e - e0;
-        var offset0 = e0 * k;
-        var offset1 = offset0 + k;
-        for (j = 0; j < cubeVertices; j++) {
-         if (j & pos) {
-          cubeN[j] *= n1;
-          cubeVertex[j] += offset1;
-         } else {
-          cubeN[j] *= n0;
-          cubeVertex[j] += offset0;
-         }
-        }
-        k *= size_i;
-        pos <<= 1;
-       }
-       for (j = 0; j < n; ++j) {
-        var rj = 0;
-        for (i = 0; i < cubeVertices; i++) {
-         rj += samples[cubeVertex[i] + j] * cubeN[i];
-        }
-        rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
-        dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
-       }
-      };
-     },
-     constructInterpolated: function PDFFunction_constructInterpolated(str, dict) {
-      var c0 = dict.getArray('C0') || [0];
-      var c1 = dict.getArray('C1') || [1];
-      var n = dict.get('N');
-      if (!isArray(c0) || !isArray(c1)) {
-       error('Illegal dictionary for interpolated function');
-      }
-      var length = c0.length;
-      var diff = [];
-      for (var i = 0; i < length; ++i) {
-       diff.push(c1[i] - c0[i]);
-      }
-      return [
-       CONSTRUCT_INTERPOLATED,
-       c0,
-       diff,
-       n
-      ];
-     },
-     constructInterpolatedFromIR: function PDFFunction_constructInterpolatedFromIR(IR) {
-      var c0 = IR[1];
-      var diff = IR[2];
-      var n = IR[3];
-      var length = diff.length;
-      return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
-       var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
-       for (var j = 0; j < length; ++j) {
-        dest[destOffset + j] = c0[j] + x * diff[j];
-       }
-      };
-     },
-     constructStiched: function PDFFunction_constructStiched(fn, dict, xref) {
-      var domain = dict.getArray('Domain');
-      if (!domain) {
-       error('No domain');
-      }
-      var inputSize = domain.length / 2;
-      if (inputSize !== 1) {
-       error('Bad domain for stiched function');
-      }
-      var fnRefs = dict.get('Functions');
-      var fns = [];
-      for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
-       fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i])));
-      }
-      var bounds = dict.getArray('Bounds');
-      var encode = dict.getArray('Encode');
-      return [
-       CONSTRUCT_STICHED,
-       domain,
-       bounds,
-       encode,
-       fns
-      ];
-     },
-     constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) {
-      var domain = IR[1];
-      var bounds = IR[2];
-      var encode = IR[3];
-      var fnsIR = IR[4];
-      var fns = [];
-      var tmpBuf = new Float32Array(1);
-      for (var i = 0, ii = fnsIR.length; i < ii; i++) {
-       fns.push(PDFFunction.fromIR(fnsIR[i]));
-      }
-      return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
-       var clip = function constructStichedFromIRClip(v, min, max) {
-        if (v > max) {
-         v = max;
-        } else if (v < min) {
-         v = min;
-        }
-        return v;
-       };
-       var v = clip(src[srcOffset], domain[0], domain[1]);
-       for (var i = 0, ii = bounds.length; i < ii; ++i) {
-        if (v < bounds[i]) {
-         break;
-        }
-       }
-       var dmin = domain[0];
-       if (i > 0) {
-        dmin = bounds[i - 1];
-       }
-       var dmax = domain[1];
-       if (i < bounds.length) {
-        dmax = bounds[i];
-       }
-       var rmin = encode[2 * i];
-       var rmax = encode[2 * i + 1];
-       tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
-       fns[i](tmpBuf, 0, dest, destOffset);
-      };
-     },
-     constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) {
-      var domain = dict.getArray('Domain');
-      var range = dict.getArray('Range');
-      if (!domain) {
-       error('No domain.');
-      }
-      if (!range) {
-       error('No range.');
-      }
-      var lexer = new PostScriptLexer(fn);
-      var parser = new PostScriptParser(lexer);
-      var code = parser.parse();
-      return [
-       CONSTRUCT_POSTSCRIPT,
-       domain,
-       range,
-       code
-      ];
-     },
-     constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR(IR) {
-      var domain = IR[1];
-      var range = IR[2];
-      var code = IR[3];
-      var compiled = new PostScriptCompiler().compile(code, domain, range);
-      if (compiled) {
-       return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled);
-      }
-      info('Unable to compile PS function');
-      var numOutputs = range.length >> 1;
-      var numInputs = domain.length >> 1;
-      var evaluator = new PostScriptEvaluator(code);
-      var cache = Object.create(null);
-      var MAX_CACHE_SIZE = 2048 * 4;
-      var cache_available = MAX_CACHE_SIZE;
-      var tmpBuf = new Float32Array(numInputs);
-      return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
-       var i, value;
-       var key = '';
-       var input = tmpBuf;
-       for (i = 0; i < numInputs; i++) {
-        value = src[srcOffset + i];
-        input[i] = value;
-        key += value + '_';
-       }
-       var cachedValue = cache[key];
-       if (cachedValue !== undefined) {
-        dest.set(cachedValue, destOffset);
-        return;
-       }
-       var output = new Float32Array(numOutputs);
-       var stack = evaluator.execute(input);
-       var stackIndex = stack.length - numOutputs;
-       for (i = 0; i < numOutputs; i++) {
-        value = stack[stackIndex + i];
-        var bound = range[i * 2];
-        if (value < bound) {
-         value = bound;
-        } else {
-         bound = range[i * 2 + 1];
-         if (value > bound) {
-          value = bound;
-         }
-        }
-        output[i] = value;
-       }
-       if (cache_available > 0) {
-        cache_available--;
-        cache[key] = output;
-       }
-       dest.set(output, destOffset);
-      };
-     }
-    };
-   }();
-   function isPDFFunction(v) {
-    var fnDict;
-    if (typeof v !== 'object') {
-     return false;
-    } else if (isDict(v)) {
-     fnDict = v;
-    } else if (isStream(v)) {
-     fnDict = v.dict;
-    } else {
-     return false;
-    }
-    return fnDict.has('FunctionType');
-   }
-   var PostScriptStack = function PostScriptStackClosure() {
-    var MAX_STACK_SIZE = 100;
-    function PostScriptStack(initialStack) {
-     this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
-    }
-    PostScriptStack.prototype = {
-     push: function PostScriptStack_push(value) {
-      if (this.stack.length >= MAX_STACK_SIZE) {
-       error('PostScript function stack overflow.');
-      }
-      this.stack.push(value);
-     },
-     pop: function PostScriptStack_pop() {
-      if (this.stack.length <= 0) {
-       error('PostScript function stack underflow.');
-      }
-      return this.stack.pop();
-     },
-     copy: function PostScriptStack_copy(n) {
-      if (this.stack.length + n >= MAX_STACK_SIZE) {
-       error('PostScript function stack overflow.');
-      }
-      var stack = this.stack;
-      for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
-       stack.push(stack[i]);
-      }
-     },
-     index: function PostScriptStack_index(n) {
-      this.push(this.stack[this.stack.length - n - 1]);
-     },
-     roll: function PostScriptStack_roll(n, p) {
-      var stack = this.stack;
-      var l = stack.length - n;
-      var r = stack.length - 1, c = l + (p - Math.floor(p / n) * n), i, j, t;
-      for (i = l, j = r; i < j; i++, j--) {
-       t = stack[i];
-       stack[i] = stack[j];
-       stack[j] = t;
-      }
-      for (i = l, j = c - 1; i < j; i++, j--) {
-       t = stack[i];
-       stack[i] = stack[j];
-       stack[j] = t;
-      }
-      for (i = c, j = r; i < j; i++, j--) {
-       t = stack[i];
-       stack[i] = stack[j];
-       stack[j] = t;
-      }
-     }
-    };
-    return PostScriptStack;
-   }();
-   var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
-    function PostScriptEvaluator(operators) {
-     this.operators = operators;
-    }
-    PostScriptEvaluator.prototype = {
-     execute: function PostScriptEvaluator_execute(initialStack) {
-      var stack = new PostScriptStack(initialStack);
-      var counter = 0;
-      var operators = this.operators;
-      var length = operators.length;
-      var operator, a, b;
-      while (counter < length) {
-       operator = operators[counter++];
-       if (typeof operator === 'number') {
-        stack.push(operator);
-        continue;
-       }
-       switch (operator) {
-       case 'jz':
-        b = stack.pop();
-        a = stack.pop();
-        if (!a) {
-         counter = b;
-        }
-        break;
-       case 'j':
-        a = stack.pop();
-        counter = a;
-        break;
-       case 'abs':
-        a = stack.pop();
-        stack.push(Math.abs(a));
-        break;
-       case 'add':
-        b = stack.pop();
-        a = stack.pop();
-        stack.push(a + b);
-        break;
-       case 'and':
-        b = stack.pop();
-        a = stack.pop();
-        if (isBool(a) && isBool(b)) {
-         stack.push(a && b);
-        } else {
-         stack.push(a & b);
-        }
-        break;
-       case 'atan':
-        a = stack.pop();
-        stack.push(Math.atan(a));
-        break;
-       case 'bitshift':
-        b = stack.pop();
-        a = stack.pop();
-        if (a > 0) {
-         stack.push(a << b);
-        } else {
-         stack.push(a >> b);
-        }
-        break;
-       case 'ceiling':
-        a = stack.pop();
-        stack.push(Math.ceil(a));
-        break;
-       case 'copy':
-        a = stack.pop();
-        stack.copy(a);
-        break;
-       case 'cos':
-        a = stack.pop();
-        stack.push(Math.cos(a));
-        break;
-       case 'cvi':
-        a = stack.pop() | 0;
-        stack.push(a);
-        break;
-       case 'cvr':
-        break;
-       case 'div':
-        b = stack.pop();
-        a = stack.pop();
-        stack.push(a / b);
-        break;
-       case 'dup':
-        stack.copy(1);
-        break;
-       case 'eq':
-        b = stack.pop();
-        a = stack.pop();
-        stack.push(a === b);
-        break;
-       case 'exch':
-        stack.roll(2, 1);
-        break;
-       case 'exp':
-        b = stack.pop();
-        a = stack.pop();
-        stack.push(Math.pow(a, b));
-        break;
-       case 'false':
-        stack.push(false);
-        break;
-       case 'floor':
-        a = stack.pop();
-        stack.push(Math.floor(a));
-        break;
-       case 'ge':
-        b = stack.pop();
-        a = stack.pop();
-        stack.push(a >= b);
-        break;
-       case 'gt':
-        b = stack.pop();
-        a = stack.pop();
-        stack.push(a > b);
-        break;
-       case 'idiv':
-        b = stack.pop();
-        a = stack.pop();
-        stack.push(a / b | 0);
-        break;
-       case 'index':
-        a = stack.pop();
-        stack.index(a);
-        break;
-       case 'le':
-        b = stack.pop();
-        a = stack.pop();
-        stack.push(a <= b);
-        break;
-       case 'ln':
-        a = stack.pop();
-        stack.push(Math.log(a));
-        break;
-       case 'log':
-        a = stack.pop();
-        stack.push(Math.log(a) / Math.LN10);
-        break;
-       case 'lt':
-        b = stack.pop();
-        a = stack.pop();
-        stack.push(a < b);
-        break;
-       case 'mod':
-        b = stack.pop();
-        a = stack.pop();
-        stack.push(a % b);
-        break;
-       case 'mul':
-        b = stack.pop();
-        a = stack.pop();
-        stack.push(a * b);
-        break;
-       case 'ne':
-        b = stack.pop();
-        a = stack.pop();
-        stack.push(a !== b);
-        break;
-       case 'neg':
-        a = stack.pop();
-        stack.push(-a);
-        break;
-       case 'not':
-        a = stack.pop();
-        if (isBool(a)) {
-         stack.push(!a);
-        } else {
-         stack.push(~a);
-        }
-        break;
-       case 'or':
-        b = stack.pop();
-        a = stack.pop();
-        if (isBool(a) && isBool(b)) {
-         stack.push(a || b);
-        } else {
-         stack.push(a | b);
-        }
-        break;
-       case 'pop':
-        stack.pop();
-        break;
-       case 'roll':
-        b = stack.pop();
-        a = stack.pop();
-        stack.roll(a, b);
-        break;
-       case 'round':
-        a = stack.pop();
-        stack.push(Math.round(a));
-        break;
-       case 'sin':
-        a = stack.pop();
-        stack.push(Math.sin(a));
-        break;
-       case 'sqrt':
-        a = stack.pop();
-        stack.push(Math.sqrt(a));
-        break;
-       case 'sub':
-        b = stack.pop();
-        a = stack.pop();
-        stack.push(a - b);
-        break;
-       case 'true':
-        stack.push(true);
-        break;
-       case 'truncate':
-        a = stack.pop();
-        a = a < 0 ? Math.ceil(a) : Math.floor(a);
-        stack.push(a);
-        break;
-       case 'xor':
-        b = stack.pop();
-        a = stack.pop();
-        if (isBool(a) && isBool(b)) {
-         stack.push(a !== b);
-        } else {
-         stack.push(a ^ b);
-        }
-        break;
-       default:
-        error('Unknown operator ' + operator);
-        break;
-       }
-      }
-      return stack.stack;
-     }
-    };
-    return PostScriptEvaluator;
-   }();
-   var PostScriptCompiler = function PostScriptCompilerClosure() {
-    function AstNode(type) {
-     this.type = type;
-    }
-    AstNode.prototype.visit = function (visitor) {
-     throw new Error('abstract method');
-    };
-    function AstArgument(index, min, max) {
-     AstNode.call(this, 'args');
-     this.index = index;
-     this.min = min;
-     this.max = max;
-    }
-    AstArgument.prototype = Object.create(AstNode.prototype);
-    AstArgument.prototype.visit = function (visitor) {
-     visitor.visitArgument(this);
-    };
-    function AstLiteral(number) {
-     AstNode.call(this, 'literal');
-     this.number = number;
-     this.min = number;
-     this.max = number;
-    }
-    AstLiteral.prototype = Object.create(AstNode.prototype);
-    AstLiteral.prototype.visit = function (visitor) {
-     visitor.visitLiteral(this);
-    };
-    function AstBinaryOperation(op, arg1, arg2, min, max) {
-     AstNode.call(this, 'binary');
-     this.op = op;
-     this.arg1 = arg1;
-     this.arg2 = arg2;
-     this.min = min;
-     this.max = max;
-    }
-    AstBinaryOperation.prototype = Object.create(AstNode.prototype);
-    AstBinaryOperation.prototype.visit = function (visitor) {
-     visitor.visitBinaryOperation(this);
-    };
-    function AstMin(arg, max) {
-     AstNode.call(this, 'max');
-     this.arg = arg;
-     this.min = arg.min;
-     this.max = max;
-    }
-    AstMin.prototype = Object.create(AstNode.prototype);
-    AstMin.prototype.visit = function (visitor) {
-     visitor.visitMin(this);
-    };
-    function AstVariable(index, min, max) {
-     AstNode.call(this, 'var');
-     this.index = index;
-     this.min = min;
-     this.max = max;
-    }
-    AstVariable.prototype = Object.create(AstNode.prototype);
-    AstVariable.prototype.visit = function (visitor) {
-     visitor.visitVariable(this);
-    };
-    function AstVariableDefinition(variable, arg) {
-     AstNode.call(this, 'definition');
-     this.variable = variable;
-     this.arg = arg;
-    }
-    AstVariableDefinition.prototype = Object.create(AstNode.prototype);
-    AstVariableDefinition.prototype.visit = function (visitor) {
-     visitor.visitVariableDefinition(this);
-    };
-    function ExpressionBuilderVisitor() {
-     this.parts = [];
-    }
-    ExpressionBuilderVisitor.prototype = {
-     visitArgument: function (arg) {
-      this.parts.push('Math.max(', arg.min, ', Math.min(', arg.max, ', src[srcOffset + ', arg.index, ']))');
-     },
-     visitVariable: function (variable) {
-      this.parts.push('v', variable.index);
-     },
-     visitLiteral: function (literal) {
-      this.parts.push(literal.number);
-     },
-     visitBinaryOperation: function (operation) {
-      this.parts.push('(');
-      operation.arg1.visit(this);
-      this.parts.push(' ', operation.op, ' ');
-      operation.arg2.visit(this);
-      this.parts.push(')');
-     },
-     visitVariableDefinition: function (definition) {
-      this.parts.push('var ');
-      definition.variable.visit(this);
-      this.parts.push(' = ');
-      definition.arg.visit(this);
-      this.parts.push(';');
-     },
-     visitMin: function (max) {
-      this.parts.push('Math.min(');
-      max.arg.visit(this);
-      this.parts.push(', ', max.max, ')');
-     },
-     toString: function () {
-      return this.parts.join('');
-     }
-    };
-    function buildAddOperation(num1, num2) {
-     if (num2.type === 'literal' && num2.number === 0) {
-      return num1;
-     }
-     if (num1.type === 'literal' && num1.number === 0) {
-      return num2;
-     }
-     if (num2.type === 'literal' && num1.type === 'literal') {
-      return new AstLiteral(num1.number + num2.number);
-     }
-     return new AstBinaryOperation('+', num1, num2, num1.min + num2.min, num1.max + num2.max);
-    }
-    function buildMulOperation(num1, num2) {
-     if (num2.type === 'literal') {
-      if (num2.number === 0) {
-       return new AstLiteral(0);
-      } else if (num2.number === 1) {
-       return num1;
-      } else if (num1.type === 'literal') {
-       return new AstLiteral(num1.number * num2.number);
-      }
-     }
-     if (num1.type === 'literal') {
-      if (num1.number === 0) {
-       return new AstLiteral(0);
-      } else if (num1.number === 1) {
-       return num2;
-      }
-     }
-     var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
-     var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
-     return new AstBinaryOperation('*', num1, num2, min, max);
-    }
-    function buildSubOperation(num1, num2) {
-     if (num2.type === 'literal') {
-      if (num2.number === 0) {
-       return num1;
-      } else if (num1.type === 'literal') {
-       return new AstLiteral(num1.number - num2.number);
-      }
-     }
-     if (num2.type === 'binary' && num2.op === '-' && num1.type === 'literal' && num1.number === 1 && num2.arg1.type === 'literal' && num2.arg1.number === 1) {
-      return num2.arg2;
-     }
-     return new AstBinaryOperation('-', num1, num2, num1.min - num2.max, num1.max - num2.min);
-    }
-    function buildMinOperation(num1, max) {
-     if (num1.min >= max) {
-      return new AstLiteral(max);
-     } else if (num1.max <= max) {
-      return num1;
-     }
-     return new AstMin(num1, max);
-    }
-    function PostScriptCompiler() {
-    }
-    PostScriptCompiler.prototype = {
-     compile: function PostScriptCompiler_compile(code, domain, range) {
-      var stack = [];
-      var i, ii;
-      var instructions = [];
-      var inputSize = domain.length >> 1, outputSize = range.length >> 1;
-      var lastRegister = 0;
-      var n, j;
-      var num1, num2, ast1, ast2, tmpVar, item;
-      for (i = 0; i < inputSize; i++) {
-       stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
-      }
-      for (i = 0, ii = code.length; i < ii; i++) {
-       item = code[i];
-       if (typeof item === 'number') {
-        stack.push(new AstLiteral(item));
-        continue;
-       }
-       switch (item) {
-       case 'add':
-        if (stack.length < 2) {
-         return null;
-        }
-        num2 = stack.pop();
-        num1 = stack.pop();
-        stack.push(buildAddOperation(num1, num2));
-        break;
-       case 'cvr':
-        if (stack.length < 1) {
-         return null;
-        }
-        break;
-       case 'mul':
-        if (stack.length < 2) {
-         return null;
-        }
-        num2 = stack.pop();
-        num1 = stack.pop();
-        stack.push(buildMulOperation(num1, num2));
-        break;
-       case 'sub':
-        if (stack.length < 2) {
-         return null;
-        }
-        num2 = stack.pop();
-        num1 = stack.pop();
-        stack.push(buildSubOperation(num1, num2));
-        break;
-       case 'exch':
-        if (stack.length < 2) {
-         return null;
-        }
-        ast1 = stack.pop();
-        ast2 = stack.pop();
-        stack.push(ast1, ast2);
-        break;
-       case 'pop':
-        if (stack.length < 1) {
-         return null;
-        }
-        stack.pop();
-        break;
-       case 'index':
-        if (stack.length < 1) {
-         return null;
-        }
-        num1 = stack.pop();
-        if (num1.type !== 'literal') {
-         return null;
-        }
-        n = num1.number;
-        if (n < 0 || (n | 0) !== n || stack.length < n) {
-         return null;
-        }
-        ast1 = stack[stack.length - n - 1];
-        if (ast1.type === 'literal' || ast1.type === 'var') {
-         stack.push(ast1);
-         break;
-        }
-        tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
-        stack[stack.length - n - 1] = tmpVar;
-        stack.push(tmpVar);
-        instructions.push(new AstVariableDefinition(tmpVar, ast1));
-        break;
-       case 'dup':
-        if (stack.length < 1) {
-         return null;
-        }
-        if (typeof code[i + 1] === 'number' && code[i + 2] === 'gt' && code[i + 3] === i + 7 && code[i + 4] === 'jz' && code[i + 5] === 'pop' && code[i + 6] === code[i + 1]) {
-         num1 = stack.pop();
-         stack.push(buildMinOperation(num1, code[i + 1]));
-         i += 6;
-         break;
-        }
-        ast1 = stack[stack.length - 1];
-        if (ast1.type === 'literal' || ast1.type === 'var') {
-         stack.push(ast1);
-         break;
-        }
-        tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
-        stack[stack.length - 1] = tmpVar;
-        stack.push(tmpVar);
-        instructions.push(new AstVariableDefinition(tmpVar, ast1));
-        break;
-       case 'roll':
-        if (stack.length < 2) {
-         return null;
-        }
-        num2 = stack.pop();
-        num1 = stack.pop();
-        if (num2.type !== 'literal' || num1.type !== 'literal') {
-         return null;
-        }
-        j = num2.number;
-        n = num1.number;
-        if (n <= 0 || (n | 0) !== n || (j | 0) !== j || stack.length < n) {
-         return null;
-        }
-        j = (j % n + n) % n;
-        if (j === 0) {
-         break;
-        }
-        Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
-        break;
-       default:
-        return null;
-       }
-      }
-      if (stack.length !== outputSize) {
-       return null;
-      }
-      var result = [];
-      instructions.forEach(function (instruction) {
-       var statementBuilder = new ExpressionBuilderVisitor();
-       instruction.visit(statementBuilder);
-       result.push(statementBuilder.toString());
-      });
-      stack.forEach(function (expr, i) {
-       var statementBuilder = new ExpressionBuilderVisitor();
-       expr.visit(statementBuilder);
-       var min = range[i * 2], max = range[i * 2 + 1];
-       var out = [statementBuilder.toString()];
-       if (min > expr.min) {
-        out.unshift('Math.max(', min, ', ');
-        out.push(')');
-       }
-       if (max < expr.max) {
-        out.unshift('Math.min(', max, ', ');
-        out.push(')');
-       }
-       out.unshift('dest[destOffset + ', i, '] = ');
-       out.push(';');
-       result.push(out.join(''));
-      });
-      return result.join('\n');
-     }
-    };
-    return PostScriptCompiler;
-   }();
-   exports.isPDFFunction = isPDFFunction;
-   exports.PDFFunction = PDFFunction;
-   exports.PostScriptEvaluator = PostScriptEvaluator;
-   exports.PostScriptCompiler = PostScriptCompiler;
-  }));
-  (function (root, factory) {
-   factory(root.pdfjsCoreColorSpace = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreFunction);
-  }(this, function (exports, sharedUtil, corePrimitives, coreFunction) {
-   var error = sharedUtil.error;
-   var info = sharedUtil.info;
-   var isArray = sharedUtil.isArray;
-   var isString = sharedUtil.isString;
-   var shadow = sharedUtil.shadow;
-   var warn = sharedUtil.warn;
-   var isDict = corePrimitives.isDict;
-   var isName = corePrimitives.isName;
-   var isStream = corePrimitives.isStream;
-   var PDFFunction = coreFunction.PDFFunction;
-   var ColorSpace = function ColorSpaceClosure() {
-    function resizeRgbImage(src, bpc, w1, h1, w2, h2, alpha01, dest) {
-     var COMPONENTS = 3;
-     alpha01 = alpha01 !== 1 ? 0 : alpha01;
-     var xRatio = w1 / w2;
-     var yRatio = h1 / h2;
-     var i, j, py, newIndex = 0, oldIndex;
-     var xScaled = new Uint16Array(w2);
-     var w1Scanline = w1 * COMPONENTS;
-     for (i = 0; i < w2; i++) {
-      xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
-     }
-     for (i = 0; i < h2; i++) {
-      py = Math.floor(i * yRatio) * w1Scanline;
-      for (j = 0; j < w2; j++) {
-       oldIndex = py + xScaled[j];
-       dest[newIndex++] = src[oldIndex++];
-       dest[newIndex++] = src[oldIndex++];
-       dest[newIndex++] = src[oldIndex++];
-       newIndex += alpha01;
-      }
-     }
-    }
-    function ColorSpace() {
-     error('should not call ColorSpace constructor');
-    }
-    ColorSpace.prototype = {
-     getRgb: function ColorSpace_getRgb(src, srcOffset) {
-      var rgb = new Uint8Array(3);
-      this.getRgbItem(src, srcOffset, rgb, 0);
-      return rgb;
-     },
-     getRgbItem: function ColorSpace_getRgbItem(src, srcOffset, dest, destOffset) {
-      error('Should not call ColorSpace.getRgbItem');
-     },
-     getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
-      error('Should not call ColorSpace.getRgbBuffer');
-     },
-     getOutputLength: function ColorSpace_getOutputLength(inputLength, alpha01) {
-      error('Should not call ColorSpace.getOutputLength');
-     },
-     isPassthrough: function ColorSpace_isPassthrough(bits) {
-      return false;
-     },
-     fillRgb: function ColorSpace_fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
-      var count = originalWidth * originalHeight;
-      var rgbBuf = null;
-      var numComponentColors = 1 << bpc;
-      var needsResizing = originalHeight !== height || originalWidth !== width;
-      var i, ii;
-      if (this.isPassthrough(bpc)) {
-       rgbBuf = comps;
-      } else if (this.numComps === 1 && count > numComponentColors && this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') {
-       var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
-       var key;
-       for (i = 0; i < numComponentColors; i++) {
-        allColors[i] = i;
-       }
-       var colorMap = new Uint8Array(numComponentColors * 3);
-       this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
-       var destPos, rgbPos;
-       if (!needsResizing) {
-        destPos = 0;
-        for (i = 0; i < count; ++i) {
-         key = comps[i] * 3;
-         dest[destPos++] = colorMap[key];
-         dest[destPos++] = colorMap[key + 1];
-         dest[destPos++] = colorMap[key + 2];
-         destPos += alpha01;
-        }
-       } else {
-        rgbBuf = new Uint8Array(count * 3);
-        rgbPos = 0;
-        for (i = 0; i < count; ++i) {
-         key = comps[i] * 3;
-         rgbBuf[rgbPos++] = colorMap[key];
-         rgbBuf[rgbPos++] = colorMap[key + 1];
-         rgbBuf[rgbPos++] = colorMap[key + 2];
-        }
-       }
-      } else {
-       if (!needsResizing) {
-        this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
-       } else {
-        rgbBuf = new Uint8Array(count * 3);
-        this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
-       }
-      }
-      if (rgbBuf) {
-       if (needsResizing) {
-        resizeRgbImage(rgbBuf, bpc, originalWidth, originalHeight, width, height, alpha01, dest);
-       } else {
-        rgbPos = 0;
-        destPos = 0;
-        for (i = 0, ii = width * actualHeight; i < ii; i++) {
-         dest[destPos++] = rgbBuf[rgbPos++];
-         dest[destPos++] = rgbBuf[rgbPos++];
-         dest[destPos++] = rgbBuf[rgbPos++];
-         destPos += alpha01;
-        }
-       }
-      }
-     },
-     usesZeroToOneRange: true
-    };
-    ColorSpace.parse = function ColorSpace_parse(cs, xref, res) {
-     var IR = ColorSpace.parseToIR(cs, xref, res);
-     if (IR instanceof AlternateCS) {
-      return IR;
-     }
-     return ColorSpace.fromIR(IR);
-    };
-    ColorSpace.fromIR = function ColorSpace_fromIR(IR) {
-     var name = isArray(IR) ? IR[0] : IR;
-     var whitePoint, blackPoint, gamma;
-     switch (name) {
-     case 'DeviceGrayCS':
-      return this.singletons.gray;
-     case 'DeviceRgbCS':
-      return this.singletons.rgb;
-     case 'DeviceCmykCS':
-      return this.singletons.cmyk;
-     case 'CalGrayCS':
-      whitePoint = IR[1];
-      blackPoint = IR[2];
-      gamma = IR[3];
-      return new CalGrayCS(whitePoint, blackPoint, gamma);
-     case 'CalRGBCS':
-      whitePoint = IR[1];
-      blackPoint = IR[2];
-      gamma = IR[3];
-      var matrix = IR[4];
-      return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
-     case 'PatternCS':
-      var basePatternCS = IR[1];
-      if (basePatternCS) {
-       basePatternCS = ColorSpace.fromIR(basePatternCS);
-      }
-      return new PatternCS(basePatternCS);
-     case 'IndexedCS':
-      var baseIndexedCS = IR[1];
-      var hiVal = IR[2];
-      var lookup = IR[3];
-      return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup);
-     case 'AlternateCS':
-      var numComps = IR[1];
-      var alt = IR[2];
-      var tintFnIR = IR[3];
-      return new AlternateCS(numComps, ColorSpace.fromIR(alt), PDFFunction.fromIR(tintFnIR));
-     case 'LabCS':
-      whitePoint = IR[1];
-      blackPoint = IR[2];
-      var range = IR[3];
-      return new LabCS(whitePoint, blackPoint, range);
-     default:
-      error('Unknown name ' + name);
-     }
-     return null;
-    };
-    ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) {
-     if (isName(cs)) {
-      var colorSpaces = res.get('ColorSpace');
-      if (isDict(colorSpaces)) {
-       var refcs = colorSpaces.get(cs.name);
-       if (refcs) {
-        cs = refcs;
-       }
-      }
-     }
-     cs = xref.fetchIfRef(cs);
-     if (isName(cs)) {
-      switch (cs.name) {
-      case 'DeviceGray':
-      case 'G':
-       return 'DeviceGrayCS';
-      case 'DeviceRGB':
-      case 'RGB':
-       return 'DeviceRgbCS';
-      case 'DeviceCMYK':
-      case 'CMYK':
-       return 'DeviceCmykCS';
-      case 'Pattern':
-       return [
-        'PatternCS',
-        null
-       ];
-      default:
-       error('unrecognized colorspace ' + cs.name);
-      }
-     } else if (isArray(cs)) {
-      var mode = xref.fetchIfRef(cs[0]).name;
-      var numComps, params, alt, whitePoint, blackPoint, gamma;
-      switch (mode) {
-      case 'DeviceGray':
-      case 'G':
-       return 'DeviceGrayCS';
-      case 'DeviceRGB':
-      case 'RGB':
-       return 'DeviceRgbCS';
-      case 'DeviceCMYK':
-      case 'CMYK':
-       return 'DeviceCmykCS';
-      case 'CalGray':
-       params = xref.fetchIfRef(cs[1]);
-       whitePoint = params.getArray('WhitePoint');
-       blackPoint = params.getArray('BlackPoint');
-       gamma = params.get('Gamma');
-       return [
-        'CalGrayCS',
-        whitePoint,
-        blackPoint,
-        gamma
-       ];
-      case 'CalRGB':
-       params = xref.fetchIfRef(cs[1]);
-       whitePoint = params.getArray('WhitePoint');
-       blackPoint = params.getArray('BlackPoint');
-       gamma = params.getArray('Gamma');
-       var matrix = params.getArray('Matrix');
-       return [
-        'CalRGBCS',
-        whitePoint,
-        blackPoint,
-        gamma,
-        matrix
-       ];
-      case 'ICCBased':
-       var stream = xref.fetchIfRef(cs[1]);
-       var dict = stream.dict;
-       numComps = dict.get('N');
-       alt = dict.get('Alternate');
-       if (alt) {
-        var altIR = ColorSpace.parseToIR(alt, xref, res);
-        var altCS = ColorSpace.fromIR(altIR);
-        if (altCS.numComps === numComps) {
-         return altIR;
-        }
-        warn('ICCBased color space: Ignoring incorrect /Alternate entry.');
-       }
-       if (numComps === 1) {
-        return 'DeviceGrayCS';
-       } else if (numComps === 3) {
-        return 'DeviceRgbCS';
-       } else if (numComps === 4) {
-        return 'DeviceCmykCS';
-       }
-       break;
-      case 'Pattern':
-       var basePatternCS = cs[1] || null;
-       if (basePatternCS) {
-        basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res);
-       }
-       return [
-        'PatternCS',
-        basePatternCS
-       ];
-      case 'Indexed':
-      case 'I':
-       var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res);
-       var hiVal = xref.fetchIfRef(cs[2]) + 1;
-       var lookup = xref.fetchIfRef(cs[3]);
-       if (isStream(lookup)) {
-        lookup = lookup.getBytes();
-       }
-       return [
-        'IndexedCS',
-        baseIndexedCS,
-        hiVal,
-        lookup
-       ];
-      case 'Separation':
-      case 'DeviceN':
-       var name = xref.fetchIfRef(cs[1]);
-       numComps = isArray(name) ? name.length : 1;
-       alt = ColorSpace.parseToIR(cs[2], xref, res);
-       var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
-       return [
-        'AlternateCS',
-        numComps,
-        alt,
-        tintFnIR
-       ];
-      case 'Lab':
-       params = xref.fetchIfRef(cs[1]);
-       whitePoint = params.getArray('WhitePoint');
-       blackPoint = params.getArray('BlackPoint');
-       var range = params.getArray('Range');
-       return [
-        'LabCS',
-        whitePoint,
-        blackPoint,
-        range
-       ];
-      default:
-       error('unimplemented color space object "' + mode + '"');
-      }
-     } else {
-      error('unrecognized color space object: "' + cs + '"');
-     }
-     return null;
-    };
-    ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) {
-     if (!isArray(decode)) {
-      return true;
-     }
-     if (n * 2 !== decode.length) {
-      warn('The decode map is not the correct length');
-      return true;
-     }
-     for (var i = 0, ii = decode.length; i < ii; i += 2) {
-      if (decode[i] !== 0 || decode[i + 1] !== 1) {
-       return false;
-      }
-     }
-     return true;
-    };
-    ColorSpace.singletons = {
-     get gray() {
-      return shadow(this, 'gray', new DeviceGrayCS());
-     },
-     get rgb() {
-      return shadow(this, 'rgb', new DeviceRgbCS());
-     },
-     get cmyk() {
-      return shadow(this, 'cmyk', new DeviceCmykCS());
-     }
-    };
-    return ColorSpace;
-   }();
-   var AlternateCS = function AlternateCSClosure() {
-    function AlternateCS(numComps, base, tintFn) {
-     this.name = 'Alternate';
-     this.numComps = numComps;
-     this.defaultColor = new Float32Array(numComps);
-     for (var i = 0; i < numComps; ++i) {
-      this.defaultColor[i] = 1;
-     }
-     this.base = base;
-     this.tintFn = tintFn;
-     this.tmpBuf = new Float32Array(base.numComps);
-    }
-    AlternateCS.prototype = {
-     getRgb: ColorSpace.prototype.getRgb,
-     getRgbItem: function AlternateCS_getRgbItem(src, srcOffset, dest, destOffset) {
-      var tmpBuf = this.tmpBuf;
-      this.tintFn(src, srcOffset, tmpBuf, 0);
-      this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
-     },
-     getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
-      var tintFn = this.tintFn;
-      var base = this.base;
-      var scale = 1 / ((1 << bits) - 1);
-      var baseNumComps = base.numComps;
-      var usesZeroToOneRange = base.usesZeroToOneRange;
-      var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
-      var pos = isPassthrough ? destOffset : 0;
-      var baseBuf = isPassthrough ? dest : new Uint8Array(baseNumComps * count);
-      var numComps = this.numComps;
-      var scaled = new Float32Array(numComps);
-      var tinted = new Float32Array(baseNumComps);
-      var i, j;
-      for (i = 0; i < count; i++) {
-       for (j = 0; j < numComps; j++) {
-        scaled[j] = src[srcOffset++] * scale;
-       }
-       tintFn(scaled, 0, tinted, 0);
-       if (usesZeroToOneRange) {
-        for (j = 0; j < baseNumComps; j++) {
-         baseBuf[pos++] = tinted[j] * 255;
-        }
-       } else {
-        base.getRgbItem(tinted, 0, baseBuf, pos);
-        pos += baseNumComps;
-       }
-      }
-      if (!isPassthrough) {
-       base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
-      }
-     },
-     getOutputLength: function AlternateCS_getOutputLength(inputLength, alpha01) {
-      return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
-     },
-     isPassthrough: ColorSpace.prototype.isPassthrough,
-     fillRgb: ColorSpace.prototype.fillRgb,
-     isDefaultDecode: function AlternateCS_isDefaultDecode(decodeMap) {
-      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
-     },
-     usesZeroToOneRange: true
-    };
-    return AlternateCS;
-   }();
-   var PatternCS = function PatternCSClosure() {
-    function PatternCS(baseCS) {
-     this.name = 'Pattern';
-     this.base = baseCS;
-    }
-    PatternCS.prototype = {};
-    return PatternCS;
-   }();
-   var IndexedCS = function IndexedCSClosure() {
-    function IndexedCS(base, highVal, lookup) {
-     this.name = 'Indexed';
-     this.numComps = 1;
-     this.defaultColor = new Uint8Array(this.numComps);
-     this.base = base;
-     this.highVal = highVal;
-     var baseNumComps = base.numComps;
-     var length = baseNumComps * highVal;
-     if (isStream(lookup)) {
-      this.lookup = new Uint8Array(length);
-      var bytes = lookup.getBytes(length);
-      this.lookup.set(bytes);
-     } else if (isString(lookup)) {
-      this.lookup = new Uint8Array(length);
-      for (var i = 0; i < length; ++i) {
-       this.lookup[i] = lookup.charCodeAt(i);
-      }
-     } else if (lookup instanceof Uint8Array || lookup instanceof Array) {
-      this.lookup = lookup;
-     } else {
-      error('Unrecognized lookup table: ' + lookup);
-     }
-    }
-    IndexedCS.prototype = {
-     getRgb: ColorSpace.prototype.getRgb,
-     getRgbItem: function IndexedCS_getRgbItem(src, srcOffset, dest, destOffset) {
-      var numComps = this.base.numComps;
-      var start = src[srcOffset] * numComps;
-      this.base.getRgbItem(this.lookup, start, dest, destOffset);
-     },
-     getRgbBuffer: function IndexedCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
-      var base = this.base;
-      var numComps = base.numComps;
-      var outputDelta = base.getOutputLength(numComps, alpha01);
-      var lookup = this.lookup;
-      for (var i = 0; i < count; ++i) {
-       var lookupPos = src[srcOffset++] * numComps;
-       base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
-       destOffset += outputDelta;
-      }
-     },
-     getOutputLength: function IndexedCS_getOutputLength(inputLength, alpha01) {
-      return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
-     },
-     isPassthrough: ColorSpace.prototype.isPassthrough,
-     fillRgb: ColorSpace.prototype.fillRgb,
-     isDefaultDecode: function IndexedCS_isDefaultDecode(decodeMap) {
-      return true;
-     },
-     usesZeroToOneRange: true
-    };
-    return IndexedCS;
-   }();
-   var DeviceGrayCS = function DeviceGrayCSClosure() {
-    function DeviceGrayCS() {
-     this.name = 'DeviceGray';
-     this.numComps = 1;
-     this.defaultColor = new Float32Array(this.numComps);
-    }
-    DeviceGrayCS.prototype = {
-     getRgb: ColorSpace.prototype.getRgb,
-     getRgbItem: function DeviceGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
-      var c = src[srcOffset] * 255 | 0;
-      c = c < 0 ? 0 : c > 255 ? 255 : c;
-      dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
-     },
-     getRgbBuffer: function DeviceGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
-      var scale = 255 / ((1 << bits) - 1);
-      var j = srcOffset, q = destOffset;
-      for (var i = 0; i < count; ++i) {
-       var c = scale * src[j++] | 0;
-       dest[q++] = c;
-       dest[q++] = c;
-       dest[q++] = c;
-       q += alpha01;
-      }
-     },
-     getOutputLength: function DeviceGrayCS_getOutputLength(inputLength, alpha01) {
-      return inputLength * (3 + alpha01);
-     },
-     isPassthrough: ColorSpace.prototype.isPassthrough,
-     fillRgb: ColorSpace.prototype.fillRgb,
-     isDefaultDecode: function DeviceGrayCS_isDefaultDecode(decodeMap) {
-      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
-     },
-     usesZeroToOneRange: true
-    };
-    return DeviceGrayCS;
-   }();
-   var DeviceRgbCS = function DeviceRgbCSClosure() {
-    function DeviceRgbCS() {
-     this.name = 'DeviceRGB';
-     this.numComps = 3;
-     this.defaultColor = new Float32Array(this.numComps);
-    }
-    DeviceRgbCS.prototype = {
-     getRgb: ColorSpace.prototype.getRgb,
-     getRgbItem: function DeviceRgbCS_getRgbItem(src, srcOffset, dest, destOffset) {
-      var r = src[srcOffset] * 255 | 0;
-      var g = src[srcOffset + 1] * 255 | 0;
-      var b = src[srcOffset + 2] * 255 | 0;
-      dest[destOffset] = r < 0 ? 0 : r > 255 ? 255 : r;
-      dest[destOffset + 1] = g < 0 ? 0 : g > 255 ? 255 : g;
-      dest[destOffset + 2] = b < 0 ? 0 : b > 255 ? 255 : b;
-     },
-     getRgbBuffer: function DeviceRgbCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
-      if (bits === 8 && alpha01 === 0) {
-       dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
-       return;
-      }
-      var scale = 255 / ((1 << bits) - 1);
-      var j = srcOffset, q = destOffset;
-      for (var i = 0; i < count; ++i) {
-       dest[q++] = scale * src[j++] | 0;
-       dest[q++] = scale * src[j++] | 0;
-       dest[q++] = scale * src[j++] | 0;
-       q += alpha01;
-      }
-     },
-     getOutputLength: function DeviceRgbCS_getOutputLength(inputLength, alpha01) {
-      return inputLength * (3 + alpha01) / 3 | 0;
-     },
-     isPassthrough: function DeviceRgbCS_isPassthrough(bits) {
-      return bits === 8;
-     },
-     fillRgb: ColorSpace.prototype.fillRgb,
-     isDefaultDecode: function DeviceRgbCS_isDefaultDecode(decodeMap) {
-      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
-     },
-     usesZeroToOneRange: true
-    };
-    return DeviceRgbCS;
-   }();
-   var DeviceCmykCS = function DeviceCmykCSClosure() {
-    function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
-     var c = src[srcOffset + 0] * srcScale;
-     var m = src[srcOffset + 1] * srcScale;
-     var y = src[srcOffset + 2] * srcScale;
-     var k = src[srcOffset + 3] * srcScale;
-     var r = c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747) + 255 | 0;
-     var g = c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578) + 255 | 0;
-     var b = c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367) + 255 | 0;
-     dest[destOffset] = r > 255 ? 255 : r < 0 ? 0 : r;
-     dest[destOffset + 1] = g > 255 ? 255 : g < 0 ? 0 : g;
-     dest[destOffset + 2] = b > 255 ? 255 : b < 0 ? 0 : b;
-    }
-    function DeviceCmykCS() {
-     this.name = 'DeviceCMYK';
-     this.numComps = 4;
-     this.defaultColor = new Float32Array(this.numComps);
-     this.defaultColor[3] = 1;
-    }
-    DeviceCmykCS.prototype = {
-     getRgb: ColorSpace.prototype.getRgb,
-     getRgbItem: function DeviceCmykCS_getRgbItem(src, srcOffset, dest, destOffset) {
-      convertToRgb(src, srcOffset, 1, dest, destOffset);
-     },
-     getRgbBuffer: function DeviceCmykCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
-      var scale = 1 / ((1 << bits) - 1);
-      for (var i = 0; i < count; i++) {
-       convertToRgb(src, srcOffset, scale, dest, destOffset);
-       srcOffset += 4;
-       destOffset += 3 + alpha01;
-      }
-     },
-     getOutputLength: function DeviceCmykCS_getOutputLength(inputLength, alpha01) {
-      return inputLength / 4 * (3 + alpha01) | 0;
-     },
-     isPassthrough: ColorSpace.prototype.isPassthrough,
-     fillRgb: ColorSpace.prototype.fillRgb,
-     isDefaultDecode: function DeviceCmykCS_isDefaultDecode(decodeMap) {
-      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
-     },
-     usesZeroToOneRange: true
-    };
-    return DeviceCmykCS;
-   }();
-   var CalGrayCS = function CalGrayCSClosure() {
-    function CalGrayCS(whitePoint, blackPoint, gamma) {
-     this.name = 'CalGray';
-     this.numComps = 1;
-     this.defaultColor = new Float32Array(this.numComps);
-     if (!whitePoint) {
-      error('WhitePoint missing - required for color space CalGray');
-     }
-     blackPoint = blackPoint || [
-      0,
-      0,
-      0
-     ];
-     gamma = gamma || 1;
-     this.XW = whitePoint[0];
-     this.YW = whitePoint[1];
-     this.ZW = whitePoint[2];
-     this.XB = blackPoint[0];
-     this.YB = blackPoint[1];
-     this.ZB = blackPoint[2];
-     this.G = gamma;
-     if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
-      error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
-     }
-     if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
-      info('Invalid BlackPoint for ' + this.name + ', falling back to default');
-      this.XB = this.YB = this.ZB = 0;
-     }
-     if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
-      warn(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB + ', ZB: ' + this.ZB + ', only default values are supported.');
-     }
-     if (this.G < 1) {
-      info('Invalid Gamma: ' + this.G + ' for ' + this.name + ', falling back to default');
-      this.G = 1;
-     }
-    }
-    function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
-     var A = src[srcOffset] * scale;
-     var AG = Math.pow(A, cs.G);
-     var L = cs.YW * AG;
-     var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0) | 0;
-     dest[destOffset] = val;
-     dest[destOffset + 1] = val;
-     dest[destOffset + 2] = val;
-    }
-    CalGrayCS.prototype = {
-     getRgb: ColorSpace.prototype.getRgb,
-     getRgbItem: function CalGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
-      convertToRgb(this, src, srcOffset, dest, destOffset, 1);
-     },
-     getRgbBuffer: function CalGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
-      var scale = 1 / ((1 << bits) - 1);
-      for (var i = 0; i < count; ++i) {
-       convertToRgb(this, src, srcOffset, dest, destOffset, scale);
-       srcOffset += 1;
-       destOffset += 3 + alpha01;
-      }
-     },
-     getOutputLength: function CalGrayCS_getOutputLength(inputLength, alpha01) {
-      return inputLength * (3 + alpha01);
-     },
-     isPassthrough: ColorSpace.prototype.isPassthrough,
-     fillRgb: ColorSpace.prototype.fillRgb,
-     isDefaultDecode: function CalGrayCS_isDefaultDecode(decodeMap) {
-      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
-     },
-     usesZeroToOneRange: true
-    };
-    return CalGrayCS;
-   }();
-   var CalRGBCS = function CalRGBCSClosure() {
-    var BRADFORD_SCALE_MATRIX = new Float32Array([
-     0.8951,
-     0.2664,
-     -0.1614,
-     -0.7502,
-     1.7135,
-     0.0367,
-     0.0389,
-     -0.0685,
-     1.0296
-    ]);
-    var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([
-     0.9869929,
-     -0.1470543,
-     0.1599627,
-     0.4323053,
-     0.5183603,
-     0.0492912,
-     -0.0085287,
-     0.0400428,
-     0.9684867
-    ]);
-    var SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([
-     3.2404542,
-     -1.5371385,
-     -0.4985314,
-     -0.9692660,
-     1.8760108,
-     0.0415560,
-     0.0556434,
-     -0.2040259,
-     1.0572252
-    ]);
-    var FLAT_WHITEPOINT_MATRIX = new Float32Array([
-     1,
-     1,
-     1
-    ]);
-    var tempNormalizeMatrix = new Float32Array(3);
-    var tempConvertMatrix1 = new Float32Array(3);
-    var tempConvertMatrix2 = new Float32Array(3);
-    var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0;
-    function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
-     this.name = 'CalRGB';
-     this.numComps = 3;
-     this.defaultColor = new Float32Array(this.numComps);
-     if (!whitePoint) {
-      error('WhitePoint missing - required for color space CalRGB');
-     }
-     blackPoint = blackPoint || new Float32Array(3);
-     gamma = gamma || new Float32Array([
-      1,
-      1,
-      1
-     ]);
-     matrix = matrix || new Float32Array([
-      1,
-      0,
-      0,
-      0,
-      1,
-      0,
-      0,
-      0,
-      1
-     ]);
-     var XW = whitePoint[0];
-     var YW = whitePoint[1];
-     var ZW = whitePoint[2];
-     this.whitePoint = whitePoint;
-     var XB = blackPoint[0];
-     var YB = blackPoint[1];
-     var ZB = blackPoint[2];
-     this.blackPoint = blackPoint;
-     this.GR = gamma[0];
-     this.GG = gamma[1];
-     this.GB = gamma[2];
-     this.MXA = matrix[0];
-     this.MYA = matrix[1];
-     this.MZA = matrix[2];
-     this.MXB = matrix[3];
-     this.MYB = matrix[4];
-     this.MZB = matrix[5];
-     this.MXC = matrix[6];
-     this.MYC = matrix[7];
-     this.MZC = matrix[8];
-     if (XW < 0 || ZW < 0 || YW !== 1) {
-      error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
-     }
-     if (XB < 0 || YB < 0 || ZB < 0) {
-      info('Invalid BlackPoint for ' + this.name + ' [' + XB + ', ' + YB + ', ' + ZB + '], falling back to default');
-      this.blackPoint = new Float32Array(3);
-     }
-     if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
-      info('Invalid Gamma [' + this.GR + ', ' + this.GG + ', ' + this.GB + '] for ' + this.name + ', falling back to default');
-      this.GR = this.GG = this.GB = 1;
-     }
-     if (this.MXA < 0 || this.MYA < 0 || this.MZA < 0 || this.MXB < 0 || this.MYB < 0 || this.MZB < 0 || this.MXC < 0 || this.MYC < 0 || this.MZC < 0) {
-      info('Invalid Matrix for ' + this.name + ' [' + this.MXA + ', ' + this.MYA + ', ' + this.MZA + this.MXB + ', ' + this.MYB + ', ' + this.MZB + this.MXC + ', ' + this.MYC + ', ' + this.MZC + '], falling back to default');
-      this.MXA = this.MYB = this.MZC = 1;
-      this.MXB = this.MYA = this.MZA = this.MXC = this.MYC = this.MZB = 0;
-     }
-    }
-    function matrixProduct(a, b, result) {
-     result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
-     result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
-     result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
-    }
-    function convertToFlat(sourceWhitePoint, LMS, result) {
-     result[0] = LMS[0] * 1 / sourceWhitePoint[0];
-     result[1] = LMS[1] * 1 / sourceWhitePoint[1];
-     result[2] = LMS[2] * 1 / sourceWhitePoint[2];
-    }
-    function convertToD65(sourceWhitePoint, LMS, result) {
-     var D65X = 0.95047;
-     var D65Y = 1;
-     var D65Z = 1.08883;
-     result[0] = LMS[0] * D65X / sourceWhitePoint[0];
-     result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
-     result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
-    }
-    function sRGBTransferFunction(color) {
-     if (color <= 0.0031308) {
-      return adjustToRange(0, 1, 12.92 * color);
-     }
-     return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055);
-    }
-    function adjustToRange(min, max, value) {
-     return Math.max(min, Math.min(max, value));
-    }
-    function decodeL(L) {
-     if (L < 0) {
-      return -decodeL(-L);
-     }
-     if (L > 8.0) {
-      return Math.pow((L + 16) / 116, 3);
-     }
-     return L * DECODE_L_CONSTANT;
-    }
-    function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
-     if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
-      result[0] = XYZ_Flat[0];
-      result[1] = XYZ_Flat[1];
-      result[2] = XYZ_Flat[2];
-      return;
-     }
-     var zeroDecodeL = decodeL(0);
-     var X_DST = zeroDecodeL;
-     var X_SRC = decodeL(sourceBlackPoint[0]);
-     var Y_DST = zeroDecodeL;
-     var Y_SRC = decodeL(sourceBlackPoint[1]);
-     var Z_DST = zeroDecodeL;
-     var Z_SRC = decodeL(sourceBlackPoint[2]);
-     var X_Scale = (1 - X_DST) / (1 - X_SRC);
-     var X_Offset = 1 - X_Scale;
-     var Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
-     var Y_Offset = 1 - Y_Scale;
-     var Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
-     var Z_Offset = 1 - Z_Scale;
-     result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
-     result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
-     result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
-    }
-    function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
-     if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
-      result[0] = XYZ_In[0];
-      result[1] = XYZ_In[1];
-      result[2] = XYZ_In[2];
-      return;
-     }
-     var LMS = result;
-     matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
-     var LMS_Flat = tempNormalizeMatrix;
-     convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
-     matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
-    }
-    function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
-     var LMS = result;
-     matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
-     var LMS_D65 = tempNormalizeMatrix;
-     convertToD65(sourceWhitePoint, LMS, LMS_D65);
-     matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
-    }
-    function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
-     var A = adjustToRange(0, 1, src[srcOffset] * scale);
-     var B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
-     var C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
-     var AGR = Math.pow(A, cs.GR);
-     var BGG = Math.pow(B, cs.GG);
-     var CGB = Math.pow(C, cs.GB);
-     var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
-     var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
-     var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
-     var XYZ = tempConvertMatrix1;
-     XYZ[0] = X;
-     XYZ[1] = Y;
-     XYZ[2] = Z;
-     var XYZ_Flat = tempConvertMatrix2;
-     normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
-     var XYZ_Black = tempConvertMatrix1;
-     compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
-     var XYZ_D65 = tempConvertMatrix2;
-     normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
-     var SRGB = tempConvertMatrix1;
-     matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
-     var sR = sRGBTransferFunction(SRGB[0]);
-     var sG = sRGBTransferFunction(SRGB[1]);
-     var sB = sRGBTransferFunction(SRGB[2]);
-     dest[destOffset] = Math.round(sR * 255);
-     dest[destOffset + 1] = Math.round(sG * 255);
-     dest[destOffset + 2] = Math.round(sB * 255);
-    }
-    CalRGBCS.prototype = {
-     getRgb: function CalRGBCS_getRgb(src, srcOffset) {
-      var rgb = new Uint8Array(3);
-      this.getRgbItem(src, srcOffset, rgb, 0);
-      return rgb;
-     },
-     getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, dest, destOffset) {
-      convertToRgb(this, src, srcOffset, dest, destOffset, 1);
-     },
-     getRgbBuffer: function CalRGBCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
-      var scale = 1 / ((1 << bits) - 1);
-      for (var i = 0; i < count; ++i) {
-       convertToRgb(this, src, srcOffset, dest, destOffset, scale);
-       srcOffset += 3;
-       destOffset += 3 + alpha01;
-      }
-     },
-     getOutputLength: function CalRGBCS_getOutputLength(inputLength, alpha01) {
-      return inputLength * (3 + alpha01) / 3 | 0;
-     },
-     isPassthrough: ColorSpace.prototype.isPassthrough,
-     fillRgb: ColorSpace.prototype.fillRgb,
-     isDefaultDecode: function CalRGBCS_isDefaultDecode(decodeMap) {
-      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
-     },
-     usesZeroToOneRange: true
-    };
-    return CalRGBCS;
-   }();
-   var LabCS = function LabCSClosure() {
-    function LabCS(whitePoint, blackPoint, range) {
-     this.name = 'Lab';
-     this.numComps = 3;
-     this.defaultColor = new Float32Array(this.numComps);
-     if (!whitePoint) {
-      error('WhitePoint missing - required for color space Lab');
-     }
-     blackPoint = blackPoint || [
-      0,
-      0,
-      0
-     ];
-     range = range || [
-      -100,
-      100,
-      -100,
-      100
-     ];
-     this.XW = whitePoint[0];
-     this.YW = whitePoint[1];
-     this.ZW = whitePoint[2];
-     this.amin = range[0];
-     this.amax = range[1];
-     this.bmin = range[2];
-     this.bmax = range[3];
-     this.XB = blackPoint[0];
-     this.YB = blackPoint[1];
-     this.ZB = blackPoint[2];
-     if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
-      error('Invalid WhitePoint components, no fallback available');
-     }
-     if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
-      info('Invalid BlackPoint, falling back to default');
-      this.XB = this.YB = this.ZB = 0;
-     }
-     if (this.amin > this.amax || this.bmin > this.bmax) {
-      info('Invalid Range, falling back to defaults');
-      this.amin = -100;
-      this.amax = 100;
-      this.bmin = -100;
-      this.bmax = 100;
-     }
-    }
-    function fn_g(x) {
-     var result;
-     if (x >= 6 / 29) {
-      result = x * x * x;
-     } else {
-      result = 108 / 841 * (x - 4 / 29);
-     }
-     return result;
-    }
-    function decode(value, high1, low2, high2) {
-     return low2 + value * (high2 - low2) / high1;
-    }
-    function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
-     var Ls = src[srcOffset];
-     var as = src[srcOffset + 1];
-     var bs = src[srcOffset + 2];
-     if (maxVal !== false) {
-      Ls = decode(Ls, maxVal, 0, 100);
-      as = decode(as, maxVal, cs.amin, cs.amax);
-      bs = decode(bs, maxVal, cs.bmin, cs.bmax);
-     }
-     as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as;
-     bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs;
-     var M = (Ls + 16) / 116;
-     var L = M + as / 500;
-     var N = M - bs / 200;
-     var X = cs.XW * fn_g(L);
-     var Y = cs.YW * fn_g(M);
-     var Z = cs.ZW * fn_g(N);
-     var r, g, b;
-     if (cs.ZW < 1) {
-      r = X * 3.1339 + Y * -1.6170 + Z * -0.4906;
-      g = X * -0.9785 + Y * 1.9160 + Z * 0.0333;
-      b = X * 0.0720 + Y * -0.2290 + Z * 1.4057;
-     } else {
-      r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
-      g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
-      b = X * 0.0557 + Y * -0.2040 + Z * 1.0570;
-     }
-     dest[destOffset] = r <= 0 ? 0 : r >= 1 ? 255 : Math.sqrt(r) * 255 | 0;
-     dest[destOffset + 1] = g <= 0 ? 0 : g >= 1 ? 255 : Math.sqrt(g) * 255 | 0;
-     dest[destOffset + 2] = b <= 0 ? 0 : b >= 1 ? 255 : Math.sqrt(b) * 255 | 0;
-    }
-    LabCS.prototype = {
-     getRgb: ColorSpace.prototype.getRgb,
-     getRgbItem: function LabCS_getRgbItem(src, srcOffset, dest, destOffset) {
-      convertToRgb(this, src, srcOffset, false, dest, destOffset);
-     },
-     getRgbBuffer: function LabCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
-      var maxVal = (1 << bits) - 1;
-      for (var i = 0; i < count; i++) {
-       convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
-       srcOffset += 3;
-       destOffset += 3 + alpha01;
-      }
-     },
-     getOutputLength: function LabCS_getOutputLength(inputLength, alpha01) {
-      return inputLength * (3 + alpha01) / 3 | 0;
-     },
-     isPassthrough: ColorSpace.prototype.isPassthrough,
-     fillRgb: ColorSpace.prototype.fillRgb,
-     isDefaultDecode: function LabCS_isDefaultDecode(decodeMap) {
-      return true;
-     },
-     usesZeroToOneRange: false
-    };
-    return LabCS;
-   }();
-   exports.ColorSpace = ColorSpace;
-  }));
-  (function (root, factory) {
    factory(root.pdfjsCoreImage = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreColorSpace, root.pdfjsCoreStream, root.pdfjsCoreJpx);
   }(this, function (exports, sharedUtil, corePrimitives, coreColorSpace, coreStream, coreJpx) {
    var ImageKind = sharedUtil.ImageKind;
    var assert = sharedUtil.assert;
    var error = sharedUtil.error;
    var info = sharedUtil.info;
    var isArray = sharedUtil.isArray;
    var warn = sharedUtil.warn;
@@ -44183,27 +44185,27 @@
    var info = sharedUtil.info;
    var isArray = sharedUtil.isArray;
    var isNum = sharedUtil.isNum;
    var isString = sharedUtil.isString;
    var getLookupTableFactory = sharedUtil.getLookupTableFactory;
    var warn = sharedUtil.warn;
    var Dict = corePrimitives.Dict;
    var Name = corePrimitives.Name;
+   var isEOF = corePrimitives.isEOF;
    var isCmd = corePrimitives.isCmd;
    var isDict = corePrimitives.isDict;
    var isName = corePrimitives.isName;
    var isRef = corePrimitives.isRef;
    var isStream = corePrimitives.isStream;
    var DecodeStream = coreStream.DecodeStream;
    var JpegStream = coreStream.JpegStream;
    var Stream = coreStream.Stream;
    var Lexer = coreParser.Lexer;
    var Parser = coreParser.Parser;
-   var isEOF = coreParser.isEOF;
    var PDFImage = coreImage.PDFImage;
    var ColorSpace = coreColorSpace.ColorSpace;
    var MurmurHash3_64 = coreMurmurHash3.MurmurHash3_64;
    var ErrorFont = coreFonts.ErrorFont;
    var FontFlags = coreFonts.FontFlags;
    var Font = coreFonts.Font;
    var IdentityToUnicodeMap = coreFonts.IdentityToUnicodeMap;
    var ToUnicodeMap = coreFonts.ToUnicodeMap;
--- a/browser/extensions/pdfjs/content/pdfjschildbootstrap.js
+++ b/browser/extensions/pdfjs/content/pdfjschildbootstrap.js
@@ -9,26 +9,26 @@
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 /* globals Components, PdfjsContentUtils, PdfJs, Services */
 
-'use strict';
+"use strict";
 
 /*
  * pdfjschildbootstrap.js loads into the content process to take care of
  * initializing our built-in version of pdfjs when running remote.
  */
 
-Components.utils.import('resource://gre/modules/Services.jsm');
-Components.utils.import('resource://pdf.js/PdfJs.jsm');
-Components.utils.import('resource://pdf.js/PdfjsContentUtils.jsm');
+Components.utils.import("resource://gre/modules/Services.jsm");
+Components.utils.import("resource://pdf.js/PdfJs.jsm");
+Components.utils.import("resource://pdf.js/PdfjsContentUtils.jsm");
 
 // init content utils shim pdfjs will use to access privileged apis.
 PdfjsContentUtils.init();
 
 if (Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_CONTENT) {
   // register various pdfjs factories that hook us into content loading.
   PdfJs.updateRegistration();
 }
--- a/browser/extensions/pdfjs/content/web/l10n.js
+++ b/browser/extensions/pdfjs/content/web/l10n.js
@@ -1,51 +1,51 @@
-'use strict';
+"use strict";
 
 // Small subset of the webL10n API by Fabien Cazenave for pdf.js extension.
 (function(window) {
-  var gLanguage = '';
+  var gLanguage = "";
   var gExternalLocalizerServices = null;
-  var gReadyState = 'loading';
+  var gReadyState = "loading";
 
   // fetch an l10n objects
   function getL10nData(key) {
     var response = gExternalLocalizerServices.getStrings(key);
     var data = JSON.parse(response);
     if (!data) {
-      console.warn('[l10n] #' + key + ' missing for [' + gLanguage + ']');
+      console.warn("[l10n] #" + key + " missing for [" + gLanguage + "]");
     }
     return data;
   }
 
   // replace {{arguments}} with their values
   function substArguments(text, args) {
     if (!args) {
       return text;
     }
     return text.replace(/\{\{\s*(\w+)\s*\}\}/g, function(all, name) {
-      return (name in args ? args[name] : '{{' + name + '}}');
+      return (name in args ? args[name] : "{{" + name + "}}");
     });
   }
 
   // translate a string
   function translateString(key, args, fallback) {
-    var i = key.lastIndexOf('.');
+    var i = key.lastIndexOf(".");
     var name, property;
     if (i >= 0) {
       name = key.substring(0, i);
       property = key.substring(i + 1);
     } else {
       name = key;
-      property = 'textContent';
+      property = "textContent";
     }
     var data = getL10nData(name);
     var value = (data && data[property]) || fallback;
     if (!value) {
-      return '{{' + key + '}}';
+      return "{{" + key + "}}";
     }
     return substArguments(value, args);
   }
 
   // translate an HTML element
   function translateElement(element) {
     if (!element || !element.dataset) {
       return;
@@ -60,60 +60,60 @@
 
     // get arguments (if any)
     // TODO: more flexible parser?
     var args;
     if (element.dataset.l10nArgs) {
       try {
         args = JSON.parse(element.dataset.l10nArgs);
       } catch (e) {
-        console.warn('[l10n] could not parse arguments for #' + key + '');
+        console.warn("[l10n] could not parse arguments for #" + key + "");
       }
     }
 
     // translate element
     // TODO: security check?
     for (var k in data) {
       element[k] = substArguments(data[k], args);
     }
   }
 
 
   // translate an HTML subtree
   function translateFragment(element) {
-    element = element || document.querySelector('html');
+    element = element || document.querySelector("html");
 
     // check all translatable children (= w/ a `data-l10n-id' attribute)
-    var children = element.querySelectorAll('*[data-l10n-id]');
+    var children = element.querySelectorAll("*[data-l10n-id]");
     var elementCount = children.length;
     for (var i = 0; i < elementCount; i++) {
       translateElement(children[i]);
     }
 
     // translate element itself if necessary
     if (element.dataset.l10nId) {
       translateElement(element);
     }
   }
 
   function translateDocument() {
     gLanguage = gExternalLocalizerServices.getLocale();
 
     translateFragment();
 
-    gReadyState = 'complete';
+    gReadyState = "complete";
 
     // fire a 'localized' DOM event
-    var evtObject = document.createEvent('Event');
-    evtObject.initEvent('localized', false, false);
+    var evtObject = document.createEvent("Event");
+    evtObject.initEvent("localized", false, false);
     evtObject.language = gLanguage;
     window.dispatchEvent(evtObject);
   }
 
-  window.addEventListener('DOMContentLoaded', function() {
+  window.addEventListener("DOMContentLoaded", function() {
     if (gExternalLocalizerServices) {
       translateDocument();
     }
     // ... else see setExternalLocalizerServices below
   });
 
   // Public API
   document.mozL10n = {
@@ -124,34 +124,34 @@
     getLanguage() {
       return gLanguage;
     },
 
     // get the direction (ltr|rtl) of the current language
     getDirection() {
       // http://www.w3.org/International/questions/qa-scripts
       // Arabic, Hebrew, Farsi, Pashto, Urdu
-      var rtlList = ['ar', 'he', 'fa', 'ps', 'ur'];
+      var rtlList = ["ar", "he", "fa", "ps", "ur"];
 
       // use the short language code for "full" codes like 'ar-sa' (issue 5440)
-      var shortCode = gLanguage.split('-')[0];
+      var shortCode = gLanguage.split("-")[0];
 
-      return (rtlList.indexOf(shortCode) >= 0) ? 'rtl' : 'ltr';
+      return (rtlList.indexOf(shortCode) >= 0) ? "rtl" : "ltr";
     },
 
     getReadyState() {
       return gReadyState;
     },
 
     setExternalLocalizerServices(externalLocalizerServices) {
       gExternalLocalizerServices = externalLocalizerServices;
 
       // ... in case if we missed DOMContentLoaded above.
-      if (window.document.readyState === 'interactive' ||
-          window.document.readyState === 'complete') {
+      if (window.document.readyState === "interactive" ||
+          window.document.readyState === "complete") {
         translateDocument();
       }
     },
 
     // translate an element or document fragment
     translate: translateFragment
   };
 })(this);
--- a/browser/extensions/pdfjs/content/web/viewer.js
+++ b/browser/extensions/pdfjs/content/web/viewer.js
@@ -120,17 +120,17 @@ var pdfjsWebLibs;
       document.body.appendChild(this.overlay);
      }
     },
     _endPan: function GrabToPan__endPan() {
      this.element.removeEventListener('scroll', this._endPan, true);
      this.document.removeEventListener('mousemove', this._onmousemove, true);
      this.document.removeEventListener('mouseup', this._endPan, true);
      if (this.overlay.parentNode) {
-      this.overlay.remove();
+      this.overlay.parentNode.removeChild(this.overlay);
      }
     }
    };
    var matchesSelector;
    [
     'webkitM',
     'mozM',
     'msM',
--- a/browser/extensions/shield-recipe-client/bootstrap.js
+++ b/browser/extensions/shield-recipe-client/bootstrap.js
@@ -68,19 +68,19 @@ this.shutdown = function(data, reason) {
 
   CleanupManager.cleanup();
 
   if (reason === REASONS.ADDON_DISABLE || reason === REASONS.ADDON_UNINSTALL) {
     Services.prefs.setBoolPref(PREF_SELF_SUPPORT_ENABLED, true);
   }
 
   const modules = [
-    "data/EventEmitter.js",
     "lib/CleanupManager.jsm",
     "lib/EnvExpressions.jsm",
+    "lib/EventEmitter.jsm",
     "lib/Heartbeat.jsm",
     "lib/LogManager.jsm",
     "lib/NormandyApi.jsm",
     "lib/NormandyDriver.jsm",
     "lib/RecipeRunner.jsm",
     "lib/Sampling.jsm",
     "lib/SandboxManager.jsm",
     "lib/Storage.jsm",
deleted file mode 100644
--- a/browser/extensions/shield-recipe-client/data/EventEmitter.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This file is meant to run inside action sandboxes
-
-"use strict";
-
-
-this.EventEmitter = function(driver) {
-  if (!driver) {
-    throw new Error("driver must be provided");
-  }
-
-  const listeners = {};
-
-  return {
-    emit(eventName, event) {
-      // Fire events async
-      Promise.resolve()
-        .then(() => {
-          if (!(eventName in listeners)) {
-            driver.log(`EventEmitter: Event fired with no listeners: ${eventName}`);
-            return;
-          }
-          // freeze event to prevent handlers from modifying it
-          const frozenEvent = Object.freeze(event);
-          // Clone callbacks array to avoid problems with mutation while iterating
-          const callbacks = Array.from(listeners[eventName]);
-          for (const cb of callbacks) {
-            cb(frozenEvent);
-          }
-        });
-    },
-
-    on(eventName, callback) {
-      if (!(eventName in listeners)) {
-        listeners[eventName] = [];
-      }
-      listeners[eventName].push(callback);
-    },
-
-    off(eventName, callback) {
-      if (eventName in listeners) {
-        const index = listeners[eventName].indexOf(callback);
-        if (index !== -1) {
-          listeners[eventName].splice(index, 1);
-        }
-      }
-    },
-
-    once(eventName, callback) {
-      const inner = event => {
-        callback(event);
-        this.off(eventName, inner);
-      };
-      this.on(eventName, inner);
-    },
-  };
-};
new file mode 100644
--- /dev/null
+++ b/browser/extensions/shield-recipe-client/lib/EventEmitter.jsm
@@ -0,0 +1,65 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+"use strict";
+
+const {utils: Cu} = Components;
+Cu.import("resource://shield-recipe-client/lib/LogManager.jsm");
+
+this.EXPORTED_SYMBOLS = ["EventEmitter"];
+
+const log = LogManager.getLogger("event-emitter");
+
+this.EventEmitter = function(sandboxManager) {
+  const listeners = {};
+
+  return {
+    createSandboxedEmitter() {
+      return sandboxManager.cloneInto({
+        on: this.on.bind(this),
+        off: this.off.bind(this),
+        once: this.once.bind(this),
+      }, {cloneFunctions: true});
+    },
+
+    emit(eventName, event) {
+      // Fire events async
+      Promise.resolve()
+        .then(() => {
+          if (!(eventName in listeners)) {
+            log.info(`EventEmitter: Event fired with no listeners: ${eventName}`);
+            return;
+          }
+          // Clone callbacks array to avoid problems with mutation while iterating
+          const callbacks = Array.from(listeners[eventName]);
+          for (const cb of callbacks) {
+            cb(sandboxManager.cloneInto(event));
+          }
+        });
+    },
+
+    on(eventName, callback) {
+      if (!(eventName in listeners)) {
+        listeners[eventName] = [];
+      }
+      listeners[eventName].push(callback);
+    },
+
+    off(eventName, callback) {
+      if (eventName in listeners) {
+        const index = listeners[eventName].indexOf(callback);
+        if (index !== -1) {
+          listeners[eventName].splice(index, 1);
+        }
+      }
+    },
+
+    once(eventName, callback) {
+      const inner = event => {
+        callback(event);
+        this.off(eventName, inner);
+      };
+      this.on(eventName, inner);
+    },
+  };
+};
--- a/browser/extensions/shield-recipe-client/lib/Heartbeat.jsm
+++ b/browser/extensions/shield-recipe-client/lib/Heartbeat.jsm
@@ -5,33 +5,32 @@
 "use strict";
 
 const {utils: Cu} = Components;
 
 Cu.import("resource://gre/modules/Preferences.jsm");
 Cu.import("resource://gre/modules/TelemetryController.jsm");
 Cu.import("resource://gre/modules/Timer.jsm"); /* globals setTimeout, clearTimeout */
 Cu.import("resource://shield-recipe-client/lib/CleanupManager.jsm");
+Cu.import("resource://shield-recipe-client/lib/EventEmitter.jsm");
 Cu.import("resource://shield-recipe-client/lib/LogManager.jsm");
 
 Cu.importGlobalProperties(["URL"]); /* globals URL */
 
 this.EXPORTED_SYMBOLS = ["Heartbeat"];
 
 const log = LogManager.getLogger("heartbeat");
 const PREF_SURVEY_DURATION = "browser.uitour.surveyDuration";
 const NOTIFICATION_TIME = 3000;
 
 /**
  * Show the Heartbeat UI to request user feedback.
  *
  * @param chromeWindow
  *        The chrome window that the heartbeat notification is displayed in.
- * @param eventEmitter
- *        An EventEmitter instance to report status to.
  * @param sandboxManager
  *        The manager for the sandbox this was called from. Heartbeat will
  *        increment the hold counter on the manager.
  * @param {Object} options Options object.
  * @param {String} options.message
  *        The message, or question, to display on the notification.
  * @param {String} options.thanksMessage
  *        The thank you message to display after user votes.
@@ -51,17 +50,17 @@ const NOTIFICATION_TIME = 3000;
  * @param {Number} [options.surveyVersion]
  *        Survey's version number, reflected in the Telemetry ping.
  * @param {boolean} [options.testing]
  *        Whether this is a test survey, reflected in the Telemetry ping.
  * @param {String} [options.postAnswerURL=null]
  *        The url to visit after the user answers the question.
  */
 this.Heartbeat = class {
-  constructor(chromeWindow, eventEmitter, sandboxManager, options) {
+  constructor(chromeWindow, sandboxManager, options) {
     if (typeof options.flowId !== "string") {
       throw new Error("flowId must be a string");
     }
 
     if (!options.flowId) {
       throw new Error("flowId must not be an empty string");
     }
 
@@ -87,17 +86,17 @@ this.Heartbeat = class {
       try {
         options.learnMoreUrl = new URL(options.learnMoreUrl);
       } catch (e) {
         options.learnMoreUrl = null;
       }
     }
 
     this.chromeWindow = chromeWindow;
-    this.eventEmitter = eventEmitter;
+    this.eventEmitter = new EventEmitter(sandboxManager);
     this.sandboxManager = sandboxManager;
     this.options = options;
     this.surveyResults = {};
     this.buttons = null;
 
     // so event handlers are consistent
     this.handleWindowClosed = this.handleWindowClosed.bind(this);
     this.close = this.close.bind(this);
@@ -256,17 +255,17 @@ this.Heartbeat = class {
         log.error("Unrecognized Heartbeat event:", name);
       },
     };
 
     (phases[name] || phases.default)();
 
     data.timestamp = timestamp;
     data.flowId = this.options.flowId;
-    this.eventEmitter.emit(name, Cu.cloneInto(data, this.sandboxManager.sandbox));
+    this.eventEmitter.emit(name, data);
 
     if (sendPing) {
       // Send the ping to Telemetry
       const payload = Object.assign({version: 1}, this.surveyResults);
       for (const meta of ["surveyId", "surveyVersion", "testing"]) {
         if (this.options.hasOwnProperty(meta)) {
           payload[meta] = this.options[meta];
         }
@@ -274,17 +273,17 @@ this.Heartbeat = class {
 
       log.debug("Sending telemetry");
       TelemetryController.submitExternalPing("heartbeat", payload, {
         addClientId: true,
         addEnvironment: true,
       });
 
       // only for testing
-      this.eventEmitter.emit("TelemetrySent", Cu.cloneInto(payload, this.sandboxManager.sandbox));
+      this.eventEmitter.emit("TelemetrySent", payload);
 
       // Survey is complete, clear out the expiry timer & survey configuration
       this.endTimerIfPresent("surveyEndTimer");
 
       this.pingSent = true;
       this.surveyResults = null;
     }
 
--- a/browser/extensions/shield-recipe-client/lib/NormandyDriver.jsm
+++ b/browser/extensions/shield-recipe-client/lib/NormandyDriver.jsm
@@ -54,21 +54,19 @@ this.NormandyDriver = function(sandboxMa
     showHeartbeat(options) {
       log.info(`Showing heartbeat prompt "${options.message}"`);
       const aWindow = Services.wm.getMostRecentWindow("navigator:browser");
 
       if (!aWindow) {
         return sandbox.Promise.reject(new sandbox.Error("No window to show heartbeat in"));
       }
 
-      const sandboxedDriver = Cu.cloneInto(this, sandbox, {cloneFunctions: true});
-      const ee = new sandbox.EventEmitter(sandboxedDriver).wrappedJSObject;
       const internalOptions = Object.assign({}, options, {testing: this.testing});
-      new Heartbeat(aWindow, ee, sandboxManager, internalOptions);
-      return sandbox.Promise.resolve(ee);
+      const heartbeat = new Heartbeat(aWindow, sandboxManager, internalOptions);
+      return sandbox.Promise.resolve(heartbeat.eventEmitter.createSandboxedEmitter());
     },
 
     saveHeartbeatFlow() {
       // no-op required by spec
     },
 
     client() {
       const appinfo = {
@@ -87,17 +85,21 @@ this.NormandyDriver = function(sandboxMa
             appinfo.searchEngine = Services.search.defaultEngine.identifier;
           }
           resolve();
         });
       });
 
       const pluginsPromise = new Promise(resolve => {
         AddonManager.getAddonsByTypes(["plugin"], plugins => {
-          plugins.forEach(plugin => appinfo.plugins[plugin.name] = plugin);
+          plugins.forEach(plugin => appinfo.plugins[plugin.name] = {
+            name: plugin.name,
+            description: plugin.description,
+            version: plugin.version,
+          });
           resolve();
         });
       });
 
       return new sandbox.Promise(resolve => {
         Promise.all([searchEnginePromise, pluginsPromise]).then(() => {
           resolve(Cu.cloneInto(appinfo, sandbox));
         });
--- a/browser/extensions/shield-recipe-client/lib/RecipeRunner.jsm
+++ b/browser/extensions/shield-recipe-client/lib/RecipeRunner.jsm
@@ -140,50 +140,49 @@ this.RecipeRunner = {
    * @param  {Object} recipe A recipe to execute
    * @param  {Object} extraContext Extra data about the user, see NormandyDriver
    * @param  {String} actionScript The JavaScript for the action to execute.
    * @promise Resolves or rejects when the action has executed or failed.
    */
   executeAction(recipe, extraContext, actionScript) {
     return new Promise((resolve, reject) => {
       const sandboxManager = new SandboxManager();
-      const {sandbox} = sandboxManager;
       const prepScript = `
         function registerAction(name, Action) {
           let a = new Action(sandboxedDriver, sandboxedRecipe);
           a.execute()
             .then(actionFinished)
             .catch(actionFailed);
         };
 
         this.window = this;
         this.registerAction = registerAction;
         this.setTimeout = sandboxedDriver.setTimeout;
         this.clearTimeout = sandboxedDriver.clearTimeout;
       `;
 
       const driver = new NormandyDriver(sandboxManager, extraContext);
-      sandbox.sandboxedDriver = Cu.cloneInto(driver, sandbox, {cloneFunctions: true});
-      sandbox.sandboxedRecipe = Cu.cloneInto(recipe, sandbox);
+      sandboxManager.cloneIntoGlobal("sandboxedDriver", driver, {cloneFunctions: true});
+      sandboxManager.cloneIntoGlobal("sandboxedRecipe", recipe);
 
       // Results are cloned so that they don't become inaccessible when
       // the sandbox they came from is nuked when the hold is removed.
-      sandbox.actionFinished = result => {
+      sandboxManager.addGlobal("actionFinished", result => {
         const clonedResult = Cu.cloneInto(result, {});
         sandboxManager.removeHold("recipeExecution");
         resolve(clonedResult);
-      };
-      sandbox.actionFailed = err => {
+      });
+      sandboxManager.addGlobal("actionFailed", err => {
         Cu.reportError(err);
 
         // Error objects can't be cloned, so we just copy the message
         // (which doesn't need to be cloned) to be somewhat useful.
         const message = err.message;
         sandboxManager.removeHold("recipeExecution");
         reject(new Error(message));
-      };
+      });
 
       sandboxManager.addHold("recipeExecution");
-      Cu.evalInSandbox(prepScript, sandbox);
-      Cu.evalInSandbox(actionScript, sandbox);
+      sandboxManager.evalInSandbox(prepScript);
+      sandboxManager.evalInSandbox(actionScript);
     });
   },
 };
--- a/browser/extensions/shield-recipe-client/lib/SandboxManager.jsm
+++ b/browser/extensions/shield-recipe-client/lib/SandboxManager.jsm
@@ -24,16 +24,34 @@ this.SandboxManager = class {
     const index = this.holds.indexOf(name);
     if (index === -1) {
       throw new Error(`Tried to remove non-existant hold "${name}"`);
     }
     this.holds.splice(index, 1);
     this.tryCleanup();
   }
 
+  cloneInto(value, options = {}) {
+    return Cu.cloneInto(value, this.sandbox, options);
+  }
+
+  cloneIntoGlobal(name, value, options = {}) {
+    const clonedValue = Cu.cloneInto(value, this.sandbox, options);
+    this.addGlobal(name, clonedValue);
+    return clonedValue;
+  }
+
+  addGlobal(name, value) {
+    this.sandbox[name] = value;
+  }
+
+  evalInSandbox(script) {
+    return Cu.evalInSandbox(script, this.sandbox);
+  }
+
   tryCleanup() {
     if (this.holds.length === 0) {
       const sandbox = this._sandbox;
       this._sandbox = null;
       Cu.nukeSandbox(sandbox);
     }
   }
 
@@ -51,13 +69,10 @@ this.SandboxManager = class {
 
 
 function makeSandbox() {
   const sandbox = new Cu.Sandbox(null, {
     wantComponents: false,
     wantGlobalProperties: ["URL", "URLSearchParams"],
   });
 
-  const url = "resource://shield-recipe-client/data/EventEmitter.js";
-  Services.scriptloader.loadSubScript(url, sandbox);
-
   return sandbox;
 }
--- a/browser/extensions/shield-recipe-client/test/.eslintrc.js
+++ b/browser/extensions/shield-recipe-client/test/.eslintrc.js
@@ -5,15 +5,16 @@ module.exports = {
     Assert: false,
     BrowserTestUtils: false,
     add_task: false,
     is: false,
     isnot: false,
     ok: false,
     SpecialPowers: false,
     SimpleTest: false,
+    registerCleanupFunction: false,
   },
   rules: {
     "spaced-comment": 2,
     "space-before-function-paren": 2,
     "require-yield": 0
   }
 };
--- a/browser/extensions/shield-recipe-client/test/browser/browser_EventEmitter.js
+++ b/browser/extensions/shield-recipe-client/test/browser/browser_EventEmitter.js
@@ -1,21 +1,13 @@
 "use strict";
 
 const {utils: Cu} = Components;
-Cu.import("resource://gre/modules/Log.jsm", this);
-Cu.import("resource://shield-recipe-client/lib/NormandyDriver.jsm", this);
-Cu.import("resource://shield-recipe-client/lib/SandboxManager.jsm", this);
-
-const sandboxManager = new SandboxManager();
-sandboxManager.addHold("test running");
-const driver = new NormandyDriver(sandboxManager);
-const sandboxedDriver = Cu.cloneInto(driver, sandboxManager.sandbox, {cloneFunctions: true});
-const eventEmitter = new sandboxManager.sandbox.EventEmitter(sandboxedDriver).wrappedJSObject;
-
+Cu.import("resource://shield-recipe-client/test/browser/Utils.jsm", this);
+Cu.import("resource://shield-recipe-client/lib/EventEmitter.jsm", this);
 
 const evidence = {
   a: 0,
   b: 0,
   c: 0,
   log: "",
 };
 
@@ -29,17 +21,19 @@ function listenerB(x = 1) {
   evidence.log += "b";
 }
 
 function listenerC(x = 1) {
   evidence.c += x;
   evidence.log += "c";
 }
 
-add_task(function* () {
+add_task(Utils.withSandboxManager(Assert, function* (sandboxManager) {
+  const eventEmitter = new EventEmitter(sandboxManager);
+
   // Fire an unrelated event, to make sure nothing goes wrong
   eventEmitter.on("nothing");
 
   // bind listeners
   eventEmitter.on("event", listenerA);
   eventEmitter.on("event", listenerB);
   eventEmitter.once("event", listenerC);
 
@@ -79,14 +73,55 @@ add_task(function* () {
 
   Assert.deepEqual(evidence, {
     a: 111,
     b: 11,
     c: 1,
     log: "abcaba",  // events are in order
   }, "events fired as expected");
 
-  sandboxManager.removeHold("test running");
+  // Test that mutating the data passed to the event doesn't actually
+  // mutate it for other events.
+  let handlerRunCount = 0;
+  const mutationHandler = data => {
+    handlerRunCount++;
+    data.count++;
+    is(data.count, 1, "Event data is not mutated between handlers.");
+  };
+  eventEmitter.on("mutationTest", mutationHandler);
+  eventEmitter.on("mutationTest", mutationHandler);
+
+  const data = {count: 0};
+  eventEmitter.emit("mutationTest", data);
+  yield Promise.resolve();
+
+  is(handlerRunCount, 2, "Mutation handler was executed twice.");
+  is(data.count, 0, "Event data cannot be mutated by handlers.");
+}));
+
+add_task(Utils.withSandboxManager(Assert, function* sandboxedEmitter(sandboxManager) {
+  const eventEmitter = new EventEmitter(sandboxManager);
 
-  yield sandboxManager.isNuked()
-    .then(() => ok(true, "sandbox is nuked"))
-    .catch(e => ok(false, "sandbox is nuked", e));
-});
+  // Event handlers inside the sandbox should be run in response to
+  // events triggered outside the sandbox.
+  sandboxManager.addGlobal("emitter", eventEmitter.createSandboxedEmitter());
+  sandboxManager.evalInSandbox(`
+    this.eventCounts = {on: 0, once: 0};
+    emitter.on("event", value => {
+      this.eventCounts.on += value;
+    });
+    emitter.once("eventOnce", value => {
+      this.eventCounts.once += value;
+    });
+  `);
+
+  eventEmitter.emit("event", 5);
+  eventEmitter.emit("event", 10);
+  eventEmitter.emit("eventOnce", 5);
+  eventEmitter.emit("eventOnce", 10);
+  yield Promise.resolve();
+
+  const eventCounts = sandboxManager.evalInSandbox("this.eventCounts");
+  Assert.deepEqual(eventCounts, {
+    on: 15,
+    once: 5,
+  }, "Events emitted outside a sandbox trigger handlers within a sandbox.");
+}));
--- a/browser/extensions/shield-recipe-client/test/browser/browser_Heartbeat.js
+++ b/browser/extensions/shield-recipe-client/test/browser/browser_Heartbeat.js
@@ -1,16 +1,15 @@
 "use strict";
 
 const {utils: Cu} = Components;
 
 Cu.import("resource://gre/modules/Services.jsm", this);
 Cu.import("resource://shield-recipe-client/lib/Heartbeat.jsm", this);
 Cu.import("resource://shield-recipe-client/lib/SandboxManager.jsm", this);
-Cu.import("resource://shield-recipe-client/lib/NormandyDriver.jsm", this);
 
 /**
  * Assert an array is in non-descending order, and that every element is a number
  */
 function assertOrdered(arr) {
   for (let i = 0; i < arr.length; i++) {
     Assert.equal(typeof arr[i], "number", `element ${i} is type "number"`);
   }
@@ -49,17 +48,17 @@ function closeAllNotifications(targetWin
     observer.observe(notificationBox, {childList: true});
 
     for (const notification of notificationBox.allNotifications) {
       notification.close();
     }
   });
 }
 
-/* Check that the correct telmetry was sent */
+/* Check that the correct telemetry was sent */
 function assertTelemetrySent(hb, eventNames) {
   return new Promise(resolve => {
     hb.eventEmitter.once("TelemetrySent", payload => {
       const events = [0];
       for (const name of eventNames) {
         Assert.equal(typeof payload[name], "number", `payload field ${name} is a number`);
         events.push(payload[name]);
       }
@@ -68,32 +67,29 @@ function assertTelemetrySent(hb, eventNa
       assertOrdered(events);
       resolve();
     });
   });
 }
 
 
 const sandboxManager = new SandboxManager();
-const driver = new NormandyDriver(sandboxManager);
 sandboxManager.addHold("test running");
-const sandboxedDriver = Cu.cloneInto(driver, sandboxManager.sandbox, {cloneFunctions: true});
 
 
 // Several of the behaviors of heartbeat prompt are mutually exclusive, so checks are broken up
 // into three batches.
 
 /* Batch #1 - General UI, Stars, and telemetry data */
 add_task(function* () {
-  const eventEmitter = new sandboxManager.sandbox.EventEmitter(sandboxedDriver).wrappedJSObject;
   const targetWindow = Services.wm.getMostRecentWindow("navigator:browser");
   const notificationBox = targetWindow.document.querySelector("#high-priority-global-notificationbox");
 
   const preCount = notificationBox.childElementCount;
-  const hb = new Heartbeat(targetWindow, eventEmitter, sandboxManager, {
+  const hb = new Heartbeat(targetWindow, sandboxManager, {
     testing: true,
     flowId: "test",
     message: "test",
     engagementButtonLabel: undefined,
     learnMoreMessage: "Learn More",
     learnMoreUrl: "https://example.org/learnmore",
   });
 
@@ -121,20 +117,19 @@ add_task(function* () {
   yield closeAllNotifications(targetWindow, notificationBox);
   yield telemetrySentPromise;
   yield BrowserTestUtils.removeTab(tab);
 });
 
 
 // Batch #2 - Engagement buttons
 add_task(function* () {
-  const eventEmitter = new sandboxManager.sandbox.EventEmitter(sandboxedDriver).wrappedJSObject;
   const targetWindow = Services.wm.getMostRecentWindow("navigator:browser");
   const notificationBox = targetWindow.document.querySelector("#high-priority-global-notificationbox");
-  const hb = new Heartbeat(targetWindow, eventEmitter, sandboxManager, {
+  const hb = new Heartbeat(targetWindow, sandboxManager, {
     testing: true,
     flowId: "test",
     message: "test",
     engagementButtonLabel: "Click me!",
     postAnswerUrl: "https://example.org/postAnswer",
     learnMoreMessage: "Learn More",
     learnMoreUrl: "https://example.org/learnMore",
   });
@@ -157,20 +152,19 @@ add_task(function* () {
   // Close notification to trigger telemetry to be sent
   yield closeAllNotifications(targetWindow, notificationBox);
   yield telemetrySentPromise;
   yield BrowserTestUtils.removeTab(tab);
 });
 
 // Batch 3 - Closing the window while heartbeat is open
 add_task(function* () {
-  const eventEmitter = new sandboxManager.sandbox.EventEmitter(sandboxedDriver).wrappedJSObject;
   const targetWindow = yield BrowserTestUtils.openNewBrowserWindow();
 
-  const hb = new Heartbeat(targetWindow, eventEmitter, sandboxManager, {
+  const hb = new Heartbeat(targetWindow, sandboxManager, {
     testing: true,
     flowId: "test",
     message: "test",
   });
 
   const telemetrySentPromise = assertTelemetrySent(hb, ["offeredTS", "windowClosedTS"]);
   // triggers sending ping to normandy
   yield BrowserTestUtils.closeWindow(targetWindow);
--- a/browser/installer/Makefile.in
+++ b/browser/installer/Makefile.in
@@ -91,18 +91,16 @@ endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 MOZ_PKG_MAC_DSSTORE=branding/dsstore
 MOZ_PKG_MAC_BACKGROUND=branding/background.png
 MOZ_PKG_MAC_ICON=branding/disk.icns
 MOZ_PKG_MAC_EXTRA=--symlink '/Applications:/ '
 endif
 
-INSTALL_SDK = 1
-
 include $(topsrcdir)/toolkit/mozapps/installer/signing.mk
 include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
 
 ifeq (bundle, $(MOZ_FS_LAYOUT))
 BINPATH = $(_BINPATH)
 DEFINES += -DAPPNAME=$(_APPNAME)
 else
 # Every other platform just winds up in dist/bin
--- a/build/automation.py.in
+++ b/build/automation.py.in
@@ -174,26 +174,17 @@ class Automation(object):
                                 shell, cwd, env,
                                 universal_newlines, startupinfo, creationflags)
       self.log = _log
 
     def kill(self):
       if Automation().IS_WIN32:
         import platform
         pid = "%i" % self.pid
-        if platform.release() == "2000":
-          # Windows 2000 needs 'kill.exe' from the 
-          #'Windows 2000 Resource Kit tools'. (See bug 475455.)
-          try:
-            subprocess.Popen(["kill", "-f", pid]).wait()
-          except:
-            self.log.info("TEST-UNEXPECTED-FAIL | automation.py | Missing 'kill' utility to kill process with pid=%s. Kill it manually!", pid)
-        else:
-          # Windows XP and later.
-          subprocess.Popen(["taskkill", "/F", "/PID", pid]).wait()
+        subprocess.Popen(["taskkill", "/F", "/PID", pid]).wait()
       else:
         os.kill(self.pid, signal.SIGKILL)
 
   def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False, dmdPath=None, lsanPath=None):
     if xrePath == None:
       xrePath = self.DIST_BIN
     if env == None:
       env = dict(os.environ)
--- a/build/docs/defining-binaries.rst
+++ b/build/docs/defining-binaries.rst
@@ -292,19 +292,16 @@ needs to be prefixed with ``static:`` in
       USE_LIBS += [
           'static:mylib',
       ]
 
 
 Miscellaneous
 =============
 
-The ``SDK_LIBRARY`` boolean variable defines whether the library in the current
-directory is going to be installed in the SDK.
-
 The ``SONAME`` variable declares a "shared object name" for the library. It
 defaults to the ``Library`` name or the ``SHARED_LIBRARY_NAME`` if set. When
 linking to a library with a ``SONAME``, the resulting library or program will
 have a dependency on the library with the name corresponding to the ``SONAME``
 instead of the ``Library`` name. This only impacts ELF systems.
 
 ::
 
--- a/build/macosx/cross-mozconfig.common
+++ b/build/macosx/cross-mozconfig.common
@@ -2,17 +2,16 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MOZ_AUTOMATION_L10N_CHECK=0
 
 if [ "x$IS_NIGHTLY" = "xyes" ]; then
   # Some nightlies (eg: Mulet) don't want these set.
   MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-1}
-  MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
 fi
 . "$topsrcdir/build/mozconfig.common"
 
 # ld needs libLTO.so from llvm
 mk_add_options "export LD_LIBRARY_PATH=$topsrcdir/clang/lib"
 
 CROSS_CCTOOLS_PATH=$topsrcdir/cctools
 # This SDK was copied from a local XCode install and uploaded to tooltool.
--- a/build/macosx/local-mozconfig.common
+++ b/build/macosx/local-mozconfig.common
@@ -1,17 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 if [ "x$IS_NIGHTLY" = "xyes" ]; then
   # Some nightlies (eg: Mulet) don't want these set.
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-1}
   MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-1}
-  MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
 fi
 . "$topsrcdir/build/mozconfig.common"
 
 if [ -d "$topsrcdir/clang" ]; then
     # mozilla-central based build
     export CC=$topsrcdir/clang/bin/clang
     export CXX=$topsrcdir/clang/bin/clang++
     export LLVMCONFIG=$topsrcdir/clang/bin/llvm-config
--- a/build/moz-automation.mk
+++ b/build/moz-automation.mk
@@ -29,17 +29,16 @@ tier_MOZ_AUTOMATION_PRETTY_INSTALLER = p
 tier_MOZ_AUTOMATION_PACKAGE = package
 tier_MOZ_AUTOMATION_PRETTY_PACKAGE = pretty-package
 tier_MOZ_AUTOMATION_PACKAGE_TESTS = package-tests
 tier_MOZ_AUTOMATION_PRETTY_PACKAGE_TESTS = pretty-package-tests
 tier_MOZ_AUTOMATION_UPDATE_PACKAGING = update-packaging
 tier_MOZ_AUTOMATION_PRETTY_UPDATE_PACKAGING = pretty-update-packaging
 tier_MOZ_AUTOMATION_UPLOAD_SYMBOLS = uploadsymbols
 tier_MOZ_AUTOMATION_UPLOAD = upload
-tier_MOZ_AUTOMATION_SDK = sdk
 
 # Automation build steps. Everything in MOZ_AUTOMATION_TIERS also gets used in
 # TIERS for mach display. As such, the MOZ_AUTOMATION_TIERS are roughly sorted
 # here in the order that they will be executed (since mach doesn't know of the
 # dependencies between them).
 moz_automation_symbols = \
   MOZ_AUTOMATION_PACKAGE_TESTS \
   MOZ_AUTOMATION_PRETTY_PACKAGE_TESTS \
@@ -49,17 +48,16 @@ moz_automation_symbols = \
   MOZ_AUTOMATION_PRETTY_PACKAGE \
   MOZ_AUTOMATION_INSTALLER \
   MOZ_AUTOMATION_PRETTY_INSTALLER \
   MOZ_AUTOMATION_UPDATE_PACKAGING \
   MOZ_AUTOMATION_PRETTY_UPDATE_PACKAGING \
   MOZ_AUTOMATION_L10N_CHECK \
   MOZ_AUTOMATION_PRETTY_L10N_CHECK \
   MOZ_AUTOMATION_UPLOAD \
-  MOZ_AUTOMATION_SDK \
   $(NULL)
 MOZ_AUTOMATION_TIERS := $(foreach sym,$(moz_automation_symbols),$(if $(filter 1,$($(sym))),$(tier_$(sym))))
 
 # Dependencies between automation build steps
 automation/uploadsymbols: automation/buildsymbols
 
 automation/update-packaging: automation/package
 automation/update-packaging: automation/installer
@@ -71,32 +69,30 @@ automation/l10n-check: automation/instal
 automation/pretty-l10n-check: automation/pretty-package
 automation/pretty-l10n-check: automation/pretty-installer
 
 automation/upload: automation/installer
 automation/upload: automation/package
 automation/upload: automation/package-tests
 automation/upload: automation/buildsymbols
 automation/upload: automation/update-packaging
-automation/upload: automation/sdk
 
 # buildsymbols will modify our test binaries, which can interfere with
 # packaging them. A finer-grained dependency can help performance here
 # once bug 1329020 is fixed.
 automation/pretty-package-tests: automation/buildsymbols
 
 # automation/{pretty-}package should depend on build (which is implicit due to
 # the way client.mk invokes automation/build), but buildsymbols changes the
 # binaries/libs, and that's what we package/test.
 automation/pretty-package: automation/buildsymbols
 
-# The installer, sdk and packager all run stage-package, and may conflict
+# The installer and packager all run stage-package, and may conflict
 # with each other.
 automation/installer: automation/package
-automation/sdk: automation/installer automation/package
 
 # The 'pretty' versions of targets run before the regular ones to avoid
 # conflicts in writing to the same files.
 automation/installer: automation/pretty-installer
 automation/package: automation/pretty-package
 automation/package-tests: automation/pretty-package-tests
 automation/l10n-check: automation/pretty-l10n-check
 automation/update-packaging: automation/pretty-update-packaging
--- a/build/mozconfig.automation
+++ b/build/mozconfig.automation
@@ -12,17 +12,16 @@
 mk_add_options "export MOZ_AUTOMATION_BUILD_SYMBOLS=${MOZ_AUTOMATION_BUILD_SYMBOLS-1}"
 mk_add_options "export MOZ_AUTOMATION_L10N_CHECK=${MOZ_AUTOMATION_L10N_CHECK-1}"
 mk_add_options "export MOZ_AUTOMATION_PACKAGE=${MOZ_AUTOMATION_PACKAGE-1}"
 mk_add_options "export MOZ_AUTOMATION_PACKAGE_TESTS=${MOZ_AUTOMATION_PACKAGE_TESTS-1}"
 mk_add_options "export MOZ_AUTOMATION_INSTALLER=${MOZ_AUTOMATION_INSTALLER-0}"
 mk_add_options "export MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-0}"
 mk_add_options "export MOZ_AUTOMATION_UPLOAD=${MOZ_AUTOMATION_UPLOAD-1}"
 mk_add_options "export MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-0}"
-mk_add_options "export MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-0}"
 
 # If we are also building with MOZ_PKG_PRETTYNAMES, set the corresponding
 # stages.
 if test "$MOZ_AUTOMATION_PRETTY" = "1"; then
     mk_add_options "export MOZ_AUTOMATION_PRETTY_PACKAGE=${MOZ_AUTOMATION_PACKAGE-1}"
     mk_add_options "export MOZ_AUTOMATION_PRETTY_PACKAGE_TESTS=${MOZ_AUTOMATION_PACKAGE_TESTS-1}"
     mk_add_options "export MOZ_AUTOMATION_PRETTY_L10N_CHECK=${MOZ_AUTOMATION_L10N_CHECK-1}"
     mk_add_options "export MOZ_AUTOMATION_PRETTY_INSTALLER=${MOZ_AUTOMATION_INSTALLER-0}"
--- a/build/mozconfig.win-common
+++ b/build/mozconfig.win-common
@@ -1,17 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 if [ "x$IS_NIGHTLY" = "xyes" ]; then
   # Some nightlies (eg: Mulet) don't want these set.
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-1}
   MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-1}
-  MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
 fi
 
 # Some builds (eg: Mulet) don't want the installer, so only set this if it
 # hasn't already been set.
 MOZ_AUTOMATION_INSTALLER=${MOZ_AUTOMATION_INSTALLER-1}
 
 export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=c:/builds/crash-stats-api.token
 
--- a/build/unix/moz.build
+++ b/build/unix/moz.build
@@ -8,15 +8,11 @@ if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION'
     DIRS += ['stdc++compat']
 
 if CONFIG['USE_ELF_HACK']:
     DIRS += ['elfhack']
 
 if CONFIG['LLVM_SYMBOLIZER']:
     FINAL_TARGET_FILES += ['/' + CONFIG['LLVM_SYMBOLIZER']]
 
-SDK_FILES.bin += [
-    'run-mozilla.sh',
-]
-
 FINAL_TARGET_FILES += [
     'run-mozilla.sh',
 ]
--- a/build/unix/mozconfig.linux
+++ b/build/unix/mozconfig.linux
@@ -1,13 +1,12 @@
 if [ "x$IS_NIGHTLY" = "xyes" ]; then
   # Some nightlies (eg: Mulet) don't want these set.
   MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-1}
   MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-1}
-  MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
 fi
 
 . "$topsrcdir/build/mozconfig.common"
 
 TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
 
 # some b2g desktop builds still happen on i686 machines, and the tooltool
 # toolchain is x86_64 only.
--- a/config/config.mk
+++ b/config/config.mk
@@ -368,19 +368,16 @@ endif
 endif
 endif
 
 #
 # Name of the binary code directories
 #
 # Override defaults
 
-SDK_LIB_DIR = $(DIST)/sdk/lib
-SDK_BIN_DIR = $(DIST)/sdk/bin
-
 DEPENDENCIES	= .md
 
 ifdef MACOSX_DEPLOYMENT_TARGET
 export MACOSX_DEPLOYMENT_TARGET
 endif # MACOSX_DEPLOYMENT_TARGET
 
 # Export to propagate to cl and submake for third-party code.
 # Eventually, we'll want to just use -I.
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -111,18 +111,18 @@ ifdef REAL_LIBRARY
 ifdef FORCE_SHARED_LIB
 # ... except when we really want one
 ifdef NO_EXPAND_LIBS
 LIBRARY			:= $(REAL_LIBRARY)
 else
 LIBRARY			:= $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
 endif
 else
-# Only build actual library if it is installed in DIST/lib or SDK
-ifeq (,$(SDK_LIBRARY)$(DIST_INSTALL)$(NO_EXPAND_LIBS))
+# Only build actual library if it is installed in DIST/lib
+ifeq (,$(DIST_INSTALL)$(NO_EXPAND_LIBS))
 LIBRARY			:= $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
 else
 ifdef NO_EXPAND_LIBS
 LIBRARY			:= $(REAL_LIBRARY)
 else
 LIBRARY			:= $(REAL_LIBRARY) $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
 endif
 endif
@@ -244,17 +244,16 @@ LIBRARY :=
 SHARED_LIBRARY :=
 IMPORT_LIBRARY :=
 REAL_LIBRARY :=
 PROGRAM :=
 SIMPLE_PROGRAMS :=
 HOST_LIBRARY :=
 HOST_PROGRAM :=
 HOST_SIMPLE_PROGRAMS :=
-SDK_LIBRARY :=
 endif
 
 ALL_TRASH = \
 	$(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
 	$(filter-out $(ASFILES),$(OBJS:.$(OBJ_SUFFIX)=.s)) $(OBJS:.$(OBJ_SUFFIX)=.ii) \
 	$(OBJS:.$(OBJ_SUFFIX)=.i) $(OBJS:.$(OBJ_SUFFIX)=.i_o) \
 	$(HOST_PROGOBJS) $(HOST_OBJS) $(IMPORT_LIBRARY) \
 	$(EXE_DEF_FILE) so_locations _gen _stubs $(wildcard *.res) $(wildcard *.RES) \
@@ -1194,28 +1193,16 @@ PREF_DIR = defaults/pref
 # If DIST_SUBDIR is defined it indicates that app and gre dirs are
 # different and that we are building app related resources. Hence,
 # PREF_DIR should point to the app prefs location.
 ifneq (,$(DIST_SUBDIR)$(XPI_NAME))
 PREF_DIR = defaults/preferences
 endif
 
 ################################################################################
-# SDK
-
-ifneq (,$(SDK_LIBRARY))
-ifndef NO_DIST_INSTALL
-SDK_LIBRARY_FILES := $(SDK_LIBRARY)
-SDK_LIBRARY_DEST := $(SDK_LIB_DIR)
-SDK_LIBRARY_TARGET := target
-INSTALL_TARGETS += SDK_LIBRARY
-endif
-endif # SDK_LIBRARY
-
-################################################################################
 # CHROME PACKAGING
 
 chrome::
 	$(MAKE) realchrome
 	$(LOOP_OVER_DIRS)
 
 $(FINAL_TARGET)/chrome: $(call mkdir_deps,$(FINAL_TARGET)/chrome)
 
--- a/devtools/client/themes/fonts.css
+++ b/devtools/client/themes/fonts.css
@@ -106,16 +106,17 @@
   display: inline;
 }
 
 .font-css-code {
   max-width: 100%;
   overflow: hidden;
   text-overflow: ellipsis;
   padding: 5px;
+  direction: ltr;
 }
 
 .theme-light .font-css-code,
 .theme-light .font-url {
   border: 1px solid #CCC;
   background: white;
 }
 
--- a/docshell/base/crashtests/crashtests.list
+++ b/docshell/base/crashtests/crashtests.list
@@ -5,11 +5,11 @@ load 430124-1.html
 load 430628-1.html
 load 432114-1.html
 load 432114-2.html
 load 436900-1.html
 asserts(0-1) load 436900-2.html # bug 566159
 load 500328-1.html
 load 514779-1.xhtml
 load 614499-1.html
-load 678872-1.html
+asserts-if(stylo,1) load 678872-1.html # bug 1324683
 skip-if(Android) pref(dom.disable_open_during_load,false) load 914521.html
 pref(browser.send_pings,true) load 1257730-1.html
--- a/dom/animation/test/crashtests/crashtests.list
+++ b/dom/animation/test/crashtests/crashtests.list
@@ -1,20 +1,20 @@
 pref(dom.animations-api.core.enabled,true) load 1239889-1.html
-pref(dom.animations-api.core.enabled,true) load 1244595-1.html
+asserts-if(stylo,2) pref(dom.animations-api.core.enabled,true) load 1244595-1.html # bug 1324696
 pref(dom.animations-api.core.enabled,true) load 1216842-1.html # bug 1334036
 pref(dom.animations-api.core.enabled,true) load 1216842-2.html # bug 1334036
 pref(dom.animations-api.core.enabled,true) load 1216842-3.html
 pref(dom.animations-api.core.enabled,true) load 1216842-4.html
 pref(dom.animations-api.core.enabled,true) load 1216842-5.html # bug 1334036
 pref(dom.animations-api.core.enabled,true) load 1216842-6.html # bug 1334036
 skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1272475-1.html # bug 1324693 and bug 1332657
 skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1272475-2.html # bug 1324693 and bug 1332657
 pref(dom.animations-api.core.enabled,true) load 1278485-1.html
-pref(dom.animations-api.core.enabled,true) load 1277272-1.html
+asserts-if(stylo,10) pref(dom.animations-api.core.enabled,true) load 1277272-1.html # bug 1324694
 pref(dom.animations-api.core.enabled,true) load 1290535-1.html
 pref(dom.animations-api.core.enabled,true) load 1304886-1.html
 pref(dom.animations-api.core.enabled,true) load 1322382-1.html
 skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1322291-1.html # bug 1311257
 skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1322291-2.html # bug 1311257 and bug 1311257
 skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1323114-1.html # bug 1324690 and bug 1311257
 skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1323114-2.html # bug 1324690
 skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1325193-1.html # bug 1311257
--- a/dom/base/crashtests/crashtests.list
+++ b/dom/base/crashtests/crashtests.list
@@ -40,24 +40,24 @@ load 366200-1.xhtml
 load 369219-1.xhtml
 load 369413-1.html
 load 371124-1.html
 load 371124-2.html
 load 371466-1.xhtml
 load 372554-1.html
 load 375399-1.html
 load 377360-1.xhtml
-load 377960-1.html
+asserts-if(stylo,3) load 377960-1.html # bug 1324633
 load 377960-2.html
 load 384663-1.html
 load 386000-1.html
 load 386794-1.html
 skip-if(stylo) load 387460-1.html # bug 1323647
-load 395469-1.xhtml
-load 395469-2.xhtml
+asserts-if(stylo,2) load 395469-1.xhtml # bug 1324704
+asserts-if(stylo,3) load 395469-2.xhtml # bug 1324704
 load 398088-1.xul
 skip load 399712-1.html # sporadically times out (bug 473680)
 load 400763-1.html
 skip-if(stylo) load 401993-1.html # bug 1323648
 load 404869-1.xul
 load 407818.html
 load 410860-1.xml
 load 411882-1.xhtml
@@ -74,17 +74,17 @@ load 450383-1.html
 load 450385-1.html
 skip load 458637-1.html # sporadically times out (bug 473680)
 load 462947.html
 load 467392.html
 load 472593-1.html
 load 473284.xul
 load 474041-1.svg
 load 476526.html
-load 483818-1.html
+asserts-if(stylo,1) load 483818-1.html # bug 1324683
 load 490760-1.xhtml
 load 493281-1.html
 load 493281-2.html
 load 494810-1.html
 load 499006-1.html
 load 499006-2.html
 load 502617.html
 load 504224.html
@@ -163,42 +163,42 @@ load 815500.html
 load 816253.html
 load 819014.html
 load 822691.html
 load 822723.html
 load 824719.html
 load 827190.html
 load 828054.html
 load 828903.html
-load 829428.html
-load 830098.html
+asserts-if(stylo,2) load 829428.html # bug 1324669
+asserts-if(stylo,2) load 830098.html # bug 1324669
 load 831287.html
 load 832644.html
 load 836890.html
 load 838489-1.html
 load 838489-2.html
 load 841205.html
 load 844404.html
 load 845093-1.html
 load 845093-2.html
 load 847127.html
 load 849601.html
 load 849727.html
 load 849732.html
-load 851353-1.html
+asserts-if(stylo,17) load 851353-1.html # bug 1324699
 load 852381.html
 load 863950.html
 load 864448.html
 load 886213.html
 load 898906.html
 load 930250.html
 load 942979.html
 load 973401.html
 load 978646.html
-pref(dom.webcomponents.enabled,true) load 1024428-1.html
+asserts-if(stylo,1-11) pref(dom.webcomponents.enabled,true) load 1024428-1.html # bug 1324671
 load 1026714.html
 pref(dom.webcomponents.enabled,true) load 1027461-1.html
 pref(dom.webcomponents.enabled,true) load 1029710.html
 load 1154598.xhtml
 load 1157995.html
 load 1158412.html
 load 1181619.html
 load structured_clone_container_throws.html
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -807,25 +807,27 @@ MaybeWrapNonDOMObjectOrNullValue(JSConte
 }
 
 // If rval is a gcthing and is not in the compartment of cx, wrap rval
 // into the compartment of cx (typically by replacing it with an Xray or
 // cross-compartment wrapper around the original object).
 MOZ_ALWAYS_INLINE bool
 MaybeWrapValue(JSContext* cx, JS::MutableHandle<JS::Value> rval)
 {
-  if (rval.isString()) {
-    return MaybeWrapStringValue(cx, rval);
+  if (rval.isGCThing()) {
+    if (rval.isString()) {
+      return MaybeWrapStringValue(cx, rval);
+    }
+    if (rval.isObject()) {
+      return MaybeWrapObjectValue(cx, rval);
+    }
+    MOZ_ASSERT(rval.isSymbol());
+    JS_MarkCrossZoneId(cx, SYMBOL_TO_JSID(rval.toSymbol()));
   }
-
-  if (!rval.isObject()) {
-    return true;
-  }
-
-  return MaybeWrapObjectValue(cx, rval);
+  return true;
 }
 
 namespace binding_detail {
 enum GetOrCreateReflectorWrapBehavior {
   eWrapIntoContextCompartment,
   eDontWrapIntoContextCompartment
 };
 
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -10950,16 +10950,17 @@ class CGResolveOwnPropertyViaResolve(CGA
             {
               // Since we're dealing with an Xray, do the resolve on the
               // underlying object first.  That gives it a chance to
               // define properties on the actual object as needed, and
               // then use the fact that it created the objects as a flag
               // to avoid re-resolving the properties if someone deletes
               // them.
               JSAutoCompartment ac(cx, obj);
+              JS_MarkCrossZoneId(cx, id);
               JS::Rooted<JS::PropertyDescriptor> objDesc(cx);
               if (!self->DoResolve(cx, obj, id, &objDesc)) {
                 return false;
               }
               // If desc.value() is undefined, then the DoResolve call
               // has already defined the property on the object.  Don't
               // try to also define it.
               if (objDesc.object() &&
--- a/dom/canvas/crashtests/crashtests.list
+++ b/dom/canvas/crashtests/crashtests.list
@@ -1,42 +1,42 @@
-load 0px-size-font-667225.html
-load 0px-size-font-shadow.html
+asserts-if(stylo,1) load 0px-size-font-667225.html # bug 1324700
+asserts-if(stylo,1) load 0px-size-font-shadow.html # bug 1324700
 load 360293-1.html
 load 421715-1.html
 load 553938-1.html
 load 647480.html
 load 727547.html
 load 729116.html
-load 745699-1.html
+asserts-if(stylo,1) load 745699-1.html # bug 1324700
 load 746813-1.html
 load 743499-negative-size.html
 skip-if(Android) load 745818-large-source.html # Bug XXX - Crashes Android mid-run w/o a stack
 load 767337-1.html
-skip-if(Android) load 780392-1.html
+asserts-if(stylo,1) skip-if(Android) load 780392-1.html # bug 1324700
 skip-if(Android) skip-if(gtkWidget&&isDebugBuild) load 789933-1.html # bug 1155252 for linux
 load 794463-1.html
 load 802926-1.html
 load 896047-1.html
 load 916128-1.html
 load 934939-1.html
-load 1099143-1.html
+asserts-if(stylo,1) load 1099143-1.html # bug 1324700
 load 1161277-1.html
 load 1183363.html
-load 1190705.html
-load 1223740-1.html
-load 1225381-1.html
+asserts-if(stylo,1) load 1190705.html # bug 1324700
+asserts-if(stylo,1) load 1223740-1.html # bug 1324700
+asserts-if(stylo,1) load 1225381-1.html # bug 1324700
 skip-if(azureCairo) load 1229983-1.html
-load 1229932-1.html
+asserts-if(stylo,1) load 1229932-1.html # bug 1324700
 load 1244850-1.html
 load 1246775-1.html
-load 1284356-1.html
+asserts-if(stylo,1) load 1284356-1.html # bug 1324700
 load 1284578-1.html
 skip-if(d2d) load 1287515-1.html
-load 1287652-1.html
-load 1288872-1.html
+asserts-if(stylo,1) load 1287652-1.html # bug 1324700
+asserts-if(stylo,1) load 1288872-1.html # bug 1324700
 load 1290628-1.html
-load 1283113-1.html
+asserts-if(stylo,1) load 1283113-1.html # bug 1324700
 load 1286458-1.html
 load 1299062-1.html
 load 1305312-1.html
 load 1298576-1.html
 
--- a/dom/canvas/test/reftest/filters/reftest-stylo.list
+++ b/dom/canvas/test/reftest/filters/reftest-stylo.list
@@ -1,31 +1,31 @@
 # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
 default-preferences pref(canvas.filters.enabled,true)
 
-== default-color.html default-color.html
+fails == default-color.html default-color.html
 # == drop-shadow.html drop-shadow.html
-== drop-shadow-transformed.html drop-shadow-transformed.html
-== global-alpha.html global-alpha.html
-== global-composite-operation.html global-composite-operation.html
-== liveness.html liveness.html
-== multiple-drop-shadows.html multiple-drop-shadows.html
-== shadow.html shadow.html
-== subregion-fill-paint.html subregion-fill-paint.html
-== subregion-stroke-paint.html subregion-stroke-paint.html
-== svg-bbox.html svg-bbox.html
-== svg-inline.html svg-inline.html
-== svg-liveness.html svg-liveness.html
-== svg-off-screen.html svg-off-screen.html
-== units.html units.html
-== units-em.html units-em.html
-== units-ex.html units-ex.html
-== units-off-screen.html units-off-screen.html
-== fillText-with-filter-opacity-1.html fillText-with-filter-opacity-1.html
-== fillText-with-filter-opacity-2.html fillText-with-filter-opacity-2.html
-== strokeText-with-filter-grayscale-1.html strokeText-with-filter-grayscale-1.html
-== strokeText-with-filter-grayscale-2.html strokeText-with-filter-grayscale-2.html
-== fillText-with-shadow-1.html fillText-with-shadow-1.html
-== fillText-with-shadow-2.html fillText-with-shadow-2.html
-== fillText-with-filter-grayscale-1.html fillText-with-filter-grayscale-1.html
-== fillText-with-filter-grayscale-2.html fillText-with-filter-grayscale-2.html
-== strokeText-with-shadow-1.html strokeText-with-shadow-1.html
-== strokeText-with-shadow-2.html strokeText-with-shadow-2.html
+fails == drop-shadow-transformed.html drop-shadow-transformed.html
+fails == global-alpha.html global-alpha.html
+fails == global-composite-operation.html global-composite-operation.html
+fails == liveness.html liveness.html
+fails == multiple-drop-shadows.html multiple-drop-shadows.html
+fails == shadow.html shadow.html
+fails == subregion-fill-paint.html subregion-fill-paint.html
+fails == subregion-stroke-paint.html subregion-stroke-paint.html
+fails == svg-bbox.html svg-bbox.html
+fails == svg-inline.html svg-inline.html
+fails == svg-liveness.html svg-liveness.html
+fails == svg-off-screen.html svg-off-screen.html
+fails == units.html units.html
+fails == units-em.html units-em.html
+fails == units-ex.html units-ex.html
+fails == units-off-screen.html units-off-screen.html
+fails == fillText-with-filter-opacity-1.html fillText-with-filter-opacity-1.html
+fails == fillText-with-filter-opacity-2.html fillText-with-filter-opacity-2.html
+fails == strokeText-with-filter-grayscale-1.html strokeText-with-filter-grayscale-1.html
+fails == strokeText-with-filter-grayscale-2.html strokeText-with-filter-grayscale-2.html
+fails == fillText-with-shadow-1.html fillText-with-shadow-1.html
+fails == fillText-with-shadow-2.html fillText-with-shadow-2.html
+fails == fillText-with-filter-grayscale-1.html fillText-with-filter-grayscale-1.html
+fails == fillText-with-filter-grayscale-2.html fillText-with-filter-grayscale-2.html
+fails == strokeText-with-shadow-1.html strokeText-with-shadow-1.html
+fails == strokeText-with-shadow-2.html strokeText-with-shadow-2.html
--- a/dom/canvas/test/reftest/reftest-stylo.list
+++ b/dom/canvas/test/reftest/reftest-stylo.list
@@ -13,17 +13,17 @@ skip-if(Android) == webgl-clear-test.htm
 pref(webgl.force-layers-readback,true) skip-if(Android) == webgl-clear-test.html?readback webgl-clear-test.html?readback
 
 # Make sure that our choice of attribs doesn't break rendering.
 skip-if(Android) == webgl-clear-test.html?depth webgl-clear-test.html?depth
 skip-if(Android) == webgl-clear-test.html?stencil webgl-clear-test.html?stencil
 skip-if(Android) == webgl-clear-test.html?depth&stencil webgl-clear-test.html?depth&stencil
 
 # Check that resize works:
-== webgl-resize-test.html webgl-resize-test.html
+fails == webgl-resize-test.html webgl-resize-test.html
 
 # Check that captureStream() displays in a local video element
 skip-if(Android) == webgl-capturestream-test.html?preserve webgl-capturestream-test.html?preserve
 
 # Some of the failure conditions are a little crazy. I'm (jgilbert) setting these based on
 # failures encountered when running on Try, and then targetting the Try config by
 # differences in the `sandbox` contents. That is, I'm labeling based on symptoms rather
 # than cause.
@@ -150,25 +150,25 @@ skip-if(!winWidget) pref(webgl.disable-a
 # Do we correctly handle multiple clip paths?
 == clip-multiple-paths.html clip-multiple-paths.html
 
 # Bug 1255062
 == clip-multiple-move-1.html clip-multiple-move-1.html
 == clip-multiple-move-2.html clip-multiple-move-2.html
 
 # Bug 815648
-== stroketext-shadow.html stroketext-shadow.html
+fails == stroketext-shadow.html stroketext-shadow.html
 
 # focus rings
 pref(canvas.focusring.enabled,true) skip-if(cocoaWidget) skip-if(winWidget) needs-focus == drawFocusIfNeeded.html drawFocusIfNeeded.html
 pref(canvas.customfocusring.enabled,true) skip-if(Android||cocoaWidget||winWidget) fuzzy-if(gtkWidget,64,410) needs-focus == drawCustomFocusRing.html drawCustomFocusRing.html
 
 # Check that captureStream() displays in a local video element
 == capturestream.html capturestream.html
 
-== 1177726-text-stroke-bounds.html 1177726-text-stroke-bounds.html
+fails == 1177726-text-stroke-bounds.html 1177726-text-stroke-bounds.html
 
 # Canvas Filter Reftests
 include filters/reftest-stylo.list
 
 # Bug 1305963
 == mozCurrentTransform.html mozCurrentTransform.html
 == mozCurrentTransformInverse.html mozCurrentTransformInverse.html
--- a/dom/encoding/test/reftest/reftest-stylo.list
+++ b/dom/encoding/test/reftest/reftest-stylo.list
@@ -1,6 +1,6 @@
 # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
 # == bug863728-1.html bug863728-1.html
-== bug863728-2.html bug863728-2.html
+fails == bug863728-2.html bug863728-2.html
 == bug863728-3.html bug863728-3.html
 # == bug945215-1.html bug945215-1.html
-== bug945215-2.html bug945215-2.html
+fails == bug945215-2.html bug945215-2.html
--- a/dom/html/crashtests/crashtests.list
+++ b/dom/html/crashtests/crashtests.list
@@ -4,17 +4,17 @@ load 285166-1.html
 load 294235-1.html
 load 307616-1.html
 load 324918-1.xhtml
 load 338649-1.xhtml
 load 339501-1.xhtml
 load 339501-2.xhtml
 load 378993-1.xhtml
 load 382568-1.html
-load 383137.xhtml
+asserts-if(stylo,1) load 383137.xhtml # bug 1324704
 load 388183-1.html
 skip-if(stylo) load 395340-1.html # bug 1323652
 load 399694-1.html
 load 407053.html
 load 423371-1.html
 load 448564.html
 load 451123-1.html
 load 453406-1.html
@@ -46,29 +46,29 @@ load 614988-1.html
 load 620078-1.html
 load 620078-2.html
 load 631421.html
 load 673853.html
 load 680922-1.xul
 load 682058.xhtml
 load 682460.html
 load 738744.xhtml
-load 741218.json
+asserts-if(stylo,6-30) load 741218.json # bug 1324634
 load 741250.xhtml
 load 795221-1.html
-load 795221-2.html
+asserts-if(stylo,1) load 795221-2.html # bug 1324702
 load 795221-3.html
-load 795221-4.html
+asserts-if(stylo,2) load 795221-4.html # bug 1324669
 load 795221-5.xml
 load 811226.html
 load 819745.html
 load 828180.html
 pref(dom.experimental_forms,true) load 828472.html
 load 837033.html
-load 838256-1.html
+asserts-if(stylo,3) load 838256-1.html # bug 1324671
 load 862084.html
 load 865147.html
 load 877910.html
 load 903106.html
 load 916322-1.html
 load 916322-2.html
 load 1032654.html
 load 1141260.html
--- a/dom/html/reftests/autofocus/reftest-stylo.list
+++ b/dom/html/reftests/autofocus/reftest-stylo.list
@@ -1,15 +1,15 @@
 # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
 default-preferences pref(dom.forms.number,true) pref(dom.forms.datetime,true)
-== input-load.html input-load.html
-== input-create.html input-create.html
+fails == input-load.html input-load.html
+fails == input-create.html input-create.html
 # fuzzy-if(skiaContent,1,3) needs-focus == input-number.html input-number.html
-== input-time.html input-time.html
-== button-load.html button-load.html
-== button-create.html button-create.html
-== textarea-load.html textarea-load.html
-== textarea-create.html textarea-create.html
-== select-load.html select-load.html
-== select-create.html select-create.html
-needs-focus == autofocus-after-load.html autofocus-after-load.html
-== autofocus-leaves-iframe.html autofocus-leaves-iframe.html
-== autofocus-after-body-focus.html autofocus-after-body-focus.html
+fails == input-time.html input-time.html
+fails == button-load.html button-load.html
+fails == button-create.html button-create.html
+fails == textarea-load.html textarea-load.html
+fails == textarea-create.html textarea-create.html
+fails == select-load.html select-load.html
+fails == select-create.html select-create.html
+fails needs-focus == autofocus-after-load.html autofocus-after-load.html
+fails == autofocus-leaves-iframe.html autofocus-leaves-iframe.html
+fails == autofocus-after-body-focus.html autofocus-after-body-focus.html
--- a/dom/html/reftests/reftest-stylo.list
+++ b/dom/html/reftests/reftest-stylo.list
@@ -1,64 +1,64 @@
 # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
 # autofocus attribute (we can't test with mochitests)
 include autofocus/reftest-stylo.list
 include toblob-todataurl/reftest-stylo.list
 
-== 41464-1a.html 41464-1a.html
-== 41464-1b.html 41464-1b.html
-== 52019-1.html 52019-1.html
-== 82711-1.html 82711-1.html
-== 82711-2.html 82711-2.html
+fails == 41464-1a.html 41464-1a.html
+fails == 41464-1b.html 41464-1b.html
+fails == 52019-1.html 52019-1.html
+fails == 82711-1.html 82711-1.html
+fails == 82711-2.html 82711-2.html
 # == 82711-1-ref.html 82711-1-ref.html
 == 468263-1a.html 468263-1a.html
 == 468263-1b.html 468263-1b.html
 == 468263-1c.html 468263-1c.html
 # == 468263-1d.html 468263-1d.html
 # == 468263-2.html 468263-2.html
 # == 468263-2.html 468263-2.html
-== 484200-1.html 484200-1.html
+fails == 484200-1.html 484200-1.html
 # == 485377.html 485377.html
 == 557840.html 557840.html
 == 560059-video-dimensions.html 560059-video-dimensions.html
-== 573322-quirks.html 573322-quirks.html
-== 573322-no-quirks.html 573322-no-quirks.html
-== 596455-1a.html 596455-1a.html
-== 596455-1b.html 596455-1b.html
-== 596455-2a.html 596455-2a.html
-== 596455-2b.html 596455-2b.html
-== 610935.html 610935.html
+fails == 573322-quirks.html 573322-quirks.html
+fails == 573322-no-quirks.html 573322-no-quirks.html
+fails == 596455-1a.html 596455-1a.html
+fails == 596455-1b.html 596455-1b.html
+fails == 596455-2a.html 596455-2a.html
+fails == 596455-2b.html 596455-2b.html
+fails == 610935.html 610935.html
 == 649134-1.html 649134-1.html
 # == 649134-2.html 649134-2.html
-== 741776-1.vtt 741776-1.vtt
+fails == 741776-1.vtt 741776-1.vtt
 
 # == bug448564-1_malformed.html bug448564-1_malformed.html
 # == bug448564-1_malformed.html bug448564-1_malformed.html
 
 # == bug448564-4a.html bug448564-4a.html
 # == bug502168-1_malformed.html bug502168-1_malformed.html
 
 # == responsive-image-load-shortcircuit.html responsive-image-load-shortcircuit.html
 == image-load-shortcircuit-1.html image-load-shortcircuit-1.html
 == image-load-shortcircuit-2.html image-load-shortcircuit-2.html
 
 # Test that image documents taken into account CSS properties like
 # image-orientation when determining the size of the image.
 # (Fuzzy necessary due to pixel-wise comparison of different JPEGs.
 # The vast majority of the fuzziness comes from Linux and WinXP.)
 # == bug917595-iframe-1.html bug917595-iframe-1.html
-== bug917595-exif-rotated.jpg bug917595-exif-rotated.jpg
+fails == bug917595-exif-rotated.jpg bug917595-exif-rotated.jpg
 
 # Test support for SVG-as-image in <picture> elements.
 == bug1106522-1.html bug1106522-1.html
 == bug1106522-2.html bug1106522-2.html
 
-== href-attr-change-restyles.html href-attr-change-restyles.html
+fails == href-attr-change-restyles.html href-attr-change-restyles.html
 # == figure.html figure.html
-== pre-1.html pre-1.html
+fails == pre-1.html pre-1.html
 # == table-border-1.html table-border-1.html
 # == table-border-2.html table-border-2.html
 # == table-border-2.html table-border-2.html
 
 # Test imageset is using permissions.default.image
 # pref(permissions.default.image,1) HTTP == bug1196784-with-srcset.html bug1196784-with-srcset.html
 # pref(permissions.default.image,2) HTTP == bug1196784-with-srcset.html bug1196784-with-srcset.html
 
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -2576,16 +2576,26 @@ TabChild::InitRenderingState(const Textu
       NS_WARNING("failed to get CompositorBridgeChild instance");
       return;
     }
 
     CompositorOptions options;
     Unused << compositorChild->SendGetCompositorOptions(aLayersId, &options);
     mCompositorOptions = Some(options);
 
+    mRemoteFrame = static_cast<RenderFrameChild*>(aRenderFrame);
+    if (aLayersId != 0) {
+      if (!sTabChildren) {
+        sTabChildren = new TabChildMap;
+      }
+      MOZ_ASSERT(!sTabChildren->Get(aLayersId));
+      sTabChildren->Put(aLayersId, this);
+      mLayersId = aLayersId;
+    }
+
     ShadowLayerForwarder* lf =
         mPuppetWidget->GetLayerManager(
             nullptr, mTextureFactoryIdentifier.mParentBackend)
                 ->AsShadowForwarder();
     // As long as we are creating a ClientLayerManager for the puppet widget,
     // lf must be non-null here.
     MOZ_ASSERT(lf);
 
@@ -2596,31 +2606,20 @@ TabChild::InitRenderingState(const Textu
       PLayerTransactionChild* shadowManager =
           compositorChild->SendPLayerTransactionConstructor(backends,
                                                             aLayersId, &mTextureFactoryIdentifier, &success);
       if (shadowManager && success) {
         lf->SetShadowManager(shadowManager);
         lf->IdentifyTextureHost(mTextureFactoryIdentifier);
         ImageBridgeChild::IdentifyCompositorTextureHost(mTextureFactoryIdentifier);
         gfx::VRManagerChild::IdentifyTextureHost(mTextureFactoryIdentifier);
+        InitAPZState();
       }
     }
 
-    mRemoteFrame = static_cast<RenderFrameChild*>(aRenderFrame);
-    if (aLayersId != 0) {
-      if (!sTabChildren) {
-        sTabChildren = new TabChildMap;
-      }
-      MOZ_ASSERT(!sTabChildren->Get(aLayersId));
-      sTabChildren->Put(aLayersId, this);
-      mLayersId = aLayersId;
-    }
-
-    InitAPZState();
-
     nsCOMPtr<nsIObserverService> observerService =
         mozilla::services::GetObserverService();
 
     if (observerService) {
         observerService->AddObserver(this,
                                      BEFORE_FIRST_PAINT,
                                      false);
     }
--- a/dom/jsurl/crashtests/crashtests.list
+++ b/dom/jsurl/crashtests/crashtests.list
@@ -1,6 +1,6 @@
 load 341963-1.html
 load 344874-1.html
 load 344996-1.xhtml
-load 457050-1.html
+asserts-if(stylo,4) load 457050-1.html # bug 1324634
 load 1018583.html
 load 1180389.html
--- a/dom/media/encoder/TrackEncoder.cpp
+++ b/dom/media/encoder/TrackEncoder.cpp
@@ -3,24 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 #include "TrackEncoder.h"
 #include "AudioChannelFormat.h"
 #include "MediaStreamGraph.h"
 #include "MediaStreamListener.h"
 #include "mozilla/Logging.h"
 #include "VideoUtils.h"
-
-#undef LOG
-#ifdef MOZ_WIDGET_GONK
-#include <android/log.h>
-#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args);
-#else
-#define LOG(args, ...)
-#endif
+#include "mozilla/Logging.h"
 
 namespace mozilla {
 
 LazyLogModule gTrackEncoderLog("TrackEncoder");
 #define TRACK_LOG(type, msg) MOZ_LOG(gTrackEncoderLog, type, msg)
 
 static const int DEFAULT_CHANNELS = 1;
 static const int DEFAULT_SAMPLING_RATE = 16000;
@@ -73,42 +66,42 @@ AudioTrackEncoder::NotifyQueuedTrackChan
     while (!iter.IsEnded()) {
       AudioChunk chunk = *iter;
 
       // The number of channels is determined by the first non-null chunk, and
       // thus the audio encoder is initialized at this time.
       if (!chunk.IsNull()) {
         nsresult rv = Init(chunk.mChannelData.Length(), aGraph->GraphRate());
         if (NS_FAILED(rv)) {
-          LOG("[AudioTrackEncoder]: Fail to initialize the encoder!");
+          TRACK_LOG(LogLevel::Error, ("[AudioTrackEncoder]: Fail to initialize the encoder!"));
           NotifyCancel();
         }
         break;
       }
 
       iter.Next();
     }
 
     mNotInitDuration += aQueuedMedia.GetDuration();
     if (!mInitialized &&
         (mNotInitDuration / aGraph->GraphRate() > INIT_FAILED_DURATION) &&
         mInitCounter > 1) {
-      LOG("[AudioTrackEncoder]: Initialize failed for 30s.");
+      TRACK_LOG(LogLevel::Warning, ("[AudioTrackEncoder]: Initialize failed for 30s."));
       NotifyEndOfStream();
       return;
     }
   }
 
   // Append and consume this raw segment.
   AppendAudioSegment(audio);
 
 
   // The stream has stopped and reached the end of track.
   if (aTrackEvents == TrackEventCommand::TRACK_EVENT_ENDED) {
-    LOG("[AudioTrackEncoder]: Receive TRACK_EVENT_ENDED .");
+    TRACK_LOG(LogLevel::Info, ("[AudioTrackEncoder]: Receive TRACK_EVENT_ENDED ."));
     NotifyEndOfStream();
   }
 }
 
 void
 AudioTrackEncoder::NotifyEndOfStream()
 {
   ReentrantMonitorAutoEnter mon(mReentrantMonitor);
@@ -211,29 +204,29 @@ VideoTrackEncoder::Init(const VideoSegme
    VideoChunk chunk = *iter;
    if (!chunk.IsNull()) {
      gfx::IntSize imgsize = chunk.mFrame.GetImage()->GetSize();
      gfx::IntSize intrinsicSize = chunk.mFrame.GetIntrinsicSize();
      nsresult rv = Init(imgsize.width, imgsize.height,
                         intrinsicSize.width, intrinsicSize.height);
 
      if (NS_FAILED(rv)) {
-       LOG("[VideoTrackEncoder]: Fail to initialize the encoder!");
+       TRACK_LOG(LogLevel::Error, ("[VideoTrackEncoder]: Fail to initialize the encoder!"));
        NotifyCancel();
      }
      break;
    }
 
    iter.Next();
   }
 
   mNotInitDuration += aSegment.GetDuration();
   if ((mNotInitDuration / mTrackRate > INIT_FAILED_DURATION) &&
       mInitCounter > 1) {
-    LOG("[VideoTrackEncoder]: Initialize failed for %ds.", INIT_FAILED_DURATION);
+    TRACK_LOG(LogLevel::Debug, ("[VideoTrackEncoder]: Initialize failed for %ds.", INIT_FAILED_DURATION));
     NotifyEndOfStream();
     return;
   }
 }
 
 void
 VideoTrackEncoder::SetCurrentFrames(const VideoSegment& aSegment)
 {
@@ -269,17 +262,17 @@ VideoTrackEncoder::NotifyQueuedTrackChan
 
    // Check and initialize parameters for codec encoder.
   Init(video);
 
   AppendVideoSegment(video);
 
   // The stream has stopped and reached the end of track.
   if (aTrackEvents == TrackEventCommand::TRACK_EVENT_ENDED) {
-    LOG("[VideoTrackEncoder]: Receive TRACK_EVENT_ENDED .");
+    TRACK_LOG(LogLevel::Info, ("[VideoTrackEncoder]: Receive TRACK_EVENT_ENDED ."));
     NotifyEndOfStream();
   }
 
 }
 
 nsresult
 VideoTrackEncoder::AppendVideoSegment(const VideoSegment& aSegment)
 {
--- a/dom/media/test/crashtests/crashtests.list
+++ b/dom/media/test/crashtests/crashtests.list
@@ -1,15 +1,15 @@
 load 0-timescale.html # bug 1229166
 skip-if(Android) load 459439-1.html # bug 888557
 load 466607-1.html
 load 466945-1.html
 load 468763-1.html
 load 474744-1.html
-HTTP load 481136-1.html # needs to be HTTP to recognize the ogg as an audio file?
+asserts-if(stylo,8) HTTP load 481136-1.html # bug 1324671 # needs to be HTTP to recognize the ogg as an audio file?
 load 492286-1.xhtml
 load 493915-1.html
 load 495794-1.html
 load 576612-1.html
 load 752784-1.html
 load 789075-1.html
 HTTP load 795892-1.html
 load 844563.html
@@ -66,17 +66,17 @@ load 944851.html
 load 952756.html
 load 966636.html
 load 986901.html
 load 990794.html
 load 995289.html
 load 1012609.html
 load 1015662.html
 load 1020205.html
-skip-if(Android) test-pref(media.navigator.permission.disabled,true) load 1028458.html # bug 1048863
+asserts-if(stylo,8) skip-if(Android) test-pref(media.navigator.permission.disabled,true) load 1028458.html # bug 1324671 # bug 1048863
 load 1041466.html
 load 1045650.html
 load 1080986.html
 load 1122218.html
 load 1127188.html
 load 1157994.html
 load 1158427.html
 load 1185176.html
--- a/dom/media/tests/crashtests/crashtests.list
+++ b/dom/media/tests/crashtests/crashtests.list
@@ -1,16 +1,16 @@
 default-preferences  pref(media.peerconnection.enabled,true) pref(media.navigator.permission.disabled,true)
 
 load 780790.html
 load 791270.html
 load 791278.html
 load 791330.html
-load 799419.html
+asserts-if(stylo,16) load 799419.html # bug 1324671
 load 802982.html
-load 812785.html
+asserts-if(stylo,48) load 812785.html # bug 1324671
 load 834100.html
 load 836349.html
 load 837324.html
 load 855796.html
 load 860143.html
 load 861958.html
 load 863929.html
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -717,16 +717,22 @@ GetProperty(JSContext *cx, JSObject *obj
 {
   NS_ASSERTION(NPIdentifierIsInt(npid) || NPIdentifierIsString(npid),
                "id must be either string or int!\n");
   JS::Rooted<JSObject *> obj(cx, objArg);
   JS::Rooted<jsid> id(cx, NPIdentifierToJSId(npid));
   return ::JS_GetPropertyById(cx, obj, id, rval);
 }
 
+static void
+MarkCrossZoneNPIdentifier(JSContext* cx, NPIdentifier npid)
+{
+  JS_MarkCrossZoneId(cx, NPIdentifierToJSId(npid));
+}
+
 // static
 bool
 nsJSObjWrapper::NP_HasMethod(NPObject *npobj, NPIdentifier id)
 {
   NPP npp = NPPStack::Peek();
   nsIGlobalObject* globalObject = GetGlobalObject(npp);
   if (NS_WARN_IF(!globalObject)) {
     return false;
@@ -740,16 +746,17 @@ nsJSObjWrapper::NP_HasMethod(NPObject *n
                           "Null npobj in nsJSObjWrapper::NP_HasMethod!");
 
     return false;
   }
 
   nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
 
   JSAutoCompartment ac(cx, npjsobj->mJSObj);
+  MarkCrossZoneNPIdentifier(cx, id);
 
   AutoJSExceptionSuppressor suppressor(aes, npjsobj);
 
   JS::Rooted<JS::Value> v(cx);
   bool ok = GetProperty(cx, npjsobj->mJSObj, id, &v);
 
   return ok && !v.isPrimitive() &&
     ::JS_ObjectIsFunction(cx, v.toObjectOrNull());
@@ -779,16 +786,17 @@ doInvoke(NPObject *npobj, NPIdentifier m
 
   // Initialize *result
   VOID_TO_NPVARIANT(*result);
 
   nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
 
   JS::Rooted<JSObject*> jsobj(cx, npjsobj->mJSObj);
   JSAutoCompartment ac(cx, jsobj);
+  MarkCrossZoneNPIdentifier(cx, method);
   JS::Rooted<JS::Value> fv(cx);
 
   AutoJSExceptionSuppressor suppressor(aes, npjsobj);
 
   if (method != NPIdentifier_VOID) {
     if (!GetProperty(cx, jsobj, method, &fv) ||
         ::JS_TypeOfValue(cx, fv) != JSTYPE_FUNCTION) {
       return false;
@@ -871,16 +879,17 @@ nsJSObjWrapper::NP_HasProperty(NPObject 
   }
 
   nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
   bool found, ok = false;
 
   AutoJSExceptionSuppressor suppressor(aes, npjsobj);
   JS::Rooted<JSObject*> jsobj(cx, npjsobj->mJSObj);
   JSAutoCompartment ac(cx, jsobj);
+  MarkCrossZoneNPIdentifier(cx, npid);
 
   NS_ASSERTION(NPIdentifierIsInt(npid) || NPIdentifierIsString(npid),
                "id must be either string or int!\n");
   JS::Rooted<jsid> id(cx, NPIdentifierToJSId(npid));
   ok = ::JS_HasPropertyById(cx, jsobj, id, &found);
   return ok && found;
 }
 
@@ -907,16 +916,17 @@ nsJSObjWrapper::NP_GetProperty(NPObject 
 
     return false;
   }
 
   nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
 
   AutoJSExceptionSuppressor suppressor(aes, npjsobj);
   JSAutoCompartment ac(cx, npjsobj->mJSObj);
+  MarkCrossZoneNPIdentifier(cx, id);
 
   JS::Rooted<JS::Value> v(cx);
   return (GetProperty(cx, npjsobj->mJSObj, id, &v) &&
           JSValToNPVariant(npp, cx, v, result));
 }
 
 // static
 bool
@@ -943,16 +953,17 @@ nsJSObjWrapper::NP_SetProperty(NPObject 
   }
 
   nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
   bool ok = false;
 
   AutoJSExceptionSuppressor suppressor(aes, npjsobj);
   JS::Rooted<JSObject*> jsObj(cx, npjsobj->mJSObj);
   JSAutoCompartment ac(cx, jsObj);
+  MarkCrossZoneNPIdentifier(cx, npid);
 
   JS::Rooted<JS::Value> v(cx, NPVariantToJSVal(npp, cx, value));
 
   NS_ASSERTION(NPIdentifierIsInt(npid) || NPIdentifierIsString(npid),
                "id must be either string or int!\n");
   JS::Rooted<jsid> id(cx, NPIdentifierToJSId(npid));
   ok = ::JS_SetPropertyById(cx, jsObj, id, v);
 
@@ -980,16 +991,17 @@ nsJSObjWrapper::NP_RemoveProperty(NPObje
   }
 
   nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
 
   AutoJSExceptionSuppressor suppressor(aes, npjsobj);
   JS::ObjectOpResult result;
   JS::Rooted<JSObject*> obj(cx, npjsobj->mJSObj);
   JSAutoCompartment ac(cx, obj);
+  MarkCrossZoneNPIdentifier(cx, npid);
 
   NS_ASSERTION(NPIdentifierIsInt(npid) || NPIdentifierIsString(npid),
                "id must be either string or int!\n");
   JS::Rooted<jsid> id(cx, NPIdentifierToJSId(npid));
   if (!::JS_DeletePropertyById(cx, obj, id, result))
     return false;
 
   if (result) {
@@ -2308,15 +2320,16 @@ nsJSObjWrapper::HasOwnProperty(NPObject 
   }
 
   nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
   bool found, ok = false;
 
   AutoJSExceptionSuppressor suppressor(aes, npjsobj);
   JS::Rooted<JSObject*> jsobj(cx, npjsobj->mJSObj);
   JSAutoCompartment ac(cx, jsobj);
+  MarkCrossZoneNPIdentifier(cx, npid);
 
   NS_ASSERTION(NPIdentifierIsInt(npid) || NPIdentifierIsString(npid),
                "id must be either string or int!\n");
   JS::Rooted<jsid> id(cx, NPIdentifierToJSId(npid));
   ok = ::JS_AlreadyHasOwnPropertyById(cx, jsobj, id, &found);
   return ok && found;
 }
--- a/dom/plugins/test/crashtests/crashtests.list
+++ b/dom/plugins/test/crashtests/crashtests.list
@@ -6,9 +6,9 @@ asserts-if(winWidget&&browserIsRemote,0-
 load 570884.html
 # This test relies on the reading of screenX/Y forcing a round trip to
 # the X server, which is a bad assumption for <browser remote>.
 # Plugin arch is going to change anyway with OOP content so skipping
 # this test for now is OK.
 skip-if(!haveTestPlugin||http.platform!="X11") load 598862.html
 skip-if(Android) load 626602-1.html # bug 908363
 load 752340.html
-load 843086.xhtml
+asserts-if(stylo,1) load 843086.xhtml # bug 1324647
--- a/dom/plugins/test/reftest/reftest-stylo.list
+++ b/dom/plugins/test/reftest/reftest-stylo.list
@@ -1,27 +1,27 @@
 # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
 # basic sanity checking
 # == plugin-sanity.html plugin-sanity.html
 # == plugin-sanity.html plugin-sanity.html
-== plugin-alpha-zindex.html plugin-alpha-zindex.html
+fails == plugin-alpha-zindex.html plugin-alpha-zindex.html
 == plugin-alpha-opacity.html plugin-alpha-opacity.html
 == windowless-clipping-1.html windowless-clipping-1.html
 # fuzzy because of anti-aliasing in dashed border
 == border-padding-1.html border-padding-1.html
 == border-padding-2.html border-padding-2.html
 == border-padding-3.html border-padding-3.html
 # The following two "pluginproblemui-direction" tests are unreliable on all platforms. They should be re-written or replaced.
 #random-if(cocoaWidget||d2d||/^Windows\x20NT\x205\.1/.test(http.oscpu)) fails-if(!haveTestPlugin&&!Android) == pluginproblemui-direction-1.html pluginproblemui-direction-1.html
 #random-if(cocoaWidget) fails-if(!haveTestPlugin&&!Android) == pluginproblemui-direction-2.html pluginproblemui-direction-2.html
-== plugin-canvas-alpha-zindex.html plugin-canvas-alpha-zindex.html
-== plugin-transform-alpha-zindex.html plugin-transform-alpha-zindex.html
-== plugin-busy-alpha-zindex.html plugin-busy-alpha-zindex.html
+fails == plugin-canvas-alpha-zindex.html plugin-canvas-alpha-zindex.html
+fails == plugin-transform-alpha-zindex.html plugin-transform-alpha-zindex.html
+fails == plugin-busy-alpha-zindex.html plugin-busy-alpha-zindex.html
 # == plugin-background.html plugin-background.html
-== plugin-background-1-step.html plugin-background-1-step.html
-== plugin-background-2-step.html plugin-background-2-step.html
-== plugin-background-5-step.html plugin-background-5-step.html
-== plugin-background-10-step.html plugin-background-10-step.html
+fails == plugin-background-1-step.html plugin-background-1-step.html
+fails == plugin-background-2-step.html plugin-background-2-step.html
+fails == plugin-background-5-step.html plugin-background-5-step.html
+fails == plugin-background-10-step.html plugin-background-10-step.html
 == plugin-transform-1.html plugin-transform-1.html
-== plugin-transform-2.html plugin-transform-2.html
-== shrink-1.html shrink-1.html
-== update-1.html update-1.html
+fails == plugin-transform-2.html plugin-transform-2.html
+fails == shrink-1.html shrink-1.html
+fails == update-1.html update-1.html
 skip-if(!haveTestPlugin) == windowless-layers.html windowless-layers.html
--- a/dom/smil/crashtests/crashtests.list
+++ b/dom/smil/crashtests/crashtests.list
@@ -18,23 +18,23 @@ load 554202-2.svg
 load 555026-1.svg
 load 556841-1.svg
 load 572938-1.svg
 load 572938-2.svg
 load 572938-3.svg
 load 572938-4.svg
 load 588287-1.svg
 load 588287-2.svg
-load 590425-1.html
-load 592477-1.xhtml
+asserts-if(stylo,2) load 590425-1.html # bug 1324669
+asserts-if(stylo,1-27) load 592477-1.xhtml # bug 1324669
 load 594653-1.svg
 load 596796-1.svg
 load 605345-1.svg
 load 606101-1.svg
-load 608295-1.html
+asserts-if(stylo,2) load 608295-1.html # bug 1324689
 load 608549-1.svg
 load 611927-1.svg
 load 615002-1.svg
 load 615872-1.svg
 load 641388-1.html
 load 641388-2.html
 load 650732-1.svg
 load 665334-1.svg
--- a/dom/svg/crashtests/crashtests.list
+++ b/dom/svg/crashtests/crashtests.list
@@ -1,15 +1,15 @@
 asserts(0-6) load 307322-1.svg # bug 563481
 load 327705-1.svg
 load 336994-1.html
 load 344888-1.svg
 load 345445-1.svg
 load 360836-1.svg
-load 367357-1.xhtml
+asserts-if(stylo,2) load 367357-1.xhtml # bug 1324669
 load 369051-1.svg
 load 369249-1.svg
 load 369291-1.svg
 load 369291-2.svg
 load 369568-1.svg
 load 372046-1.svg
 load 372046-2.svg
 load 374882-1.svg
@@ -70,21 +70,21 @@ load 880544-1.svg
 load 880544-2.svg
 load 880544-3.svg
 load 880544-4.svg
 load 880544-5.svg
 load 898915-1.svg
 load 1035248-1.svg
 load 1035248-2.svg
 load 1244898-1.xhtml
-load 1250725.html
+asserts-if(stylo,2) load 1250725.html # bug 1324669
 load 1267272-1.svg
 load 1282985-1.svg
 # Disabled for now due to it taking a very long time to run - bug 1259356
 #load long-clipPath-reference-chain.svg
 load zero-size-image.svg
-load 1322286.html
+asserts-if(stylo,2) load 1322286.html # bug 1324669
 load 1329849-1.svg
 load 1329849-2.svg
 load 1329849-3.svg
 load 1329849-4.svg
 load 1329849-5.svg
 load 1329849-6.svg
--- a/dom/tests/reftest/reftest-stylo.list
+++ b/dom/tests/reftest/reftest-stylo.list
@@ -1,14 +1,14 @@
 # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
-== bug453105.html bug453105.html
-== optiontext.html optiontext.html
-== bug456008.xhtml bug456008.xhtml
+fails == bug453105.html bug453105.html
+fails == optiontext.html optiontext.html
+fails == bug456008.xhtml bug456008.xhtml
 == bug439965.html bug439965.html
 == bug427779.xml bug427779.xml
-== bug559996.html bug559996.html
+fails == bug559996.html bug559996.html
 == bug591981-1.html bug591981-1.html
 == bug591981-2.html bug591981-2.html
 == bug592366-1.html bug592366-1.html
 == bug592366-2.html bug592366-2.html
 == bug592366-1.xhtml bug592366-1.xhtml
 == bug592366-2.xhtml bug592366-2.xhtml
 == bug798068.xhtml bug798068.xhtml
--- a/editor/libeditor/crashtests/crashtests.list
+++ b/editor/libeditor/crashtests/crashtests.list
@@ -1,10 +1,10 @@
 load 336081-1.xhtml
-load 336104.html
+asserts-if(stylo,2-3) load 336104.html # bug 1324669
 load 382527-1.html
 load 382778-1.html
 load 402172-1.html
 load 403965-1.xhtml
 load 407074-1.html
 load 407079-1.html
 load 407256-1.html
 load 407277-1.html
--- a/editor/reftests/reftest-stylo.list
+++ b/editor/reftests/reftest-stylo.list
@@ -1,29 +1,29 @@
 # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
 # include the XUL reftests
 include xul/reftest-stylo.list
 
-== newline-1.html newline-1.html
-== newline-2.html newline-2.html
-== newline-3.html newline-3.html
-== newline-4.html newline-4.html
-== dynamic-1.html dynamic-1.html
-== dynamic-type-1.html dynamic-type-1.html
-== dynamic-type-2.html dynamic-type-2.html
-== dynamic-type-3.html dynamic-type-3.html
-== dynamic-type-4.html dynamic-type-4.html
-== passwd-1.html passwd-1.html
-== passwd-2.html passwd-2.html
-== passwd-3.html passwd-3.html
-needs-focus == passwd-4.html passwd-4.html
-== emptypasswd-1.html emptypasswd-1.html
-== emptypasswd-2.html emptypasswd-2.html
-== caret_on_positioned.html caret_on_positioned.html
-== spellcheck-input-disabled.html spellcheck-input-disabled.html
+fails == newline-1.html newline-1.html
+fails == newline-2.html newline-2.html
+fails == newline-3.html newline-3.html
+fails == newline-4.html newline-4.html
+fails == dynamic-1.html dynamic-1.html
+fails == dynamic-type-1.html dynamic-type-1.html
+fails == dynamic-type-2.html dynamic-type-2.html
+fails == dynamic-type-3.html dynamic-type-3.html
+fails == dynamic-type-4.html dynamic-type-4.html
+fails == passwd-1.html passwd-1.html
+fails == passwd-2.html passwd-2.html
+fails == passwd-3.html passwd-3.html
+fails needs-focus == passwd-4.html passwd-4.html
+fails == emptypasswd-1.html emptypasswd-1.html
+fails == emptypasswd-2.html emptypasswd-2.html
+fails == caret_on_positioned.html caret_on_positioned.html
+fails == spellcheck-input-disabled.html spellcheck-input-disabled.html
 # == spellcheck-input-attr-before.html spellcheck-input-attr-before.html
 # == spellcheck-input-attr-before.html spellcheck-input-attr-before.html
 # == spellcheck-input-attr-after.html spellcheck-input-attr-after.html
 # == spellcheck-input-attr-after.html spellcheck-input-attr-after.html
 # == spellcheck-input-attr-inherit.html spellcheck-input-attr-inherit.html
 # == spellcheck-input-attr-inherit.html spellcheck-input-attr-inherit.html
 # == spellcheck-input-attr-dynamic.html spellcheck-input-attr-dynamic.html
 # == spellcheck-input-attr-dynamic.html spellcheck-input-attr-dynamic.html
@@ -39,86 +39,86 @@ needs-focus == passwd-4.html passwd-4.ht
 # == spellcheck-input-attr-dynamic-override-inherit.html spellcheck-input-attr-dynamic-override-inherit.html
 # == spellcheck-input-property-dynamic-override.html spellcheck-input-property-dynamic-override.html
 # == spellcheck-input-property-dynamic-override.html spellcheck-input-property-dynamic-override.html
 # == spellcheck-input-property-dynamic-override-inherit.html spellcheck-input-property-dynamic-override-inherit.html
 # == spellcheck-input-property-dynamic-override-inherit.html spellcheck-input-property-dynamic-override-inherit.html
 # == spellcheck-textarea-attr.html spellcheck-textarea-attr.html
 #the random-if(Android) tests pass on android native, but fail on android-xul, see bug 728942
 # == spellcheck-textarea-attr.html spellcheck-textarea-attr.html
-needs-focus == spellcheck-textarea-focused.html spellcheck-textarea-focused.html
-needs-focus == spellcheck-textarea-focused-reframe.html spellcheck-textarea-focused-reframe.html
-needs-focus == spellcheck-textarea-focused-notreadonly.html spellcheck-textarea-focused-notreadonly.html
-== spellcheck-textarea-nofocus.html spellcheck-textarea-nofocus.html
-== spellcheck-textarea-disabled.html spellcheck-textarea-disabled.html
-== spellcheck-textarea-attr-inherit.html spellcheck-textarea-attr-inherit.html
-== spellcheck-textarea-attr-dynamic.html spellcheck-textarea-attr-dynamic.html
-== spellcheck-textarea-attr-dynamic-inherit.html spellcheck-textarea-attr-dynamic-inherit.html
-== spellcheck-textarea-property-dynamic.html spellcheck-textarea-property-dynamic.html
-== spellcheck-textarea-property-dynamic-inherit.html spellcheck-textarea-property-dynamic-inherit.html
-== spellcheck-textarea-attr-dynamic-override.html spellcheck-textarea-attr-dynamic-override.html
-== spellcheck-textarea-attr-dynamic-override-inherit.html spellcheck-textarea-attr-dynamic-override-inherit.html
-== spellcheck-textarea-property-dynamic-override.html spellcheck-textarea-property-dynamic-override.html
-== spellcheck-textarea-property-dynamic-override-inherit.html spellcheck-textarea-property-dynamic-override-inherit.html
-needs-focus == caret_on_focus.html caret_on_focus.html
-needs-focus == caret_on_textarea_lastline.html caret_on_textarea_lastline.html
-needs-focus == input-text-onfocus-reframe.html input-text-onfocus-reframe.html
-needs-focus == input-text-notheme-onfocus-reframe.html input-text-notheme-onfocus-reframe.html
-needs-focus == caret_after_reframe.html caret_after_reframe.html
+fails needs-focus == spellcheck-textarea-focused.html spellcheck-textarea-focused.html
+fails needs-focus == spellcheck-textarea-focused-reframe.html spellcheck-textarea-focused-reframe.html
+fails needs-focus == spellcheck-textarea-focused-notreadonly.html spellcheck-textarea-focused-notreadonly.html
+fails == spellcheck-textarea-nofocus.html spellcheck-textarea-nofocus.html
+fails == spellcheck-textarea-disabled.html spellcheck-textarea-disabled.html
+fails == spellcheck-textarea-attr-inherit.html spellcheck-textarea-attr-inherit.html
+fails == spellcheck-textarea-attr-dynamic.html spellcheck-textarea-attr-dynamic.html
+fails == spellcheck-textarea-attr-dynamic-inherit.html spellcheck-textarea-attr-dynamic-inherit.html
+fails == spellcheck-textarea-property-dynamic.html spellcheck-textarea-property-dynamic.html
+fails == spellcheck-textarea-property-dynamic-inherit.html spellcheck-textarea-property-dynamic-inherit.html
+fails == spellcheck-textarea-attr-dynamic-override.html spellcheck-textarea-attr-dynamic-override.html
+fails == spellcheck-textarea-attr-dynamic-override-inherit.html spellcheck-textarea-attr-dynamic-override-inherit.html
+fails == spellcheck-textarea-property-dynamic-override.html spellcheck-textarea-property-dynamic-override.html
+fails == spellcheck-textarea-property-dynamic-override-inherit.html spellcheck-textarea-property-dynamic-override-inherit.html
+fails needs-focus == caret_on_focus.html caret_on_focus.html
+fails needs-focus == caret_on_textarea_lastline.html caret_on_textarea_lastline.html
+fails needs-focus == input-text-onfocus-reframe.html input-text-onfocus-reframe.html
+fails needs-focus == input-text-notheme-onfocus-reframe.html input-text-notheme-onfocus-reframe.html
+fails needs-focus == caret_after_reframe.html caret_after_reframe.html
 # == nobogusnode-1.html nobogusnode-1.html
 # == nobogusnode-2.html nobogusnode-2.html
-== spellcheck-hyphen-valid.html spellcheck-hyphen-valid.html
-== spellcheck-hyphen-invalid.html spellcheck-hyphen-invalid.html
-== spellcheck-slash-valid.html spellcheck-slash-valid.html
-== spellcheck-period-valid.html spellcheck-period-valid.html
-== spellcheck-space-valid.html spellcheck-space-valid.html
-== spellcheck-comma-valid.html spellcheck-comma-valid.html
-== spellcheck-hyphen-multiple-valid.html spellcheck-hyphen-multiple-valid.html
-== spellcheck-hyphen-multiple-invalid.html spellcheck-hyphen-multiple-invalid.html
-== spellcheck-dotafterquote-valid.html spellcheck-dotafterquote-valid.html
-== spellcheck-url-valid.html spellcheck-url-valid.html
-needs-focus == spellcheck-non-latin-arabic.html spellcheck-non-latin-arabic.html
-needs-focus == spellcheck-non-latin-chinese-simplified.html spellcheck-non-latin-chinese-simplified.html
-needs-focus == spellcheck-non-latin-chinese-traditional.html spellcheck-non-latin-chinese-traditional.html
-needs-focus == spellcheck-non-latin-hebrew.html spellcheck-non-latin-hebrew.html
-needs-focus == spellcheck-non-latin-japanese.html spellcheck-non-latin-japanese.html
-needs-focus == spellcheck-non-latin-korean.html spellcheck-non-latin-korean.html
-== unneeded_scroll.html unneeded_scroll.html
+fails == spellcheck-hyphen-valid.html spellcheck-hyphen-valid.html
+fails == spellcheck-hyphen-invalid.html spellcheck-hyphen-invalid.html
+fails == spellcheck-slash-valid.html spellcheck-slash-valid.html
+fails == spellcheck-period-valid.html spellcheck-period-valid.html
+fails == spellcheck-space-valid.html spellcheck-space-valid.html
+fails == spellcheck-comma-valid.html spellcheck-comma-valid.html
+fails == spellcheck-hyphen-multiple-valid.html spellcheck-hyphen-multiple-valid.html
+fails == spellcheck-hyphen-multiple-invalid.html spellcheck-hyphen-multiple-invalid.html
+fails == spellcheck-dotafterquote-valid.html spellcheck-dotafterquote-valid.html
+fails == spellcheck-url-valid.html spellcheck-url-valid.html
+fails needs-focus == spellcheck-non-latin-arabic.html spellcheck-non-latin-arabic.html
+fails needs-focus == spellcheck-non-latin-chinese-simplified.html spellcheck-non-latin-chinese-simplified.html
+fails needs-focus == spellcheck-non-latin-chinese-traditional.html spellcheck-non-latin-chinese-traditional.html
+fails needs-focus == spellcheck-non-latin-hebrew.html spellcheck-non-latin-hebrew.html
+fails needs-focus == spellcheck-non-latin-japanese.html spellcheck-non-latin-japanese.html
+fails needs-focus == spellcheck-non-latin-korean.html spellcheck-non-latin-korean.html
+fails == unneeded_scroll.html unneeded_scroll.html
 # == caret_on_presshell_reinit.html caret_on_presshell_reinit.html
 # == caret_on_presshell_reinit-2.html caret_on_presshell_reinit-2.html
-== 642800.html 642800.html
-== selection_visibility_after_reframe.html selection_visibility_after_reframe.html
-== selection_visibility_after_reframe-2.html selection_visibility_after_reframe-2.html
-== selection_visibility_after_reframe-3.html selection_visibility_after_reframe-3.html
-== 672709.html 672709.html
-== 338427-1.html 338427-1.html
-== 674212-spellcheck.html 674212-spellcheck.html
-== 338427-2.html 338427-2.html
-== 338427-3.html 338427-3.html
-== 462758-grabbers-resizers.html 462758-grabbers-resizers.html
-== readwrite-non-editable.html readwrite-non-editable.html
-== readwrite-editable.html readwrite-editable.html
-== readonly-non-editable.html readonly-non-editable.html
-== readonly-editable.html readonly-editable.html
-== dynamic-overflow-change.html dynamic-overflow-change.html
-== 694880-1.html 694880-1.html
-== 694880-2.html 694880-2.html
-== 694880-3.html 694880-3.html
-== 388980-1.html 388980-1.html
-needs-focus == spellcheck-superscript-1.html spellcheck-superscript-1.html
-== spellcheck-superscript-2.html spellcheck-superscript-2.html
+fails == 642800.html 642800.html
+fails == selection_visibility_after_reframe.html selection_visibility_after_reframe.html
+fails == selection_visibility_after_reframe-2.html selection_visibility_after_reframe-2.html
+fails == selection_visibility_after_reframe-3.html selection_visibility_after_reframe-3.html
+fails == 672709.html 672709.html
+fails == 338427-1.html 338427-1.html
+fails == 674212-spellcheck.html 674212-spellcheck.html
+fails == 338427-2.html 338427-2.html
+fails == 338427-3.html 338427-3.html
+fails == 462758-grabbers-resizers.html 462758-grabbers-resizers.html
+fails == readwrite-non-editable.html readwrite-non-editable.html
+fails == readwrite-editable.html readwrite-editable.html
+fails == readonly-non-editable.html readonly-non-editable.html
+fails == readonly-editable.html readonly-editable.html
+fails == dynamic-overflow-change.html dynamic-overflow-change.html
+fails == 694880-1.html 694880-1.html
+fails == 694880-2.html 694880-2.html
+fails == 694880-3.html 694880-3.html
+fails == 388980-1.html 388980-1.html
+fails needs-focus == spellcheck-superscript-1.html spellcheck-superscript-1.html
+fails == spellcheck-superscript-2.html spellcheck-superscript-2.html
 == 824080-1.html 824080-1.html
 # == 824080-2.html 824080-2.html
 # == 824080-3.html 824080-3.html
 # needs-focus == 824080-2.html 824080-2.html
 # == 824080-4.html 824080-4.html
 # == 824080-5.html 824080-5.html
 # needs-focus == 824080-4.html 824080-4.html
 # needs-focus == 824080-6.html 824080-6.html
-needs-focus pref(layout.accessiblecaret.enabled,false) pref(layout.accessiblecaret.enabled_on_touch,false) == 824080-7.html 824080-7.html
+fails needs-focus pref(layout.accessiblecaret.enabled,false) pref(layout.accessiblecaret.enabled_on_touch,false) == 824080-7.html 824080-7.html
 # needs-focus == 824080-6.html 824080-6.html
 # Bug 674927: copy spellcheck-textarea tests to contenteditable
 # == spellcheck-contenteditable-attr.html spellcheck-contenteditable-attr.html
 # == spellcheck-contenteditable-attr.html spellcheck-contenteditable-attr.html
 # needs-focus == spellcheck-contenteditable-focused.html spellcheck-contenteditable-focused.html
 # needs-focus == spellcheck-contenteditable-focused-reframe.html spellcheck-contenteditable-focused-reframe.html
 == spellcheck-contenteditable-nofocus.html spellcheck-contenteditable-nofocus.html
 # == spellcheck-contenteditable-disabled.html spellcheck-contenteditable-disabled.html
@@ -128,11 +128,11 @@ needs-focus pref(layout.accessiblecaret.
 # == spellcheck-contenteditable-attr-dynamic-inherit.html spellcheck-contenteditable-attr-dynamic-inherit.html
 == spellcheck-contenteditable-property-dynamic.html spellcheck-contenteditable-property-dynamic.html
 # == spellcheck-contenteditable-property-dynamic-inherit.html spellcheck-contenteditable-property-dynamic-inherit.html
 # == spellcheck-contenteditable-attr-dynamic-override.html spellcheck-contenteditable-attr-dynamic-override.html
 == spellcheck-contenteditable-attr-dynamic-override-inherit.html spellcheck-contenteditable-attr-dynamic-override-inherit.html
 # == spellcheck-contenteditable-property-dynamic-override.html spellcheck-contenteditable-property-dynamic-override.html
 == spellcheck-contenteditable-property-dynamic-override-inherit.html spellcheck-contenteditable-property-dynamic-override-inherit.html
 # == 911201.html 911201.html
-needs-focus == 969773.html 969773.html
-== 997805.html 997805.html
-== 1088158.html 1088158.html
+fails needs-focus == 969773.html 969773.html
+fails == 997805.html 997805.html
+fails == 1088158.html 1088158.html
--- a/gfx/layers/apz/test/reftest/reftest-stylo.list
+++ b/gfx/layers/apz/test/reftest/reftest-stylo.list
@@ -6,15 +6,15 @@ fuzzy-if(Android,4,5) skip-if(!Android) 
 fuzzy-if(Android,3,5) skip-if(!Android) pref(apz.allow_zooming,true) == async-scrollbar-1-vh.html async-scrollbar-1-vh.html
 # == async-scrollbar-1-v-rtl.html async-scrollbar-1-v-rtl.html
 # == async-scrollbar-1-h-rtl.html async-scrollbar-1-h-rtl.html
 # == async-scrollbar-1-vh-rtl.html async-scrollbar-1-vh-rtl.html
 
 # Different async zoom levels. Since the scrollthumb gets async-scaled in the
 # compositor, the border-radius ends of the scrollthumb are going to be a little
 # off, hence the fuzzy-if clauses.
-== async-scrollbar-zoom-1.html async-scrollbar-zoom-1.html
-== async-scrollbar-zoom-2.html async-scrollbar-zoom-2.html
+fails == async-scrollbar-zoom-1.html async-scrollbar-zoom-1.html
+fails == async-scrollbar-zoom-2.html async-scrollbar-zoom-2.html
 
 # Meta-viewport tag support
 # == initial-scale-1.html initial-scale-1.html
 
 skip-if(!asyncPan) == frame-reconstruction-scroll-clamping.html frame-reconstruction-scroll-clamping.html
--- a/gfx/tests/crashtests/crashtests.list
+++ b/gfx/tests/crashtests/crashtests.list
@@ -26,17 +26,17 @@ skip-if(Android&&smallScreen) load 38522
 skip load 385228-2.svg  # bug 523255 / bug 385228
 load 385289-1.xhtml
 load 385417-1.html
 load 385417-2.html
 load 385423-1.html
 load 385423-2.html
 load 385719-1.html
 load 389326-1.html
-load 390476.html
+asserts-if(stylo,1) load 390476.html # bug 1324700
 load 393746-1.xhtml
 load 393749-1.html
 load 393822-1.html
 load 394384-1.html
 load 394246-1.html
 load 394246-2.html
 skip-if(Android) load 394751.xhtml # bug 922976
 load 395335-1.xhtml
@@ -98,38 +98,38 @@ load 662467-1.html
 load 665218.html
 load 675550-1.html
 load 686190-1.html
 load 691581-1.html
 load 693143-1.html
 load 696936-1.html
 load 699563-1.html
 load 710149-1.html
-load 766452-1.html
+asserts-if(stylo,1) load 766452-1.html # bug 1324700
 load 766452-2.html
 load 768079-1.html
-load 783041-1.html
+asserts-if(stylo,2) load 783041-1.html # bug 1324661
 load 783041-2.html
-load 783041-3.html
+asserts-if(stylo,1) load 783041-3.html # bug 1324671
 load 783041-4.html
 load 798853.html # bug 868792
 load 805760-1.html
 skip-if(Android) load 815489.html # bug 1216304
 load 836225-1.html
-load 839745-1.html
+asserts-if(stylo,2) load 839745-1.html # bug 1324669
 load 856784-1.html
 load 893572-1.html
 load 893572-2.html
 load 893572-3.html
 load 893572-4.html
 pref(layers.force-active,true) load 914457-1.html
 load 944579.svg
-load 944579.html
-pref(security.fileuri.strict_origin_policy,false) load 950000.html
+asserts-if(stylo,2) load 944579.html # bug 1324669
+asserts-if(stylo,1) pref(security.fileuri.strict_origin_policy,false) load 950000.html # bug 1324700
 load 1034403-1.html
 load 1205900.html
 load 1134549-1.svg
 load balinese-letter-spacing.html
 load 1216832-1.html
 load 1225125-1.html
-load 1308394.html
+asserts-if(stylo,2) load 1308394.html # bug 1324669
 skip-if(stylo) load 1317403-1.html # bug 1331533
 load 1325159-1.html
--- a/gfx/tests/reftest/reftest-stylo.list
+++ b/gfx/tests/reftest/reftest-stylo.list
@@ -1,10 +1,10 @@
 # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
 # 468496-1 will also detect bugs in video drivers.
-== 468496-1.html 468496-1.html
+fails == 468496-1.html 468496-1.html
 # == 611498-1.html 611498-1.html
-== 709477-1.html 709477-1.html
+fails == 709477-1.html 709477-1.html
 skip-if(!asyncPan) == 1086723.html 1086723.html
-== 853889-1.html 853889-1.html
+fails == 853889-1.html 853889-1.html
 skip-if(Android) fuzzy-if(skiaContent,1,587) == 1143303-1.svg 1143303-1.svg
 fuzzy(100,30) == 1149923.html 1149923.html
 == 1131264-1.svg 1131264-1.svg
--- a/image/test/reftest/bmp/bmp-4bpp/reftest-stylo.list
+++ b/image/test/reftest/bmp/bmp-4bpp/reftest-stylo.list
@@ -17,9 +17,9 @@
 == bmp-size-31x31-4bpp.bmp bmp-size-31x31-4bpp.bmp
 == bmp-size-32x32-4bpp.bmp bmp-size-32x32-4bpp.bmp
 == bmp-size-33x33-4bpp.bmp bmp-size-33x33-4bpp.bmp
 == bmp-not-square-4bpp.bmp bmp-not-square-4bpp.bmp
 == os2bmp-size-32x32-4bpp.bmp os2bmp-size-32x32-4bpp.bmp
 == top-to-bottom-16x16-4bpp.bmp top-to-bottom-16x16-4bpp.bmp
 # test that delta skips are drawn as transparent
 # taken from http://bmptestsuite.sourceforge.net/
-== rle4-delta-320x240.bmp rle4-delta-320x240.bmp
+fails == rle4-delta-320x240.bmp rle4-delta-320x240.bmp
--- a/image/test/reftest/bmp/bmpsuite/q/reftest-stylo.list
+++ b/image/test/reftest/bmp/bmpsuite/q/reftest-stylo.list
@@ -17,22 +17,22 @@
 == wrapper.html?pal2.bmp wrapper.html?pal2.bmp
 
 # BMP: bihsize=40, 127 x 64, bpp=4, compression=2, colors=13
 # "An RLE-compressed image that used 'delta' codes to skip over some pixels,
 # leaving them undefined. Some viewers make undefined pixels transparent,
 # others make them black, and others assign them palette color 0 (purple, in
 # this case)."
 # [We make the undefined pixels transparent. So does Chromium.]
-== pal4rletrns.bmp pal4rletrns.bmp
+fails == pal4rletrns.bmp pal4rletrns.bmp
 
 # BMP: bihsize=40, 127 x 64, bpp=8, compression=1, colors=253
 # "8-bit version of q/pal4rletrns.bmp."
 # [Ditto.]
-== pal8rletrns.bmp pal8rletrns.bmp
+fails == pal8rletrns.bmp pal8rletrns.bmp
 
 # BMP: bihsize=40, 127 x 64, bpp=8, compression=0, colors=252
 # "A file with some unused bytes between the palette and the image. This is
 # probably valid, but I’m not 100% sure."
 # [We accept it. So does Chromium.]
 == pal8offs.bmp pal8offs.bmp
 
 # BMP: bihsize=40, 127 x 64, bpp=8, compression=0, colors=300
@@ -67,17 +67,17 @@
 # (possibly including one round of bit replication), instead of proper
 # scaling."
 == rgb16-231.bmp rgb16-231.bmp
 
 # BMP: bihsize=124, 127 x 64, bpp=16, compression=3, colors=0
 # "A 16-bit image with an alpha channel. There are 4 bits for each color
 # channel, and 4 bits for the alpha channel. It’s not clear if this is valid,
 # but I can’t find anything that suggests it isn’t."
-== rgba16-4444.bmp rgba16-4444.bmp
+fails == rgba16-4444.bmp rgba16-4444.bmp
 
 # BMP: bihsize=40, 127 x 64, bpp=24, compression=0, colors=300
 # "A 24-bit image, with a palette containing 300 colors. The fact that the
 # palette has more than 256 colors may cause some viewers to complain, but the
 # documentation does not mention a size limit."
 # [We accept it. So does Chromium.]
 == rgb24largepal.bmp rgb24largepal.bmp
 
@@ -115,17 +115,17 @@
 # 10 for blue. As far as I know, this is perfectly valid, but it is unusual."
 == rgb32-111110.bmp rgb32-111110.bmp
 
 # BMP: bihsize=124, 127 x 64, bpp=32, compression=3, colors=0
 # "A BMP with an alpha channel. Transparency is barely documented, so it’s
 # possible that this file is not correctly formed. The color channels are in an
 # unusual order, to prevent viewers from passing this test by making a lucky
 # guess."
-== rgba32.bmp rgba32.bmp
+fails == rgba32.bmp rgba32.bmp
 
 # BMP: bihsize=40, 127 x 64, bpp=32, compression=6, colors=0
 # "An image of type BI_ALPHABITFIELDS. Supposedly, this was used on Windows CE.
 # I don’t know whether it is constructed correctly."
 # [We reject it. So does Chromium.]
 == wrapper.html?rgba32abf.bmp wrapper.html?rgba32abf.bmp
 
 
--- a/image/test/reftest/downscaling/reftest-stylo.list
+++ b/image/test/reftest/downscaling/reftest-stylo.list
@@ -22,173 +22,173 @@
 # Also note that Mac OS X has its own system-level downscaling algorithm, so
 # tests here may need Mac-specific "fuzzy-if(cocoaWidget,...)" annotations.
 # Similarly, modern versions of Windows have slightly different downscaling
 # behavior than other platforms, and may require "fuzzy-if(winWidget,...)".
 
 
 # RUN TESTS NOT AFFECTED BY DOWNSCALE-DURING-DECODE:
 # #
-== downscale-svg-1a.html downscale-svg-1a.html
-== downscale-svg-1b.html downscale-svg-1b.html
-== downscale-svg-1c.html downscale-svg-1c.html
-== downscale-svg-1d.html downscale-svg-1d.html
-== downscale-svg-1e.html downscale-svg-1e.html
-== downscale-svg-1f.html downscale-svg-1f.html
+fails == downscale-svg-1a.html downscale-svg-1a.html
+fails == downscale-svg-1b.html downscale-svg-1b.html
+fails == downscale-svg-1c.html downscale-svg-1c.html
+fails == downscale-svg-1d.html downscale-svg-1d.html
+fails == downscale-svg-1e.html downscale-svg-1e.html
+fails == downscale-svg-1f.html downscale-svg-1f.html
 
 # RUN TESTS WITH DOWNSCALE-DURING-DECODE DISABLED:
 # #
 default-preferences pref(image.downscale-during-decode.enabled,false)
 
 == downscale-1.html downscale-1.html
 
-== downscale-2a.html?203,52,left downscale-2a.html?203,52,left
-== downscale-2b.html?203,52,left downscale-2b.html?203,52,left
-== downscale-2c.html?203,52,left downscale-2c.html?203,52,left
-== downscale-2d.html?203,52,left downscale-2d.html?203,52,left
-== downscale-2e.html?203,52,left downscale-2e.html?203,52,left
+fails == downscale-2a.html?203,52,left downscale-2a.html?203,52,left
+fails == downscale-2b.html?203,52,left downscale-2b.html?203,52,left
+fails == downscale-2c.html?203,52,left downscale-2c.html?203,52,left
+fails == downscale-2d.html?203,52,left downscale-2d.html?203,52,left
+fails == downscale-2e.html?203,52,left downscale-2e.html?203,52,left
 
-== downscale-2a.html?205,53,left downscale-2a.html?205,53,left
-== downscale-2b.html?205,53,left downscale-2b.html?205,53,left
-== downscale-2c.html?205,53,left downscale-2c.html?205,53,left
-== downscale-2d.html?205,53,left downscale-2d.html?205,53,left
-== downscale-2e.html?205,53,left downscale-2e.html?205,53,left
+fails == downscale-2a.html?205,53,left downscale-2a.html?205,53,left
+fails == downscale-2b.html?205,53,left downscale-2b.html?205,53,left
+fails == downscale-2c.html?205,53,left downscale-2c.html?205,53,left
+fails == downscale-2d.html?205,53,left downscale-2d.html?205,53,left
+fails == downscale-2e.html?205,53,left downscale-2e.html?205,53,left
 
-== downscale-2a.html?203,52,right downscale-2a.html?203,52,right
-== downscale-2b.html?203,52,right downscale-2b.html?203,52,right
-== downscale-2c.html?203,52,right downscale-2c.html?203,52,right
-== downscale-2d.html?203,52,right downscale-2d.html?203,52,right
-== downscale-2e.html?203,52,right downscale-2e.html?203,52,right
+fails == downscale-2a.html?203,52,right downscale-2a.html?203,52,right
+fails == downscale-2b.html?203,52,right downscale-2b.html?203,52,right
+fails == downscale-2c.html?203,52,right downscale-2c.html?203,52,right
+fails == downscale-2d.html?203,52,right downscale-2d.html?203,52,right
+fails == downscale-2e.html?203,52,right downscale-2e.html?203,52,right
 
-== downscale-2a.html?205,53,right downscale-2a.html?205,53,right
-== downscale-2b.html?205,53,right downscale-2b.html?205,53,right
-== downscale-2c.html?205,53,right downscale-2c.html?205,53,right
-== downscale-2d.html?205,53,right downscale-2d.html?205,53,right
-== downscale-2e.html?205,53,right downscale-2e.html?205,53,right
+fails == downscale-2a.html?205,53,right downscale-2a.html?205,53,right
+fails == downscale-2b.html?205,53,right downscale-2b.html?205,53,right
+fails == downscale-2c.html?205,53,right downscale-2c.html?205,53,right
+fails == downscale-2d.html?205,53,right downscale-2d.html?205,53,right
+fails == downscale-2e.html?205,53,right downscale-2e.html?205,53,right
 
-== downscale-2a.html?203,52,top downscale-2a.html?203,52,top
-== downscale-2b.html?203,52,top downscale-2b.html?203,52,top
-== downscale-2c.html?203,52,top downscale-2c.html?203,52,top
-== downscale-2d.html?203,52,top downscale-2d.html?203,52,top
-== downscale-2e.html?203,52,top downscale-2e.html?203,52,top
+fails == downscale-2a.html?203,52,top downscale-2a.html?203,52,top
+fails == downscale-2b.html?203,52,top downscale-2b.html?203,52,top
+fails == downscale-2c.html?203,52,top downscale-2c.html?203,52,top
+fails == downscale-2d.html?203,52,top downscale-2d.html?203,52,top
+fails == downscale-2e.html?203,52,top downscale-2e.html?203,52,top
 
-== downscale-2a.html?205,53,top downscale-2a.html?205,53,top
-== downscale-2b.html?205,53,top downscale-2b.html?205,53,top
-== downscale-2c.html?205,53,top downscale-2c.html?205,53,top
-== downscale-2d.html?205,53,top downscale-2d.html?205,53,top
-== downscale-2e.html?205,53,top downscale-2e.html?205,53,top
+fails == downscale-2a.html?205,53,top downscale-2a.html?205,53,top
+fails == downscale-2b.html?205,53,top downscale-2b.html?205,53,top
+fails == downscale-2c.html?205,53,top downscale-2c.html?205,53,top
+fails == downscale-2d.html?205,53,top downscale-2d.html?205,53,top
+fails == downscale-2e.html?205,53,top downscale-2e.html?205,53,top
 
-== downscale-2a.html?203,52,bottom downscale-2a.html?203,52,bottom
-== downscale-2b.html?203,52,bottom downscale-2b.html?203,52,bottom
-== downscale-2c.html?203,52,bottom downscale-2c.html?203,52,bottom
-== downscale-2d.html?203,52,bottom downscale-2d.html?203,52,bottom
-== downscale-2e.html?203,52,bottom downscale-2e.html?203,52,bottom
+fails == downscale-2a.html?203,52,bottom downscale-2a.html?203,52,bottom
+fails == downscale-2b.html?203,52,bottom downscale-2b.html?203,52,bottom
+fails == downscale-2c.html?203,52,bottom downscale-2c.html?203,52,bottom
+fails == downscale-2d.html?203,52,bottom downscale-2d.html?203,52,bottom
+fails == downscale-2e.html?203,52,bottom downscale-2e.html?203,52,bottom
 
-== downscale-2a.html?205,53,bottom downscale-2a.html?205,53,bottom
-== downscale-2b.html?205,53,bottom downscale-2b.html?205,53,bottom
-== downscale-2c.html?205,53,bottom downscale-2c.html?205,53,bottom
-== downscale-2d.html?205,53,bottom downscale-2d.html?205,53,bottom
-== downscale-2e.html?205,53,bottom downscale-2e.html?205,53,bottom
+fails == downscale-2a.html?205,53,bottom downscale-2a.html?205,53,bottom
+fails == downscale-2b.html?205,53,bottom downscale-2b.html?205,53,bottom
+fails == downscale-2c.html?205,53,bottom downscale-2c.html?205,53,bottom
+fails == downscale-2d.html?205,53,bottom downscale-2d.html?205,53,bottom
+fails == downscale-2e.html?205,53,bottom downscale-2e.html?205,53,bottom
 
 == downscale-moz-icon-1.html downscale-moz-icon-1.html
 
-== downscale-png.html?16,16,interlaced downscale-png.html?16,16,interlaced
-== downscale-png.html?24,24,interlaced downscale-png.html?24,24,interlaced
+fails == downscale-png.html?16,16,interlaced downscale-png.html?16,16,interlaced
+fails == downscale-png.html?24,24,interlaced downscale-png.html?24,24,interlaced
 
 # Non-transparent and transparent ICO images
-== downscale-16px.html?ff-0RGB.ico downscale-16px.html?ff-0RGB.ico
-== downscale-16px.html?ff-ARGB.ico downscale-16px.html?ff-ARGB.ico
+fails == downscale-16px.html?ff-0RGB.ico downscale-16px.html?ff-0RGB.ico
+fails == downscale-16px.html?ff-ARGB.ico downscale-16px.html?ff-ARGB.ico
 
 # Upside-down (negative height) BMP
-== downscale-8px.html?top-to-bottom-16x16-24bpp.bmp downscale-8px.html?top-to-bottom-16x16-24bpp.bmp
+fails == downscale-8px.html?top-to-bottom-16x16-24bpp.bmp downscale-8px.html?top-to-bottom-16x16-24bpp.bmp
 
 # Test downscaling from all supported formats from 256 to 32.
-== downscale-32px.html?.bmp downscale-32px.html?.bmp
-== downscale-32px.html?.gif downscale-32px.html?.gif
-== downscale-32px.html?.jpg downscale-32px.html?.jpg
-== downscale-32px.html?.png downscale-32px.html?.png
-== downscale-32px.html?.svg downscale-32px.html?.svg
-== downscale-32px.html?-bmp-in.ico downscale-32px.html?-bmp-in.ico
-== downscale-32px.html?-png-in.ico downscale-32px.html?-png-in.ico
+fails == downscale-32px.html?.bmp downscale-32px.html?.bmp
+fails == downscale-32px.html?.gif downscale-32px.html?.gif
+fails == downscale-32px.html?.jpg downscale-32px.html?.jpg
+fails == downscale-32px.html?.png downscale-32px.html?.png
+fails == downscale-32px.html?.svg downscale-32px.html?.svg
+fails == downscale-32px.html?-bmp-in.ico downscale-32px.html?-bmp-in.ico
+fails == downscale-32px.html?-png-in.ico downscale-32px.html?-png-in.ico
 
 # RUN TESTS WITH DOWNSCALE-DURING-DECODE ENABLED:
 # #
 default-preferences pref(image.downscale-during-decode.enabled,true)
 
 == downscale-1.html downscale-1.html
 
-== downscale-2a.html?203,52,left downscale-2a.html?203,52,left
-== downscale-2b.html?203,52,left downscale-2b.html?203,52,left
-== downscale-2c.html?203,52,left downscale-2c.html?203,52,left
-== downscale-2d.html?203,52,left downscale-2d.html?203,52,left
-== downscale-2e.html?203,52,left downscale-2e.html?203,52,left
-== downscale-2f.html?203,52,left downscale-2f.html?203,52,left
+fails == downscale-2a.html?203,52,left downscale-2a.html?203,52,left
+fails == downscale-2b.html?203,52,left downscale-2b.html?203,52,left
+fails == downscale-2c.html?203,52,left downscale-2c.html?203,52,left
+fails == downscale-2d.html?203,52,left downscale-2d.html?203,52,left
+fails == downscale-2e.html?203,52,left downscale-2e.html?203,52,left
+fails == downscale-2f.html?203,52,left downscale-2f.html?203,52,left
 
-== downscale-2a.html?205,53,left downscale-2a.html?205,53,left
-== downscale-2b.html?205,53,left downscale-2b.html?205,53,left
-== downscale-2c.html?205,53,left downscale-2c.html?205,53,left
-== downscale-2d.html?205,53,left downscale-2d.html?205,53,left
-== downscale-2e.html?205,53,left downscale-2e.html?205,53,left
-== downscale-2f.html?205,53,left downscale-2f.html?205,53,left
+fails == downscale-2a.html?205,53,left downscale-2a.html?205,53,left
+fails == downscale-2b.html?205,53,left downscale-2b.html?205,53,left
+fails == downscale-2c.html?205,53,left downscale-2c.html?205,53,left
+fails == downscale-2d.html?205,53,left downscale-2d.html?205,53,left
+fails == downscale-2e.html?205,53,left downscale-2e.html?205,53,left
+fails == downscale-2f.html?205,53,left downscale-2f.html?205,53,left
 
-== downscale-2a.html?203,52,right downscale-2a.html?203,52,right
-== downscale-2b.html?203,52,right downscale-2b.html?203,52,right
-== downscale-2c.html?203,52,right downscale-2c.html?203,52,right
-== downscale-2d.html?203,52,right downscale-2d.html?203,52,right
-== downscale-2e.html?203,52,right downscale-2e.html?203,52,right
-== downscale-2f.html?203,52,right downscale-2f.html?203,52,right
+fails == downscale-2a.html?203,52,right downscale-2a.html?203,52,right
+fails == downscale-2b.html?203,52,right downscale-2b.html?203,52,right
+fails == downscale-2c.html?203,52,right downscale-2c.html?203,52,right
+fails == downscale-2d.html?203,52,right downscale-2d.html?203,52,right
+fails == downscale-2e.html?203,52,right downscale-2e.html?203,52,right
+fails == downscale-2f.html?203,52,right downscale-2f.html?203,52,right
 
-== downscale-2a.html?205,53,right downscale-2a.html?205,53,right
-== downscale-2b.html?205,53,right downscale-2b.html?205,53,right
-== downscale-2c.html?205,53,right downscale-2c.html?205,53,right
-== downscale-2d.html?205,53,right downscale-2d.html?205,53,right
-== downscale-2e.html?205,53,right downscale-2e.html?205,53,right
-== downscale-2f.html?205,53,right downscale-2f.html?205,53,right
+fails == downscale-2a.html?205,53,right downscale-2a.html?205,53,right
+fails == downscale-2b.html?205,53,right downscale-2b.html?205,53,right
+fails == downscale-2c.html?205,53,right downscale-2c.html?205,53,right
+fails == downscale-2d.html?205,53,right downscale-2d.html?205,53,right
+fails == downscale-2e.html?205,53,right downscale-2e.html?205,53,right
+fails == downscale-2f.html?205,53,right downscale-2f.html?205,53,right
 
-== downscale-2a.html?203,52,top downscale-2a.html?203,52,top
-== downscale-2b.html?203,52,top downscale-2b.html?203,52,top
-== downscale-2c.html?203,52,top downscale-2c.html?203,52,top
-== downscale-2d.html?203,52,top downscale-2d.html?203,52,top
-== downscale-2e.html?203,52,top downscale-2e.html?203,52,top
-== downscale-2f.html?203,52,top downscale-2f.html?203,52,top
+fails == downscale-2a.html?203,52,top downscale-2a.html?203,52,top
+fails == downscale-2b.html?203,52,top downscale-2b.html?203,52,top
+fails == downscale-2c.html?203,52,top downscale-2c.html?203,52,top
+fails == downscale-2d.html?203,52,top downscale-2d.html?203,52,top
+fails == downscale-2e.html?203,52,top downscale-2e.html?203,52,top
+fails == downscale-2f.html?203,52,top downscale-2f.html?203,52,top
 
-== downscale-2a.html?205,53,top downscale-2a.html?205,53,top
-== downscale-2b.html?205,53,top downscale-2b.html?205,53,top
-== downscale-2c.html?205,53,top downscale-2c.html?205,53,top
-== downscale-2d.html?205,53,top downscale-2d.html?205,53,top
-== downscale-2e.html?205,53,top downscale-2e.html?205,53,top
-== downscale-2f.html?205,53,top downscale-2f.html?205,53,top
+fails == downscale-2a.html?205,53,top downscale-2a.html?205,53,top
+fails == downscale-2b.html?205,53,top downscale-2b.html?205,53,top
+fails == downscale-2c.html?205,53,top downscale-2c.html?205,53,top
+fails == downscale-2d.html?205,53,top downscale-2d.html?205,53,top
+fails == downscale-2e.html?205,53,top downscale-2e.html?205,53,top
+fails == downscale-2f.html?205,53,top downscale-2f.html?205,53,top
 
-== downscale-2a.html?203,52,bottom downscale-2a.html?203,52,bottom
-== downscale-2b.html?203,52,bottom downscale-2b.html?203,52,bottom
-== downscale-2c.html?203,52,bottom downscale-2c.html?203,52,bottom
-== downscale-2d.html?203,52,bottom downscale-2d.html?203,52,bottom
-== downscale-2e.html?203,52,bottom downscale-2e.html?203,52,bottom
-== downscale-2f.html?203,52,bottom downscale-2f.html?203,52,bottom
+fails == downscale-2a.html?203,52,bottom downscale-2a.html?203,52,bottom
+fails == downscale-2b.html?203,52,bottom downscale-2b.html?203,52,bottom
+fails == downscale-2c.html?203,52,bottom downscale-2c.html?203,52,bottom
+fails == downscale-2d.html?203,52,bottom downscale-2d.html?203,52,bottom
+fails == downscale-2e.html?203,52,bottom downscale-2e.html?203,52,bottom
+fails == downscale-2f.html?203,52,bottom downscale-2f.html?203,52,bottom
 
-== downscale-2a.html?205,53,bottom downscale-2a.html?205,53,bottom
-== downscale-2b.html?205,53,bottom downscale-2b.html?205,53,bottom
-== downscale-2c.html?205,53,bottom downscale-2c.html?205,53,bottom
-== downscale-2d.html?205,53,bottom downscale-2d.html?205,53,bottom
-== downscale-2e.html?205,53,bottom downscale-2e.html?205,53,bottom
-== downscale-2f.html?205,53,bottom downscale-2f.html?205,53,bottom
+fails == downscale-2a.html?205,53,bottom downscale-2a.html?205,53,bottom
+fails == downscale-2b.html?205,53,bottom downscale-2b.html?205,53,bottom
+fails == downscale-2c.html?205,53,bottom downscale-2c.html?205,53,bottom
+fails == downscale-2d.html?205,53,bottom downscale-2d.html?205,53,bottom
+fails == downscale-2e.html?205,53,bottom downscale-2e.html?205,53,bottom
+fails == downscale-2f.html?205,53,bottom downscale-2f.html?205,53,bottom
 
 # Skip on WinXP with skia content
 == downscale-moz-icon-1.html downscale-moz-icon-1.html
 
-== downscale-png.html?16,16,interlaced downscale-png.html?16,16,interlaced
-== downscale-png.html?24,24,interlaced downscale-png.html?24,24,interlaced
+fails == downscale-png.html?16,16,interlaced downscale-png.html?16,16,interlaced
+fails == downscale-png.html?24,24,interlaced downscale-png.html?24,24,interlaced
 
 # Non-transparent and transparent ICO images
-== downscale-16px.html?ff-0RGB.ico downscale-16px.html?ff-0RGB.ico
-== downscale-16px.html?ff-ARGB.ico downscale-16px.html?ff-ARGB.ico
+fails == downscale-16px.html?ff-0RGB.ico downscale-16px.html?ff-0RGB.ico
+fails == downscale-16px.html?ff-ARGB.ico downscale-16px.html?ff-ARGB.ico
 
 # Upside-down (negative height) BMP
-== downscale-8px.html?top-to-bottom-16x16-24bpp.bmp downscale-8px.html?top-to-bottom-16x16-24bpp.bmp
+fails == downscale-8px.html?top-to-bottom-16x16-24bpp.bmp downscale-8px.html?top-to-bottom-16x16-24bpp.bmp
 
 # Test downscaling from all supported formats from 256 to 32.
-== downscale-32px.html?.bmp downscale-32px.html?.bmp
-== downscale-32px.html?.gif downscale-32px.html?.gif
-== downscale-32px.html?.jpg downscale-32px.html?.jpg
-== downscale-32px.html?.png downscale-32px.html?.png
-== downscale-32px.html?.svg downscale-32px.html?.svg
-== downscale-32px.html?-bmp-in.ico downscale-32px.html?-bmp-in.ico
-== downscale-32px.html?-png-in.ico downscale-32px.html?-png-in.ico
+fails == downscale-32px.html?.bmp downscale-32px.html?.bmp
+fails == downscale-32px.html?.gif downscale-32px.html?.gif
+fails == downscale-32px.html?.jpg downscale-32px.html?.jpg
+fails == downscale-32px.html?.png downscale-32px.html?.png
+fails == downscale-32px.html?.svg downscale-32px.html?.svg
+fails == downscale-32px.html?-bmp-in.ico downscale-32px.html?-bmp-in.ico
+fails == downscale-32px.html?-png-in.ico downscale-32px.html?-png-in.ico
--- a/image/test/reftest/gif/reftest-stylo.list
+++ b/image/test/reftest/gif/reftest-stylo.list
@@ -1,35 +1,35 @@
 # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
 # GIF tests
 
 # tests for bug 519589
-== 1bit-255-trans.gif 1bit-255-trans.gif
-== in-colormap-trans.gif in-colormap-trans.gif
-== out-of-colormap-trans.gif out-of-colormap-trans.gif
+fails == 1bit-255-trans.gif 1bit-255-trans.gif
+fails == in-colormap-trans.gif in-colormap-trans.gif
+fails == out-of-colormap-trans.gif out-of-colormap-trans.gif
 
 # a GIF file that uses the comment extension
 == comment.gif comment.gif
 
 # a GIF file with a background smaller than the size of the canvas
-== small-background-size.gif small-background-size.gif
-== small-background-size-2.gif small-background-size-2.gif
+fails == small-background-size.gif small-background-size.gif
+fails == small-background-size-2.gif small-background-size-2.gif
 
 # a transparent gif that disposes previous frames with clear; we must properly
 # clear each frame to pass.
 random == delaytest.html?transparent-animation.gif delaytest.html?transparent-animation.gif
 
 # test for bug 641198
-== test_bug641198.html test_bug641198.html
+fails == test_bug641198.html test_bug641198.html
 
 # Bug 1062886: a gif with a single color and an offset
-== one-color-offset.gif one-color-offset.gif
+fails == one-color-offset.gif one-color-offset.gif
 
 # Bug 1068230
-== tile-transform.html tile-transform.html
+fails == tile-transform.html tile-transform.html
 
 # Bug 1234077
 == truncated-framerect.html truncated-framerect.html
 
 # webcam-simulacrum.mgif is a hand-edited file containing red.gif and blue.gif,
 # concatenated together with the relevant headers for
 # multipart/x-mixed-replace. Specifically, with the headers in
 # webcam-simulacrum.mjpg^headers^, the web browser will get the following:
@@ -46,9 +46,9 @@ random == delaytest.html?transparent-ani
 # \r\n
 # <contents of blue.gif> (no newline)
 # --BOUNDARYOMG--\r\n
 #
 # (The boundary is arbitrary, and just has to be defined as something that
 # won't be in the text of the contents themselves. --$(boundary)\r\n means
 # "Here is the beginning of a boundary," and --$(boundary)-- means "All done
 # sending you parts.")
-HTTP == webcam.html webcam.html
+fails HTTP == webcam.html webcam.html
--- a/image/test/reftest/ico/ico-bmp-1bpp/reftest-stylo.list
+++ b/image/test/reftest/ico/ico-bmp-1bpp/reftest-stylo.list
@@ -13,12 +13,12 @@
 == ico-size-9x9-1bpp.ico ico-size-9x9-1bpp.ico
 == ico-size-15x15-1bpp.ico ico-size-15x15-1bpp.ico
 == ico-size-16x16-1bpp.ico ico-size-16x16-1bpp.ico
 == ico-size-17x17-1bpp.ico ico-size-17x17-1bpp.ico
 == ico-size-31x31-1bpp.ico ico-size-31x31-1bpp.ico
 == ico-size-32x32-1bpp.ico ico-size-32x32-1bpp.ico
 == ico-size-33x33-1bpp.ico ico-size-33x33-1bpp.ico
 == ico-size-256x256-1bpp.ico ico-size-256x256-1bpp.ico
-== ico-partial-transparent-1bpp.ico ico-partial-transparent-1bpp.ico
-== ico-transparent-1bpp.ico ico-transparent-1bpp.ico
-== ico-not-square-transparent-1bpp.ico ico-not-square-transparent-1bpp.ico
+fails == ico-partial-transparent-1bpp.ico ico-partial-transparent-1bpp.ico
+fails == ico-transparent-1bpp.ico ico-transparent-1bpp.ico
+fails == ico-not-square-transparent-1bpp.ico ico-not-square-transparent-1bpp.ico
 
--- a/image/test/reftest/ico/ico-bmp-24bpp/reftest-stylo.list
+++ b/image/test/reftest/ico/ico-bmp-24bpp/reftest-stylo.list
@@ -13,12 +13,12 @@
 == ico-size-9x9-24bpp.ico ico-size-9x9-24bpp.ico
 == ico-size-15x15-24bpp.ico ico-size-15x15-24bpp.ico
 == ico-size-16x16-24bpp.ico ico-size-16x16-24bpp.ico
 == ico-size-17x17-24bpp.ico ico-size-17x17-24bpp.ico
 == ico-size-31x31-24bpp.ico ico-size-31x31-24bpp.ico
 == ico-size-32x32-24bpp.ico ico-size-32x32-24bpp.ico
 == ico-size-33x33-24bpp.ico ico-size-33x33-24bpp.ico
 == ico-size-256x256-24bpp.ico ico-size-256x256-24bpp.ico