From 72c8711cd341c011134857dbab4a8412b3639da4 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 3 May 2016 12:07:23 -0400 Subject: [PATCH] String::contains() -> indexOf() for Firefox 48 (and 38) compatibility .contains() was removed in Firefox 48, but .includes() wasn't available until 40, so use indexOf() for now. We can start using .contains() once we no longer need to support 38 ESR. --- chrome/content/zotero/xpcom/quickCopy.js | 2 +- chrome/content/zotero/xpcom/search.js | 2 +- components/zotero-protocol-handler.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/quickCopy.js b/chrome/content/zotero/xpcom/quickCopy.js index 3018dbe04a..307ba33a9a 100644 --- a/chrome/content/zotero/xpcom/quickCopy.js +++ b/chrome/content/zotero/xpcom/quickCopy.js @@ -145,7 +145,7 @@ Zotero.QuickCopy = new function() { // Only concern ourselves with entries containing the current domain // or paths that apply to all domains - if (!row.domainPath.contains(urlDomain[0]) && !row.domainPath.startsWith('/')) { + if (!row.domainPath.indexOf(urlDomain[0]) != -1 && !row.domainPath.startsWith('/')) { continue; } diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js index 1b631ea73e..c5a92eaeb8 100644 --- a/chrome/content/zotero/xpcom/search.js +++ b/chrome/content/zotero/xpcom/search.js @@ -1123,7 +1123,7 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () { let objectTypeClass = Zotero.DataObjectUtilities.getObjectsClassForObjectType(objectType); // Old-style library-key hash - if (objKey.contains('_')) { + if (objKey.indexOf('_') != -1) { [objLibraryID, objKey] = objKey.split('_'); } // libraryID assigned on search diff --git a/components/zotero-protocol-handler.js b/components/zotero-protocol-handler.js index 3bc48c5066..17e3426966 100644 --- a/components/zotero-protocol-handler.js +++ b/components/zotero-protocol-handler.js @@ -172,7 +172,7 @@ function ZoteroProtocolHandler() { // search // items // item - if (params.sort.contains('/')) { + if (params.sort.indexOf('/') != -1) { let parts = params.sort.split('/'); params.sort = parts[0]; params.direction = parts[1] == 'd' ? 'desc' : 'asc';