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

Delta Between Two Patch Sets: safari/ext/popup.js

Issue 5464830253203456: Refactored the abstraction layer to address prerendered pages on Safari caused by leaky abstraction (Closed)
Left Patch Set: Created Feb. 22, 2014, 10:45 a.m.
Right Patch Set: Addressed comments Created April 11, 2014, 2:47 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « safari/ext/content.js ('k') | stats.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 8
8 var updateSize = function() 9 var updateSize = function()
9 { 10 {
10 if (mayResize) 11 if (mayResize && !resizingScheduled)
11 { 12 {
12 safari.self.width = document.body.offsetWidth; 13 setTimeout(function()
13 safari.self.height = document.body.offsetHeight; 14 {
15 safari.self.width = document.body.offsetWidth;
16 safari.self.height = document.body.offsetHeight;
17
18 resizingScheduled = false;
19 }, 0);
20
21 resizingScheduled = true;
14 } 22 }
15 }; 23 };
16 24
17 window.addEventListener("load", function() 25 window.addEventListener("load", function()
18 { 26 {
19 updateSize(); 27 updateSize();
20 28
21 var MutationObserver = window.MutationObserver || window.WebKitMutationObser ver; 29 var MutationObserver = window.MutationObserver || window.WebKitMutationObser ver;
22 if (MutationObserver) 30 if (MutationObserver)
23 { 31 {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // the reloading code above. 65 // the reloading code above.
58 window.ext = { 66 window.ext = {
59 __proto__: safari.extension.globalPage.contentWindow.ext, 67 __proto__: safari.extension.globalPage.contentWindow.ext,
60 68
61 closePopup: function() 69 closePopup: function()
62 { 70 {
63 safari.self.hide(); 71 safari.self.hide();
64 } 72 }
65 }; 73 };
66 })(); 74 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld