Can't deploy extension (firefox) - firefox

I am closely following the tutorial here as I attempt to create a Firefox extension. I have the following tree for my extension:
backtosearch
+-chrome
+-content
backtosearch.xul
+-chrome.manifest
+-install.rdf
I have created a testing profile for FF called "Extension Testing" and have added a file to the profile extensions folder "backtosearch#my.name" containing absolute path to the extension folder. I have reloaded the browser chrome using the extension development extension and restarted the browser - but I see no new button.
I have simplified the tutorial (as I only require one button), and my .xul contains only that. My chrome.manifest file contains:
content backtosearch chrome/content/
overlay chrome://browser/content/browser.xul chrome://backtosearch/content/backtosearch.xul
The extension is not showing under view -> toolbars or tools -> addons
Thanks for any help
install.rdf
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<!-- Required Items -->
<em:id>backtosearch#dylan.lloyd</em:id>
<em:name>Back To Search</em:name>
<em:version>1.0</em:version>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>1.5</em:minVersion>
<em:maxVersion>3.5.*</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Optional Items -->
<em:creator>Dylan Lloyd</em:creator>
<em:description>Adds options to return to your last search immediately.</em:description>
<em:homepageURL>http://www.getyourkeywords.com/</em:homepageURL>
</Description>
</RDF>
backtosearch#dylan.lloyd
C:\Users\Dylan\Desktop\backtosearch\

Hey I found out in moziila own documentation the mistake on this hello world.
You can read on:
https://github.com/oschrenk/firefox-extension
I had written
<RDF xmlns="http://www.w3.org/1999/02/22-RDF-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-RDF#">
<Description about="urn:mozilla:install-manifest">
as the root element, but it needs to be all lowercase
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
Just update the install.rdf =)

From your description it's not clear what the problem is. The most likely cause, as sdwilsh noted is that the Extension didn't get registered. If this is the case, the extension will not appear in Tools -> Addons.
You can try to set extensions.logging.enable pref to true to help debugging. Maybe try installing a helloworld extension first?
Possible causes:
You didn't use the correct name for the "link" file (must match the extension ID).
The "link" file contents is invalid (the path format is OS-native). In your case the path should end with "backtosearch"
Incorrect install.rdf. You can check it at least to be valid XML by opening it in Firefox (possibly renaming to .xml first) -- if the yellow screen opens, its invalid.
Installed in the wrong profile or didn't really restart Firefox.
If the extension is registered, try opening chrome://backtosearch/content/backtosearch.xul in Firefox (by copying that to the Location bar) -- if any errors appear, you should fix them. If the file loads successfully (may be empty), there's a problem with your overlay's contents, which is hard to debug without seeing it. Perhaps start with an overlay that's known to work?

Try running it through Mozilla's Add-On Validation page. It might just tell you what the error is. If it is a javascript error, it will tell you for sure.
Now, I had the same problem - when I loaded my addon, my toolbar didn't appear, and even though the addon showed in "Tools > Addons", when I clicked on the "options" button, everything froze.
Turned out, there were several errors.
The optionsurl in my install.rdf had "cchrome" instead of "chrome".
In my main .js file, I forgot a ";" at the end of a line with a var
assignment.
In my xul file, I did not leave a space: label="string"tooltip="string" between the two property assignments.
I had a hanging </toolbarbutton> from where I copied one line to the next. This is what really caused the problem. In the code file, the line was very long, and I never saw that part!
The combination was total failure, even though it passed fine in the Mozilla Validator.
The Validator, in my opinion should have caught the cchrome thing. It would have caught the javascript error.
Anyway, I tell you that in case such might be YOUR problem.

Related

Hack Firefox to open extensions with address bar

I see this one time, and know that it not so hard, but can't find any solutions in internet.
Let say I have plugin, as you know it written by XUL. XUL like HTML has tags, js and etc. So I want to debug it with Firebug.
But in default plugin view firebug (as all other plugins disabled). So i need to open my plugin like Web page.
I remember that it's something like
chrome://address/to/my/plugin/page.xul
Does anyone face this problem?
There is no general rule by which you can build the addresses of extension pages. You have to open the extension's XPI file (it's a regular ZIP file, rename it if necessary) and have a look at chrome.manifest inside. E.g. in Firebug's chrome.manifest it says:
content firebug content/firebug/
Which means that the files in the content/firebug/ directory of the extension are accessible under chrome://firebug/content/. You can try opening them as web pages but they won't necessarily work.
A better approach would be using tools that are actually meant for extensions. For example Chromebug or DOM Inspector.

