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

Unified Diff: chrome/browser/resources/extensions/extension_loader.js

Issue 342003005: Show alert failure for reloading unpacked extensions with bad manifest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed patch set 4 comments Created 6 years, 6 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
Index: chrome/browser/resources/extensions/extension_loader.js
diff --git a/chrome/browser/resources/extensions/extension_loader.js b/chrome/browser/resources/extensions/extension_loader.js
index fb57c18b139075cba35b00c733df28187052c4c9..45a27d04bcd38ec84b9d96e8265e45b59a105b97 100644
--- a/chrome/browser/resources/extensions/extension_loader.js
+++ b/chrome/browser/resources/extensions/extension_loader.js
@@ -2,6 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+document.addEventListener('DOMContentLoaded', function() {
+ chrome.send('extensionLoaderDisplayFailures');
+});
+
+window.addEventListener('beforeunload', function() {
Devlin 2014/06/30 21:06:42 Actually, I'm wondering if this wouldn't be better
gpdavis 2014/06/30 21:41:19 Will the ExtensionLoader be constructed after the
Devlin 2014/06/30 22:32:36 Well, since extensions are loaded on page load, we
gpdavis 2014/06/30 23:35:11 Wait, are you talking about the Extension Loader H
Devlin 2014/07/01 17:02:55 I was talking about the ExtensionLoader JS class.
gpdavis 2014/07/01 20:58:55 I replaced the DOMContentLoaded listener with a me
Devlin 2014/07/01 22:14:17 Can we not just unset it when the page is reloadin
gpdavis 2014/07/01 23:50:59 Well, that is the goal. I figured adding a listen
Devlin 2014/07/02 17:46:49 Can we not just listen for the same signal that Ex
+ chrome.send('extensionLoaderSetDisplayLoading');
+});
+
cr.define('extensions', function() {
'use strict';
@@ -38,6 +46,14 @@ cr.define('extensions', function() {
this.reason_ = this.querySelector('#extension-load-error-reason');
/**
+ * The element which displays information about additional load failures.
+ * @type {HTMLPreElement}
+ * @private
+ */
+ this.additional_ =
+ this.querySelector('#extension-load-error-additional');
+
+ /**
* The element which displays the manifest code.
* @type {ExtensionCode}
* @private
@@ -76,6 +92,15 @@ cr.define('extensions', function() {
},
/**
+ * Display additional load failures to the user.
Devlin 2014/06/30 21:06:41 We should be able to clean this up when we move al
+ * @param {string} failures The error message listing paths of additional
+ * extensions that failed to load.
+ */
+ showAdditional: function(failures) {
+ this.additional_.textContent = failures;
+ },
+
+ /**
* Hide the extension load error.
* @private
*/
@@ -122,6 +147,16 @@ cr.define('extensions', function() {
*/
notifyFailed: function(filePath, reason, manifest) {
this.loadError_.show(filePath, reason, manifest);
+ },
+
+ /**
+ * Notify the ExtensionLoader of additional failures.
+ * @param {string} filePath The path to the unpacked extension.
+ * @param {string} failures The error message listing paths of additional
+ * extensions that failed to load.
+ */
+ notifyAdditionalFailures: function(failures) {
+ this.loadError_.showAdditional(failures);
}
};
@@ -136,6 +171,16 @@ cr.define('extensions', function() {
ExtensionLoader.getInstance().notifyFailed(filePath, reason, manifest);
};
+ /*
+ * A static forwarding function for ExtensionLoader.notifyFailed.
+ * @param {string} failures The error message listing paths of additional
+ * extensions that failed to load.
+ * @see ExtensionLoader.notifyAdditionalFailures
+ */
+ ExtensionLoader.notifyAdditional = function(failures) {
+ ExtensionLoader.getInstance().notifyAdditionalFailures(failures);
+ };
+
return {
ExtensionLoader: ExtensionLoader
};

Powered by Google App Engine
This is Rietveld 408576698