Incorrect error message when using the sidebar API in Firefox 24

RESOLVED INVALID

Status

Add-on SDK
General
P2
normal
RESOLVED INVALID
4 years ago
4 years ago

People

(Reporter: shweta.universidad, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:24.0) Gecko/20100101 Firefox/24.0 (Beta/Release)
Build ID: 20130911160237

Steps to reproduce:

I try to run the example shown here:

https://github.com/mozilla/addon-sdk/wiki/JEP-Sidebars

lib/main.js

var data = require("sdk/self").data;
const { Sidebar } = require('sdk/ui');

  let sidebar = Sidebar({
    id: 'twitter-sidebar',
    url: data.url('twitter.html'), // Has access to a `addon` global to communicate with the addon
    title: 'Twitter'
  });
  sidebar.on('attach', function(worker) {
    worker.port.on('message', function(msg) {
      console.log(msg); // Logs 'Hello World!'
    });
    worker.port.emit('message', 'Hello');
  })
  sidebar.show(); // shows in most recent window
  sidebar.hide();  // hides in most recent window

data/twitter.html
<script>
addon.port.on('message', function(msg) {
  addon.port.emit('message', msg + " World!")
})
</script>

I run two options with two different results:
option 1:
> cfx run

option 2:
> cfx -o run
because I use the sdk from: https://github.com/mozilla/addon-sdk

code here: https://github.com/shwe87/sidebar-test


Actual results:

