Merge pull request #5059 from timvandermeij/unused-code
Removing unused code and enforcing additional JSHint options
This commit is contained in:
		
						commit
						7026543663
					
				| @ -9,6 +9,9 @@ | |||||||
|   "quotmark": "single", |   "quotmark": "single", | ||||||
|   "trailing": true, |   "trailing": true, | ||||||
|   "curly": true, |   "curly": true, | ||||||
|  |   "undef": true, | ||||||
|  |   "noarg": true, | ||||||
|  |   "nonbsp": true, | ||||||
| 
 | 
 | ||||||
|   // Relaxing |   // Relaxing | ||||||
|   "boss": true, |   "boss": true, | ||||||
|  | |||||||
| @ -100,7 +100,7 @@ var AnnotationUtils = (function AnnotationUtilsClosure() { | |||||||
|     return element; |     return element; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   function getHtmlElementForTextAnnotation(item, commonObjs) { |   function getHtmlElementForTextAnnotation(item) { | ||||||
|     var rect = item.rect; |     var rect = item.rect; | ||||||
| 
 | 
 | ||||||
|     // sanity check because of OOo-generated PDFs
 |     // sanity check because of OOo-generated PDFs
 | ||||||
| @ -217,8 +217,7 @@ var AnnotationUtils = (function AnnotationUtilsClosure() { | |||||||
|     return container; |     return container; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   function getHtmlElementForLinkAnnotation(item, commonObjs) { |   function getHtmlElementForLinkAnnotation(item) { | ||||||
| 
 |  | ||||||
|     var container = initContainer(item); |     var container = initContainer(item); | ||||||
|     container.className = 'annotLink'; |     container.className = 'annotLink'; | ||||||
| 
 | 
 | ||||||
| @ -238,9 +237,9 @@ var AnnotationUtils = (function AnnotationUtilsClosure() { | |||||||
|       case AnnotationType.WIDGET: |       case AnnotationType.WIDGET: | ||||||
|         return getHtmlElementForTextWidgetAnnotation(data, objs); |         return getHtmlElementForTextWidgetAnnotation(data, objs); | ||||||
|       case AnnotationType.TEXT: |       case AnnotationType.TEXT: | ||||||
|         return getHtmlElementForTextAnnotation(data, objs); |         return getHtmlElementForTextAnnotation(data); | ||||||
|       case AnnotationType.LINK: |       case AnnotationType.LINK: | ||||||
|         return getHtmlElementForLinkAnnotation(data, objs); |         return getHtmlElementForLinkAnnotation(data); | ||||||
|       default: |       default: | ||||||
|         throw new Error('Unsupported annotationType: ' + data.annotationType); |         throw new Error('Unsupported annotationType: ' + data.annotationType); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ | |||||||
|  */ |  */ | ||||||
| /* globals error, PDFJS, assert, info, shadow, TextRenderingMode, | /* globals error, PDFJS, assert, info, shadow, TextRenderingMode, | ||||||
|            FONT_IDENTITY_MATRIX, Uint32ArrayView, IDENTITY_MATRIX, ImageData, |            FONT_IDENTITY_MATRIX, Uint32ArrayView, IDENTITY_MATRIX, ImageData, | ||||||
|            ImageKind, isArray, isNum, TilingPattern, OPS, Promise, Util, warn, |            ImageKind, isArray, isNum, TilingPattern, OPS, Util, warn, | ||||||
|            getShadingPatternFromIR, WebGLUtils */ |            getShadingPatternFromIR, WebGLUtils */ | ||||||
| 
 | 
 | ||||||
| 'use strict'; | 'use strict'; | ||||||
|  | |||||||
| @ -15,6 +15,7 @@ | |||||||
|  * limitations under the License. |  * limitations under the License. | ||||||
|  */ |  */ | ||||||
| /*jshint globalstrict: false */ | /*jshint globalstrict: false */ | ||||||
|  | /* globals PDFJS */ | ||||||
| 
 | 
 | ||||||
| // Initializing PDFJS global object (if still undefined)
 | // Initializing PDFJS global object (if still undefined)
 | ||||||
| if (typeof PDFJS === 'undefined') { | if (typeof PDFJS === 'undefined') { | ||||||
|  | |||||||
| @ -384,7 +384,7 @@ var Type2Parser = function type2Parser(aFilePath) { | |||||||
|       error('Need to support CFFExpertSubsetCharset'); |       error('Need to support CFFExpertSubsetCharset'); | ||||||
|     } else { |     } else { | ||||||
|       aStream.pos = charsetEntry; |       aStream.pos = charsetEntry; | ||||||
|       var charset = readCharset(aStream, charStrings); |       readCharset(aStream, charStrings); | ||||||
|     } |     } | ||||||
|   }; |   }; | ||||||
| }; | }; | ||||||
|  | |||||||
| @ -14,7 +14,7 @@ | |||||||
|  * See the License for the specific language governing permissions and |  * See the License for the specific language governing permissions and | ||||||
|  * limitations under the License. |  * limitations under the License. | ||||||
|  */ |  */ | ||||||
| /* globals PDFJS, getPdf, combineUrl, StatTimer, SpecialPowers, Promise */ | /* globals PDFJS, combineUrl, StatTimer, SpecialPowers, Promise */ | ||||||
| 
 | 
 | ||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
| @ -274,8 +274,6 @@ function nextPage(task, loadError) { | |||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   var page = null; |  | ||||||
| 
 |  | ||||||
|   if (!failure) { |   if (!failure) { | ||||||
|     try { |     try { | ||||||
|       log(' loading page ' + task.pageNum + '/' + task.pdfDoc.numPages + |       log(' loading page ' + task.pageNum + '/' + task.pdfDoc.numPages + | ||||||
|  | |||||||
							
								
								
									
										18
									
								
								test/test.js
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								test/test.js
									
									
									
									
									
								
							| @ -25,7 +25,6 @@ var path = require('path'); | |||||||
| var fs = require('fs'); | var fs = require('fs'); | ||||||
| var os = require('os'); | var os = require('os'); | ||||||
| var url = require('url'); | var url = require('url'); | ||||||
| var spawn = require('child_process').spawn; |  | ||||||
| var testUtils = require('./testutils.js'); | var testUtils = require('./testutils.js'); | ||||||
| 
 | 
 | ||||||
| function parseOptions() { | function parseOptions() { | ||||||
| @ -630,22 +629,6 @@ function startBrowsers(url, initSessionCallback) { | |||||||
|   }); |   }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function stopBrowsers(callback) { |  | ||||||
|   var count = sessions.length; |  | ||||||
|   sessions.forEach(function (session) { |  | ||||||
|     if (session.closed) { |  | ||||||
|       return; |  | ||||||
|     } |  | ||||||
|     session.browser.stop(function () { |  | ||||||
|       session.closed = true; |  | ||||||
|       count--; |  | ||||||
|       if (count === 0 && callback) { |  | ||||||
|         callback(); |  | ||||||
|       } |  | ||||||
|     }); |  | ||||||
|   }); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| function getServerBaseAddress() { | function getServerBaseAddress() { | ||||||
|   return 'http://' + host + ':' + server.port; |   return 'http://' + host + ':' + server.port; | ||||||
| } | } | ||||||
| @ -690,7 +673,6 @@ function closeSession(browser) { | |||||||
| 
 | 
 | ||||||
| function ensurePDFsDownloaded(callback) { | function ensurePDFsDownloaded(callback) { | ||||||
|   var downloadUtils = require('./downloadutils.js'); |   var downloadUtils = require('./downloadutils.js'); | ||||||
|   var downloadManifestFiles = downloadUtils.downloadManifestFiles; |  | ||||||
|   var manifest = JSON.parse(fs.readFileSync(options.manifestFile)); |   var manifest = JSON.parse(fs.readFileSync(options.manifestFile)); | ||||||
|   downloadUtils.downloadManifestFiles(manifest, function () { |   downloadUtils.downloadManifestFiles(manifest, function () { | ||||||
|     downloadUtils.verifyManifestFiles(manifest, function (hasErrors) { |     downloadUtils.verifyManifestFiles(manifest, function (hasErrors) { | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||||||
| /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ | /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ | ||||||
| /* globals PDFJS, expect, it, describe, Promise, combineUrl, waitsFor, runs */ | /* globals PDFJS, expect, it, describe, Promise, combineUrl, waitsFor */ | ||||||
| 
 | 
 | ||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||||||
| /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ | /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ | ||||||
| /* globals expect, it, describe, StringStream, Lexer, CMapFactory, Name */ | /* globals expect, it, describe, StringStream, CMapFactory, Name */ | ||||||
| 
 | 
 | ||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
| @ -95,8 +95,7 @@ describe('cmap', function() { | |||||||
|     expect(cmap.vertical).toEqual(true); |     expect(cmap.vertical).toEqual(true); | ||||||
|   }); |   }); | ||||||
|   it('loads built in cmap', function() { |   it('loads built in cmap', function() { | ||||||
|     var cmap = CMapFactory.create(new Name('Adobe-Japan1-1'), |     CMapFactory.create(new Name('Adobe-Japan1-1'), '../../external/cmaps/', | ||||||
|                                   '../../external/cmaps/', |  | ||||||
|                        null); |                        null); | ||||||
|   }); |   }); | ||||||
| }); | }); | ||||||
|  | |||||||
| @ -601,20 +601,15 @@ describe('CipherTransformFactory', function() { | |||||||
|   describe('#ctor', function() { |   describe('#ctor', function() { | ||||||
|     describe('AES256 Revision 5', function () { |     describe('AES256 Revision 5', function () { | ||||||
|       it('should accept user password', function () { |       it('should accept user password', function () { | ||||||
|         var factory = new CipherTransformFactory(new DictMock(aes256Map), |         new CipherTransformFactory(new DictMock(aes256Map), fileID1, 'user'); | ||||||
|                                                  fileID1, |  | ||||||
|                                                  'user'); |  | ||||||
|       }); |       }); | ||||||
|       it('should accept owner password', function () { |       it('should accept owner password', function () { | ||||||
|         var factory = new CipherTransformFactory(new DictMock(aes256Map), |         new CipherTransformFactory(new DictMock(aes256Map), fileID1, 'owner'); | ||||||
|                                                  fileID1, |  | ||||||
|                                                  'owner'); |  | ||||||
|       }); |       }); | ||||||
|       it('should not accept wrong password', function () { |       it('should not accept wrong password', function () { | ||||||
|         var thrown = false; |         var thrown = false; | ||||||
|         try { |         try { | ||||||
|           var factory = new CipherTransformFactory(new DictMock(aes256Map), |           new CipherTransformFactory(new DictMock(aes256Map), fileID1, | ||||||
|                                                    fileID1, |  | ||||||
|                                      'wrong'); |                                      'wrong'); | ||||||
|         } catch (e) { |         } catch (e) { | ||||||
|           thrown = true; |           thrown = true; | ||||||
| @ -622,27 +617,23 @@ describe('CipherTransformFactory', function() { | |||||||
|         expect(thrown).toEqual(true); |         expect(thrown).toEqual(true); | ||||||
|       }); |       }); | ||||||
|       it('should accept blank password', function () { |       it('should accept blank password', function () { | ||||||
|         var factory = new CipherTransformFactory(new DictMock(aes256BlankMap), |         new CipherTransformFactory(new DictMock(aes256BlankMap), fileID1); | ||||||
|                                                  fileID1); |  | ||||||
|       }); |       }); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     describe('AES256 Revision 6', function () { |     describe('AES256 Revision 6', function () { | ||||||
|       it('should accept user password', function () { |       it('should accept user password', function () { | ||||||
|         var factory = new CipherTransformFactory(new DictMock(aes256IsoMap), |         new CipherTransformFactory(new DictMock(aes256IsoMap), fileID1, | ||||||
|                                                  fileID1, |  | ||||||
|                                    'user'); |                                    'user'); | ||||||
|       }); |       }); | ||||||
|       it('should accept owner password', function () { |       it('should accept owner password', function () { | ||||||
|         var factory = new CipherTransformFactory(new DictMock(aes256IsoMap), |         new CipherTransformFactory(new DictMock(aes256IsoMap), fileID1, | ||||||
|                                                  fileID1, |  | ||||||
|                                    'owner'); |                                    'owner'); | ||||||
|       }); |       }); | ||||||
|       it('should not accept wrong password', function () { |       it('should not accept wrong password', function () { | ||||||
|         var thrown = false; |         var thrown = false; | ||||||
|         try { |         try { | ||||||
|           var factory = new CipherTransformFactory(new DictMock(aes256IsoMap), |           new CipherTransformFactory(new DictMock(aes256IsoMap), fileID1, | ||||||
|                                                    fileID1, |  | ||||||
|                                      'wrong'); |                                      'wrong'); | ||||||
|         } catch (e) { |         } catch (e) { | ||||||
|           thrown = true; |           thrown = true; | ||||||
| @ -650,25 +641,21 @@ describe('CipherTransformFactory', function() { | |||||||
|         expect(thrown).toEqual(true); |         expect(thrown).toEqual(true); | ||||||
|       }); |       }); | ||||||
|       it('should accept blank password', function () { |       it('should accept blank password', function () { | ||||||
|         var factory = new CipherTransformFactory(new DictMock(aes256IBlankMap), |         new CipherTransformFactory(new DictMock(aes256IBlankMap), fileID1); | ||||||
|                                                  fileID1); |  | ||||||
|       }); |       }); | ||||||
|     }); |     }); | ||||||
|     it('should accept user password', function() { |     it('should accept user password', function() { | ||||||
|       var factory = new CipherTransformFactory(new DictMock(map1), fileID1, |       new CipherTransformFactory(new DictMock(map1), fileID1, '123456'); | ||||||
|                                                '123456'); |  | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     it('should accept owner password', function() { |     it('should accept owner password', function() { | ||||||
|       var factory = new CipherTransformFactory(new DictMock(map1), fileID1, |       new CipherTransformFactory(new DictMock(map1), fileID1, '654321'); | ||||||
|                                                '654321'); |  | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     it('should not accept wrong password', function() { |     it('should not accept wrong password', function() { | ||||||
|       var thrown = false; |       var thrown = false; | ||||||
|       try { |       try { | ||||||
|         var factory = new CipherTransformFactory(new DictMock(map1), fileID1, |         new CipherTransformFactory(new DictMock(map1), fileID1, 'wrong'); | ||||||
|                                                  'wrong'); |  | ||||||
|       } catch (e) { |       } catch (e) { | ||||||
|         thrown = true; |         thrown = true; | ||||||
|       } |       } | ||||||
| @ -676,7 +663,7 @@ describe('CipherTransformFactory', function() { | |||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     it('should accept no password', function() { |     it('should accept no password', function() { | ||||||
|       var factory = new CipherTransformFactory(new DictMock(map2), fileID2); |       new CipherTransformFactory(new DictMock(map2), fileID2); | ||||||
|     }); |     }); | ||||||
|   }); |   }); | ||||||
| }); | }); | ||||||
|  | |||||||
| @ -6,17 +6,6 @@ | |||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
| describe('font', function() { | describe('font', function() { | ||||||
|   function hexDump(bytes) { |  | ||||||
|     var line = ''; |  | ||||||
|     for (var i = 0, ii = bytes.length; i < ii; ++i) { |  | ||||||
|       var b = bytes[i].toString(16); |  | ||||||
|       if (b.length < 2) { |  | ||||||
|         b = '0' + b; |  | ||||||
|       } |  | ||||||
|       line += b.toString(16); |  | ||||||
|     } |  | ||||||
|     return line; |  | ||||||
|   } |  | ||||||
|   // This example font comes from the CFF spec:
 |   // This example font comes from the CFF spec:
 | ||||||
|   // http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5176.CFF.pdf
 |   // http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5176.CFF.pdf
 | ||||||
|   var exampleFont = '0100040100010101134142434445462b' + |   var exampleFont = '0100040100010101134142434445462b' + | ||||||
| @ -41,14 +30,6 @@ describe('font', function() { | |||||||
|     } |     } | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   function bytesToString(bytesArray) { |  | ||||||
|     var str = ''; |  | ||||||
|     for (var i = 0, ii = bytesArray.length; i < ii; i++) { |  | ||||||
|       str += String.fromCharCode(bytesArray[i]); |  | ||||||
|     } |  | ||||||
|     return str; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   describe('CFFParser', function() { |   describe('CFFParser', function() { | ||||||
|     var parser = new CFFParser(fontData, {}); |     var parser = new CFFParser(fontData, {}); | ||||||
|     var cff = parser.parse(); |     var cff = parser.parse(); | ||||||
| @ -381,7 +362,7 @@ describe('font', function() { | |||||||
|         '/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def\n'); |         '/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def\n'); | ||||||
|       var parser = new Type1Parser(stream); |       var parser = new Type1Parser(stream); | ||||||
|       var props = {}; |       var props = {}; | ||||||
|       var program = parser.extractFontHeader(props); |       parser.extractFontHeader(props); | ||||||
|       expect(props.fontMatrix).toEqual([0.001, 0, 0, 0.001, 0, 0]); |       expect(props.fontMatrix).toEqual([0.001, 0, 0, 0.001, 0, 0]); | ||||||
|     }); |     }); | ||||||
|     it('parses font header encoding', function() { |     it('parses font header encoding', function() { | ||||||
| @ -392,7 +373,7 @@ describe('font', function() { | |||||||
|         'readonly def\n'); |         'readonly def\n'); | ||||||
|       var parser = new Type1Parser(stream); |       var parser = new Type1Parser(stream); | ||||||
|       var props = { overridableEncoding: true }; |       var props = { overridableEncoding: true }; | ||||||
|       var program = parser.extractFontHeader(props); |       parser.extractFontHeader(props); | ||||||
|       expect(props.builtInEncoding[33]).toEqual('arrowright'); |       expect(props.builtInEncoding[33]).toEqual('arrowright'); | ||||||
|     }); |     }); | ||||||
|   }); |   }); | ||||||
|  | |||||||
| @ -1,10 +1,10 @@ | |||||||
| /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||||||
| /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ | /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ | ||||||
| /*jshint globalstrict: false */ | /* globals SpecialPowers */ | ||||||
| 
 | 
 | ||||||
| var TestReporter = function(browser, appPath) { |  | ||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
|  | var TestReporter = function(browser, appPath) { | ||||||
|   function send(action, json, cb) { |   function send(action, json, cb) { | ||||||
|     var r = new XMLHttpRequest(); |     var r = new XMLHttpRequest(); | ||||||
|     // (The POST URI is ignored atm.)
 |     // (The POST URI is ignored atm.)
 | ||||||
|  | |||||||
| @ -66,7 +66,6 @@ WebServer.prototype = { | |||||||
|     this.server = null; |     this.server = null; | ||||||
|   }, |   }, | ||||||
|   _handler: function (req, res) { |   _handler: function (req, res) { | ||||||
|     var agent = req.headers['user-agent']; |  | ||||||
|     var url = req.url; |     var url = req.url; | ||||||
|     var urlParts = /([^?]*)((?:\?(.*))?)/.exec(url); |     var urlParts = /([^?]*)((?:\?(.*))?)/.exec(url); | ||||||
|     var pathPart = decodeURI(urlParts[1]), queryPart = urlParts[3]; |     var pathPart = decodeURI(urlParts[1]), queryPart = urlParts[3]; | ||||||
|  | |||||||
| @ -14,7 +14,6 @@ | |||||||
|  * See the License for the specific language governing permissions and |  * See the License for the specific language governing permissions and | ||||||
|  * limitations under the License. |  * limitations under the License. | ||||||
|  */ |  */ | ||||||
| /* globals */ |  | ||||||
| 
 | 
 | ||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -14,7 +14,7 @@ | |||||||
|  * See the License for the specific language governing permissions and |  * See the License for the specific language governing permissions and | ||||||
|  * limitations under the License. |  * limitations under the License. | ||||||
|  */ |  */ | ||||||
| /* globals mozL10n, GrabToPan, PDFView, Preferences, SecondaryToolbar */ | /* globals mozL10n, GrabToPan, Preferences, SecondaryToolbar */ | ||||||
| 
 | 
 | ||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user