Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | /* |
michael@0 | 6 | Construct the HTML for the annotation list. |
michael@0 | 7 | |
michael@0 | 8 | Bind a function to click events on the link that send a message back to |
michael@0 | 9 | the add-on code, so it can open the link in the main browser. |
michael@0 | 10 | */ |
michael@0 | 11 | |
michael@0 | 12 | self.on("message", function onMessage(storedAnnotations) { |
michael@0 | 13 | var annotationList = $('#annotation-list'); |
michael@0 | 14 | annotationList.empty(); |
michael@0 | 15 | storedAnnotations.forEach( |
michael@0 | 16 | function(storedAnnotation) { |
michael@0 | 17 | var annotationHtml = $('#template .annotation-details').clone(); |
michael@0 | 18 | annotationHtml.find('.url').text(storedAnnotation.url) |
michael@0 | 19 | .attr('href', storedAnnotation.url); |
michael@0 | 20 | annotationHtml.find('.url').bind('click', function(event) { |
michael@0 | 21 | event.stopPropagation(); |
michael@0 | 22 | event.preventDefault(); |
michael@0 | 23 | self.postMessage(storedAnnotation.url); |
michael@0 | 24 | }); |
michael@0 | 25 | annotationHtml.find('.selection-text') |
michael@0 | 26 | .text(storedAnnotation.anchorText); |
michael@0 | 27 | annotationHtml.find('.annotation-text') |
michael@0 | 28 | .text(storedAnnotation.annotationText); |
michael@0 | 29 | annotationList.append(annotationHtml); |
michael@0 | 30 | }); |
michael@0 | 31 | }); |