How to add icon on Customize Toolbar?

I am trying to add a button on the Customize Tool Window on Firefox 4
My folders look like this:
addon
|- content
|- om
|- xul
|- browser.xul
|- browser.css
|- skin
|- default
|- icon.png
My chrome.manifest file:
content orkutmanager content/om/
content orkutmanager content/om/ contentaccessible=yes
skin orkutmanager default skin/default/
locale orkutmanager en-US locale/en-US/
overlay chrome://global/content/browser.xul chrome://orkutmanager/content/xul/browser.xul
My browser.xul file:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="chrome://orkutmanager/content/xul/browser.css"?>
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton id="orkutmanager-button" label="OM"
class="toolbarbutton-1 chromeclass-toolbar-additional"
tooltiptext="Orkut Manager"/>
</toolbarpalette>
</overlay>
Accessing chrome://orkutmanager/content/xul/browser.xul gets me to a blank page, which means the file was found. (Should something be rendered?).
Accessing chrome://global/content/browser.xul gets me to an error page:
Firefox can't find the file at jar:file:///C:/Program Files (x86)/Mozilla Firefox 4.0 Beta 7/omni.jar!/chrome/toolkit/content/global/browser.xul
Isn't this file supposed to exist? Did it move? How can I add an icon on the Customize Toolbar window?
Apparently I should post this as an answer for accepting:
http://forums.mozillazine.org/viewtopic.php?f=38&t=934345
seems to demonstrate roughly the problem you are looking at. However, you commented that this was not correct entirely, but that it did lead to you finding the problem which was the inclusion of the filename in a different place.
For others fighting the same problem, ensure that all the new paths are up to date.
Thanks.
Instead of chrome://global/content/browser.xul it is chrome://browser/content/browser.xul.
I found a page, here, where it is explains very well how to achieve this.
In another documentation page, I found:
The CSS file with your toolbar styles
needs to be included in the overlay
file, as you would expect, but also in
the chrome.manifest file. This is very
important because the toolbar
customization dialog won't work
correctly without this. The way to
include the file in the manifest is to
add this line:
style chrome://global/content/customizeToolbar.xul chrome://xulschoolhello/skin/toolbar.css
The documentation is very messy, I was looking at one about Firefox 1.5 when I copied the url. :S

Problem with Outlook plugin and webbrowser

I've created a couple of Office plugins. The plugin shows a set of html files installed on the clients computer. The plugin uses a COM-accessible assembly which shows a WinForm with a WebBrowser on it. The plugin makes the WebBrowser navigate to a file on the clients computer. The assembly is also used in other programs to show the same information.
When showing the local html files using a 'normal' browser (e.g. double clicking a file in Windows Explorer) the browser popup a security warning about running active content. This is because we have some javascript in it. This warning is supressed by setting the 'Allow active content to run in files on My Computer' in the Internet Explorer settings. This solves the issue using a 'normal' browser.
Funny enough the 'active content' warning is not shown when getting the same file using a Word/Excel/PowerPoint plugin. It calls the same assembly, using the same WinForm and using the same content. Despite the setting 'Allow active content to run from My Computer' being false, the content is shown without a warning and the javascript is executed.
Now, the problem and the real question is that Outlook does the reverse. No matter what I use for 'Allow active content to run from My Computer' the browser warning about the active content in the html file is shown. When I confirm the message and allow the scripts to continue, the javascript runs fine. So, even when I set the 'Allow active content to run from My Computer' to true, the warning is given.
I've gone through all (sort of) relevant settings in Outlook, but nothing helps.
I assume that Outlook is using some kind of private context for a webbrowser (probably because it is using a webbrowser object internally).
The real question is: how can I make the Outlook plugin respect the IE settings?
(I understand this is a long story and maybe not clear enough. Please let me know if I have to elaborate more).
I couldn't get rid of the security warning without lowering the security setting. And that is not an option: we are talking about a project that will be installed on millions of computers.
I decided to go another route. Let's see if we can make the browser trust the html pages. So, what to do to get rid of the 'Active content' warning.
First I investigated what exactly triggers the warning. That was easy: any tag in your html file will do. And I need script, so removing that isn't an option. But, when hosted from a website, the scripts run fine and don't suffer from a warning. So, I investigated if it is possible to run my files in the Internet-context.
I found out there is a way, at least for IE (which in my case is sufficient). If you save a webpage as a complete HTML file from IE, the browser adds a comment to the html to signal its origin. Something like: . If you later open that stored html file, the file is shown in the Internet context.
So, I tried adding to the html file. And, voila, the file is opened in the Internet context. The security warning about active content is gone and the scripts are executed fine.
But, that raised another problem. We have a couple of window.open statements in the scripts and using that causes he cross domain browsing problems that in recent IE versions are blocked. Even if you use a relative path in the window.open call, if fails and you end up with a blank window.
In our case, we can (probably) decide to get rid of the window.open calls. But, if a reader ever finds a solution for using window.open in this scenario, I would be very happy if you let me know.
So, for now: case closed...
Internet explorer use Mark of web in such cases
<!-- saved from url=(0014)about:internet -->
<!doctype html>
<!-- saved from url=(0023)http://www.contoso.com/ -->
<html>
<head>
<title>A Mark of the Web Example.</title>
</head>
<body>
<p>Hello, World</p>
</body>
</html>
More info from here
https://msdn.microsoft.com/en-us/library/ms537628(v=vs.85).aspx

