This commit is contained in:
ben%bengoodger.com 2004-05-11 05:09:57 +00:00
Родитель 63f37119b2
Коммит ac457d17fa
22 изменённых файлов: 508 добавлений и 130 удалений

Просмотреть файл

@ -20,6 +20,9 @@ srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = {641d8d09-7dda-4850-8228-ac0ab65e2ac9} {972ce4c6-7e08-4474-a285-3208198ce6fd}
include $(topsrcdir)/config/rules.mk
FILES := \
@ -30,8 +33,8 @@ FILES := $(addprefix $(srcdir)/, $(FILES))
libs::
$(INSTALL) $(FILES) $(DIST)/bin/defaults/profile/extensions
$(INSTALL) $(srcdir)/"installed-extensions.txt" $(DIST)/bin/Extensions
$(INSTALL) $(srcdir)/"installed-extensions.txt" $(DIST)/bin/defaults/profile/extensions
install::
$(SYSINSTALL) $(IFLAGS1) $(FILES) $(DESTDIR)$(mozappdir)/defaults/profile/extensions
$(SYSINSTALL) $(IFLAGS1) $(srcdir)/"installed-extensions.txt" $(DESTDIR)$(mozappdir)/Extensions
$(SYSINSTALL) $(IFLAGS1) $(srcdir)/"installed-extensions.txt" $(DESTDIR)$(mozappdir)/defaults/profile/extensions

Просмотреть файл

@ -0,0 +1,35 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# Contributor(s):
#
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
FILES := \
install.rdf \
$(NULL)
FILES := $(addprefix $(srcdir)/, $(FILES))
libs::
$(INSTALL) $(FILES) $(DIST)/bin/defaults/profile/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}
install::
$(SYSINSTALL) $(IFLAGS1) $(FILES) $(DESTDIR)$(mozappdir)/defaults/profile/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}

Просмотреть файл

@ -0,0 +1,35 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# Contributor(s):
#
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
FILES := \
install.rdf \
$(NULL)
FILES := $(addprefix $(srcdir)/, $(FILES))
libs::
$(INSTALL) $(FILES) $(DIST)/bin/defaults/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}
install::
$(SYSINSTALL) $(IFLAGS1) $(FILES) $(DESTDIR)$(mozappdir)/defaults/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}

Просмотреть файл

@ -18,6 +18,10 @@
<em:locked>true</em:locked>
<!-- Front End Integration Hooks (used by Theme Manager)-->
<em:creator>Arvid Axelsson</em:creator>
<em:contributor>Mozilla Contributors</em:contributor>
<em:internalName>classic/1.0</em:internalName>
</Description>
</RDF>

Просмотреть файл

@ -62,6 +62,8 @@ pref("update.app.updateDescription", "");
pref("update.app.updateURL", "");
pref("update.extensions.enabled", true);
pref("update.extensions.wsdl", "chrome://mozapps/locale/extensions/extensions.properties");
pref("extensions.getMoreExtensionsURL", "chrome://mozapps/locale/extensions/extensions.properties");
pref("extensions.getMoreThemesURL", "chrome://mozapps/locale/extensions/extensions.properties");
// Automatically download and install updates to themes and extensions.
pref("update.extensions.autoUpdate", false);

Просмотреть файл

@ -28,5 +28,3 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
libs::
$(INSTALL) $(srcdir)/install.rdf $(DIST)/bin/Extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}

Просмотреть файл

@ -18,5 +18,4 @@ classic.jar:
skin/classic/browser/Throbber-small.png
skin/classic/browser/Throbber-small.gif
skin/classic/browser/Toolbar-small.png
skin/classic/browser/Toolbar.png
install.rdf
skin/classic/browser/Toolbar.png

Просмотреть файл

@ -28,5 +28,3 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
libs::
$(INSTALL) $(srcdir)/install.rdf $(DIST)/bin/Extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}

Двоичные данные
browser/extensions/inspector/content/inspector.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 203 B

Просмотреть файл

@ -3,3 +3,4 @@ inspector.jar:
+ content/inspector/tasksOverlay.xul (content/tasksOverlay.xul)
*+ locale/en-US/inspector/contents.rdf (locale/contents.rdf)
+ locale/en-US/inspector/tasksOverlay.dtd (locale/tasksOverlay.dtd)
+ inspector.gif (content/inspector.gif)

Просмотреть файл

