Using venkman in my xul application - firefox

I've tried to follow these steps to get venkman in my xul application:
Get Venkman from addons.mozilla.org To download the package, right-click the install link and save the package locally. (got the newest version).
Create a directory /distribution/bundles/venkman. Unzip the package into that directory.
Add <script src="chrome://venkman/content/venkman-overlay.js" /> to one of your XUL windows.
Add UI to open Venkman to your window (it could be a menu item or a toolbar button). Make it call start_venkman() when activated.
Not sure where to create the distribution directory, I've tried in the same directory as my application.ini in chrome and in chrome/content but when I try to include the script as in step 3 I get:
No chrome package registered for chrome://venkman/content/venkman-overlay.js
And step 4 gives me:
Error: ReferenceError: start_venkman is not defined
I start my application using the following command:
firefox.exe --app application.ini -jsconsole
Changed the BuildID in my application.ini a couple of times but that didn't change anything.

Created the directory: C:\Program Files (x86)\Mozilla Firefox\distribution\bundles and copied the venkman directory in there.
In my xul window I added:
<script src="test.js" />
<button label="Press Me"
oncommand="start_venkman();"/>
The content of test.js is:
function toOpenWindowByType(inType, uri) {
var winopts = "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar";
window.open(uri, "_blank", winopts);
}
When I click the button the Venkman window opens.

Related

'Gulpfile.js - failed to load See output' but output does not show any error information

I am trying to use gulp to copy some JS/CSS from node_modules to wwwroot in an ASP.Net core app.
I have what I thought was a fairly simple gulpfile.js
var gulp = require('gulp');
gulp.task('copy-files', function () {
var assets = {
js: [
'./node_modules/bootstrap/dist/js/bootstrap.js'
],
css: [
'./node_modules/bootstrap/dist/css/bootstrap.css'
]
};
_(assets).forEach(function (assets, type) {
gulp.src(assets).pipe(gulp.dest('./wwwroot/' + type));
});
});
However, when I look at the VS Task Runner, it just shows an error:
But the output window is empty:
How can I get more information about the error?
This answer here worked for me.
Moved up the $(PATH) location above everything. As I did not have (DevEnvDir)|Extensions\Microsoft\Web Tools\External location as mentioned in the answer.
For VS 2015
Tools > Options > Projects and Solutions > External Web Tools
For VS 2017
Tools > Options > Projects and Solutions > Web Package Management > External Web Tools
The problem is not related to path, but actually there must be some problem with gulp file itself either syntax error or some package is missing which unfortunately visual studio does not show that specific error but generic error what you see in task runner "failed to load". And the right way to see the errors is
Open the command prompt (preferably in admin mode, this is what i did).
Goto the same location where gulp file is located.
Run the task through following command example --> gulp default
If there is any error like package is missing, it will show you, fix those issues.
After all errors are fixed, then you will see that gulp task runs successfully.
Go back to visual studio, task runner, and click on refresh (left top button), and it will show you all tasks.
screenshot?
I'm not sure why but opening a cmd prompt at the directory containing gulpfile.js and running npm install has fixed it.
Perhaps someone wiser than I can explain why.
In Output window, make sure you select Task Runner Explorer for Show output from option. This was my problem why I didn't see the error logs from gulpfile. A rookie mistake.
I'm using Visual Studio Community 2019 Version 16.5.4.
I had the same problem and found the answer in the next link:
https://developercommunity.visualstudio.com/content/problem/961170/gulpfile-fails-to-load-after-upgrading-to-vs2019-1.html
Gulp uses node.js but it is important the version to be compatible. I've tried few versions and at the end version 0.12.7 works for me. But had to place absolute path to the place where that node version is installed in VS
Tools > Options > Projects and Solutions > External Web Tools
and move the path to the top. Placing the Path in environment variables and moving $(PATH) to the top didn't help in my case.

How to create a xpi file from scratchpad

I have developed my add-on in scratchpad environment and now developing is finished and I want to create final xpi file.
I replace only this:
Cu.import('resource://gre/modules/ctypes.jsm');
by this:
var {Cu} = require("chrome");
var{ctypes} = Cu.import("resource://gre/modules/ctypes.jsm", null);
Then using nodejs (jpm init and jpm xpi commands) I created xpi file however this is not worked properly.
What we did was follow the jpm tutorial: https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Getting_Started_%28jpm%29 and https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/jpm#Installation
I did this on a Windows system:
we downloaded node.js
npm came with it
created a directory, in this directory i did jpm-init from command line
filled out the prompts then filled in the code for the addon:
We then created a similiar addon to this demo addon here:
https://github.com/Noitidart/jpm-chromeworker
I cant share the actuall addon as that was personal to the user. But the above is simpler and shows how to do it.
We did our jsctypes in a chromeworker, and have it communicate with index.js via messaging