How to create hidden Firefox Extension?

Is it possible to create Firewox extension that will not shown in Extensions List? And so cannot be deinstalled manually?
To Hide an extensions/addons in the list of extension about:addons simply follow these few simple steps:
(1) Create an a zipfile myextenios.zip (firefox extension are actually zip files) having this structure:
myextension.zip
|
|--chrome.manifest
|--install.rdf
|--[content]
|--hideExtensions.css
(2) The chrome.manifest should have this content:
content myextension content/
style chrome://mozapps/content/extensions/extensions.xul chrome://myextension/content/hideExtensions.css
style about:addons chrome://myextension/content/hideExtensions.css
(3) The install.rdf should have this content:
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>myextension#yoursite.de</em:id>
<em:name>myextension</em:name>
<em:description>This addon hides addons entries in about:addons</em:description>
<em:optionsURL></em:optionsURL>
<em:iconURL></em:iconURL>
<em:version>1.0</em:version>
<em:creator>your name</em:creator>
<em:homepageURL>http://www.yourside.de</em:homepageURL>
<em:type>2</em:type>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>4.0</em:minVersion>
<em:maxVersion>14.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>
(4) Lastly the file hideExtensions.css has to have the following content:
(note: of course you might wanna adjust the name of the extension you want to hide)
.addon[name="1. Name of addon to hide"],
.addon[name="2. Name of addon to hide"],
.addon[name="3. Name of addon to hide"],
.addon[name="myextension"]
{
display:none;
}
(5) Rename the myextension.zip to myextension.xpi so that it recognized as a extension + install it by dragging the file into Firefox browser window.
Conclusion:
Most of the steps baove are equal to those of the creation of any other firefox extension. Therefore anybody with the knowledge to create an firefox addon/extension can also cause this extension not to show up in the addon list you see when you enter about:addons. Consequently if you have just one malicious firefox extension (virus) then you cannot trust Firefox as much to even see this virus-extension in the list.
See this mozillazine entry and this forum entry. These extensions are somehow installed via the registry and supposed to be malicious - so there's no use for this except if you want to be on some malware blacklist.
For private use or administration use like MSalters suggested in his comment, "hidden" (for some users) extensions could be useful, but this should be implemented by Mozilla first.

Firefox Links to local or network pages do not work

