Skip to content

Commit

Permalink
Google Mail Checker fixes:
Browse files Browse the repository at this point in the history
* Enforce the minimum poll interval better
* Add an instance ID parameter so that Gmail can debug instances of this extension seemingly pounding their servers.

R=mpcomplete@chromium.org
BUG=none
TEST=no

Review URL: http://codereview.chromium.org/7348006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92235 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
mihaip@chromium.org committed Jul 12, 2011
1 parent 5ac8aff commit 210d06a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
Binary file modified chrome/common/extensions/docs/examples/extensions/gmail.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -24,7 +27,9 @@
}

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) {
Expand Down Expand Up @@ -106,8 +111,8 @@
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"permissions": [
"tabs", "http://*.google.com/", "https://*.google.com/"
],
"version": "3.1"
"version": "3.2"
}
10 changes: 6 additions & 4 deletions chrome/common/extensions/docs/samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@
"chrome.experimental.sidebar.setIcon": "experimental.sidebar.html#method-setIcon",
"chrome.experimental.sidebar.setTitle": "experimental.sidebar.html#method-setTitle",
"chrome.experimental.sidebar.show": "experimental.sidebar.html#method-show",
"chrome.experimental.tts.getVoices": "experimental.tts.html#method-getVoices",
"chrome.experimental.tts.isSpeaking": "experimental.tts.html#method-isSpeaking",
"chrome.experimental.tts.onSpeak": "experimental.tts.html#event-onSpeak",
"chrome.experimental.tts.onStop": "experimental.tts.html#event-onStop",
"chrome.experimental.tts.speak": "experimental.tts.html#method-speak",
"chrome.experimental.tts.speakCompleted": "experimental.tts.html#method-speakCompleted",
"chrome.experimental.tts.stop": "experimental.tts.html#method-stop",
"chrome.experimental.ttsEngine.onEvent": "experimental.ttsEngine.html#event-onEvent",
"chrome.experimental.ttsEngine.onSpeak": "experimental.ttsEngine.html#event-onSpeak",
"chrome.experimental.ttsEngine.onStop": "experimental.ttsEngine.html#event-onStop",
"chrome.experimental.ttsEngine.sendTtsEvent": "experimental.ttsEngine.html#method-sendTtsEvent",
"chrome.experimental.webNavigation.onBeforeNavigate": "experimental.webNavigation.html#event-onBeforeNavigate",
"chrome.experimental.webNavigation.onBeforeRetarget": "experimental.webNavigation.html#event-onBeforeRetarget",
"chrome.experimental.webNavigation.onCommitted": "experimental.webNavigation.html#event-onCommitted",
Expand Down Expand Up @@ -953,7 +955,7 @@
"manifest.json",
"options.html"
],
"source_hash": "030b77992ed5bbbbc18f1b717bc330b965b26aaf",
"source_hash": "327e6bf6005b861f17848b59dc50ebb18d1a57f4",
"zip_path": "examples\/extensions\/gmail.zip"
},
{
Expand Down

0 comments on commit 210d06a

Please sign in to comment.