The option 1 does:
Using binary at '/usr/bin/firefox'.
Using profile at '/tmp/tmpPpF0o7.mozrunner'.
error: clickme: An exception occurred.
Error: Module `sdk/ui` is not found at resource://gre/modules/commonjs/sdk/ui.js
resource://gre/modules/commonjs/sdk/loader/cuddlefish.js 133
Traceback (most recent call last):
  File "resource://gre/modules/NetUtil.jsm", line 137, in 
    aCallback(pipe.inputStream, aStatusCode, aRequest);
  File "resource://gre/modules/commonjs/sdk/net/url.js", line 49, in readAsync/<
    resolve(data);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 155, in then
    result.then(resolve, reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 155, in then
    result.then(resolve, reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/addon/runner.js", line 115, in startup/<
    run(options);
  File "resource://gre/modules/commonjs/sdk/addon/runner.js", line 147, in run
    let program = main(options.loader, options.main);
  File "resource://jid1-67i8zhrbcv5neq-at-jetpack/clickme/lib/main.js", line 102, in 
    const { Sidebar } = require('sdk/ui');
  File "resource://gre/modules/commonjs/sdk/loader/cuddlefish.js", line 133, in CuddlefishLoader/options<.load
    result = load(loader, module);
error: clickme: An exception occurred.
Error: Module `sdk/ui` is not found at resource://gre/modules/commonjs/sdk/ui.js
resource://gre/modules/commonjs/sdk/loader/cuddlefish.js 133
Traceback (most recent call last):
  File "resource://gre/modules/NetUtil.jsm", line 137, in 
    aCallback(pipe.inputStream, aStatusCode, aRequest);
  File "resource://gre/modules/commonjs/sdk/net/url.js", line 49, in readAsync/<
    resolve(data);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 155, in then
    result.then(resolve, reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 155, in then
    result.then(resolve, reject);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://gre/modules/commonjs/sdk/addon/runner.js", line 115, in startup/<
    run(options);
  File "resource://gre/modules/commonjs/sdk/addon/runner.js", line 147, in run
    let program = main(options.loader, options.main);
  File "resource://jid1-67i8zhrbcv5neq-at-jetpack/clickme/lib/main.js", line 102, in 
    const { Sidebar } = require('sdk/ui');
  File "resource://gre/modules/commonjs/sdk/loader/cuddlefish.js", line 133, in CuddlefishLoader/options<.load
    result = load(loader, module);

The option 2:

Using binary at '/usr/bin/firefox'.
Using profile at '/tmp/tmpOp09sP.mozrunner'.
console.error: clickme: 
  Message: Error: Unsupported Application version: The module sdk/ui currently supports only version > 24 of Firefox.
  Stack:
    incompatibility@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/loader/cuddlefish.js:78
CuddlefishLoader/options<.load@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/loader/cuddlefish.js:135
@resource://jid1-67i8zhrbcv5neq-at-jetpack/clickme/lib/main.js:102
CuddlefishLoader/options<.load@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/loader/cuddlefish.js:129
run@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/addon/runner.js:146
startup/<@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/addon/runner.js:113
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:118
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:118
then@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:43
then@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:153
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:185
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:118
then@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:43
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:185
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:118
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:118
then@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:43
then@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:153
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:185
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:118
then@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:43
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:185
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:118
then@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:43
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:185
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:118
then@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:43
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:185
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:118
then@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:43
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:185
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:118
then@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:43
resolve@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/core/promise.js:185
readAsync/<@resource://extensions.modules.jid1-67i8zhrbcv5neq-at-jetpack.commonjs.path/sdk/net/url.js:49
@resource://gre/modules/NetUtil.jsm:137




Expected results:

It should have shown/hidden the sidebar. 
Please note that I'm using the version 24 of firefox
Pretty sure sidebars are only available in Firefox 26. Erik?
Flags: needinfo?(evold)
sdk/ui/sidebar.js is in Aurora and not Beta, so that's 26 I guess.
Flags: needinfo?(evold)

Comment 3

4 years ago
Hey Guys, got the same Problem with this sidebar module using Firefox 24.
Is there any other opptorunity using a comparable Sidebar for firefox 24?

Greetz Romanskie
(Reporter)

Comment 4

4 years ago
Hello, If it only works in Firefox 26 then please modify the Message error because the current message is the following:

> Message: Error: Unsupported Application version: The module sdk/ui currently supports only version > 24 of Firefox.

Ramonskie, I recommend you to implement it using XUL elements of the browser.xul file.


Thanks!
Greets Shweta.
(Reporter)

Comment 5

4 years ago
Hello, If it only works in Firefox 26 then please modify the Message error because the current message is the following:

> Message: Error: Unsupported Application version: The module sdk/ui currently supports only version > 24 of Firefox.

I was confused because I didn't know about the firefox 26. :S

Ramonskie, I recommend you to implement it using XUL elements of the browser.xul file.


Thanks!
Greets Shweta.
(Reporter)

Comment 6

4 years ago
Hello, If it only works in Firefox 26 then please modify the Message error because the current message is the following:

> Message: Error: Unsupported Application version: The module sdk/ui currently supports only version > 24 of Firefox.

I was confused because I didn't know about the firefox 26. :S

Ramonskie, I recommend you to implement it using XUL elements of the browser.xul file.


Thanks!
Greets Shweta.
(Reporter)

Comment 7

4 years ago
How can I add a tabcontainer in a sidebar? I've done this so far:

var data = require("sdk/self").data;
const {Ci,Cc} = require("chrome");
var tabs = require("sdk/tabs");


var windows = require("sdk/windows").browserWindows;

var mediator = Cc['@mozilla.org/appshell/window-mediator;1'].getService(Ci.nsIWindowMediator);
var window = mediator.getMostRecentWindow("navigator:browser");
var document = mediator.getMostRecentWindow("navigator:browser").document; 
exports.main = function(options, callbacks) {
    addSideBar();
    // other stuff
};

function addSideBar(){
	//try{
		var sidebar = document.getElementById('viewSidebarMenu');
		
		if (sidebar != null){
			console.log("not null");
                        var prefix = "my";
			var bcset = document.getElementById('mainBroadcasterSet');
			let bc = document.createElement('broadcaster');
			    bc.setAttribute('id', prefix + 'broadcaster');
			    bc.setAttribute('label', 'Sidebar');
			    bc.setAttribute('autoCheck', 'false');
			    bc.setAttribute('type', 'checkbox');
			    bc.setAttribute('group', 'sidebar');
			    bc.setAttribute('sidebartitle', 'Sync & Share');
			    bc.setAttribute('oncommand', 'toggleSidebar("' + prefix + 'broadcaster")');
			    bcset.appendChild(bc);
			    
			    
			    var menuitem = document.createElement('menuitem');
				menuitem.setAttribute('id', 'myOwnSidebar');
				menuitem.setAttribute('observes', prefix + 'broadcaster');
				sidebar.appendChild(menuitem);
                               let sidebarBox = document.getElementById('sidebar-box');
				
				
				var vBox = document.createElement('vbox');
				
				var tabbox = document.createElement('tabbox');
				var tabs = document.createElement('tabs');
				tabbox.appendChild(tabs);
				var tab = document.createElement('tab');
				tab.setAttribute('label','Bookmarks');
				tabs.appendChild(tab);
				var tabPanels = document.createElement('tabpanels');
				var tabPanel = document.createElement('tabpanel');
				tabPanel.setAttribute('id','BookmarkPanel');
				tabPanel.setAttribute('orient','vertical');
				tabPanel.innerHTML = "<html><body>Bookmark</body></html>";
				tabPanels.appendChild(tabPanel);
				
				var another = document.createElement('tab');
				another.setAttribute('label','History');
				//var tabPanels = document.createElement('tabpanels');
				var tabPanel = document.createElement('tabpanel');
				tabPanel.setAttribute('id','HistoryPanel');
				//tabPanel.setAttribute('orient','vertical');
				tabPanel.innerHTML = "History";
				tabPanels.appendChild(tabPanel);
				tabbox.appendChild(tabPanels);
				tabs.appendChild(another);
				
				vBox.appendChild(tabbox);
				sidebarBox.appendChild(vBox);
		}
	

}


It doesn0t work because, the tabbox doesn't form part of the content of the side-bar as I pretend it to be.

Thanks
Duplicate of this bug: 928710
We should change that error message
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2
Summary: Using sdk/ui problems → Incorrect error message when using the sidebar API in Firefox 24
The sidebar module should work in current releases, also the message said the sidebar only supported > 24 and you said you were trying this on version 24, so the error makes sense.
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.