@ -1,5 +1,6 @@
view {
-moz-binding: url("chrome://mozapps/skin/shared/richview.xml#richview");
width: 20em;
}
extension {
@ -35,3 +36,11 @@ extension[toBeUninstalled="true"] {
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#extension-tobeuninstalled");
}
extension[itemType="theme"] {
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#theme");
}
.themePreviewArea {
width: 0px;
}

Просмотреть файл

@ -10,8 +10,12 @@ var gExtensionssView = null;
var gWindowState = "";
var gURIPrefix = ""; // extension or theme prefix
var gDSRoot = ""; // extension or theme root
var gGetMoreURL = "";
const PREF_EM_EXTENSIONS_DISABLED = "extensions.safeMode";
const PREF_APP_ID = "app.id";
const PREF_EXTENSIONS_GETMORETHEMESURL = "extensions.getMoreThemesURL";
const PREF_EXTENSIONS_GETMOREEXTENSIONSURL = "extensions.getMoreExtensionsURL";
const PREF_GENERAL_SKINS_SELECTEDSKIN = "general.skins.selectedSkin";
///////////////////////////////////////////////////////////////////////////////
// Utility Functions
@ -60,8 +64,9 @@ function onExtensionSelect(aEvent)
function Startup()
{
gWindowState = window.arguments[0];
gURIPrefix = gWindowState == "extensions" ? "urn:mozilla:extension:" : "urn:mozilla:theme:";
gDSRoot = gWindowState == "extensions" ? "urn:mozilla:extension:root" : "urn:mozilla:theme:root";
var isExtensions = gWindowState == "extensions";
gURIPrefix = isExtensions ? "urn:mozilla:extension:" : "urn:mozilla:theme:";
gDSRoot = isExtensions ? "urn:mozilla:extension:root" : "urn:mozilla:theme:root";
document.documentElement.setAttribute("windowtype", document.documentElement.getAttribute("windowtype") + "-" + gWindowState);
@ -94,10 +99,78 @@ function Startup()
document.documentElement.setAttribute("title", extensionsStrings.getString(gWindowState + "Title"));
gExtensionsViewController.onCommandUpdate();
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
gGetMoreURL = pref.getComplexValue(isExtensions ? PREF_EXTENSIONS_GETMOREEXTENSIONSURL
: PREF_EXTENSIONS_GETMORETHEMESURL,
Components.interfaces.nsIPrefLocalizedString).data;
gGetMoreURL = gGetMoreURL.replace(/%APPID%/g, pref.getCharPref(PREF_APP_ID));
// Update various pieces of state-dependant UI
var getMore = document.getElementById("getMore");
getMore.setAttribute("value", getMore.getAttribute(isExtensions ? "valueextensions" : "valuethemes"));
getMore.setAttribute("tooltiptext", getMore.getAttribute(isExtensions ? "tooltiptextextensions" : "tooltiptextthemes"));
if (!isExtensions) {
var themePreviewArea = document.getElementById("themePreviewArea");
themePreviewArea.hidden = false;
gExtensionsView.removeAttribute("flex");
var win = document.documentElement;
if (!win.hasAttribute("width") || !win.hasAttribute("height")) {
win.setAttribute("width", 500);
win.setAttribute("width", 380);
gExtensionsView.addEventListener("richview-select", onThemeSelect, false);
}
}
}
function Shutdown()
{
if (gWindowState != "extensions")
gExtensionsView.removeEventListener("richview-select", onThemeSelect, false);
}
function onViewDoubleClick()
{
switch (gWindowState) {
case "extensions":
gExtensionsViewController.doCommand('cmd_options');
break;
case "themes":
if (!gExtensionsView.selected)
return;
var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
.getService(Components.interfaces.nsIXULChromeRegistry);
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var internalName = gExtensionsView.selected.getAttribute("internalName");
var inUse = cr.isSkinSelected(internalName, true);
if (inUse == Components.interfaces.nsIChromeRegistry.FULL)
return;
pref.setCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN, internalName);
cr.selectSkin(internalName, true);
cr.refreshSkins();
break;
}
}
function onThemeSelect(aEvent)
{
var previewImageDeck = document.getElementById("previewImageDeck");
if (!gExtensionsView.selected) {
previewImageDeck.setAttribute("index", "0");
return;
}
var url = gExtensionsView.selected.getAttribute("previewImage");
if (url) {
previewImageDeck.setAttribute("index", "2");
previewImage.setAttribute("src", url);
}
else
previewImageDeck.setAttribute("index", "1");
}
///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -189,5 +189,29 @@
</implementation>
</binding>
<binding id="theme" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
<resources>
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
</resources>
<content>
<xul:hbox flex="1">
<xul:vbox pack="start">
<xul:image class="extension-icon" xbl:inherits="src=image"
style="width: 32px; max-width: 32px; height: 32px; max-height: 32px;"/>
</xul:vbox>
<xul:vbox pack="start" flex="1">
<xul:hbox>
<xul:label class="extension-item-name" xbl:inherits="value=name" crop="center"/>
<xul:label class="extension-item-version" xbl:inherits="value=version"/>
</xul:hbox>
<xul:label class="extension-item-creator" xbl:inherits="value=creator" crop="right"/>
</xul:vbox>
</xul:hbox>
</content>
<implementation>
<field name="eventPrefix">"extension-"</field>
</implementation>
</binding>
</bindings>

Просмотреть файл

@ -118,79 +118,106 @@
<popup id="extensionContextMenu" onpopupshowing="return buildContextMenu(event);"/>
<view id="extensionsView" flex="1" style="overflow: auto;"
datasources="rdf:null" persist="last-selected"
ondragover="nsDragAndDrop.dragOver(event, gExtensionsDNDObserver);"
ondragdrop="nsDragAndDrop.drop(event, gExtensionsDNDObserver);"
ondblclick="gExtensionsViewController.doCommand('cmd_options');">
<template>
<rule>
<conditions>
<content uri="?uri"/>
<member container="?uri" child="?extension"/>
<triple subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#name"
object="?name"/>
<triple subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#version"
object="?version"/>
</conditions>
<bindings>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#creator"
object="?creator"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#iconURL"
object="?icon"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#optionsURL"
object="?options-url"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#aboutURL"
object="?about-url"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#updateURL"
object="?update-url"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#disabled"
object="?disabled"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#homepageURL"
object="?homepage-url"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#description"
object="?description"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#locked"
object="?locked"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#toBeInstalled"
object="?toBeInstalled"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#toBeUninstalled"
object="?toBeUninstalled"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#toBeEnabled"
object="?toBeEnabled"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#toBeDisabled"
object="?toBeDisabled"/>
</bindings>
<action>
<extension uri="?extension" context="extensionContextMenu"
image="?icon" name="?name" version="?version"
description="?description" creator="?creator"
disabled="?disabled" locked="?locked"
optionsURL="?options-url" homepageURL="?homepage-url"
aboutURL="?about-url" updateURL="?update-url"
toBeInstalled="?toBeInstalled" toBeUninstalled="?toBeUninstalled"
toBeEnabled="?toBeEnabled" toBeDisabled="?toBeDisabled"/>
</action>
</rule>
</template>
</view>
<hbox flex="1">
<view id="extensionsView" flex="3" style="overflow: auto;"
datasources="rdf:null" persist="last-selected"
ondragover="nsDragAndDrop.dragOver(event, gExtensionsDNDObserver);"
ondragdrop="nsDragAndDrop.drop(event, gExtensionsDNDObserver);"
ondblclick="onViewDoubleClick();">
<template>
<rule>
<conditions>
<content uri="?uri"/>
<member container="?uri" child="?extension"/>
<triple subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#name"
object="?name"/>
<triple subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#version"
object="?version"/>
</conditions>
<bindings>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#creator"
object="?creator"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#iconURL"
object="?icon"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#previewImage"
object="?previewImage"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#optionsURL"
object="?options-url"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#aboutURL"
object="?about-url"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#updateURL"
object="?update-url"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#disabled"
object="?disabled"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#homepageURL"
object="?homepage-url"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#description"
object="?description"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#locked"
object="?locked"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#toBeInstalled"
object="?toBeInstalled"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#toBeUninstalled"
object="?toBeUninstalled"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#toBeEnabled"
object="?toBeEnabled"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#toBeDisabled"
object="?toBeDisabled"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#itemType"
object="?itemType"/>
<binding subject="?extension"
predicate="http://www.mozilla.org/2004/em-rdf#internalName"
object="?internalName"/>
</bindings>
<action>
<extension uri="?extension" context="extensionContextMenu"
image="?icon" name="?name" version="?version"
description="?description" creator="?creator"
disabled="?disabled" locked="?locked"
optionsURL="?options-url" homepageURL="?homepage-url"
aboutURL="?about-url" updateURL="?update-url"
previewImage="?previewImage" internalName="?internalName"
toBeInstalled="?toBeInstalled" toBeUninstalled="?toBeUninstalled"
toBeEnabled="?toBeEnabled" toBeDisabled="?toBeDisabled"
itemType="?itemType"/>
</action>
</rule>
</template>
</view>
<vbox id="themePreviewArea" class="themePreviewArea" hidden="true" flex="5">
<deck id="previewImageDeck" flex="1">
<vbox id="noThemeSelected" pack="center" align="center">
<label class="previewText">&previewNoThemeSelected.label;</label>
</vbox>
<vbox id="noPreviewImage" pack="center" align="center">
<label class="previewText">&previewNoPreviewImage.label;</label>
</vbox>
<vbox id="previewImageContainer" pack="center" align="center"
style="overflow: auto;">
<image id="previewImage"/>
</vbox>
</deck>
</vbox>
</hbox>
<hbox>
<hbox id="commandBar" flex="1">
<hbox id="commandBar" flex="1" align="center">
<button id="uninstallButton"
label="&cmd.uninstall.label;" accesskey="&cmd.uninstall.accesskey;" tooltiptext="&cmd.uninstall.tooltip;"
command="cmd_uninstall"/>
@ -198,6 +225,12 @@
<button id="updateButton"
label="&cmd.update.label;" accesskey="&cmd.update.accesskey;" tooltiptext="&cmd.update.tooltip;"
command="cmd_update"/>
<label id="getMore" onclick="openURL(gGetMoreURL);"
valuethemes="&getMoreThemes.label;"
valueextensions="&getMoreExtensions.label;"
tooltiptextthemes="&getMoreThemes.tooltip;"
tooltiptextextensions="&getMoreExtensions.tooltip;"
flex="1" crop="right" align="right"/>
</hbox>
<resizer id="windowResizer" dir="bottomright"/>

Просмотреть файл

@ -42,4 +42,13 @@
<!ENTITY extensionItem.toBeDisabled.label "This item will be disabled after you restart &brandShortName;.">
<!ENTITY extensionItem.toBeEnabled.label "This item will be enabled after you restart &brandShortName;.">
<!ENTITY extensionItem.toBeInstalled.label "This item will be installed after you restart &brandShortName;.">
<!ENTITY extensionItem.toBeUninstalled.label "This item will be uninstalled after you restart &brandShortName;.">
<!ENTITY extensionItem.toBeUninstalled.label "This item will be uninstalled after you restart &brandShortName;.">
<!ENTITY getMoreExtensions.label "Get More Extensions">
<!ENTITY getMoreExtensions.tooltip "Get More Extensions from update.mozilla.org">
<!ENTITY getMoreThemes.label "Get More Themes">
<!ENTITY getMoreThemes.tooltip "Get More Themes from update.mozilla.org">
<!ENTITY previewNoThemeSelected.label "No Theme Selected">
<!ENTITY previewNoPreviewImage.label "This Theme does not have a Preview Image.">

Просмотреть файл

@ -13,6 +13,8 @@ queryUninstallThemeMessage=Do you want to uninstall %S?
queryUninstallTitle=Uninstall %S
update.extensions.wsdl=http://localhost:8080/axis/services/VersionCheck?wsdl
extensions.getMoreExtensionsURL=http://update.mozilla.org/extensions.php?app=%APPID%
extensions.getMoreThemesURL=http://update.mozilla.org/themes.php?app=%APPID%
themesTitle=Themes
extensionsTitle=Extensions

Просмотреть файл

