From e7ae04749c7eacaf058c3359f8e261053e44fdfa Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 4 Jan 2011 11:23:48 -0500 Subject: [PATCH] Get the statusline color right after a :rehash. --- common/content/buffer.js | 12 +++--------- common/content/statusline.js | 12 +++++++++++- common/modules/config.jsm | 5 ++--- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 31937671..f9bb62cb 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -265,15 +265,9 @@ var Buffer = Module("buffer", { // for notifying the user about secure web pages onSecurityChange: function onSecurityChange(webProgress, request, state) { onSecurityChange.superapply(this, arguments); - // TODO: do something useful with STATE_SECURE_MED and STATE_SECURE_LOW - if (state & Ci.nsIWebProgressListener.STATE_IS_INSECURE) - statusline.class = "insecure"; - else if (state & Ci.nsIWebProgressListener.STATE_IS_BROKEN) - statusline.class = "broken"; - else if (state & Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL) - statusline.class = "extended"; - else if (state & Ci.nsIWebProgressListener.STATE_SECURE_HIGH) - statusline.class = "secure"; + if (webProgress && webProgress.DOMWindow) + webProgress.DOMWindow.document.dactylSecurity = state; + statusline.security = state; }, onStatusChange: function onStatusChange(webProgress, request, status, message) { onStatusChange.superapply(this, arguments); diff --git a/common/content/statusline.js b/common/content/statusline.js index 1db8c5c3..0eb849ed 100644 --- a/common/content/statusline.js +++ b/common/content/statusline.js @@ -67,7 +67,7 @@ var StatusLine = Module("statusline", { objects: this.widgets = { get status() this.container }, prepend: prepend.elements() }); - this.class = "insecure"; + this.security = content.document.dactylSecurity; }, get visible() !this.statusBar.collapsed && !this.statusBar.hidden, @@ -94,6 +94,16 @@ var StatusLine = Module("statusline", { highlight.highlightNode(this.statusBar, this.baseGroup + highlightGroup[type]); }, get class() this._class, + set security(state) { + if (state & Ci.nsIWebProgressListener.STATE_IS_BROKEN) + this.class = "broken"; + else if (state & Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL) + this.class = "extended"; + else if (state & Ci.nsIWebProgressListener.STATE_SECURE_HIGH) + this.class = "secure"; + else // if (state & Ci.nsIWebProgressListener.STATE_IS_INSECURE) + this.class = "insecure"; + }, // update all fields of the statusline update: function update() { diff --git a/common/modules/config.jsm b/common/modules/config.jsm index 70f80806..a5965915 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -118,8 +118,7 @@ var ConfigBase = Class("ConfigBase", { this.helpCSS = true; }, - Local: function Local(dactyl, modules, window) - let ({modes} = modules) ({ + Local: function Local(dactyl, modules, window) ({ init: function init() { let append = @@ -142,7 +141,7 @@ var ConfigBase = Class("ConfigBase", { browser: Class.memoize(function () window.gBrowser), tabbrowser: Class.memoize(function () window.gBrowser), - get browserModes() [modes.NORMAL], + get browserModes() [modules.modes.NORMAL], /** * @property {string} The ID of the application's main XUL window.