FireBreath plugin automatic installation

2019-01-27 01:02发布

问题:

I wrote a plugin using FireBreath, VS2010, for Windows, all browsers.

In FireBreath documentation I saw that I have to install WiX. I installed it. I created the project using the automatic fbgen tool so it autmatically created a WiX for me.

I couldn't understand from the doc is waht to do now:

  1. Do I have to edit the generated WiX source file? If yes, what to change there?

  2. What to write in the object tag that will trigger the installation of the msi created? Or at least say to the user that installation is needed and link him to a download?

10x!

回答1:

With the WiX Toolkit installed, re-run the prep__.bat file to regenerate the installer project along with the main plugin project. Build the plugin project, then build the installer project named something like {YourPlugin}_WiXInstaller. The msi will be placed in Firebreath's \build\bin\{YourPlugin}\{Configuration} dir ( {Configuration} is Debug, Release, etc).

It's not necessary to edit the WiX file unless you really want to change a specific setting. One thing I can think of is changing the default per-user install to all users. Per-user is usually better because it avoids UAC issues.

Deploying it to the user is a bit trickier. For most browsers, the user must save & run the msi. On IE you can declare an object in the HTML body and point the codebase to a URL containing the plugin:

<object id="pluginid" type="application/x-yourplugin" width="0" height="0" codebase="/YourPlugin.msi" >
    <param name="onload" value="pluginLoaded" />
</object>

However IE9's security seems to block MSI's here. It does work if the plugin DLL is used (codebase="/YourPlugin.dll"). This auto-install method only works in IE with signed binaries (unless IE's security options are cranked way down). Hopefully a discussion thread on the MSI security issue will yield some answers.

Update: As hinted by Richard / taxilian, an MSI must be packaged within a CAB file in order for IE to install it. Getting the INF right and creating the CAB takes some additional steps as documented by RB. And to add yet another wrinkle, Vista/Win7 do not allow the INF to call any binary outside of the CAB file, so a stub launching app must be used (see this thread and example code posted by Roey towards the bottom).