Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: safari/ext/popup.js

Issue 5193308200501248: Issue 1287 - Use window.location instead document.location (Closed)
Patch Set: Created Aug. 29, 2014, 3:33 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « safari/ext/content.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 (function() 1 (function()
2 { 2 {
3 // Safari doesn't adjust the size of the popover automatically to the size 3 // Safari doesn't adjust the size of the popover automatically to the size
4 // of its content, like when the ad counter is expanded/collapsed. So we add 4 // of its content, like when the ad counter is expanded/collapsed. So we add
5 // event listeners to do so. 5 // event listeners to do so.
6 var mayResize = true; 6 var mayResize = true;
7 var resizingScheduled = false; 7 var resizingScheduled = false;
8 8
9 var updateSize = function() 9 var updateSize = function()
10 { 10 {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 51
52 // Safari will load the popover once, and then show it everytime the icon is 52 // Safari will load the popover once, and then show it everytime the icon is
53 // clicked. While Chrome loads it everytime you click the icon. So in order to 53 // clicked. While Chrome loads it everytime you click the icon. So in order to
54 // make the popover show the right state and details, we have to emulate the 54 // make the popover show the right state and details, we have to emulate the
55 // same behavior as on Chrome, by reloading the popover every time it is shown . 55 // same behavior as on Chrome, by reloading the popover every time it is shown .
56 safari.self.addEventListener("popover", function() 56 safari.self.addEventListener("popover", function()
57 { 57 {
58 mayResize = false; 58 mayResize = false;
59 document.documentElement.style.display = "none"; 59 document.documentElement.style.display = "none";
60 document.location.reload(); 60 location.reload();
61 }); 61 });
62 62
63 63
64 // Safari doesn't hide popovers automatically, when we change the active tab 64 // Safari doesn't hide popovers automatically, when we change the active tab
65 // programmatically, like when the options link is clicked. So we add an event 65 // programmatically, like when the options link is clicked. So we add an event
66 // listener to do so. 66 // listener to do so.
67 safari.application.addEventListener("activate", function() 67 safari.application.addEventListener("activate", function()
68 { 68 {
69 safari.self.hide(); 69 safari.self.hide();
70 }, true); 70 }, true);
71 71
72 72
73 // import ext into the javascript context of the popover. This code might fail , 73 // import ext into the javascript context of the popover. This code might fail ,
74 // when the background page isn't ready yet. So it is important to put it belo w 74 // when the background page isn't ready yet. So it is important to put it belo w
75 // the reloading code above. 75 // the reloading code above.
76 window.ext = { 76 window.ext = {
77 __proto__: safari.extension.globalPage.contentWindow.ext, 77 __proto__: safari.extension.globalPage.contentWindow.ext,
78 78
79 closePopup: function() 79 closePopup: function()
80 { 80 {
81 safari.self.hide(); 81 safari.self.hide();
82 } 82 }
83 }; 83 };
84 })(); 84 })();
OLDNEW
« no previous file with comments | « safari/ext/content.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld