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

Unified Diff: dart/site/try/src/cache.dart

Issue 266293002: Make Try Dart tests run on Firefox. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | « no previous file | dart/site/try/src/editor.dart » ('j') | dart/site/try/src/selection.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/site/try/src/cache.dart
diff --git a/dart/site/try/src/cache.dart b/dart/site/try/src/cache.dart
index fd4cce08a90434a70bdc2cd7c876112cd22a03d1..2007497e4927aebce671e677fd8e0bd50b907085 100644
--- a/dart/site/try/src/cache.dart
+++ b/dart/site/try/src/cache.dart
@@ -20,6 +20,7 @@ import 'ui.dart' show
/// Called when the window has finished loading.
void onLoad(Event event) {
+ if (!ApplicationCache.supported) return;
window.applicationCache.onUpdateReady.listen((_) => updateCacheStatus());
kasperl 2014/05/06 04:42:22 Consider having a local helper function for the (_
ahe 2014/05/06 08:10:16 I've changed updateCacheStatus to take an argument
window.applicationCache.onCached.listen((_) => updateCacheStatus());
window.applicationCache.onChecking.listen((_) => updateCacheStatus());
@@ -30,11 +31,19 @@ void onLoad(Event event) {
window.applicationCache.onProgress.listen(onCacheProgress);
}
-onCacheProgress(ProgressEvent event) {
- if (!event.lengthComputable) {
- updateCacheStatus();
- return;
+onCacheProgress(Event event) {
kasperl 2014/05/06 04:42:22 I'd add a void here -- if nothing else then for co
ahe 2014/05/06 08:10:16 Done.
+ if (event is ProgressEvent) {
+ // Firefox doesn't fire a ProgressEvent on cache progress. Just a plain
+ // Event with type == "progress".
+ if (event.lengthComputable) {
+ updateCacheStatusFromEvent(event);
+ return;
+ }
}
+ updateCacheStatus();
+}
+
+void updateCacheStatusFromEvent(ProgressEvent event) {
cacheStatusElement.nodes.clear();
cacheStatusElement.appendText('Downloading SDK ');
var progress = '${event.loaded} of ${event.total}';
« no previous file with comments | « no previous file | dart/site/try/src/editor.dart » ('j') | dart/site/try/src/selection.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698