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

Unified Diff: chrome/common/extensions/docs/js/bootstrap.js

Issue 997010: Extension Docs (No building or testable files) (Closed)
Patch Set: Created 10 years, 9 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/common/extensions/docs/index.html ('k') | chrome/common/extensions/docs/manifest.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/js/bootstrap.js
diff --git a/chrome/common/extensions/docs/js/bootstrap.js b/chrome/common/extensions/docs/js/bootstrap.js
index 7741df062d465120f993621ae1c96423dd618988..738686ed70d13be505a8be0edd5b063f3e445905 100755
--- a/chrome/common/extensions/docs/js/bootstrap.js
+++ b/chrome/common/extensions/docs/js/bootstrap.js
@@ -1,9 +1,25 @@
+var fileXHREnabled = function() {
+ var xhr = new XMLHttpRequest();
+ try {
+ xhr.onreadystatechange = function() {};
+ xhr.onerror = function() {};
+ xhr.open("GET", "nothing.xml", true);
+ xhr.send(null);
+ } catch (e) {
+ return false;
+ }
+
+ xhr.abort();
+ return true;
+}();
+
// Regenerate page if we are passed the "?regenerate" search param
// or if the user-agent is chrome AND the document is being served
// from the file:/// scheme.
if (window.location.search == "?regenerate" ||
(navigator.userAgent.indexOf("Chrome") > -1) &&
- (window.location.href.match("^file:"))) {
+ (window.location.href.match("^file:")) &&
+ fileXHREnabled) {
// Hide body content initially to minimize flashing.
document.write('<style id="hider" type="text/css">');
@@ -23,4 +39,11 @@ if (window.location.search == "?regenerate" ||
if (location.hash.length > 1)
location.href = location.href;
}
+} else if ((navigator.userAgent.indexOf("Chrome") > -1) &&
+ (window.location.href.match("^file:")) &&
+ !fileXHREnabled) {
+ window.onload = function() {
+ // Display the warning to use the --allow-file-access-from-files.
+ document.getElementById("devModeWarning").style.display = "block";
+ }
}
« no previous file with comments | « chrome/common/extensions/docs/index.html ('k') | chrome/common/extensions/docs/manifest.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698