Skip to content

Commit 9c01bc3

Browse files
committed
Fix nits
1 parent a35e400 commit 9c01bc3

8 files changed

+37
-37
lines changed

src/core/worker.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,6 @@ class WorkerMessageHandler {
517517
"GetOperatorList",
518518
function wphSetupRenderPage(data, sink) {
519519
var pageIndex = data.pageIndex;
520-
const annotationStorage = data.annotationStorage;
521520
pdfManager.getPage(pageIndex).then(function (page) {
522521
var task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
523522
startWorkerTask(task);
@@ -533,7 +532,7 @@ class WorkerMessageHandler {
533532
task,
534533
intent: data.intent,
535534
renderInteractiveForms: data.renderInteractiveForms,
536-
annotationStorage,
535+
annotationStorage: data.annotationStorage,
537536
})
538537
.then(
539538
function (operatorListInfo) {

src/display/annotation_layer.js

+1
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {
543543
*/
544544
render() {
545545
this.container.className = "buttonWidgetAnnotation checkBox";
546+
546547
const element = document.createElement("input");
547548
element.disabled = this.data.readOnly;
548549
element.type = "checkbox";

src/display/annotation_storage.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2014 Mozilla Foundation
1+
/* Copyright 2020 Mozilla Foundation
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.
@@ -14,21 +14,21 @@
1414
*/
1515

1616
class AnnotationStorage {
17-
constructor(storage = {}) {
18-
this._storage = storage;
17+
constructor() {
18+
this._storage = {};
1919
}
2020

2121
/**
22-
* Get the value for a given key if it doesn't exist
23-
* or store and return the defaultValue
22+
* Get the value for a given key if it exists
23+
* or store and return the default value
2424
*
2525
* @public
2626
* @memberof AnnotationStorage
27-
* @param {String} key
27+
* @param {string} key
2828
* @param {Object} defaultValue
2929
* @returns {Object}
3030
*/
31-
getOrCreate(key, defaultValue) {
31+
getOrCreateValue(key, defaultValue) {
3232
if (key in this._storage) {
3333
return this._storage[key];
3434
}
@@ -49,7 +49,7 @@ class AnnotationStorage {
4949
this._storage[key] = value;
5050
}
5151

52-
getDict() {
52+
getAll() {
5353
return this._storage;
5454
}
5555
}

src/display/api.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ class PDFDocumentProxy {
581581
}
582582

583583
/**
584-
* @type {AnnotationStorage} storage for annotations.
584+
* @type {AnnotationStorage} Storage for annotation data in forms.
585585
*/
586586
get annotationStorage() {
587587
return this._annotationStorage;

test/unit/annotation_storage_spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
import { AnnotationStorage } from "../../src/display/annotation_storage.js";
1717

1818
describe("AnnotationStorage", function () {
19-
describe("GetOrCreate", function () {
19+
describe("GetOrCreateValue", function () {
2020
it("should get and set a new value in the annotation storage", function (done) {
2121
const annotationStorage = new AnnotationStorage();
22-
let value = annotationStorage.getOrCreate("123A", "hello world");
22+
let value = annotationStorage.getOrCreateValue("123A", "hello world");
2323
expect(value).toEqual("hello world");
2424

2525
// the second argument is the default value to use
2626
// if the key isn't in the storage
27-
value = annotationStorage.getOrCreate("123A", "an other string");
27+
value = annotationStorage.getOrCreateValue("123A", "an other string");
2828
expect(value).toEqual("hello world");
2929
done();
3030
});
@@ -34,7 +34,7 @@ describe("AnnotationStorage", function () {
3434
it("should set a new value in the annotation storage", function (done) {
3535
const annotationStorage = new AnnotationStorage();
3636
annotationStorage.setValue("123A", "an other string");
37-
const value = annotationStorage.getDict()["123A"];
37+
const value = annotationStorage.getAll()["123A"];
3838
expect(value).toEqual("an other string");
3939
done();
4040
});

test/unit/jasmine-boot.js

+20-20
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,26 @@
1313
* limitations under the License.
1414
*/
1515
/*
16-
Copyright (c) 2008-2016 Pivotal Labs
17-
18-
Permission is hereby granted, free of charge, to any person obtaining
19-
a copy of this software and associated documentation files (the
20-
"Software"), to deal in the Software without restriction, including
21-
without limitation the rights to use, copy, modify, merge, publish,
22-
distribute, sublicense, and/or sell copies of the Software, and to
23-
permit persons to whom the Software is furnished to do so, subject to
24-
the following conditions:
25-
26-
The above copyright notice and this permission notice shall be
27-
included in all copies or substantial portions of the Software.
28-
29-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
30-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
32-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
33-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
34-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
35-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16+
Copyright (c) 2008-2016 Pivotal Labs
17+
18+
Permission is hereby granted, free of charge, to any person obtaining
19+
a copy of this software and associated documentation files (the
20+
"Software"), to deal in the Software without restriction, including
21+
without limitation the rights to use, copy, modify, merge, publish,
22+
distribute, sublicense, and/or sell copies of the Software, and to
23+
permit persons to whom the Software is furnished to do so, subject to
24+
the following conditions:
25+
26+
The above copyright notice and this permission notice shall be
27+
included in all copies or substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
30+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
32+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
33+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
34+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
35+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3636
*/
3737
/* globals jasmineRequire, TestReporter */
3838

web/firefox_print_service.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function composePage(pdfDocument, pageNumber, size, printContainer) {
5353
transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],
5454
viewport: pdfPage.getViewport({ scale: 1, rotation: size.rotation }),
5555
intent: "print",
56-
annotationStorage: pdfDocument.annotationStorage.getDict(),
56+
annotationStorage: pdfDocument.annotationStorage.getAll(),
5757
};
5858
return pdfPage.render(renderContext).promise;
5959
})

web/pdf_print_service.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) {
4949
transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],
5050
viewport: pdfPage.getViewport({ scale: 1, rotation: size.rotation }),
5151
intent: "print",
52-
annotationStorage: pdfDocument.annotationStorage.getDict(),
52+
annotationStorage: pdfDocument.annotationStorage.getAll(),
5353
};
5454
return pdfPage.render(renderContext).promise;
5555
})

0 commit comments

Comments
 (0)