Icon not showing in firefox add-on manager

I have a new Firefox add-on with the following directory structure:
/
package.json
data/
icons/
icon48.png
In my package.json file I have this:
"icon": "data/icons/icon48.png",
(among other things). When I run jpm run as recommended by the Firefox add-on docs, the extension loads but the icon is not visible in the add-on manager. Any idea what I'm missing? I have been referencing this page: https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/package_json#icon, but no luck.
Thanks!
Apparently this is a bug. See this issue in the jpm repository.
For me, moving the icon image to the root directory (i.e. the same path as package.json) and renaming it "icon.png" fixed the problem.
I still have this bug with jpm 1.0.6 version. I solved it adding the next icon path:
{
"id": "jid1-AKuBexDY5zJsIQ#jetpack",
"icon": "resource://jid1-akubexdy5zjsiq-at-jetpack/data/images/icon48.png",
}
Note that the "path" is similar to the "id" field but there are not capital letters

PHPUnit + Selenium: How to set Firefox about:config options?

When running Selenium tests remotely with PHPUnit and Firefox, onChange events are not fired as they are when a user is operating the browser.
The solution to this seems to be to set the focusmanager.testmode option to true in Firefox's preferences (i.e. about:config), as suggested in a Selenium bug report.
However all the examples are using Selenium directly, while I am using PHPUnit which has its own API hiding the Selenium internals. I can't figure out how to set this Firefox option using PHPUnit, so I'm hoping someone else can tell me how this can be done!
(No, I can't go into about:config and set it myself manually because the tests create a new clean browser profile each time the tests are run, so any manual config changes are lost.)
Thanks to the Selenium developers I have a solution!
Short version
Put this in your test so that it gets called in the setUp() function:
// Firefox mini-profile that sets focusmanager.testmode=true in about:config
define('FIREFOX_PROFILE',
'UEsDBAoAAAAAADqAxkSBK46tKgAAACoAAAAIABwAcHJlZnMuanNVVAkAA1BZkVM6WZFTdXgLAAEE
6AMAAARkAAAAdXNlcl9wcmVmKCJmb2N1c21hbmFnZXIudGVzdG1vZGUiLCB0cnVlKTsKUEsBAh4D
CgAAAAAAOoDGRIErjq0qAAAAKgAAAAgAGAAAAAAAAQAAAKSBAAAAAHByZWZzLmpzVVQFAANQWZFT
dXgLAAEE6AMAAARkAAAAUEsFBgAAAAABAAEATgAAAGwAAAAAAA==');
protected function setUp()
{
$this->setDesiredCapabilities(Array('firefox_profile' => FIREFOX_PROFILE));
}
This sets focusmanager.testmode to true.
Long version
You need to create your own mini Firefox profile with the preferences you want set, and pass it along at the start of your tests. Here's how to do it:
Create a new folder and put the files you want in the Firefox profile in there. This can be anything (bookmarks, extensions, a copy of your own profile, etc.) but all we need here is a file called prefs.js which stores our about:config settings.
Create prefs.js in this folder with the following content:
user_pref("focusmanager.testmode", true);
Zip up the folder (prefs.js should be in the root of the archive), and base64 encode it.
If you're using Linux, you can do it all like this:
mkdir firefox-profile
cd firefox-profile
echo 'user_pref("focusmanager.testmode", true);' >> prefs.js
zip -r ../firefox-profile.zip *
base64 < ../firefox-profile.zip
Then take the base64 value and set it as the "firefox_profile" capability as per the short version above.

Firefox 19.0.2 deletes proxy extension file

Working on Windows 8 64bit, Firefox 19.0.2.
I went to .../Firefox/Profiles/.../extensions and put my ekons#www.solver.ws file containing
a string
h:\myextensions\ekons\
The directory h:\myextensions\ekons\ contains install.rdf file of my extension.
Every time I restart Firefox, it deletes .../Firefox/Profiles/.../extensions/ekons#www.solver.ws file. Of course, without trying to install the extension.
Any suggestions?
Addition
I attach an image FF extensions directory.
Well, it was my mistake: extension file name was not the same as ID inside install.rdf.
Such files are silently deleted by FireFox from profile directory.
I had the same isue, the problem was an extra tag </em:description> in the install.rdf file.
When it was a valid XML all goes ok.

Resources