Fixed Myk's nits mentioned in bug 611763 comment 9.
authorAtul Varma <varmaa@gmail.com>
Tue, 30 Nov 2010 17:27:23 -0500
changeset 1148 4a3c87093ba3e61c10a970eb8fe58facd5fbb62a
parent 1147 72a1521c2de76d2f318589858fbbaf4e6703bbb6
child 1149 86172a91aa6ab7146ff7beb47d8e2404b33dad06
push id471
push userbwarner@mozilla.com
push dateTue, 30 Nov 2010 22:30:12 +0000
bugs611763
Fixed Myk's nits mentioned in bug 611763 comment 9.
examples/reddit-panel/lib/main.js
packages/addon-kit/lib/panel.js
--- a/examples/reddit-panel/lib/main.js
+++ b/examples/reddit-panel/lib/main.js
@@ -1,17 +1,16 @@
 const widgets = require("widget");
-const panels = require("panel");
 const data = require("self").data;
 
 exports.main = function(options, callbacks) {
   widgets.Widget({
     label: "Reddit",
     contentURL: "http://www.reddit.com/static/favicon.ico",
-    panel: panels.Panel({
+    panel: require("panel").Panel({
       width: 240,
       height: 320,
       contentURL: "http://www.reddit.com/.mobile?keep_extension=True",
       contentScriptFile: [data.url("jquery-1.4.2.min.js"), data.url("panel.js")],
       contentScriptWhen: "ready",
       onMessage: function(message) {
         require("tab-browser").addTab(message);
       }
--- a/packages/addon-kit/lib/panel.js
+++ b/packages/addon-kit/lib/panel.js
@@ -132,17 +132,16 @@ const Panel = Symbiont.resolve({
   _width: 320,
   /* Public API: Panel.height */
   get height() this._height,
   set height(value)
     this._height =  valid({ $: value }, { $: validNumber }).$ || this._height,
   _height: 240,
   /* Public API: Panel.show */
   show: function show(anchor) {
-    // do nothing if already open
     anchor = anchor || null;
     let document = getWindow(anchor).document;
     let xulPanel = this._xulPanel;
     if (!xulPanel) {
       xulPanel = this._xulPanel = document.createElementNS(XUL_NS, 'panel');
       let frame = document.createElementNS(XUL_NS, 'iframe');
       frame.setAttribute('type', 'content');
       frame.setAttribute('flex', '1');
@@ -235,16 +234,18 @@ const Panel = Symbiont.resolve({
     }
   },
   /**
    * Notification that panel was fully initialized.
    */
   _onInit: function _onInit() {
     this._inited = true;
     // perform all deferred tasks like initSymbiont, show, hide ...
+    // TODO: We're publicly exposing a private event here; this
+    // 'inited' event should really be made private, somehow.
     this._emit('inited');
     this._removeAllListeners('inited');
   }
 });
 exports.Panel = function(options) Panel(options)
 exports.Panel.prototype = Panel.prototype;
 
 function getWindow(anchor) {