Index: chrome/common/extensions/docs/examples/extensions/gmail/background.html |
diff --git a/chrome/common/extensions/docs/examples/extensions/gmail/background.html b/chrome/common/extensions/docs/examples/extensions/gmail/background.html |
index 4e557be86bc1776295bc1a49a7b3ef99de87b8f5..bb24259b1ae4a6019937be25922cd2f15fad5c30 100644 |
--- a/chrome/common/extensions/docs/examples/extensions/gmail/background.html |
+++ b/chrome/common/extensions/docs/examples/extensions/gmail/background.html |
@@ -1,6 +1,9 @@ |
<html> |
<head> |
<script> |
+// Identifier used to debug the possibility of multiple instances of the |
+// extension making requests on behalf of a single user. |
+var instanceId = 'gmc' + parseInt(Date.now() * Math.random(), 10); |
var animationFrames = 36; |
var animationSpeed = 10; // ms |
var canvas; |
@@ -24,7 +27,9 @@ function getGmailUrl() { |
} |
function getFeedUrl() { |
- return getGmailUrl() + "feed/atom"; |
+ // "zx" is a Gmail query parameter that is expected to contain a random |
+ // string and may be ignored/stripped. |
+ return getGmailUrl() + "feed/atom?zx=" + encodeURIComponent(instanceId); |
} |
function isGmailUrl(url) { |
@@ -106,8 +111,8 @@ function init() { |
function scheduleRequest() { |
var randomness = Math.random() * 2; |
var exponent = Math.pow(2, requestFailureCount); |
- var delay = Math.min(randomness * pollIntervalMin * exponent, |
- pollIntervalMax); |
+ var multiplier = Math.max(randomness * exponent, 1); |
+ var delay = Math.min(multiplier * pollIntervalMin, pollIntervalMax); |
delay = Math.round(delay); |
window.setTimeout(startRequest, delay); |