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

Side by Side Diff: client/dart.js

Issue 11428064: Suppress check on localStorage to enable chrome apps (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Switch to try/catch Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Bootstrap support for Dart scripts on the page as this script. 5 // Bootstrap support for Dart scripts on the page as this script.
6 if (navigator.webkitStartDart) { 6 if (navigator.webkitStartDart) {
7 if (!navigator.webkitStartDart()) { 7 if (!navigator.webkitStartDart()) {
8 document.body.innerHTML = 'This build has expired. Please download a new Da rtium at http://www.dartlang.org/dartium/index.html'; 8 document.body.innerHTML = 'This build has expired. Please download a new Da rtium at http://www.dartlang.org/dartium/index.html';
9 } 9 }
10 } else { 10 } else {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 for (var i = 0; i < length; i++) { 154 for (var i = 0; i < length; i++) {
155 result[i] = deserializeHelper(values[i]); 155 result[i] = deserializeHelper(values[i]);
156 } 156 }
157 return result; 157 return result;
158 } 158 }
159 159
160 window.registerPort = function(name, port) { 160 window.registerPort = function(name, port) {
161 var stringified = JSON.stringify(serialize(port)); 161 var stringified = JSON.stringify(serialize(port));
162 var attrName = 'dart-port:' + name; 162 var attrName = 'dart-port:' + name;
163 document.documentElement.setAttribute(attrName, stringified); 163 document.documentElement.setAttribute(attrName, stringified);
164 // TODO(vsm): Phase out usage of localStorage. We're leaving it in 164 // TODO(vsm): Phase out usage of localStorage and delete the
165 // temporarily for backwards compatibility. 165 // below. We're leaving it in temporarily for backwards
166 window.localStorage[attrName] = stringified; 166 // compatibility.
167 try {
168 window.localStorage[attrName] = stringified;
169 } catch (e) {
170 // Swallow errors (e.g., Chrome apps disallow this access).
171 }
167 }; 172 };
168 173
169 window.lookupPort = function(name) { 174 window.lookupPort = function(name) {
170 var attrName = 'dart-port:' + name; 175 var attrName = 'dart-port:' + name;
171 var stringified = document.documentElement.getAttribute(attrName); 176 var stringified = document.documentElement.getAttribute(attrName);
172 // TODO(vsm): Phase out usage of localStorage. We're leaving it in 177 // TODO(vsm): Phase out usage of localStorage. We're leaving it in
173 // temporarily for backwards compatibility. 178 // temporarily for backwards compatibility.
174 if (!stringified) { 179 if (!stringified) {
175 stringified = window.localStorage[attrName]; 180 stringified = window.localStorage[attrName];
176 } 181 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 var result = null; 253 var result = null;
249 var listener = function (e) { 254 var listener = function (e) {
250 result = JSON.parse(getPortSyncEventData(e)); 255 result = JSON.parse(getPortSyncEventData(e));
251 }; 256 };
252 window.addEventListener(source, listener, false); 257 window.addEventListener(source, listener, false);
253 dispatchEvent(target, [source, serialized]); 258 dispatchEvent(target, [source, serialized]);
254 window.removeEventListener(source, listener, false); 259 window.removeEventListener(source, listener, false);
255 return deserialize(result); 260 return deserialize(result);
256 } 261 }
257 })(); 262 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698