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

Unified Diff: chrome/renderer/resources/offline.js

Issue 601523003: Network error interstitial bug fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix blue button flash when page loads Created 6 years, 3 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
« no previous file with comments | « chrome/renderer/resources/neterror.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/offline.js
diff --git a/chrome/renderer/resources/offline.js b/chrome/renderer/resources/offline.js
index 22009c88ed9cf1e74b2f70c9c060ff6b333a03b3..4876abf9955dd4b87013cc43b9222763a9a43dec 100644
--- a/chrome/renderer/resources/offline.js
+++ b/chrome/renderer/resources/offline.js
@@ -55,7 +55,7 @@ function Runner(outerContainerId, opt_config) {
this.soundFx = {};
// Global web audio context for playing sounds.
- this.audioContext = new AudioContext();
+ this.audioContext = null;
// Images.
this.images = {};
@@ -250,6 +250,7 @@ Runner.prototype = {
* Load and decode base 64 encoded sounds.
*/
loadSounds: function() {
+ this.audioContext = new AudioContext();
var resourceTemplate =
document.getElementById(this.config.RESOURCE_TEMPLATE_ID).content;
@@ -324,10 +325,9 @@ Runner.prototype = {
this.startListening();
this.update();
- this.loadSounds();
window.addEventListener(Runner.events.RESIZE,
- this.debounceResize.bind(this), false);
+ this.debounceResize.bind(this));
},
/**
@@ -436,13 +436,13 @@ Runner.prototype = {
// Handle tabbing off the page. Pause the current game.
window.addEventListener(Runner.events.VISIBILITY,
- this.onVisibilityChange.bind(this), false);
+ this.onVisibilityChange.bind(this));
window.addEventListener(Runner.events.BLUR,
- this.onVisibilityChange.bind(this), false);
+ this.onVisibilityChange.bind(this));
window.addEventListener(Runner.events.FOCUS,
- this.onVisibilityChange.bind(this), false);
+ this.onVisibilityChange.bind(this));
},
clearCanvas: function() {
@@ -581,6 +581,7 @@ Runner.prototype = {
if (!this.crashed && (Runner.keycodes.JUMP[String(e.keyCode)] ||
e.type == Runner.events.TOUCHSTART)) {
if (!this.activated) {
+ this.loadSounds();
this.activated = true;
}
« no previous file with comments | « chrome/renderer/resources/neterror.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698