Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7460)

Unified Diff: chrome/common/extensions/docs/examples/extensions/gmail/background.html

Issue 7348006: Google Mail Checker fixes: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
« no previous file with comments | « chrome/common/extensions/docs/examples/extensions/gmail.zip ('k') | chrome/common/extensions/docs/samples.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698