I have a .asp application where image files (.PDF) are stored in a directory (fed by a copier/scanner). The created file names are stored in a database table. When a query is launched from the web page a link to the file is created. When clicked the image should be displayed.
This functionality works 100% in Internet Explorer. No such luck in Firefox (and I have some Firefox users). The created hyperlink looks like this file://Server/Scanner/XYZ.pdf
The Firefox helps suggest the reason is this:
Links to local or network pages do not work. As a security precaution, Firefox forbids sites on the Internet to link to files that are stored in your local computing environment. These files may include files on your computer, mapped network drives, and UNC network paths
None of the suggestions for a workaround seem to work (or I am not understanding the steps to create the image display)
Any Suggestions?
This is the default Firefox behavior designed for security .The assumption is probably that most web sites don't know what and where are you local files (including UNC paths).
This could be turned off in firefox:
type "about:config" in the address bar and accept "i'll be careful"
find "security.checkloaduri" in older versions or "security.fileuri.strict_origin_policy" in newer versions of firefox and change the value to "false"
restart firefox
That should do it for you. You have more information here:
http://kb.mozillazine.org/Security.fileuri.strict_origin_policy
http://kb.mozillazine.org/Security.fileuri.origin_policy
Firefox >= 68.0.1
I'm able to preview in Firefox both images and PDF files with local file links using the settings mentioned here: https://bugzilla.mozilla.org/show_bug.cgi?id=1303727
I have used links with local file: test
and added in user.js the mentioned settings (with adjusted sites list):
user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites", "http://my.intranet");
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");
Also, when setting Firefox to "Always ask" for PDF files, I was able to "Open with" the PDF in Adobe Acrobat Reader DC, which reported the expected local folder when accessing "File -> Properties".
Firefox >= 1.5.x < 20 (ish)
Search for the Firefox profile folder on your hard drive, e.g. (12345678 stands for eight random digits and letters):
Windows: "C:\Documents and Settings\Username\Application Data\Mozilla\Firefox\Profiles12345678.default\"
Linux: "/home/username/.mozilla/firefox/12345678.default/"
OS X: /Username/Library/Application Support/Firefox/Profiles/12345678.default/
In this folder create a text file with the name user.js. Write the following line into that text file:
user_pref("capability.policy.default.checkloaduri.enabled", "allAccess");
Works on my PC (Firefox 3.0.3 and 19.0 beta) with the following references:
<img src="file://///server/share/image.png" />
<img src="file://\\\server\share\image.png" />
<img src="file://d:\image.png" />
<img src="file:///d:\image.png" />
<img src="file://d:/image.png" />
<img src="file:///d:/image.png" />
<img src="file://localhost/d:/image.png" />
Also, if you are using the NoScript add-on, check the Advanced \ Trusted \ Allow local links option.
Reading at the solution given here, I followed the link Links to local pages do not work and for me, only this worked well (I am using wordpress for a personal FAQ on a local wamp installation):
Go to your "%Your Documents & Settings%\Application Data\Mozilla\Firefox\Profiles\%your profile%\"
edit the file "prefs.js"
add the following lines at the end of the document:
.
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");
user_pref("capability.policy.localfilelinks.sites", "http://localhost");
user_pref("capability.policy.maonoscript.javascript.enabled", "allAccess");
You can leave the setting "security.checkloaduri" to its default value, and also the "security.fileuri.strict_origin_policy". Thanks to those 3 lines, you just make an exception for your local server.
Be careful, if you need to go back to that prefs.js file, note that Firefox will have ordered it alphabetically. So the 3 lines you will have added at the end will be somewhere at the beginning ;).
You can load the LocalLink FireFox Add-On, which allows you to right-click on a local link and select 'Open in Foreground Window'. The other 'Open...' menu items are supposed to work, but don't for me.
http://locallink.mozdev.org/
Also, you can use NoScript, like Alex suggests, which enables normal clicking of local links. Thanks Alex.
Marko's solution should work for links that are also on the local filesystem, but I don't think it should allow an http:// page to link to a file:// page.
The issue for people linking from http:// pages is discussed here:
http://kb.mozillazine.org/Links_to_local_pages_do_not_work
along with an explanation of how to circumvent it and expose yourself to risk.
You can instead read the file off the disk and then send it in the Response from your page.
See this link for an example.
Tonnes of thanks I wAs searching this solution since months,
::THis thing worked::
This could be turned off in firefox:
* type "about:config" in the address bar and accept "i'll be careful"
* find "security.checkloaduri" in older versions or "security.fileuri.strict_origin_policy" in newer versions of firefox and change the value to "false"
* restart firefox
::::
shouldn't you really store the pages in your application directory and reference them this way. http://SITENAME/Server/scanner/XYZ.pdf.
We do something similar with files stored all in one directory and just store the file name. we then create the link using the known folder name and append the file name. this works quite well.
Finally firefox is a lot more anal about the directions of the slashes in file names as well. Make sure they are all '/' rather than '\'.
Hope this helps.
beware of incompatibility with gmarks (google toolbar replacer)
both local link and policy manager worked for me; local link is a little smoother, policy manager gives you more control
file://localhost///servername/share/file.txt works for me on FF11
(from a local html file: file:///C:/index.html)

Resources