Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into bug-666547-make-postMessage-work-in-cs
Browse files Browse the repository at this point in the history
Conflicts:
	packages/api-utils/lib/content/content-proxy.js
	packages/api-utils/tests/test-content-proxy.js
  • Loading branch information
ochameau committed Aug 8, 2011
2 parents 834d0c0 + 2acbef7 commit 373a07b
Show file tree
Hide file tree
Showing 107 changed files with 1,686 additions and 569 deletions.
95 changes: 95 additions & 0 deletions bin/activate.ps1
@@ -0,0 +1,95 @@
$Env:VIRTUAL_ENV = (gl);
$Env:CUDDLEFISH_ROOT = $Env:VIRTUAL_ENV;

# http://stackoverflow.com/questions/5648931/powershell-test-if-registry-value-exists/5652674#5652674
Function Test-RegistryValue {
param(
[Alias("PSPath")]
[Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[String]$Path
,
[Parameter(Position = 1, Mandatory = $true)]
[String]$Name
,
[Switch]$PassThru
)

process {
if (Test-Path $Path) {
$Key = Get-Item -LiteralPath $Path
if ($Key.GetValue($Name, $null) -ne $null) {
if ($PassThru) {
Get-ItemProperty $Path $Name
} else {
$true
}
} else {
$false
}
} else {
$false
}
}
}

$WINCURVERKEY = 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion';
$WIN64 = (Test-RegistryValue $WINCURVERKEY 'ProgramFilesDir (x86)');

if($WIN64) {
$PYTHONKEY='HKLM:SOFTWARE\Wow6432Node\Python\PythonCore';
}
else {
$PYTHONKEY='HKLM:SOFTWARE\Python\PythonCore';
}

$Env:PYTHONVERSION = '';
$Env:PYTHONINSTALL = '';

foreach ($version in @('2.6', '2.5', '2.4')) {
if (Test-RegistryValue "$PYTHONKEY\$version\InstallPath" '(default)') {
$Env:PYTHONVERSION = $version;
}
}

if ($Env:PYTHONVERSION) {
$Env:PYTHONINSTALL = (Get-Item "$PYTHONKEY\$version\InstallPath)").'(default)';
}

if ($Env:PYTHONINSTALL) {
$Env:Path += ";$Env:PYTHONINSTALL";
}

if (Test-Path Env:_OLD_PYTHONPATH) {
$Env:PYTHONPATH = $Env:_OLD_PYTHONPATH;
}
else {
$Env:PYTHONPATH = '';
}

$Env:_OLD_PYTHONPATH=$Env:PYTHONPATH;
$Env:PYTHONPATH= "$Env:VIRTUAL_ENV\python-lib;$Env:PYTHONPATH";

if (Test-Path Function:_OLD_VIRTUAL_PROMPT) {
Set-Content Function:Prompt (Get-Content Function:_OLD_VIRTUAL_PROMPT);
}
else {
function global:_OLD_VIRTUAL_PROMPT {}
}

Set-Content Function:_OLD_VIRTUAL_PROMPT (Get-Content Function:Prompt);

function global:prompt { "($Env:VIRTUAL_ENV) $(_OLD_VIRTUAL_PROMPT)"; };

if (Test-Path Env:_OLD_VIRTUAL_PATH) {
$Env:PATH = $Env:_OLD_VIRTUAL_PATH;
}
else {
$Env:_OLD_VIRTUAL_PATH = $Env:PATH;
}

$Env:Path="$Env:VIRTUAL_ENV\bin;$Env:Path"

[System.Console]::WriteLine("Note: this PowerShell SDK activation script is experimental.")

python -c "from jetpack_sdk_env import welcome; welcome()"

22 changes: 22 additions & 0 deletions packages/addon-kit/docs/context-menu.md
Expand Up @@ -405,6 +405,9 @@ A labeled menu item that can perform an action when clicked.
@prop label {string}
The item's label. It must either be a string or an object that implements
`toString()`.
@prop [image] {string}
The item's icon, a string URL. The URL can be remote, a reference to an
image in the add-on's `data` directory, or a data URI.
@prop [data] {string}
An optional arbitrary value to associate with the item. It must be either a
string or an object that implements `toString()`. It will be passed to
Expand Down Expand Up @@ -435,6 +438,14 @@ A labeled menu item that can perform an action when clicked.
label later.
</api>

<api name="image">
@property {string}
The item's icon, a string URL. The URL can be remote, a reference to an image
in the add-on's `data` directory, or a data URI. You can set this after
creating the item to update its image later. To remove the item's image, set
it to `null`.
</api>

<api name="data">
@property {string}
An optional arbitrary value to associate with the item. It must be either a
Expand Down Expand Up @@ -510,6 +521,9 @@ A labeled menu item that expands into a submenu.
@prop items {array}
An array of menu items that the menu will contain. Each must be an `Item`,
`Menu`, or `Separator`.
@prop [image] {string}
The menu's icon, a string URL. The URL can be remote, a reference to an
image in the add-on's `data` directory, or a data URI.
@prop [context] {value}
If the menu is contained in the top-level context menu, this declaratively
specifies the context under which the menu will appear; see Specifying
Expand Down Expand Up @@ -544,6 +558,14 @@ A labeled menu item that expands into a submenu.
the items in the new array.
</api>

<api name="image">
@property {string}
The menu's icon, a string URL. The URL can be remote, a reference to an image
in the add-on's `data` directory, or a data URI. You can set this after
creating the menu to update its image later. To remove the menu's image, set
it to `null`.
</api>

<api name="context">
@property {list}
A list of declarative contexts for which the menu will appear in the context
Expand Down
40 changes: 29 additions & 11 deletions packages/addon-kit/lib/clipboard.js
Expand Up @@ -23,6 +23,8 @@
* Contributor(s):
* Paul O’Shannessy <paul@oshannessy.com> (Original Author)
* Dietrich Ayala <dietrich@mozilla.com>
* Myk Melez <myk@mozilla.org>
* Erik Vold <erikvvold@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
Expand All @@ -38,9 +40,11 @@
*
* ***** END LICENSE BLOCK ***** */

"use strict";

const {Cc,Ci} = require("chrome");
const errors = require("errors");
const apiUtils = require("api-utils");
const errors = require("api-utils/errors");
const apiUtils = require("api-utils/api-utils");

/*
While these data flavors resemble Internet media types, they do
Expand Down Expand Up @@ -124,15 +128,29 @@ exports.set = function(aData, aDataType) {

switch (flavor) {
case "text/html":
var str = Cc["@mozilla.org/supports-string;1"].
createInstance(Ci.nsISupportsString);
str.data = options.data;
xferable.addDataFlavor(flavor);
xferable.setTransferData(flavor, str, options.data.length * 2);
// add text/html flavor
let (str = Cc["@mozilla.org/supports-string;1"].
createInstance(Ci.nsISupportsString))
{
str.data = options.data;
xferable.addDataFlavor(flavor);
xferable.setTransferData(flavor, str, str.data.length * 2);
}

// add a text/unicode flavor (html converted to plain text)
let (str = Cc["@mozilla.org/supports-string;1"].
createInstance(Ci.nsISupportsString),
converter = Cc["@mozilla.org/feed-textconstruct;1"].
createInstance(Ci.nsIFeedTextConstruct))
{
converter.type = "html";
converter.text = options.data;
str.data = converter.plainText();
xferable.addDataFlavor("text/unicode");
xferable.setTransferData("text/unicode", str, str.data.length * 2);
}
break;
// TODO: images!
// TODO: add a text/unicode flavor for HTML text that
// returns a plaintextified representation of the HTML.
default:
throw new Error("Unable to handle the flavor " + flavor + ".");
}
Expand Down Expand Up @@ -231,7 +249,7 @@ exports.__defineGetter__("currentFlavors", function() {
// SUPPORT FUNCTIONS ////////////////////////////////////////////////////////

function toJetpackFlavor(aFlavor) {
for each (flavorMap in kFlavorMap)
for each (let flavorMap in kFlavorMap)
if (flavorMap.long == aFlavor)
return flavorMap.short;
// Return null in the case where we don't match
Expand All @@ -240,7 +258,7 @@ function toJetpackFlavor(aFlavor) {

function fromJetpackFlavor(aJetpackFlavor) {
// TODO: Handle proper flavors better
for each (flavorMap in kFlavorMap)
for each (let flavorMap in kFlavorMap)
if (flavorMap.short == aJetpackFlavor || flavorMap.long == aJetpackFlavor)
return flavorMap.long;
// Return null in the case where we don't match.
Expand Down

0 comments on commit 373a07b

Please sign in to comment.