@ -39,6 +39,13 @@
margin-left: 5px;
}
#getMore {
color: #0000FF;
text-decoration: underline !important;
cursor: pointer;
text-align: right;
}
/* Extension Buttons (Iconic buttons in each extension item) */
.extension-button {
width: 10px;
@ -91,3 +98,17 @@ extension[disabled="true"] .extension-icon {
margin-right: 10px;
}
.previewText {
font-size: larger;
font-weight: bold;
color: ThreeDShadow;
}
extension[itemType="theme"] {
padding: 7px 5px 7px 6px;
}
extension[itemType="theme"] .extension-icon {
margin-right: 3px;
}

Двоичные данные
toolkit/mozapps/extensions/skin/themeGeneric.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.1 KiB

Просмотреть файл

@ -45,6 +45,7 @@ const PREF_EM_LAST_APP_VERSION = "extensions.lastAppVersion";
const PREF_UPDATE_COUNT = "update.extensions.count";
const PREF_UPDATE_EXT_WSDL_URI = "update.extensions.wsdl";
const PREF_EM_WASINSAFEMODE = "extensions.wasInSafeMode";
const PREF_EM_DISABLEDOBSOLETE = "extensions.disabledObsolete";
const DIR_EXTENSIONS = "Extensions";
const DIR_UNINSTALL = "Uninstall";
@ -53,6 +54,10 @@ const DIR_CHROME = "Chrome";
const DIR_COMPONENTS = "Components";
const DIR_DEFAULTS = "Defaults";
const DIR_DEFAULTS_PREFS = "Preferences";
const DIR_DEFAULTS_EXTENSIONS = "extensions";
const DIR_CR_CHROME = "chrome";
const DIR_CR_OVERLAYINFO = "overlayinfo";
const FILE_CR_CHROMEDS = "chrome.rdf";
const FILE_EXTENSIONS = "Extensions.rdf";
const FILE_UNINSTALL_LOG = "Uninstall";
const FILE_DEFAULTS = "Defaults";
@ -63,6 +68,10 @@ const FILE_WASINSAFEMODE = "Safe Mode";
const FILE_INSTALLED_EXTENSIONS = "installed-extensions.txt"
const FILE_INSTALLED_EXTENSIONS_PROCESSED = "installed-extensions-processed.txt"
const KEY_PROFILEDIR = "ProfD";
const KEY_APPDIR = "XCurProcD";
const KEY_DEFAULTS = "ProfDefNoLoc";
///////////////////////////////////////////////////////////////////////////////
//
// Utility Functions
@ -72,6 +81,11 @@ function EM_NS(aProperty)
return "http://www.mozilla.org/2004/em-rdf#" + aProperty;
}
function CHROME_NS(aProperty)
{
return "http://www.mozilla.org/rdf/chrome#" + aProperty;
}
// Returns the specified directory hierarchy under the special directory
// specified by aKey, creating directories along the way if necessary.
function getDir(aKey, aSubDirs)
@ -103,7 +117,7 @@ function getFile(aKey, aPathToFile)
function getDirKey(aIsProfile)
{
return aIsProfile ? "ProfD" : "XCurProcD";
return aIsProfile ? KEY_PROFILEDIR : KEY_APPDIR;
}
function dumpFile(aFile)
@ -184,6 +198,29 @@ function getURLSpecFromFile(aFile)
return fph.getURLSpecFromFile(aFile);
}
function ensureExtensionsFiles(aIsProfile)
{
var extensionsFile = getFile(getDirKey(aIsProfile),
[DIR_EXTENSIONS, FILE_EXTENSIONS]);
// If the file does not exist at the current location, copy the default
// version over so we can access the various roots.
// This is a sign also that something may have gone wrong, such as the user
// deleting /Extensions so we should remove the relative contents.rdf and
// overlayinfo hierarchies too.
if (!extensionsFile.exists()) {
var defaultFile = getFile(KEY_DEFAULTS,
[DIR_DEFAULTS_EXTENSIONS, FILE_EXTENSIONS]);
defaultFile.copyTo(extensionsFile.parent, extensionsFile.leafName);
try {
(getFile(getDirKey(aIsProfile), [DIR_CR_CHROME, FILE_CR_CHROMEDS])).remove(false);
(getDir(getDirKey(aIsProfile), [DIR_CR_CHROME, DIR_CR_OVERLAYINFO])).remove(true);
}
catch (e) { dump("*** eeeeeeee = " + e + "\n"); }
}
}
///////////////////////////////////////////////////////////////////////////////
//
// nsInstallLogBase
@ -280,7 +317,6 @@ nsInstallLogReader.prototype = {
{
var fis = Components.classes["@mozilla.org/network/file-input-stream;1"]
.createInstance(Components.interfaces.nsIFileInputStream);
dumpFile(this.uninstallLog);
fis.init(this.uninstallLog, -1, -1, false);
var lis = fis.QueryInterface(Components.interfaces.nsILineInputStream);
var line = { value: "" };
@ -328,9 +364,12 @@ nsInstallLogReader.prototype = {
//
function nsInstalledExtensionReader(aManager)
{
this._installedExtensions = getFile("XCurProcD",
this._installedExtensions = getFile(KEY_APPDIR,
[DIR_EXTENSIONS,
FILE_INSTALLED_EXTENSIONS]);
this._installedExtensionsProcessed = getFile(KEY_APPDIR,
[DIR_EXTENSIONS,
FILE_INSTALLED_EXTENSIONS_PROCESSED]);
this._manager = aManager;
}
@ -340,12 +379,16 @@ nsInstalledExtensionReader.prototype = {
read: function ()
{
if (!this._installedExtensions.exists())
if (this._installedExtensionsProcessed.exists())
return;
if (!this._installedExtensions.exists()) {
var defaultsList = getFile(KEY_DEFAULTS, [DIR_DEFAULTS_EXTENSIONS, FILE_INSTALLED_EXTENSIONS]);
defaultsList.copyTo(getDir(KEY_APPDIR, [DIR_EXTENSIONS]), FILE_INSTALLED_EXTENSIONS);
}
var fis = Components.classes["@mozilla.org/network/file-input-stream;1"]
.createInstance(Components.interfaces.nsIFileInputStream);
dumpFile(this._installedExtensions);
fis.init(this._installedExtensions, -1, -1, false);
var lis = fis.QueryInterface(Components.interfaces.nsILineInputStream);
var line = { value: "" };
@ -362,7 +405,7 @@ nsInstalledExtensionReader.prototype = {
for (var i = 0; i < lines.length; ++i)
this._parseLine(lines[i]);
this._installedExtensions.moveTo(getDir("XCurProcD", [DIR_EXTENSIONS]),
this._installedExtensions.moveTo(getDir(KEY_APPDIR, [DIR_EXTENSIONS]),
FILE_INSTALLED_EXTENSIONS_PROCESSED);
},
@ -373,8 +416,19 @@ nsInstalledExtensionReader.prototype = {
{
// extension,{GUID} or theme,{GUID}
var parts = aLine.split(",");
var manifest = getFile("XCurProcD",
var manifest = getFile(KEY_APPDIR,
[DIR_EXTENSIONS, parts[1], FILE_INSTALL_MANIFEST]);
if (parts.length != 2)
return;
if (!manifest.exists()) {
defaultManifest = defaultFile = getFile(KEY_DEFAULTS,
[DIR_DEFAULTS_EXTENSIONS, parts[1], FILE_INSTALL_MANIFEST]);
var extensionDir = getDir(KEY_APPDIR, [DIR_EXTENSIONS, parts[1]]);
defaultManifest.copyTo(extensionDir, FILE_INSTALL_MANIFEST);
manifest = getFile(KEY_APPDIR,
[DIR_EXTENSIONS, parts[1], FILE_INSTALL_MANIFEST]);
}
switch (parts[0]) {
case this.TOKEN_EXTENSION:
this._manager.ensurePreConfiguredItem(parts[1], nsIUpdateItem.TYPE_EXTENSION, manifest);
@ -411,7 +465,7 @@ nsExtensionInstaller.prototype = {
// Extension metadata
_extensionID : null,
_isProfile : true,
_extDirKey : "ProfD",
_extDirKey : KEY_PROFILEDIR,
// Source and target datasources
_metadataDS : null,
@ -789,7 +843,7 @@ nsThemeInstaller.prototype = {
.getService(Components.interfaces.nsIXULChromeRegistry);
cr.installSkin(filePath, aIsProfile, false);
var nameArc = rdf.GetResource("http://www.mozilla.org/rdf/chrome#name");
var nameArc = rdf.GetResource(CHROME_NS("name"));
var ctr = Components.classes["@mozilla.org/rdf/container;1"]
.createInstance(Components.interfaces.nsIRDFContainer);
ctr.Init(chromeMetadata, rdf.GetResource("urn:mozilla:skin:root"));
@ -879,6 +933,10 @@ function nsExtensionManager()
.getService(Components.interfaces.nsIObserverService);
os.addObserver(this, "profile-after-change", false);
os.addObserver(this, "profile-do-change", false);
ensureExtensionsFiles(false);
// XXXben TODO - do global command line flag checks HERE.
}
nsExtensionManager.prototype = {
@ -898,12 +956,16 @@ nsExtensionManager.prototype = {
// XXXben this can go away once appstartup/runner code calls us.
this.checkForMismatches();
this._disableObsoleteExtensions();
break;
case "profile-do-change":
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
os.removeObserver(this, "profile-do-change");
ensureExtensionsFiles(true);
// XXXben - a bit of a hack - clean up any empty dirs that may not have been
// properly removed by [un]install... I should really investigate those
// cases to see what is stopping these dirs from being removed, but no
@ -916,7 +978,7 @@ nsExtensionManager.prototype = {
if (!safeMode) {
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var wasInSafeModeFile = getFile("ProfD", [DIR_EXTENSIONS, FILE_WASINSAFEMODE]);
var wasInSafeModeFile = getFile(KEY_PROFILEDIR, [DIR_EXTENSIONS, FILE_WASINSAFEMODE]);
if (wasInSafeModeFile.exists()) {
var win = this._showProgressWindow();
this._ensureDS();
@ -982,7 +1044,7 @@ nsExtensionManager.prototype = {
this._ds.safeMode = true;
var wasInSafeModeFile = getFile("ProfD", [DIR_EXTENSIONS, FILE_WASINSAFEMODE]);
var wasInSafeModeFile = getFile(KEY_PROFILEDIR, [DIR_EXTENSIONS, FILE_WASINSAFEMODE]);
if (!wasInSafeModeFile.exists())
wasInSafeModeFile.create(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0644);
@ -991,6 +1053,34 @@ nsExtensionManager.prototype = {
}
},
// This function checks for and disables any "old-style" extensions
// from Firefox 0.8 and earlier created using the "chrome:extension=true" flag.
_disableObsoleteExtensions: function ()
{
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
if (!pref.prefHasUserValue(PREF_EM_DISABLEDOBSOLETE) || !pref.getBoolPref(PREF_EM_DISABLEDOBSOLETE)) {
var win = this._showProgressWindow();
var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
.getService(Components.interfaces.nsIRDFService);
var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
.getService(Components.interfaces.nsIXULChromeRegistry);
var crDS = rdf.GetDataSource("rdf:chrome");
var sources = crDS.GetSources(rdf.GetResource(CHROME_NS("extension")), rdf.GetLiteral("true"), true);
while (sources.hasMoreElements()) {
var source = sources.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
var name = crDS.GetTarget(source, rdf.GetResource(CHROME_NS("name")), true);
if (name) {
name = name.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
cr.setAllowOverlaysForPackage(name, false);
}
}
win.close();
pref.setBoolPref(PREF_EM_DISABLEDOBSOLETE, true);
}
},
_checkForGlobalInstalls: function (aPath, aItemType)
{
// First see if the path supplied is a file path
@ -1001,7 +1091,7 @@ nsExtensionManager.prototype = {
}
catch (e) {
// Try appending the path to the current proc dir.
file = getDir("XCurProcD", []);
file = getDir(KEY_APPDIR, []);
try {
file.append(aPath);
}
@ -1041,8 +1131,8 @@ nsExtensionManager.prototype = {
_finishOperations: function ()
{
var profileAutoReg = getFile("ProfD", [FILE_AUTOREG]);
var globalAutoReg = getFile("XCurProcD", [FILE_AUTOREG]);
var profileAutoReg = getFile(KEY_PROFILEDIR, [FILE_AUTOREG]);
var globalAutoReg = getFile(KEY_APPDIR, [FILE_AUTOREG]);
if (profileAutoReg.exists() || globalAutoReg.exists()) {
var win = this._showProgressWindow();
@ -1102,11 +1192,11 @@ nsExtensionManager.prototype = {
_loadDefaults: function ()
{
// Load default preferences files for all extensions
var defaultsManifest = getFile("ProfD",
var defaultsManifest = getFile(KEY_PROFILEDIR,
[DIR_EXTENSIONS, FILE_DEFAULTS]);
if (defaultsManifest.exists()) {
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
.getService(Components.interfaces.nsIPrefService);
var fis = Components.classes["@mozilla.org/network/file-input-stream;1"]
.createInstance(Components.interfaces.nsIFileInputStream);
fis.init(defaultsManifest, -1, -1, false);
@ -1261,8 +1351,8 @@ nsExtensionManager.prototype = {
_writeAutoReg: function (aIsProfile)
{
var autoRegFile = aIsProfile ? getFile("ProfD", [FILE_AUTOREG]) :
getFile("XCurProcD", [FILE_AUTOREG]);
var autoRegFile = aIsProfile ? getFile(KEY_PROFILEDIR, [FILE_AUTOREG]) :
getFile(KEY_APPDIR, [FILE_AUTOREG]);
this._writeProfileFile(autoRegFile,
this._getComponentsDir,
this._writeAutoregLines);
@ -1270,14 +1360,14 @@ nsExtensionManager.prototype = {
_writeDefaults: function ()
{
this._writeProfileFile(getFile("ProfD", [DIR_EXTENSIONS, FILE_DEFAULTS]),
this._writeProfileFile(getFile(KEY_PROFILEDIR, [DIR_EXTENSIONS, FILE_DEFAULTS]),
this._getPreferencesDir,
this._writePreferencesLines);
},
_cleanDirs: function ()
{
var keys = ["ProfD", "XCurProcD"];
var keys = [KEY_PROFILEDIR, KEY_APPDIR];
for (var i = 0; i < keys.length; ++i) {
var extensions = getDir(keys[i], [DIR_EXTENSIONS]);
var entries = extensions.directoryEntries;
@ -2056,7 +2146,8 @@ nsExtensionsDataSource.prototype = {
// Assert properties with single values
var singleProps = ["version", "name", "description", "creator", "homepageURL",
"updateURL", "optionsURL", "aboutURL", "iconURL"];
"updateURL", "optionsURL", "aboutURL", "iconURL",
"internalName"];
// Global extensions and themes can also be locked (can't be removed or disabled).
if (!aIsProfile)
@ -2191,19 +2282,9 @@ nsExtensionsDataSource.prototype = {
loadExtensions: function (aProfile)
{
var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
var extensionsFile = getFile(getDirKey(aProfile),
[DIR_EXTENSIONS, FILE_EXTENSIONS]);
dumpFile(extensionsFile);
// If the file does not exist at the current location, copy the default
// version over so we can access the various roots.
if (!extensionsFile.exists()) {
var defaultFile = getFile("ProfDefNoLoc",
["extensions", FILE_EXTENSIONS]);
defaultFile.copyTo(extensionsFile.parent, extensionsFile.leafName);
}
ensureExtensionsFiles(aProfile);
var dsURL = getURLSpecFromFile(extensionsFile);
@ -2247,6 +2328,42 @@ nsExtensionsDataSource.prototype = {
return this._composite.GetSources(aProperty, aTarget, aTruthValue);
},
_getThemeJARURL: function (aSource, aFileName, aFallbackURL)
{
var id = stripPrefix(aSource.Value, nsIUpdateItem.TYPE_THEME);
var chromeDir = getDir(this.isProfileItem(id) ? KEY_PROFILEDIR : KEY_APPDIR,
[DIR_EXTENSIONS, id, DIR_CHROME]);
var jarFile = null;
// XXXben hack for pre-configured classic.jar
if ((!chromeDir.exists() || !chromeDir.directoryEntries.hasMoreElements()) &&
aSource.EqualsNode(this._rdf.GetResource("urn:mozilla:theme:{972ce4c6-7e08-4474-a285-3208198ce6fd}")))
jarFile = getFile(KEY_APPDIR, ["chrome", "classic.jar"]);
if (chromeDir.directoryEntries.hasMoreElements() || jarFile) {
if (!jarFile)
jarFile = chromeDir.directoryEntries.getNext().QueryInterface(Components.interfaces.nsIFile);
if (jarFile.exists()) {
var zipReader = Components.classes["@mozilla.org/libjar/zip-reader;1"]
.createInstance(Components.interfaces.nsIZipReader);
zipReader.init(jarFile);
zipReader.open();
var url = aFallbackURL;
try {
zipReader.test(aFileName);
url = "jar:" + getURLSpecFromFile(jarFile) + "!/" + aFileName;
}
catch (e) { }
zipReader.close();
if (url)
return this._rdf.GetResource(url);
}
}
return null;
},
GetTarget: function (aSource, aProperty, aTruthValue)
{
if (aProperty.EqualsNode(this._emR("iconURL"))) {
@ -2275,16 +2392,17 @@ nsExtensionsDataSource.prototype = {
}
}
else if (itemType == nsIUpdateItem.TYPE_THEME) {
var id = stripPrefix(aSource.Value, nsIUpdateItem.TYPE_THEME);
var chromeDir = getDir(this.isProfileItem(id) ? "ProfD" : "XCurProcD",
[DIR_EXTENSIONS, id, DIR_CHROME]);
if (chromeDir.directoryEntries.hasMoreElements()) {
var jarFile = chromeDir.directoryEntries.getNext().QueryInterface(Components.interfaces.nsIFile);
if (jarFile.exists()) {
var jarURL = "jar:" + getURLSpecFromFile(jarFile) + "!/icon.png";
return this._rdf.GetResource(jarURL);
}
}
var res = this._getThemeJARURL(aSource, "icon.png", "chrome://mozapps/skin/extensions/themeGeneric.png");
if (res)
return res;
}
}
else if (aProperty.EqualsNode(this._emR("previewImage"))) {
var itemType = getItemType(aSource.Value);
if (itemType == nsIUpdateItem.TYPE_THEME) {
var res = this._getThemeJARURL(aSource, "preview.png", null);
if (res)
return res;
}
}
else if (aProperty.EqualsNode(this._emR("installLocation"))) {
@ -2296,6 +2414,19 @@ nsExtensionsDataSource.prototype = {
return this._emL("true");
// fall through to default.
}
else if (aProperty.EqualsNode(this._emR("itemType"))) {
// We can try and infer the type from presence in one of the
// item lists.
var rdfc = Components.classes["@mozilla.org/rdf/container;1"]
.createInstance(Components.interfaces.nsIRDFContainer);
rdfc.Init(this, this._rdf.GetResource(ROOT_EXTENSION));
if (rdfc.IndexOf(aSource) != -1)
return this._emL("extension");
rdfc.Init(this, this._rdf.GetResource(ROOT_THEME));
if (rdfc.IndexOf(aSource) != -1)
return this._emL("theme");
}
return this._composite.GetTarget(aSource, aProperty, aTruthValue);
},

Просмотреть файл

@ -51,6 +51,7 @@ classic.jar:
skin/classic/mozapps/extensions/placeholder.gif (extensions/skin/placeholder.gif)
skin/classic/mozapps/extensions/viewWatermarkExtensions.png (extensions/skin/viewWatermarkExtensions.png)
skin/classic/mozapps/extensions/viewWatermarkThemes.png (extensions/skin/viewWatermarkThemes.png)
skin/classic/mozapps/extensions/themeGeneric.png (extensions/skin/themeGeneric.png)
skin/classic/mozapps/update/update.css (update/skin/update.css)
skin/classic/mozapps/update/warning.gif (update/skin/warning.gif)
skin/classic/mozapps/update/icon32.png (update/skin/icon32.png)
@ -60,4 +61,4 @@ classic.jar:
skin/classic/mozapps/shared/itemFader.png (shared/skin/itemFader.png)
skin/classic/mozapps/shared/itemSelected.png (shared/skin/itemSelected.png)
skin/classic/mozapps/contents.rdf (contents-skin.rdf)
icon.png (update/skin/icon32.png)

Просмотреть файл

@ -263,19 +263,19 @@ nsUpdateService.prototype = {
get appUpdateVersion()
{
return this._pref.getComplexValue(PREF_UPDATE_APP_UPDATEVERSION,
Components.interfaces.nsISupportsString).data;
Components.interfaces.nsIPrefLocalizedString).data;
},
get appUpdateDescription()
{
return this._pref.getComplexValue(PREF_UPDATE_APP_UPDATEDESCRIPTION,
Components.interfaces.nsISupportsString).data;
Components.interfaces.nsIPrefLocalizedString).data;
},
get appUpdateURL()
{
return this._pref.getComplexValue(PREF_UPDATE_APP_UPDATEURL,
Components.interfaces.nsISupportsString).data;
Components.interfaces.nsIPrefLocalizedString).data;
},
/////////////////////////////////////////////////////////////////////////////