From f2d13a2e2c6f2404d66391e31f22d23ca3b6247d Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Tue, 7 Jan 2014 22:55:38 +0100 Subject: [PATCH 1/2] Test if toggleHandTool is null before using it Do not break the viewer if the buttons are not available for some reason. --- web/hand_tool.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/hand_tool.js b/web/hand_tool.js index 987e11d1f..cd4b3054a 100644 --- a/web/hand_tool.js +++ b/web/hand_tool.js @@ -25,6 +25,9 @@ var HandTool = { this.handTool = new GrabToPan({ element: options.container, onActiveChanged: function(isActive) { + if (!toggleHandTool) { + return; + } if (isActive) { toggleHandTool.title = mozL10n.get('hand_tool_disable.title', null, 'Disable hand tool'); @@ -36,9 +39,11 @@ var HandTool = { toggleHandTool.firstElementChild.textContent = mozL10n.get('hand_tool_enable_label', null, 'Enable hand tool'); } - } + } }); - toggleHandTool.addEventListener('click', this.handTool.toggle, false); + if (toggleHandTool) { + toggleHandTool.addEventListener('click', this.handTool.toggle, false); + } // TODO: Read global prefs and call this.handTool.activate() if needed. }, From 838802c2d3fcd1a2fd048c74ffb3a4b124d567b6 Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Wed, 8 Jan 2014 11:59:30 +0100 Subject: [PATCH 2/2] Explain meaning of elements in secondary_toolbar --- web/secondary_toolbar.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/secondary_toolbar.js b/web/secondary_toolbar.js index aff0c2b75..c9375823d 100644 --- a/web/secondary_toolbar.js +++ b/web/secondary_toolbar.js @@ -41,7 +41,10 @@ var SecondaryToolbar = { // Attach the event listeners. var elements = [ + // Button to toggle the visibility of the secondary toolbar: { element: this.toggleButton, handler: this.toggle }, + // All items within the secondary toolbar + // (except for toggleHandTool, hand_tool.js is responsible for it): { element: this.presentationModeButton, handler: this.presentationModeClick }, { element: this.openFile, handler: this.openFileClick },