mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Merging cedar with mozilla-central.
This commit is contained in:
commit
513d0ca1d6
@ -68,7 +68,7 @@
|
||||
#include "nsImageFrame.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
#include "nsObjectFrame.h"
|
||||
#include "nsOuterDocAccessible.h"
|
||||
@ -346,8 +346,8 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame,
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_ACCESSIBILITY_ATK)
|
||||
// 2) for plugins
|
||||
nsCOMPtr<nsIPluginInstance> pluginInstance;
|
||||
if (NS_SUCCEEDED(aFrame->GetPluginInstance(*getter_AddRefs(pluginInstance))) &&
|
||||
nsRefPtr<nsNPAPIPluginInstance> pluginInstance;
|
||||
if (NS_SUCCEEDED(aFrame->GetPluginInstance(getter_AddRefs(pluginInstance))) &&
|
||||
pluginInstance) {
|
||||
#ifdef XP_WIN
|
||||
// Note: pluginPort will be null if windowless.
|
||||
|
@ -1114,7 +1114,8 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
// at least until native API comes up with a more meaningful event.
|
||||
if (aAttribute == nsAccessibilityAtoms::aria_grabbed ||
|
||||
aAttribute == nsAccessibilityAtoms::aria_dropeffect ||
|
||||
aAttribute == nsAccessibilityAtoms::aria_hidden) {
|
||||
aAttribute == nsAccessibilityAtoms::aria_hidden ||
|
||||
aAttribute == nsAccessibilityAtoms::aria_sort) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED,
|
||||
aContent);
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ _TEST_FILES =\
|
||||
focus.html \
|
||||
scroll.html \
|
||||
test_aria_alert.html \
|
||||
test_aria_hidden.html \
|
||||
test_aria_menu.html \
|
||||
test_aria_objattr.html \
|
||||
test_aria_statechange.html \
|
||||
test_attrs.html \
|
||||
test_caretmove.html \
|
||||
|
@ -1,7 +1,7 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Accessible ARIA hidden attribute</title>
|
||||
<title>Accessible ARIA object attribute changes</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
@ -43,14 +43,38 @@
|
||||
}
|
||||
}
|
||||
|
||||
function updateSort(aID, aSort)
|
||||
{
|
||||
this.node = getNode(aID);
|
||||
this.accessible = getAccessible(this.node);
|
||||
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_OBJECT_ATTRIBUTE_CHANGED, this.accessible),
|
||||
];
|
||||
|
||||
this.invoke = function updateSort_invoke()
|
||||
{
|
||||
this.node.setAttribute("aria-sort", aSort);
|
||||
}
|
||||
|
||||
this.getID = function updateSort_getID()
|
||||
{
|
||||
return "aria-sort for " + aID + " " + aSort;
|
||||
}
|
||||
}
|
||||
|
||||
// Debug stuff.
|
||||
// gA11yEventDumpID = "eventdump";
|
||||
// gA11yEventDumpToConsole = true;
|
||||
|
||||
function doTests()
|
||||
{
|
||||
//gA11yEventDumpID = "eventdump"; // debug stuff
|
||||
|
||||
gQueue = new eventQueue();
|
||||
|
||||
gQueue.push(new hideNode("hideable", "true"));
|
||||
|
||||
gQueue.push(new updateSort("sortable", "ascending"));
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
||||
@ -67,6 +91,12 @@
|
||||
Mozilla Bug 581096
|
||||
</a>
|
||||
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=640707"
|
||||
title="Add event support for aria-sort">
|
||||
Mozilla Bug 640707
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
@ -75,5 +105,6 @@
|
||||
|
||||
<div id="hideable"><div>Hi</div><div>there</div></div>
|
||||
|
||||
<div id="sortable" role="columnheader" aria-sort"none">aria-sort</div>
|
||||
</body>
|
||||
</html>
|
@ -92,9 +92,9 @@ var gSyncSetup = {
|
||||
init: function () {
|
||||
let obs = [
|
||||
["weave:service:changepph:finish", "onResetPassphrase"],
|
||||
["weave:service:verify-login:start", "onLoginStart"],
|
||||
["weave:service:verify-login:error", "onLoginEnd"],
|
||||
["weave:service:verify-login:finish", "onLoginEnd"]];
|
||||
["weave:service:login:start", "onLoginStart"],
|
||||
["weave:service:login:error", "onLoginEnd"],
|
||||
["weave:service:login:finish", "onLoginEnd"]];
|
||||
|
||||
// Add the observers now and remove them on unload
|
||||
let self = this;
|
||||
@ -216,6 +216,8 @@ var gSyncSetup = {
|
||||
feedback = server;
|
||||
break;
|
||||
case Weave.LOGIN_FAILED_LOGIN_REJECTED:
|
||||
case Weave.LOGIN_FAILED_NO_USERNAME:
|
||||
case Weave.LOGIN_FAILED_NO_PASSWORD:
|
||||
feedback = password;
|
||||
break;
|
||||
case Weave.LOGIN_FAILED_INVALID_PASSPHRASE:
|
||||
|
@ -194,12 +194,13 @@ let gSyncUtils = {
|
||||
*/
|
||||
passphraseSave: function(elid) {
|
||||
let dialogTitle = this.bundle.GetStringFromName("save.synckey.title");
|
||||
let defaultSaveName = this.bundle.GetStringFromName("save.default.label");
|
||||
this._preparePPiframe(elid, function(iframe) {
|
||||
let filepicker = Cc["@mozilla.org/filepicker;1"]
|
||||
.createInstance(Ci.nsIFilePicker);
|
||||
filepicker.init(window, dialogTitle, Ci.nsIFilePicker.modeSave);
|
||||
filepicker.appendFilters(Ci.nsIFilePicker.filterHTML);
|
||||
filepicker.defaultString = "Firefox Sync Key.html";
|
||||
filepicker.defaultString = defaultSaveName;
|
||||
let rv = filepicker.show();
|
||||
if (rv == Ci.nsIFilePicker.returnOK
|
||||
|| rv == Ci.nsIFilePicker.returnReplace) {
|
||||
|
@ -46,33 +46,14 @@
|
||||
#ifdef XP_MACOSX
|
||||
#define NS_SAFARIPROFILEMIGRATOR_CID \
|
||||
{ 0x29e3b139, 0xad19, 0x44f3, { 0xb2, 0xc2, 0xe9, 0xf1, 0x3b, 0xa2, 0xbb, 0xc6 } }
|
||||
|
||||
#define NS_MACIEPROFILEMIGRATOR_CID \
|
||||
{ 0xf1a4e549, 0x5c4b, 0x41ff, { 0xb5, 0xe3, 0xeb, 0x87, 0xae, 0x31, 0x41, 0x9b } }
|
||||
|
||||
#define NS_OMNIWEBPROFILEMIGRATOR_CID \
|
||||
{ 0xb80ae6d8, 0x766c, 0x43da, { 0x9c, 0x7a, 0xd, 0x82, 0x44, 0x52, 0x61, 0x6a } }
|
||||
|
||||
#define NS_CAMINOPROFILEMIGRATOR_CID \
|
||||
{ 0x01d88ea9, 0x0feb, 0x495e, { 0x8c, 0x9b, 0x41, 0x65, 0x99, 0x55, 0x52, 0x65 } }
|
||||
|
||||
#define NS_ICABPROFILEMIGRATOR_CID \
|
||||
{ 0xf394a036, 0xc5e1, 0x46d8, { 0x99, 0x39, 0x6b, 0x35, 0xe1, 0x13, 0x0a, 0x27 } }
|
||||
|
||||
#endif
|
||||
|
||||
#define NS_OPERAPROFILEMIGRATOR_CID \
|
||||
{ 0xf34ff792, 0x722e, 0x4490, { 0xb1, 0x95, 0x47, 0xd2, 0x42, 0xed, 0xca, 0x1c } }
|
||||
|
||||
#define NS_DOGBERTPROFILEMIGRATOR_CID \
|
||||
{ 0x24f92fae, 0xf793, 0x473b, { 0x80, 0x61, 0x71, 0x34, 0x8, 0xbd, 0x11, 0xd5 } }
|
||||
|
||||
#define NS_SEAMONKEYPROFILEMIGRATOR_CID \
|
||||
{ 0x9a28ffa7, 0xe6ef, 0x4b52, { 0xa1, 0x27, 0x6a, 0xd9, 0x51, 0xde, 0x8e, 0x9b } }
|
||||
|
||||
#define NS_PHOENIXPROFILEMIGRATOR_CID \
|
||||
{ 0x78481e4a, 0x50e4, 0x4489, { 0xb6, 0x8a, 0xef, 0x82, 0x67, 0xe, 0xd6, 0x3f } }
|
||||
|
||||
#define NS_SHELLSERVICE_CID \
|
||||
{ 0x63c7b9f4, 0xcc8, 0x43f8, { 0xb6, 0x66, 0xa, 0x66, 0x16, 0x55, 0xcb, 0x73 } }
|
||||
|
||||
|
@ -50,20 +50,14 @@
|
||||
#endif
|
||||
|
||||
#include "nsProfileMigrator.h"
|
||||
#include "nsDogbertProfileMigrator.h"
|
||||
#if !defined(XP_OS2)
|
||||
#include "nsOperaProfileMigrator.h"
|
||||
#endif
|
||||
#include "nsPhoenixProfileMigrator.h"
|
||||
#include "nsSeamonkeyProfileMigrator.h"
|
||||
#if defined(XP_WIN) && !defined(__MINGW32__)
|
||||
#include "nsIEProfileMigrator.h"
|
||||
#elif defined(XP_MACOSX)
|
||||
#include "nsSafariProfileMigrator.h"
|
||||
#include "nsOmniWebProfileMigrator.h"
|
||||
#include "nsMacIEProfileMigrator.h"
|
||||
#include "nsCaminoProfileMigrator.h"
|
||||
#include "nsICabProfileMigrator.h"
|
||||
#endif
|
||||
|
||||
#include "rdf.h"
|
||||
@ -87,21 +81,15 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacShellService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGNOMEShellService, Init)
|
||||
#endif
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDogbertProfileMigrator)
|
||||
#if !defined(XP_OS2)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsOperaProfileMigrator)
|
||||
#endif
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPhoenixProfileMigrator)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsProfileMigrator)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSeamonkeyProfileMigrator)
|
||||
#if defined(XP_WIN) && !defined(__MINGW32__)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsIEProfileMigrator)
|
||||
#elif defined(XP_MACOSX)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSafariProfileMigrator)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsOmniWebProfileMigrator)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacIEProfileMigrator)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCaminoProfileMigrator)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsICabProfileMigrator)
|
||||
#endif
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFeedSniffer)
|
||||
@ -122,16 +110,10 @@ NS_DEFINE_NAMED_CID(NS_WINIEPROFILEMIGRATOR_CID);
|
||||
#elif defined(XP_MACOSX)
|
||||
NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_SAFARIPROFILEMIGRATOR_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_MACIEPROFILEMIGRATOR_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_OMNIWEBPROFILEMIGRATOR_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_CAMINOPROFILEMIGRATOR_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ICABPROFILEMIGRATOR_CID);
|
||||
#endif
|
||||
#if !defined(XP_OS2)
|
||||
NS_DEFINE_NAMED_CID(NS_OPERAPROFILEMIGRATOR_CID);
|
||||
#endif
|
||||
NS_DEFINE_NAMED_CID(NS_DOGBERTPROFILEMIGRATOR_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_PHOENIXPROFILEMIGRATOR_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_SEAMONKEYPROFILEMIGRATOR_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID);
|
||||
|
||||
@ -150,16 +132,10 @@ static const mozilla::Module::CIDEntry kBrowserCIDs[] = {
|
||||
#elif defined(XP_MACOSX)
|
||||
{ &kNS_SHELLSERVICE_CID, false, NULL, nsMacShellServiceConstructor },
|
||||
{ &kNS_SAFARIPROFILEMIGRATOR_CID, false, NULL, nsSafariProfileMigratorConstructor },
|
||||
{ &kNS_MACIEPROFILEMIGRATOR_CID, false, NULL, nsMacIEProfileMigratorConstructor },
|
||||
{ &kNS_OMNIWEBPROFILEMIGRATOR_CID, false, NULL, nsOmniWebProfileMigratorConstructor },
|
||||
{ &kNS_CAMINOPROFILEMIGRATOR_CID, false, NULL, nsCaminoProfileMigratorConstructor },
|
||||
{ &kNS_ICABPROFILEMIGRATOR_CID, false, NULL, nsICabProfileMigratorConstructor },
|
||||
#endif
|
||||
#if !defined(XP_OS2)
|
||||
{ &kNS_OPERAPROFILEMIGRATOR_CID, false, NULL, nsOperaProfileMigratorConstructor },
|
||||
#endif
|
||||
{ &kNS_DOGBERTPROFILEMIGRATOR_CID, false, NULL, nsDogbertProfileMigratorConstructor },
|
||||
{ &kNS_PHOENIXPROFILEMIGRATOR_CID, false, NULL, nsPhoenixProfileMigratorConstructor },
|
||||
{ &kNS_SEAMONKEYPROFILEMIGRATOR_CID, false, NULL, nsSeamonkeyProfileMigratorConstructor },
|
||||
{ &kNS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID, false, NULL, nsPrivateBrowsingServiceWrapperConstructor },
|
||||
{ NULL }
|
||||
@ -192,16 +168,10 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
|
||||
#elif defined(XP_MACOSX)
|
||||
{ NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
|
||||
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "safari", &kNS_SAFARIPROFILEMIGRATOR_CID },
|
||||
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "macie", &kNS_MACIEPROFILEMIGRATOR_CID },
|
||||
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "omniweb", &kNS_OMNIWEBPROFILEMIGRATOR_CID },
|
||||
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "camino", &kNS_CAMINOPROFILEMIGRATOR_CID },
|
||||
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "icab", &kNS_ICABPROFILEMIGRATOR_CID },
|
||||
#endif
|
||||
#if !defined(XP_OS2)
|
||||
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "opera", &kNS_OPERAPROFILEMIGRATOR_CID },
|
||||
#endif
|
||||
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "dogbert", &kNS_DOGBERTPROFILEMIGRATOR_CID },
|
||||
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "phoenix", &kNS_PHOENIXPROFILEMIGRATOR_CID },
|
||||
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "seamonkey", &kNS_SEAMONKEYPROFILEMIGRATOR_CID },
|
||||
{ NS_PRIVATE_BROWSING_SERVICE_CONTRACTID, &kNS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID },
|
||||
{ NULL }
|
||||
|
@ -128,8 +128,7 @@ var MigrationWizard = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (migrator.sourceExists &&
|
||||
!(suffix == "phoenix" && !this._autoMigrate)) {
|
||||
if (migrator.sourceExists) {
|
||||
// Save this as the first selectable item, if we don't already have
|
||||
// one, or if it is the migrator that was passed to us.
|
||||
if (!selectedMigrator || this._source == suffix)
|
||||
@ -333,15 +332,11 @@ var MigrationWizard = {
|
||||
var source = null;
|
||||
switch (this._source) {
|
||||
case "ie":
|
||||
case "macie":
|
||||
source = "sourceNameIE";
|
||||
break;
|
||||
case "opera":
|
||||
source = "sourceNameOpera";
|
||||
break;
|
||||
case "dogbert":
|
||||
source = "sourceNameDogbert";
|
||||
break;
|
||||
case "safari":
|
||||
source = "sourceNameSafari";
|
||||
break;
|
||||
|
@ -68,43 +68,21 @@
|
||||
<!-- If you are adding a migrator, please add the appropriate
|
||||
hooks to GetDefaultBrowserMigratorKey in
|
||||
browser/components/migration/src/nsProfileMigrator.cpp -->
|
||||
<radio id="phoenix" label="&importFromPhoenix.label;" accesskey="&importFromPhoenix.accesskey;"/>
|
||||
#ifdef XP_UNIX
|
||||
#ifdef XP_MACOSX
|
||||
<radio id="safari" label="&importFromSafari.label;" accesskey="&importFromSafari.accesskey;"/>
|
||||
<radio id="macie" label="&importFromIE.label;" accesskey="&importFromIE.accesskey;"/>
|
||||
<!-- XXXben - uncomment these as we write migrators for them
|
||||
<radio id="camino" label="&importFromCamino.label;" accesskey="&importFromCamino.accesskey;"/>
|
||||
<radio id="omniweb" label="&importFromOmniWeb.label;" accesskey="&importFromOmniWeb.accesskey;"/>
|
||||
<radio id="icab" label="&importFromICab.label;" accesskey="&importFromICab.accesskey;"/>
|
||||
-->
|
||||
<radio id="seamonkey" label="&importFromSeamonkey.label;" accesskey="&importFromSeamonkey.accesskey;"/>
|
||||
<radio id="dogbert" label="&importFromNetscape4.label;" accesskey="&importFromNetscape4.accesskey;"/>
|
||||
<radio id="opera" label="&importFromOpera.label;" accesskey="&importFromOpera.accesskey;"/>
|
||||
#else
|
||||
#elifdef XP_UNIX
|
||||
<radio id="seamonkey" label="&importFromSeamonkey.label;" accesskey="&importFromSeamonkey.accesskey;"/>
|
||||
<radio id="dogbert" label="&importFromNetscape4.label;" accesskey="&importFromNetscape4.accesskey;"/>
|
||||
<radio id="opera" label="&importFromOpera.label;" accesskey="&importFromOpera.accesskey;"/>
|
||||
<!-- XXXben - uncomment these as we write migrators for them
|
||||
<radio id="konqueror" label="&importFromKonqueror.label;" accesskey="&importFromKonqueror.accesskey;"/>
|
||||
<radio id="epiphany" label="&importFromEpiphany.label;" accesskey="&importFromEpiphany.accesskey;"/>
|
||||
<radio id="galeon" label="&importFromGaleon.label;" accesskey="&importFromGaleon.accesskey;"/>
|
||||
-->
|
||||
#endif
|
||||
#endif
|
||||
#ifdef XP_WIN
|
||||
#elifdef XP_WIN
|
||||
#ifndef NO_IE_MIGRATOR
|
||||
<radio id="ie" label="&importFromIE.label;" accesskey="&importFromIE.accesskey;"/>
|
||||
#endif
|
||||
<radio id="seamonkey" label="&importFromSeamonkey.label;" accesskey="&importFromSeamonkey.accesskey;"/>
|
||||
<radio id="dogbert" label="&importFromNetscape4.label;" accesskey="&importFromNetscape4.accesskey;"/>
|
||||
<radio id="opera" label="&importFromOpera.label;" accesskey="&importFromOpera.accesskey;"/>
|
||||
#endif
|
||||
#ifndef XP_UNIX
|
||||
#ifndef XP_WIN
|
||||
#else
|
||||
<radio id="seamonkey" label="&importFromSeamonkey.label;" accesskey="&importFromSeamonkey.accesskey;"/>
|
||||
<radio id="dogbert" label="&importFromNetscape4.label;" accesskey="&importFromNetscape4.accesskey;"/>
|
||||
#endif
|
||||
#endif
|
||||
<radio id="fromfile" label="&importFromHTMLFile.label;" accesskey="&importFromHTMLFile.accesskey;" hidden="true"/>
|
||||
<radio id="nothing" label="&importFromNothing.label;" accesskey="&importFromNothing.accesskey;" hidden="true"/>
|
||||
|
@ -54,8 +54,6 @@ CPPSRCS = nsProfileMigrator.cpp \
|
||||
nsBrowserProfileMigratorUtils.cpp \
|
||||
nsNetscapeProfileMigratorBase.cpp \
|
||||
nsSeamonkeyProfileMigrator.cpp \
|
||||
nsPhoenixProfileMigrator.cpp \
|
||||
nsDogbertProfileMigrator.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifneq ($(OS_ARCH),OS2)
|
||||
@ -69,10 +67,6 @@ endif
|
||||
|
||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
CPPSRCS += nsSafariProfileMigrator.cpp \
|
||||
nsMacIEProfileMigrator.cpp \
|
||||
nsOmniWebProfileMigrator.cpp \
|
||||
nsCaminoProfileMigrator.cpp \
|
||||
nsICabProfileMigrator.cpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
@ -1,115 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 The Browser Profile Migrator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsBrowserProfileMigratorUtils.h"
|
||||
#include "nsCaminoProfileMigrator.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIProfileMigrator.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsCaminoProfileMigrator
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsCaminoProfileMigrator, nsIBrowserProfileMigrator)
|
||||
|
||||
nsCaminoProfileMigrator::nsCaminoProfileMigrator()
|
||||
{
|
||||
mObserverService = do_GetService("@mozilla.org/observer-service;1");
|
||||
}
|
||||
|
||||
nsCaminoProfileMigrator::~nsCaminoProfileMigrator()
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIBrowserProfileMigrator
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCaminoProfileMigrator::Migrate(PRUint16 aItems, nsIProfileStartup* aStartup, const PRUnichar* aProfile)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NOTIFY_OBSERVERS(MIGRATION_STARTED, nsnull);
|
||||
|
||||
NOTIFY_OBSERVERS(MIGRATION_ENDED, nsnull);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCaminoProfileMigrator::GetMigrateData(const PRUnichar* aProfile,
|
||||
PRBool aReplace,
|
||||
PRUint16* aResult)
|
||||
{
|
||||
*aResult = 0; // XXXben implement me
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCaminoProfileMigrator::GetSourceExists(PRBool* aResult)
|
||||
{
|
||||
*aResult = PR_FALSE; // XXXben implement me
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCaminoProfileMigrator::GetSourceHasMultipleProfiles(PRBool* aResult)
|
||||
{
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCaminoProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCaminoProfileMigrator::GetSourceHomePageURL(nsACString& aResult)
|
||||
{
|
||||
aResult.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsCaminoProfileMigrator
|
||||
|
@ -1,61 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 The Browser Profile Migrator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef caminoprofilemigrator___h___
|
||||
#define caminoprofilemigrator___h___
|
||||
|
||||
#include "nsIBrowserProfileMigrator.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsStringAPI.h"
|
||||
|
||||
class nsCaminoProfileMigrator : public nsIBrowserProfileMigrator
|
||||
{
|
||||
public:
|
||||
NS_DECL_NSIBROWSERPROFILEMIGRATOR
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsCaminoProfileMigrator();
|
||||
virtual ~nsCaminoProfileMigrator();
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIObserverService> mObserverService;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,672 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 The Browser Profile Migrator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsBrowserProfileMigratorUtils.h"
|
||||
#include "nsDogbertProfileMigrator.h"
|
||||
#include "nsICookieManager2.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsILineInputStream.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefLocalizedString.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "prprf.h"
|
||||
#include "prenv.h"
|
||||
#include "NSReg.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#ifdef PATH_MAX
|
||||
#define MAXPATHLEN PATH_MAX
|
||||
#elif defined(_MAX_PATH)
|
||||
#define MAXPATHLEN _MAX_PATH
|
||||
#elif defined(CCHMAXPATH)
|
||||
#define MAXPATHLEN CCHMAXPATH
|
||||
#else
|
||||
#define MAXPATHLEN 1024
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define PREF_FILE_HEADER_STRING "# Mozilla User Preferences "
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
#define OLDREG_NAME "Netscape Registry"
|
||||
#define OLDREG_DIR NS_MAC_PREFS_DIR
|
||||
#define PREF_FILE_NAME_IN_4x NS_LITERAL_STRING("Netscape Preferences")
|
||||
#define COOKIES_FILE_NAME_IN_4x NS_LITERAL_STRING("MagicCookie")
|
||||
#define BOOKMARKS_FILE_NAME_IN_4x NS_LITERAL_STRING("Bookmarks.html")
|
||||
#define SECURITY_PATH "Security"
|
||||
#define PSM_CERT7_DB NS_LITERAL_STRING("Certificates7")
|
||||
#define PSM_KEY3_DB NS_LITERAL_STRING("Key Database3")
|
||||
#define PSM_SECMODULE_DB NS_LITERAL_STRING("Security Modules")
|
||||
|
||||
#elif defined(XP_WIN) || defined(XP_OS2)
|
||||
#define OLDREG_NAME "nsreg.dat"
|
||||
#ifdef XP_WIN
|
||||
#define OLDREG_DIR NS_WIN_WINDOWS_DIR
|
||||
#else
|
||||
#define OLDREG_DIR NS_OS2_DIR
|
||||
#endif
|
||||
#define PREF_FILE_NAME_IN_4x NS_LITERAL_STRING("prefs.js")
|
||||
#define COOKIES_FILE_NAME_IN_4x NS_LITERAL_STRING("cookies.txt")
|
||||
#define BOOKMARKS_FILE_NAME_IN_4x NS_LITERAL_STRING("bookmark.htm")
|
||||
#define PSM_CERT7_DB NS_LITERAL_STRING("cert7.db")
|
||||
#define PSM_KEY3_DB NS_LITERAL_STRING("key3.db")
|
||||
#define PSM_SECMODULE_DB NS_LITERAL_STRING("secmod.db")
|
||||
|
||||
#elif defined(XP_UNIX)
|
||||
#define PREF_FILE_NAME_IN_4x NS_LITERAL_STRING("preferences.js")
|
||||
#define COOKIES_FILE_NAME_IN_4x NS_LITERAL_STRING("cookies")
|
||||
#define BOOKMARKS_FILE_NAME_IN_4x NS_LITERAL_STRING("bookmarks.html")
|
||||
#define PSM_CERT7_DB NS_LITERAL_STRING("cert7.db")
|
||||
#define PSM_KEY3_DB NS_LITERAL_STRING("key3.db")
|
||||
#define PSM_SECMODULE_DB NS_LITERAL_STRING("secmodule.db")
|
||||
#define HOME_ENVIRONMENT_VARIABLE "HOME"
|
||||
#define PROFILE_HOME_ENVIRONMENT_VARIABLE "PROFILE_HOME"
|
||||
#define DEFAULT_UNIX_PROFILE_NAME "default"
|
||||
#else
|
||||
#error No netscape4.x profile-migrator on this platform.
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
#define COOKIES_FILE_NAME_IN_5x NS_LITERAL_STRING("cookies.txt")
|
||||
#define BOOKMARKS_FILE_NAME_IN_5x NS_LITERAL_STRING("bookmarks.html")
|
||||
#define PREF_FILE_NAME_IN_5x NS_LITERAL_STRING("prefs.js")
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsDogbertProfileMigrator
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsDogbertProfileMigrator, nsIBrowserProfileMigrator)
|
||||
|
||||
nsDogbertProfileMigrator::nsDogbertProfileMigrator()
|
||||
{
|
||||
mObserverService = do_GetService("@mozilla.org/observer-service;1");
|
||||
}
|
||||
|
||||
nsDogbertProfileMigrator::~nsDogbertProfileMigrator()
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIBrowserProfileMigrator
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDogbertProfileMigrator::Migrate(PRUint16 aItems, nsIProfileStartup* aStartup,
|
||||
const PRUnichar* aProfile)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRBool aReplace = aStartup ? PR_TRUE : PR_FALSE;
|
||||
|
||||
if (!mTargetProfile) {
|
||||
GetProfilePath(aStartup, mTargetProfile);
|
||||
if (!mTargetProfile) return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!mSourceProfile) {
|
||||
GetSourceProfile(aProfile);
|
||||
if (!mSourceProfile)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NOTIFY_OBSERVERS(MIGRATION_STARTED, nsnull);
|
||||
|
||||
COPY_DATA(CopyPreferences, aReplace, nsIBrowserProfileMigrator::SETTINGS);
|
||||
COPY_DATA(CopyCookies, aReplace, nsIBrowserProfileMigrator::COOKIES);
|
||||
COPY_DATA(CopyBookmarks, aReplace, nsIBrowserProfileMigrator::BOOKMARKS);
|
||||
|
||||
NOTIFY_OBSERVERS(MIGRATION_ENDED, nsnull);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// on win/mac/os2, NS4x uses a registry to determine profile locations
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
|
||||
void
|
||||
nsDogbertProfileMigrator::GetSourceProfile(const PRUnichar* aProfile)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIFile> regFile;
|
||||
rv = NS_GetSpecialDirectory(OLDREG_DIR, getter_AddRefs(regFile));
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
regFile->AppendNative(NS_LITERAL_CSTRING(OLDREG_NAME));
|
||||
|
||||
nsCAutoString path;
|
||||
rv = regFile->GetNativePath(path);
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
if (NR_StartupRegistry())
|
||||
return;
|
||||
|
||||
HREG reg = nsnull;
|
||||
RKEY profile = nsnull;
|
||||
|
||||
if (NR_RegOpen(path.get(), ®))
|
||||
goto cleanup;
|
||||
|
||||
{
|
||||
// on macos, registry entries are UTF8 encoded
|
||||
NS_ConvertUTF16toUTF8 profileName(aProfile);
|
||||
|
||||
if (NR_RegGetKey(reg, ROOTKEY_USERS, profileName.get(), &profile))
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
char profilePath[MAXPATHLEN];
|
||||
if (NR_RegGetEntryString(reg, profile, "ProfileLocation", profilePath, MAXPATHLEN))
|
||||
goto cleanup;
|
||||
|
||||
mSourceProfile = do_CreateInstance("@mozilla.org/file/local;1");
|
||||
if (!mSourceProfile) goto cleanup;
|
||||
|
||||
{
|
||||
// the string is UTF8 encoded, which forces us to do some strange string-do
|
||||
rv = mSourceProfile->InitWithPath(NS_ConvertUTF8toUTF16(profilePath));
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
mSourceProfile = nsnull;
|
||||
|
||||
cleanup:
|
||||
if (reg)
|
||||
NR_RegClose(reg);
|
||||
NR_ShutdownRegistry();
|
||||
}
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDogbertProfileMigrator::GetMigrateData(const PRUnichar* aProfile,
|
||||
PRBool aReplace,
|
||||
PRUint16* aResult)
|
||||
{
|
||||
*aResult = 0;
|
||||
if (!mSourceProfile) {
|
||||
GetSourceProfile(aProfile);
|
||||
if (!mSourceProfile)
|
||||
return NS_ERROR_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
MigrationData data[] = { { ToNewUnicode(PREF_FILE_NAME_IN_4x),
|
||||
nsIBrowserProfileMigrator::SETTINGS,
|
||||
PR_TRUE },
|
||||
{ ToNewUnicode(COOKIES_FILE_NAME_IN_4x),
|
||||
nsIBrowserProfileMigrator::COOKIES,
|
||||
PR_FALSE },
|
||||
{ ToNewUnicode(BOOKMARKS_FILE_NAME_IN_4x),
|
||||
nsIBrowserProfileMigrator::BOOKMARKS,
|
||||
PR_FALSE } };
|
||||
|
||||
// Frees file name strings allocated above.
|
||||
GetMigrateDataFromArray(data, sizeof(data)/sizeof(MigrationData),
|
||||
aReplace, mSourceProfile, aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDogbertProfileMigrator::GetSourceExists(PRBool* aResult)
|
||||
{
|
||||
nsCOMPtr<nsISupportsArray> profiles;
|
||||
GetSourceProfiles(getter_AddRefs(profiles));
|
||||
|
||||
if (profiles) {
|
||||
PRUint32 count;
|
||||
profiles->Count(&count);
|
||||
*aResult = count > 0;
|
||||
}
|
||||
else
|
||||
*aResult = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDogbertProfileMigrator::GetSourceHasMultipleProfiles(PRBool* aResult)
|
||||
{
|
||||
nsCOMPtr<nsISupportsArray> profiles;
|
||||
GetSourceProfiles(getter_AddRefs(profiles));
|
||||
|
||||
if (profiles) {
|
||||
PRUint32 count;
|
||||
profiles->Count(&count);
|
||||
*aResult = count > 1;
|
||||
}
|
||||
else
|
||||
*aResult = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2) || defined(XP_MACOSX)
|
||||
NS_IMETHODIMP
|
||||
nsDogbertProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
|
||||
{
|
||||
if (!mProfiles) {
|
||||
nsresult rv;
|
||||
|
||||
mProfiles = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIFile> regFile;
|
||||
rv = NS_GetSpecialDirectory(OLDREG_DIR, getter_AddRefs(regFile));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
regFile->AppendNative(NS_LITERAL_CSTRING(OLDREG_NAME));
|
||||
|
||||
nsCAutoString path;
|
||||
rv = regFile->GetNativePath(path);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (NR_StartupRegistry())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
HREG reg = nsnull;
|
||||
REGENUM enumstate = 0;
|
||||
|
||||
if (NR_RegOpen(path.get(), ®)) {
|
||||
NR_ShutdownRegistry();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
char profileName[MAXREGNAMELEN];
|
||||
while (!NR_RegEnumSubkeys(reg, ROOTKEY_USERS, &enumstate,
|
||||
profileName, MAXREGNAMELEN, REGENUM_CHILDREN)) {
|
||||
nsCOMPtr<nsISupportsString> nameString
|
||||
(do_CreateInstance("@mozilla.org/supports-string;1"));
|
||||
if (nameString) {
|
||||
nameString->SetData(NS_ConvertUTF8toUTF16(profileName));
|
||||
mProfiles->AppendElement(nameString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aResult = mProfiles);
|
||||
return NS_OK;
|
||||
}
|
||||
#else // XP_UNIX
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDogbertProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
const char* profileDir = PR_GetEnv(PROFILE_HOME_ENVIRONMENT_VARIABLE);
|
||||
|
||||
if (!profileDir) {
|
||||
profileDir = PR_GetEnv(HOME_ENVIRONMENT_VARIABLE);
|
||||
}
|
||||
if (!profileDir) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCAutoString profilePath(profileDir);
|
||||
profilePath += "/.netscape";
|
||||
|
||||
nsCOMPtr<nsILocalFile> profileFile;
|
||||
rv = NS_NewNativeLocalFile(profilePath, PR_TRUE, getter_AddRefs(profileFile));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIFile> prefFile;
|
||||
rv = profileFile->Clone(getter_AddRefs(prefFile));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
prefFile->AppendNative(NS_LITERAL_CSTRING("preferences.js"));
|
||||
|
||||
PRBool exists;
|
||||
rv = prefFile->Exists(&exists);
|
||||
if (NS_FAILED(rv) || !exists) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mSourceProfile = profileFile;
|
||||
|
||||
mProfiles = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsISupportsString> nameString
|
||||
(do_CreateInstance("@mozilla.org/supports-string;1"));
|
||||
if (!nameString) return NS_ERROR_FAILURE;
|
||||
|
||||
nameString->SetData(NS_LITERAL_STRING("Netscape 4.x"));
|
||||
mProfiles->AppendElement(nameString);
|
||||
NS_ADDREF(*aResult = mProfiles);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsDogbertProfileMigrator::GetSourceProfile(const PRUnichar* aProfile)
|
||||
{
|
||||
// if GetSourceProfiles didn't do its magic, we're screwed
|
||||
}
|
||||
#endif // GetSourceProfiles
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDogbertProfileMigrator::GetSourceHomePageURL(nsACString& aResult)
|
||||
{
|
||||
aResult.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsDogbertProfileMigrator
|
||||
#define F(a) nsDogbertProfileMigrator::a
|
||||
|
||||
static
|
||||
nsDogbertProfileMigrator::PrefTransform gTransforms[] = {
|
||||
// Simple Copy Prefs
|
||||
{ "browser.anchor_color", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
|
||||
{ "browser.visited_color", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
|
||||
{ "browser.startup.homepage", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
|
||||
{ "network.cookie.cookieBehavior", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } },
|
||||
{ "network.cookie.warnAboutCookies",0, F(GetBool), F(SetBool), PR_FALSE, { -1 } },
|
||||
{ "javascript.enabled", 0, F(GetBool), F(SetBool), PR_FALSE, { -1 } },
|
||||
{ "network.proxy.type", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } },
|
||||
{ "network.proxy.no_proxies_on", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
|
||||
{ "network.proxy.autoconfig_url", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
|
||||
{ "network.proxy.ftp", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
|
||||
{ "network.proxy.ftp_port", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } },
|
||||
{ "network.proxy.http", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
|
||||
{ "network.proxy.http_port", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } },
|
||||
{ "network.proxy.ssl", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
|
||||
{ "network.proxy.ssl_port", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } },
|
||||
|
||||
// Prefs with Different Names
|
||||
{ "network.hosts.socks_server", "network.proxy.socks", F(GetString), F(SetString), PR_FALSE, { -1 } },
|
||||
{ "network.hosts.socks_serverport", "network.proxy.socks_port", F(GetInt), F(SetInt), PR_FALSE, { -1 } },
|
||||
{ "browser.background_color", "browser.display.background_color", F(GetString), F(SetString), PR_FALSE, { -1 } },
|
||||
{ "browser.foreground_color", "browser.display.foreground_color", F(GetString), F(SetString), PR_FALSE, { -1 } },
|
||||
{ "browser.wfe.use_windows_colors", "browser.display.use_system_colors", F(GetBool), F(SetBool), PR_FALSE, { -1 } },
|
||||
{ "browser.use_document_colors", "browser.display.use_document_colors",F(GetBool), F(SetBool), PR_FALSE, { -1 } },
|
||||
{ "browser.use_document.fonts", "browser.display.use_document_fonts", F(GetInt), F(SetInt), PR_FALSE, { -1 } },
|
||||
{ "browser.startup.page", "browser.startup.homepage", F(GetHomepage), F(SetWStringFromASCII), PR_FALSE, { -1 } },
|
||||
{ "general.always_load_images", "permissions.default.image", F(GetImagePref),F(SetInt), PR_FALSE, { -1 } },
|
||||
};
|
||||
|
||||
nsresult
|
||||
nsDogbertProfileMigrator::TransformPreferences(const nsAString& aSourcePrefFileName,
|
||||
const nsAString& aTargetPrefFileName)
|
||||
{
|
||||
PrefTransform* transform;
|
||||
PrefTransform* end = gTransforms + sizeof(gTransforms)/sizeof(PrefTransform);
|
||||
|
||||
// Load the source pref file
|
||||
nsCOMPtr<nsIPrefService> psvc(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
psvc->ResetPrefs();
|
||||
|
||||
nsCOMPtr<nsIFile> sourcePrefsFile;
|
||||
mSourceProfile->Clone(getter_AddRefs(sourcePrefsFile));
|
||||
sourcePrefsFile->Append(aSourcePrefFileName);
|
||||
psvc->ReadUserPrefs(sourcePrefsFile);
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> branch(do_QueryInterface(psvc));
|
||||
for (transform = gTransforms; transform < end; ++transform)
|
||||
transform->prefGetterFunc(transform, branch);
|
||||
|
||||
// Now that we have all the pref data in memory, load the target pref file,
|
||||
// and write it back out
|
||||
psvc->ResetPrefs();
|
||||
for (transform = gTransforms; transform < end; ++transform)
|
||||
transform->prefSetterFunc(transform, branch);
|
||||
|
||||
nsCOMPtr<nsIFile> targetPrefsFile;
|
||||
mTargetProfile->Clone(getter_AddRefs(targetPrefsFile));
|
||||
targetPrefsFile->Append(aTargetPrefFileName);
|
||||
psvc->SavePrefFile(targetPrefsFile);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDogbertProfileMigrator::CopyPreferences(PRBool aReplace)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (!aReplace)
|
||||
return rv;
|
||||
|
||||
// 1) Copy Preferences
|
||||
TransformPreferences(PREF_FILE_NAME_IN_4x, PREF_FILE_NAME_IN_5x);
|
||||
|
||||
// 2) Copy Certficates
|
||||
rv |= CopyFile(PSM_CERT7_DB, PSM_CERT7_DB);
|
||||
rv |= CopyFile(PSM_KEY3_DB, PSM_KEY3_DB);
|
||||
rv |= CopyFile(PSM_SECMODULE_DB, PSM_SECMODULE_DB);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDogbertProfileMigrator::GetHomepage(void* aTransform, nsIPrefBranch* aBranch)
|
||||
{
|
||||
PrefTransform* xform = (PrefTransform*)aTransform;
|
||||
PRInt32 val;
|
||||
nsresult rv = aBranch->GetIntPref(xform->sourcePrefName, &val);
|
||||
if (NS_SUCCEEDED(rv) && val == 0) {
|
||||
xform->stringValue = ToNewCString(NS_LITERAL_CSTRING("about:blank"));
|
||||
if (!xform->stringValue)
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
xform->prefHasValue = PR_TRUE;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDogbertProfileMigrator::GetImagePref(void* aTransform, nsIPrefBranch* aBranch)
|
||||
{
|
||||
PrefTransform* xform = (PrefTransform*)aTransform;
|
||||
PRBool loadImages;
|
||||
nsresult rv = aBranch->GetBoolPref(xform->sourcePrefName, &loadImages);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
xform->intValue = loadImages ? 1 : 2;
|
||||
xform->prefHasValue = PR_TRUE;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDogbertProfileMigrator::CopyCookies(PRBool aReplace)
|
||||
{
|
||||
nsresult rv;
|
||||
if (aReplace) {
|
||||
#ifdef NEED_TO_FIX_4X_COOKIES
|
||||
rv = CopyFile(COOKIES_FILE_NAME_IN_4x, COOKIES_FILE_NAME_IN_5x);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = FixDogbertCookies();
|
||||
#else
|
||||
rv = CopyFile(COOKIES_FILE_NAME_IN_4x, COOKIES_FILE_NAME_IN_5x);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsICookieManager2> cookieManager(do_GetService(NS_COOKIEMANAGER_CONTRACTID));
|
||||
if (!cookieManager)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<nsIFile> dogbertCookiesFile;
|
||||
mSourceProfile->Clone(getter_AddRefs(dogbertCookiesFile));
|
||||
dogbertCookiesFile->Append(COOKIES_FILE_NAME_IN_4x);
|
||||
|
||||
rv = ImportNetscapeCookies(dogbertCookiesFile);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
#if NEED_TO_FIX_4X_COOKIES
|
||||
nsresult
|
||||
nsDogbertProfileMigrator::FixDogbertCookies()
|
||||
{
|
||||
nsCOMPtr<nsIFile> dogbertCookiesFile;
|
||||
mSourceProfile->Clone(getter_AddRefs(dogbertCookiesFile));
|
||||
dogbertCookiesFile->Append(COOKIES_FILE_NAME_IN_4x);
|
||||
|
||||
nsCOMPtr<nsIInputStream> fileInputStream;
|
||||
NS_NewLocalFileInputStream(getter_AddRefs(fileInputStream), dogbertCookiesFile);
|
||||
if (!fileInputStream) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<nsIFile> firebirdCookiesFile;
|
||||
mTargetProfile->Clone(getter_AddRefs(firebirdCookiesFile));
|
||||
firebirdCookiesFile->Append(COOKIES_FILE_NAME_IN_5x);
|
||||
|
||||
nsCOMPtr<nsIOutputStream> fileOutputStream;
|
||||
NS_NewLocalFileOutputStream(getter_AddRefs(fileOutputStream), firebirdCookiesFile);
|
||||
if (!fileOutputStream) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<nsILineInputStream> lineInputStream(do_QueryInterface(fileInputStream));
|
||||
nsCAutoString buffer, outBuffer;
|
||||
PRBool moreData = PR_FALSE;
|
||||
PRUint32 written = 0;
|
||||
do {
|
||||
nsresult rv = lineInputStream->ReadLine(buffer, &moreData);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!moreData)
|
||||
break;
|
||||
|
||||
// skip line if it is a comment or null line
|
||||
if (buffer.IsEmpty() || buffer.CharAt(0) == '#' ||
|
||||
buffer.CharAt(0) == '\r' || buffer.CharAt(0) == '\n') {
|
||||
fileOutputStream->Write(buffer.get(), buffer.Length(), &written);
|
||||
continue;
|
||||
}
|
||||
|
||||
// locate expire field, skip line if it does not contain all its fields
|
||||
int hostIndex, isDomainIndex, pathIndex, xxxIndex, expiresIndex, nameIndex, cookieIndex;
|
||||
hostIndex = 0;
|
||||
if ((isDomainIndex = buffer.FindChar('\t', hostIndex)+1) == 0 ||
|
||||
(pathIndex = buffer.FindChar('\t', isDomainIndex)+1) == 0 ||
|
||||
(xxxIndex = buffer.FindChar('\t', pathIndex)+1) == 0 ||
|
||||
(expiresIndex = buffer.FindChar('\t', xxxIndex)+1) == 0 ||
|
||||
(nameIndex = buffer.FindChar('\t', expiresIndex)+1) == 0 ||
|
||||
(cookieIndex = buffer.FindChar('\t', nameIndex)+1) == 0 )
|
||||
continue;
|
||||
|
||||
// separate the expires field from the rest of the cookie line
|
||||
const nsDependentCSubstring prefix =
|
||||
Substring(buffer, hostIndex, expiresIndex-hostIndex-1);
|
||||
const nsDependentCSubstring expiresString =
|
||||
Substring(buffer, expiresIndex, nameIndex-expiresIndex-1);
|
||||
const nsDependentCSubstring suffix =
|
||||
Substring(buffer, nameIndex, buffer.Length()-nameIndex);
|
||||
|
||||
// correct the expires field
|
||||
char* expiresCString = ToNewCString(expiresString);
|
||||
unsigned long expires = strtoul(expiresCString, nsnull, 10);
|
||||
NS_Free(expiresCString);
|
||||
|
||||
// if the cookie is supposed to expire at the end of the session
|
||||
// expires == 0. don't adjust those cookies.
|
||||
if (expires)
|
||||
expires -= SECONDS_BETWEEN_1900_AND_1970;
|
||||
char dateString[36];
|
||||
PR_snprintf(dateString, sizeof(dateString), "%lu", expires);
|
||||
|
||||
// generate the output buffer and write it to file
|
||||
outBuffer = prefix;
|
||||
outBuffer.Append('\t');
|
||||
outBuffer.Append(dateString);
|
||||
outBuffer.Append('\t');
|
||||
outBuffer.Append(suffix);
|
||||
|
||||
fileOutputStream->Write(outBuffer.get(), outBuffer.Length(), &written);
|
||||
}
|
||||
while (1);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#endif // NEED_TO_FIX_4X_COOKIES
|
||||
|
||||
|
||||
nsresult
|
||||
nsDogbertProfileMigrator::CopyBookmarks(PRBool aReplace)
|
||||
{
|
||||
// If we're blowing away existing content, just copy the file, don't do fancy importing.
|
||||
if (aReplace) {
|
||||
nsresult rv = InitializeBookmarks(mTargetProfile);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return MigrateDogbertBookmarks();
|
||||
}
|
||||
|
||||
return ImportNetscapeBookmarks(BOOKMARKS_FILE_NAME_IN_4x,
|
||||
NS_LITERAL_STRING("sourceNameDogbert").get());
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDogbertProfileMigrator::MigrateDogbertBookmarks()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// Find out what the personal toolbar folder was called, this is stored in a pref
|
||||
// in 4.x
|
||||
nsCOMPtr<nsIPrefService> psvc(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
psvc->ResetPrefs();
|
||||
|
||||
nsCOMPtr<nsIFile> dogbertPrefsFile;
|
||||
mSourceProfile->Clone(getter_AddRefs(dogbertPrefsFile));
|
||||
dogbertPrefsFile->Append(PREF_FILE_NAME_IN_4x);
|
||||
psvc->ReadUserPrefs(dogbertPrefsFile);
|
||||
|
||||
nsCString toolbarName;
|
||||
nsCOMPtr<nsIPrefBranch> branch(do_QueryInterface(psvc));
|
||||
rv = branch->GetCharPref("custtoolbar.personal_toolbar_folder", getter_Copies(toolbarName));
|
||||
// If the pref wasn't set in the user's 4.x preferences, there's no way we can "Fix" the
|
||||
// file when importing it to set the personal toolbar folder correctly, so don't bother
|
||||
// with the more involved file correction procedure and just copy the file over.
|
||||
if (NS_FAILED(rv))
|
||||
return CopyFile(BOOKMARKS_FILE_NAME_IN_4x, BOOKMARKS_FILE_NAME_IN_5x);
|
||||
|
||||
// Now read the 4.x bookmarks file, correcting the Personal Toolbar Folder line
|
||||
// and writing to the new location.
|
||||
nsCOMPtr<nsIFile> sourceBookmarksFile;
|
||||
mSourceProfile->Clone(getter_AddRefs(sourceBookmarksFile));
|
||||
sourceBookmarksFile->Append(BOOKMARKS_FILE_NAME_IN_4x);
|
||||
|
||||
nsCOMPtr<nsIFile> targetBookmarksFile;
|
||||
mTargetProfile->Clone(getter_AddRefs(targetBookmarksFile));
|
||||
targetBookmarksFile->Append(BOOKMARKS_FILE_NAME_IN_5x);
|
||||
|
||||
return AnnotatePersonalToolbarFolder(sourceBookmarksFile,
|
||||
targetBookmarksFile, toolbarName.get());
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 The Browser Profile Migrator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef dogbertprofilemigrator___h___
|
||||
#define dogbertprofilemigrator___h___
|
||||
|
||||
#include "nsIBrowserProfileMigrator.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsNetscapeProfileMigratorBase.h"
|
||||
#include "nsStringAPI.h"
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#define NEED_TO_FIX_4X_COOKIES 1
|
||||
#define SECONDS_BETWEEN_1900_AND_1970 2208988800UL
|
||||
#endif /* XP_MACOSX */
|
||||
|
||||
class nsIFile;
|
||||
|
||||
class nsDogbertProfileMigrator : public nsNetscapeProfileMigratorBase,
|
||||
public nsIBrowserProfileMigrator
|
||||
{
|
||||
public:
|
||||
NS_DECL_NSIBROWSERPROFILEMIGRATOR
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsDogbertProfileMigrator();
|
||||
virtual ~nsDogbertProfileMigrator();
|
||||
|
||||
public:
|
||||
static nsresult GetHomepage(void* aTransform, nsIPrefBranch* aBranch);
|
||||
static nsresult GetImagePref(void* aTransform, nsIPrefBranch* aBranch);
|
||||
|
||||
protected:
|
||||
nsresult CopyPreferences(PRBool aReplace);
|
||||
nsresult TransformPreferences(const nsAString& aSourcePrefFileName,
|
||||
const nsAString& aTargetPrefFileName);
|
||||
|
||||
nsresult CopyCookies(PRBool aReplace);
|
||||
#ifdef NEED_TO_FIX_4X_COOKIES
|
||||
nsresult FixDogbertCookies();
|
||||
#endif
|
||||
|
||||
nsresult CopyBookmarks(PRBool aReplace);
|
||||
nsresult MigrateDogbertBookmarks();
|
||||
|
||||
void GetSourceProfile(const PRUnichar* aProfile);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsISupportsArray> mProfiles;
|
||||
nsCOMPtr<nsIObserverService> mObserverService;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,116 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 The Browser Profile Migrator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsBrowserProfileMigratorUtils.h"
|
||||
#include "nsICabProfileMigrator.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIProfileMigrator.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsICabProfileMigrator
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsICabProfileMigrator, nsIBrowserProfileMigrator)
|
||||
|
||||
nsICabProfileMigrator::nsICabProfileMigrator()
|
||||
{
|
||||
mObserverService = do_GetService("@mozilla.org/observer-service;1");
|
||||
}
|
||||
|
||||
nsICabProfileMigrator::~nsICabProfileMigrator()
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIBrowserProfileMigrator
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsICabProfileMigrator::Migrate(PRUint16 aItems, nsIProfileStartup* aStartup, const PRUnichar* aProfile)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NOTIFY_OBSERVERS(MIGRATION_STARTED, nsnull);
|
||||
|
||||
NOTIFY_OBSERVERS(MIGRATION_ENDED, nsnull);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsICabProfileMigrator::GetMigrateData(const PRUnichar* aProfile,
|
||||
PRBool aReplace,
|
||||
PRUint16* aResult)
|
||||
{
|
||||
*aResult = 0; // XXXben implement me
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsICabProfileMigrator::GetSourceExists(PRBool* aResult)
|
||||
{
|
||||
*aResult = PR_FALSE; // XXXben implement me
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsICabProfileMigrator::GetSourceHasMultipleProfiles(PRBool* aResult)
|
||||
{
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsICabProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsICabProfileMigrator::GetSourceHomePageURL(nsACString& aResult)
|
||||
{
|
||||
aResult.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsICabProfileMigrator
|
||||
|
@ -1,61 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 The Browser Profile Migrator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef icabprofilemigrator___h___
|
||||
#define icabprofilemigrator___h___
|
||||
|
||||
#include "nsIBrowserProfileMigrator.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsStringAPI.h"
|
||||
|
||||
class nsICabProfileMigrator : public nsIBrowserProfileMigrator
|
||||
{
|
||||
public:
|
||||
NS_DECL_NSIBROWSERPROFILEMIGRATOR
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsICabProfileMigrator();
|
||||
virtual ~nsICabProfileMigrator();
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIObserverService> mObserverService;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,259 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 The Browser Profile Migrator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.com>
|
||||
* Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
*
|
||||
* 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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsBrowserProfileMigratorUtils.h"
|
||||
#include "nsMacIEProfileMigrator.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIProfileMigrator.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIProperties.h"
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
#define MACIE_BOOKMARKS_FILE_NAME NS_LITERAL_STRING("Favorites.html")
|
||||
#define MACIE_PREFERENCES_FOLDER_NAME NS_LITERAL_STRING("Explorer")
|
||||
#define MACIE_DEFAULT_HOMEPAGE_PREF "\p4D534945¥WWWHomePage"
|
||||
#define TEMP_BOOKMARKS_FILE_NAME NS_LITERAL_STRING("bookmarks_tmp.html")
|
||||
|
||||
#define MIGRATION_BUNDLE "chrome://browser/locale/migration/migration.properties"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsMacIEProfileMigrator
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsMacIEProfileMigrator, nsIBrowserProfileMigrator)
|
||||
|
||||
nsMacIEProfileMigrator::nsMacIEProfileMigrator()
|
||||
{
|
||||
mObserverService = do_GetService("@mozilla.org/observer-service;1");
|
||||
}
|
||||
|
||||
nsMacIEProfileMigrator::~nsMacIEProfileMigrator()
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIBrowserProfileMigrator
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMacIEProfileMigrator::Migrate(PRUint16 aItems, nsIProfileStartup* aStartup, const PRUnichar* aProfile)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
PRBool replace = aStartup ? PR_TRUE : PR_FALSE;
|
||||
|
||||
if (!mTargetProfile) {
|
||||
GetProfilePath(aStartup, mTargetProfile);
|
||||
if (!mTargetProfile) return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!mSourceProfile) {
|
||||
nsCOMPtr<nsIProperties> fileLocator =
|
||||
do_GetService("@mozilla.org/file/directory_service;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
fileLocator->Get(NS_OSX_USER_PREFERENCES_DIR,
|
||||
NS_GET_IID(nsILocalFile),
|
||||
getter_AddRefs(mSourceProfile));
|
||||
mSourceProfile->Append(MACIE_PREFERENCES_FOLDER_NAME);
|
||||
}
|
||||
|
||||
NOTIFY_OBSERVERS(MIGRATION_STARTED, nsnull);
|
||||
|
||||
COPY_DATA(CopyBookmarks, replace, nsIBrowserProfileMigrator::BOOKMARKS);
|
||||
|
||||
NOTIFY_OBSERVERS(MIGRATION_ENDED, nsnull);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMacIEProfileMigrator::GetMigrateData(const PRUnichar* aProfile,
|
||||
PRBool aReplace,
|
||||
PRUint16* aResult)
|
||||
{
|
||||
*aResult = 0;
|
||||
|
||||
if (!mSourceProfile) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIProperties> fileLocator =
|
||||
do_GetService("@mozilla.org/file/directory_service;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
fileLocator->Get(NS_OSX_USER_PREFERENCES_DIR,
|
||||
NS_GET_IID(nsILocalFile),
|
||||
getter_AddRefs(mSourceProfile));
|
||||
mSourceProfile->Append(MACIE_PREFERENCES_FOLDER_NAME);
|
||||
}
|
||||
|
||||
MigrationData data[] = { { ToNewUnicode(MACIE_BOOKMARKS_FILE_NAME),
|
||||
nsIBrowserProfileMigrator::BOOKMARKS,
|
||||
PR_FALSE } };
|
||||
|
||||
// Frees file name strings allocated above.
|
||||
GetMigrateDataFromArray(data, sizeof(data)/sizeof(MigrationData),
|
||||
aReplace, mSourceProfile, aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMacIEProfileMigrator::GetSourceExists(PRBool* aResult)
|
||||
{
|
||||
// Since the IE bookmarks file can sometimes be created by programs
|
||||
// other than Internet Explorer, thus misleading, we must first
|
||||
// check whether IE is even installed on this Mac. We accomplish this by
|
||||
// checking one of IEs stored preferences in the apple.internetconfig file.
|
||||
PRBool prefExists = PR_FALSE;
|
||||
OSErr err;
|
||||
ICInstance icInstance;
|
||||
|
||||
err = ::ICStart(&icInstance, 'FRFX');
|
||||
if (err == noErr) {
|
||||
ICAttr attrs;
|
||||
Str255 IEhomePageValue;
|
||||
long size = kICFileSpecHeaderSize;
|
||||
err = ::ICGetPref(icInstance, MACIE_DEFAULT_HOMEPAGE_PREF, &attrs,
|
||||
IEhomePageValue, &size);
|
||||
if (err == noErr)
|
||||
prefExists = PR_TRUE;
|
||||
|
||||
::ICStop(icInstance);
|
||||
}
|
||||
|
||||
if (!prefExists) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint16 data;
|
||||
GetMigrateData(nsnull, PR_FALSE, &data);
|
||||
|
||||
*aResult = data != 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMacIEProfileMigrator::GetSourceHasMultipleProfiles(PRBool* aResult)
|
||||
{
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMacIEProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMacIEProfileMigrator::GetSourceHomePageURL(nsACString& aResult)
|
||||
{
|
||||
aResult.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsMacIEProfileMigrator
|
||||
|
||||
nsresult
|
||||
nsMacIEProfileMigrator::CopyBookmarks(PRBool aReplace)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFile> sourceFile;
|
||||
mSourceProfile->Clone(getter_AddRefs(sourceFile));
|
||||
|
||||
sourceFile->Append(MACIE_BOOKMARKS_FILE_NAME);
|
||||
PRBool exists = PR_FALSE;
|
||||
sourceFile->Exists(&exists);
|
||||
if (!exists)
|
||||
return NS_OK;
|
||||
|
||||
// it's an import
|
||||
if (!aReplace)
|
||||
return ImportBookmarksHTML(sourceFile,
|
||||
PR_FALSE,
|
||||
PR_FALSE,
|
||||
NS_LITERAL_STRING("sourceNameIE").get());
|
||||
|
||||
// Initialize the default bookmarks
|
||||
rv = InitializeBookmarks(mTargetProfile);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// If we're blowing away existing content, annotate the Personal Toolbar and
|
||||
// then import the file.
|
||||
nsCOMPtr<nsIFile> tempFile;
|
||||
mTargetProfile->Clone(getter_AddRefs(tempFile));
|
||||
tempFile->Append(TEMP_BOOKMARKS_FILE_NAME);
|
||||
|
||||
// Look for the localized name of the IE Favorites Bar
|
||||
nsCOMPtr<nsIStringBundleService> bundleService =
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
rv = bundleService->CreateBundle(MIGRATION_BUNDLE, getter_AddRefs(bundle));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsString toolbarFolderNameMacIE;
|
||||
rv = bundle->GetStringFromName(NS_LITERAL_STRING("toolbarFolderNameMacIE").get(),
|
||||
getter_Copies(toolbarFolderNameMacIE));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Now read the 4.x bookmarks file, correcting the Personal Toolbar Folder
|
||||
// line and writing to the temporary file.
|
||||
rv = AnnotatePersonalToolbarFolder(sourceFile,
|
||||
tempFile,
|
||||
NS_ConvertUTF16toUTF8(toolbarFolderNameMacIE).get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// import the temp file
|
||||
rv = ImportBookmarksHTML(tempFile,
|
||||
PR_TRUE,
|
||||
PR_FALSE,
|
||||
EmptyString().get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// remove the temp file
|
||||
return tempFile->Remove(PR_FALSE);
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 The Browser Profile Migrator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef macieprofilemigrator___h___
|
||||
#define macieprofilemigrator___h___
|
||||
|
||||
#include "nsIBrowserProfileMigrator.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsStringAPI.h"
|
||||
|
||||
class nsMacIEProfileMigrator : public nsIBrowserProfileMigrator
|
||||
{
|
||||
public:
|
||||
NS_DECL_NSIBROWSERPROFILEMIGRATOR
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsMacIEProfileMigrator();
|
||||
virtual ~nsMacIEProfileMigrator();
|
||||
|
||||
protected:
|
||||
nsresult CopyBookmarks(PRBool aReplace);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsILocalFile> mSourceProfile;
|
||||
nsCOMPtr<nsIFile> mTargetProfile;
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIObserverService> mObserverService;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,116 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 The Browser Profile Migrator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.com>
|
||||
* Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
*
|
||||
* 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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsBrowserProfileMigratorUtils.h"
|
||||
#include "nsOmniWebProfileMigrator.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIProfileMigrator.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsOmniWebProfileMigrator
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsOmniWebProfileMigrator, nsIBrowserProfileMigrator)
|
||||
|
||||
nsOmniWebProfileMigrator::nsOmniWebProfileMigrator()
|
||||
{
|
||||
mObserverService = do_GetService("@mozilla.org/observer-service;1");
|
||||
}
|
||||
|
||||
nsOmniWebProfileMigrator::~nsOmniWebProfileMigrator()
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIBrowserProfileMigrator
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOmniWebProfileMigrator::Migrate(PRUint16 aItems, nsIProfileStartup* aStartup, const PRUnichar* aProfile)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NOTIFY_OBSERVERS(MIGRATION_STARTED, nsnull);
|
||||
|
||||
NOTIFY_OBSERVERS(MIGRATION_ENDED, nsnull);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOmniWebProfileMigrator::GetMigrateData(const PRUnichar* aProfile,
|
||||
PRBool aReplace,
|
||||
PRUint16* aResult)
|
||||
{
|
||||
*aResult = 0; // XXXben implement me
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOmniWebProfileMigrator::GetSourceExists(PRBool* aResult)
|
||||
{
|
||||
*aResult = PR_FALSE; // XXXben implement me
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOmniWebProfileMigrator::GetSourceHasMultipleProfiles(PRBool* aResult)
|
||||
{
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOmniWebProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOmniWebProfileMigrator::GetSourceHomePageURL(nsACString& aResult)
|
||||
{
|
||||
aResult.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsOmniWebProfileMigrator
|
||||
|
@ -1,61 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 The Browser Profile Migrator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef omniwebprofilemigrator___h___
|
||||
#define omniwebprofilemigrator___h___
|
||||
|
||||
#include "nsIBrowserProfileMigrator.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsStringAPI.h"
|
||||
|
||||
class nsOmniWebProfileMigrator : public nsIBrowserProfileMigrator
|
||||
{
|
||||
public:
|
||||
NS_DECL_NSIBROWSERPROFILEMIGRATOR
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsOmniWebProfileMigrator();
|
||||
virtual ~nsOmniWebProfileMigrator();
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIObserverService> mObserverService;
|
||||
};
|
||||
|
||||
#endif
|
@ -46,6 +46,7 @@
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsINavHistoryService.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
class nsICookieManager2;
|
||||
class nsILineInputStream;
|
||||
|
@ -1,438 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 The Browser Profile Migrator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsBrowserProfileMigratorUtils.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsPhoenixProfileMigrator.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsPhoenixProfileMigrator
|
||||
|
||||
#define FILE_NAME_BOOKMARKS NS_LITERAL_STRING("bookmarks.html")
|
||||
#define FILE_NAME_COOKIES NS_LITERAL_STRING("cookies.txt")
|
||||
#define FILE_NAME_SITEPERM_OLD NS_LITERAL_STRING("cookperm.txt")
|
||||
#define FILE_NAME_SITEPERM_NEW NS_LITERAL_STRING("hostperm.1")
|
||||
#define FILE_NAME_CERT8DB NS_LITERAL_STRING("cert8.db")
|
||||
#define FILE_NAME_KEY3DB NS_LITERAL_STRING("key3.db")
|
||||
#define FILE_NAME_SECMODDB NS_LITERAL_STRING("secmod.db")
|
||||
#define FILE_NAME_HISTORY NS_LITERAL_STRING("history.dat")
|
||||
#define FILE_NAME_FORMHISTORY NS_LITERAL_STRING("formhistory.dat")
|
||||
#define FILE_NAME_LOCALSTORE NS_LITERAL_STRING("localstore.rdf")
|
||||
#define FILE_NAME_MIMETYPES NS_LITERAL_STRING("mimeTypes.rdf")
|
||||
#define FILE_NAME_DOWNLOADS NS_LITERAL_STRING("downloads.rdf")
|
||||
#define FILE_NAME_PREFS NS_LITERAL_STRING("prefs.js")
|
||||
#define FILE_NAME_USER_PREFS NS_LITERAL_STRING("user.js")
|
||||
#define FILE_NAME_USERCHROME NS_LITERAL_STRING("userChrome.css")
|
||||
#define FILE_NAME_USERCONTENT NS_LITERAL_STRING("userContent.css")
|
||||
#define DIR_NAME_CHROME NS_LITERAL_STRING("chrome")
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsPhoenixProfileMigrator, nsIBrowserProfileMigrator)
|
||||
|
||||
nsPhoenixProfileMigrator::nsPhoenixProfileMigrator()
|
||||
{
|
||||
mObserverService = do_GetService("@mozilla.org/observer-service;1");
|
||||
}
|
||||
|
||||
nsPhoenixProfileMigrator::~nsPhoenixProfileMigrator()
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIBrowserProfileMigrator
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPhoenixProfileMigrator::Migrate(PRUint16 aItems, nsIProfileStartup* aStartup, const PRUnichar* aProfile)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// At this time the only reason for this migrator is to get data across from the
|
||||
// Phoenix profile directory on initial run, so we don't need to support after-the-fact
|
||||
// importing.
|
||||
NS_ASSERTION(aStartup, "Can't migrate from Phoenix/Firebird/Firefox profiles once Firefox is running!");
|
||||
if (!aStartup)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!mTargetProfile) {
|
||||
GetProfilePath(aStartup, mTargetProfile);
|
||||
if (!mTargetProfile) return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (!mSourceProfile)
|
||||
GetSourceProfile(aProfile);
|
||||
|
||||
NOTIFY_OBSERVERS(MIGRATION_STARTED, nsnull);
|
||||
|
||||
COPY_DATA(CopyPreferences, PR_TRUE, nsIBrowserProfileMigrator::SETTINGS);
|
||||
COPY_DATA(CopyCookies, PR_TRUE, nsIBrowserProfileMigrator::COOKIES);
|
||||
COPY_DATA(CopyHistory, PR_TRUE, nsIBrowserProfileMigrator::HISTORY);
|
||||
COPY_DATA(CopyPasswords, PR_TRUE, nsIBrowserProfileMigrator::PASSWORDS);
|
||||
COPY_DATA(CopyOtherData, PR_TRUE, nsIBrowserProfileMigrator::OTHERDATA);
|
||||
COPY_DATA(CopyBookmarks, PR_TRUE, nsIBrowserProfileMigrator::BOOKMARKS);
|
||||
|
||||
if (aItems & nsIBrowserProfileMigrator::SETTINGS ||
|
||||
aItems & nsIBrowserProfileMigrator::COOKIES ||
|
||||
aItems & nsIBrowserProfileMigrator::PASSWORDS ||
|
||||
!aItems) {
|
||||
// Permissions (Images, Cookies, Popups)
|
||||
rv |= CopyFile(FILE_NAME_SITEPERM_NEW, FILE_NAME_SITEPERM_NEW);
|
||||
rv |= CopyFile(FILE_NAME_SITEPERM_OLD, FILE_NAME_SITEPERM_OLD);
|
||||
}
|
||||
|
||||
NOTIFY_OBSERVERS(MIGRATION_ENDED, nsnull);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPhoenixProfileMigrator::GetMigrateData(const PRUnichar* aProfile,
|
||||
PRBool aReplace,
|
||||
PRUint16* aResult)
|
||||
{
|
||||
*aResult = 0;
|
||||
if (!mSourceProfile) {
|
||||
GetSourceProfile(aProfile);
|
||||
if (!mSourceProfile)
|
||||
return NS_ERROR_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
MigrationData data[] = { { ToNewUnicode(FILE_NAME_PREFS),
|
||||
nsIBrowserProfileMigrator::SETTINGS,
|
||||
PR_TRUE },
|
||||
{ ToNewUnicode(FILE_NAME_USER_PREFS),
|
||||
nsIBrowserProfileMigrator::SETTINGS,
|
||||
PR_TRUE },
|
||||
{ ToNewUnicode(FILE_NAME_COOKIES),
|
||||
nsIBrowserProfileMigrator::COOKIES,
|
||||
PR_TRUE },
|
||||
{ ToNewUnicode(FILE_NAME_HISTORY),
|
||||
nsIBrowserProfileMigrator::HISTORY,
|
||||
PR_TRUE },
|
||||
{ ToNewUnicode(FILE_NAME_BOOKMARKS),
|
||||
nsIBrowserProfileMigrator::BOOKMARKS,
|
||||
PR_TRUE },
|
||||
{ ToNewUnicode(FILE_NAME_DOWNLOADS),
|
||||
nsIBrowserProfileMigrator::OTHERDATA,
|
||||
PR_TRUE },
|
||||
{ ToNewUnicode(FILE_NAME_MIMETYPES),
|
||||
nsIBrowserProfileMigrator::OTHERDATA,
|
||||
PR_TRUE },
|
||||
{ ToNewUnicode(FILE_NAME_USERCHROME),
|
||||
nsIBrowserProfileMigrator::OTHERDATA,
|
||||
PR_TRUE },
|
||||
{ ToNewUnicode(FILE_NAME_USERCONTENT),
|
||||
nsIBrowserProfileMigrator::OTHERDATA,
|
||||
PR_TRUE },
|
||||
{ ToNewUnicode(FILE_NAME_FORMHISTORY),
|
||||
nsIBrowserProfileMigrator::OTHERDATA,
|
||||
PR_TRUE } };
|
||||
|
||||
// Frees file name strings allocated above.
|
||||
GetMigrateDataFromArray(data, sizeof(data)/sizeof(MigrationData),
|
||||
aReplace, mSourceProfile, aResult);
|
||||
|
||||
// Now locate passwords
|
||||
nsCString signonsFileName;
|
||||
GetSignonFileName(aReplace, getter_Copies(signonsFileName));
|
||||
|
||||
if (!signonsFileName.IsEmpty()) {
|
||||
NS_ConvertASCIItoUTF16 fileName(signonsFileName);
|
||||
nsCOMPtr<nsIFile> sourcePasswordsFile;
|
||||
mSourceProfile->Clone(getter_AddRefs(sourcePasswordsFile));
|
||||
sourcePasswordsFile->Append(fileName);
|
||||
|
||||
PRBool exists;
|
||||
sourcePasswordsFile->Exists(&exists);
|
||||
if (exists)
|
||||
*aResult |= nsIBrowserProfileMigrator::PASSWORDS;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPhoenixProfileMigrator::GetSourceExists(PRBool* aResult)
|
||||
{
|
||||
nsCOMPtr<nsISupportsArray> profiles;
|
||||
GetSourceProfiles(getter_AddRefs(profiles));
|
||||
|
||||
if (profiles) {
|
||||
PRUint32 count;
|
||||
profiles->Count(&count);
|
||||
*aResult = count > 0;
|
||||
}
|
||||
else
|
||||
*aResult = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPhoenixProfileMigrator::GetSourceHasMultipleProfiles(PRBool* aResult)
|
||||
{
|
||||
nsCOMPtr<nsISupportsArray> profiles;
|
||||
GetSourceProfiles(getter_AddRefs(profiles));
|
||||
|
||||
if (profiles) {
|
||||
PRUint32 count;
|
||||
profiles->Count(&count);
|
||||
*aResult = count > 1;
|
||||
}
|
||||
else
|
||||
*aResult = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPhoenixProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
|
||||
{
|
||||
if (!mProfileNames && !mProfileLocations) {
|
||||
mProfileNames = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
|
||||
mProfileLocations = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
|
||||
NS_ENSURE_TRUE(mProfileNames && mProfileLocations, NS_ERROR_UNEXPECTED);
|
||||
|
||||
// Fills mProfileNames and mProfileLocations
|
||||
FillProfileDataFromPhoenixRegistry();
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aResult = mProfileNames);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsPhoenixProfileMigrator::GetSourceHomePageURL(nsACString& aResult)
|
||||
{
|
||||
aResult.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsPhoenixProfileMigrator
|
||||
|
||||
nsresult
|
||||
nsPhoenixProfileMigrator::GetSourceProfile(const PRUnichar* aProfile)
|
||||
{
|
||||
PRUint32 count;
|
||||
mProfileNames->Count(&count);
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsCOMPtr<nsISupportsString> str;
|
||||
mProfileNames->QueryElementAt(i, NS_GET_IID(nsISupportsString),
|
||||
getter_AddRefs(str));
|
||||
nsString profileName;
|
||||
str->GetData(profileName);
|
||||
if (profileName.Equals(aProfile)) {
|
||||
mProfileLocations->QueryElementAt(i, NS_GET_IID(nsILocalFile),
|
||||
getter_AddRefs(mSourceProfile));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPhoenixProfileMigrator::FillProfileDataFromPhoenixRegistry()
|
||||
{
|
||||
// Find the Phoenix Registry
|
||||
nsCOMPtr<nsIProperties> fileLocator(do_GetService("@mozilla.org/file/directory_service;1"));
|
||||
nsCOMPtr<nsILocalFile> phoenixRegistry;
|
||||
#ifdef XP_WIN
|
||||
fileLocator->Get(NS_WIN_APPDATA_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(phoenixRegistry));
|
||||
|
||||
phoenixRegistry->Append(NS_LITERAL_STRING("Phoenix"));
|
||||
phoenixRegistry->Append(NS_LITERAL_STRING("registry.dat"));
|
||||
#elif defined(XP_MACOSX)
|
||||
fileLocator->Get(NS_MAC_USER_LIB_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(phoenixRegistry));
|
||||
|
||||
phoenixRegistry->Append(NS_LITERAL_STRING("Phoenix"));
|
||||
phoenixRegistry->Append(NS_LITERAL_STRING("Application Registry"));
|
||||
#elif defined(XP_UNIX)
|
||||
fileLocator->Get(NS_UNIX_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(phoenixRegistry));
|
||||
|
||||
phoenixRegistry->Append(NS_LITERAL_STRING(".phoenix"));
|
||||
phoenixRegistry->Append(NS_LITERAL_STRING("appreg"));
|
||||
#elif defined(XP_OS2)
|
||||
fileLocator->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(phoenixRegistry));
|
||||
|
||||
phoenixRegistry->Append(NS_LITERAL_STRING("Phoenix"));
|
||||
phoenixRegistry->Append(NS_LITERAL_STRING("registry.dat"));
|
||||
#endif
|
||||
|
||||
|
||||
return GetProfileDataFromRegistry(phoenixRegistry, mProfileNames, mProfileLocations);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPhoenixProfileMigrator::CopyPreferences(PRBool aReplace)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!aReplace)
|
||||
return rv;
|
||||
|
||||
// Prefs files
|
||||
rv |= CopyFile(FILE_NAME_PREFS, FILE_NAME_PREFS);
|
||||
rv |= CopyFile(FILE_NAME_USER_PREFS, FILE_NAME_USER_PREFS);
|
||||
|
||||
// Security Stuff
|
||||
rv |= CopyFile(FILE_NAME_CERT8DB, FILE_NAME_CERT8DB);
|
||||
rv |= CopyFile(FILE_NAME_KEY3DB, FILE_NAME_KEY3DB);
|
||||
rv |= CopyFile(FILE_NAME_SECMODDB, FILE_NAME_SECMODDB);
|
||||
|
||||
// User MIME Type overrides
|
||||
rv |= CopyFile(FILE_NAME_MIMETYPES, FILE_NAME_MIMETYPES);
|
||||
|
||||
rv |= CopyUserStyleSheets();
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPhoenixProfileMigrator::CopyUserStyleSheets()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIFile> sourceUserContent;
|
||||
mSourceProfile->Clone(getter_AddRefs(sourceUserContent));
|
||||
sourceUserContent->Append(DIR_NAME_CHROME);
|
||||
sourceUserContent->Append(FILE_NAME_USERCONTENT);
|
||||
|
||||
PRBool exists = PR_FALSE;
|
||||
sourceUserContent->Exists(&exists);
|
||||
if (exists) {
|
||||
nsCOMPtr<nsIFile> targetUserContent;
|
||||
mTargetProfile->Clone(getter_AddRefs(targetUserContent));
|
||||
targetUserContent->Append(DIR_NAME_CHROME);
|
||||
nsCOMPtr<nsIFile> targetChromeDir;
|
||||
targetUserContent->Clone(getter_AddRefs(targetChromeDir));
|
||||
targetUserContent->Append(FILE_NAME_USERCONTENT);
|
||||
|
||||
targetUserContent->Exists(&exists);
|
||||
if (exists)
|
||||
targetUserContent->Remove(PR_FALSE);
|
||||
|
||||
rv |= sourceUserContent->CopyTo(targetChromeDir, FILE_NAME_USERCONTENT);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> sourceUserChrome;
|
||||
mSourceProfile->Clone(getter_AddRefs(sourceUserChrome));
|
||||
sourceUserChrome->Append(DIR_NAME_CHROME);
|
||||
sourceUserChrome->Append(FILE_NAME_USERCHROME);
|
||||
|
||||
sourceUserChrome->Exists(&exists);
|
||||
if (exists) {
|
||||
nsCOMPtr<nsIFile> targetUserChrome;
|
||||
mTargetProfile->Clone(getter_AddRefs(targetUserChrome));
|
||||
targetUserChrome->Append(DIR_NAME_CHROME);
|
||||
nsCOMPtr<nsIFile> targetChromeDir;
|
||||
targetUserChrome->Clone(getter_AddRefs(targetChromeDir));
|
||||
targetUserChrome->Append(FILE_NAME_USERCHROME);
|
||||
|
||||
targetUserChrome->Exists(&exists);
|
||||
if (exists)
|
||||
targetUserChrome->Remove(PR_FALSE);
|
||||
|
||||
rv |= sourceUserChrome->CopyTo(targetChromeDir, FILE_NAME_USERCHROME);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPhoenixProfileMigrator::CopyCookies(PRBool aReplace)
|
||||
{
|
||||
return aReplace ? CopyFile(FILE_NAME_COOKIES, FILE_NAME_COOKIES) : NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPhoenixProfileMigrator::CopyHistory(PRBool aReplace)
|
||||
{
|
||||
return aReplace ? CopyFile(FILE_NAME_HISTORY, FILE_NAME_HISTORY) : NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPhoenixProfileMigrator::CopyPasswords(PRBool aReplace)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCString signonsFileName;
|
||||
if (!aReplace)
|
||||
return NS_OK;
|
||||
|
||||
// Find out what the signons file was called, this is stored in a pref
|
||||
// in Seamonkey.
|
||||
nsCOMPtr<nsIPrefService> psvc(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
psvc->ResetPrefs();
|
||||
|
||||
nsCOMPtr<nsIFile> seamonkeyPrefsFile;
|
||||
mSourceProfile->Clone(getter_AddRefs(seamonkeyPrefsFile));
|
||||
seamonkeyPrefsFile->Append(FILE_NAME_PREFS);
|
||||
psvc->ReadUserPrefs(seamonkeyPrefsFile);
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> branch(do_QueryInterface(psvc));
|
||||
rv = branch->GetCharPref("signon.SignonFileName", getter_Copies(signonsFileName));
|
||||
|
||||
if (signonsFileName.IsEmpty())
|
||||
return NS_ERROR_FILE_NOT_FOUND;
|
||||
|
||||
NS_ConvertASCIItoUTF16 fileName(signonsFileName);
|
||||
return aReplace ? CopyFile(fileName, fileName) : NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPhoenixProfileMigrator::CopyBookmarks(PRBool aReplace)
|
||||
{
|
||||
// This overwrites the defaults. This might be ok in this instance.
|
||||
return aReplace ? CopyFile(FILE_NAME_BOOKMARKS, FILE_NAME_BOOKMARKS) : NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPhoenixProfileMigrator::CopyOtherData(PRBool aReplace)
|
||||
{
|
||||
if (!aReplace)
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
rv |= CopyFile(FILE_NAME_DOWNLOADS, FILE_NAME_DOWNLOADS);
|
||||
rv |= CopyFile(FILE_NAME_LOCALSTORE, FILE_NAME_LOCALSTORE);
|
||||
rv |= CopyFile(FILE_NAME_FORMHISTORY, FILE_NAME_FORMHISTORY);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -1,87 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 The Browser Profile Migrator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef phoenixprofilemigrator___h___
|
||||
#define phoenixprofilemigrator___h___
|
||||
|
||||
#include "nsIBrowserProfileMigrator.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsNetscapeProfileMigratorBase.h"
|
||||
#include "nsStringAPI.h"
|
||||
|
||||
class nsIFile;
|
||||
class nsIPrefBranch;
|
||||
class nsIPrefService;
|
||||
|
||||
class nsPhoenixProfileMigrator : public nsNetscapeProfileMigratorBase,
|
||||
public nsIBrowserProfileMigrator
|
||||
{
|
||||
public:
|
||||
NS_DECL_NSIBROWSERPROFILEMIGRATOR
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsPhoenixProfileMigrator();
|
||||
virtual ~nsPhoenixProfileMigrator();
|
||||
|
||||
public:
|
||||
static nsresult SetImage(void* aTransform, nsIPrefBranch* aBranch);
|
||||
static nsresult SetCookie(void* aTransform, nsIPrefBranch* aBranch);
|
||||
static nsresult SetDownloadManager(void* aTransform, nsIPrefBranch* aBranch);
|
||||
|
||||
protected:
|
||||
nsresult FillProfileDataFromPhoenixRegistry();
|
||||
nsresult GetSourceProfile(const PRUnichar* aProfile);
|
||||
|
||||
nsresult CopyPreferences(PRBool aReplace);
|
||||
nsresult CopyUserStyleSheets();
|
||||
|
||||
nsresult CopyCookies(PRBool aReplace);
|
||||
nsresult CopyHistory(PRBool aReplace);
|
||||
nsresult CopyPasswords(PRBool aReplace);
|
||||
nsresult CopyBookmarks(PRBool aReplace);
|
||||
nsresult CopyOtherData(PRBool aReplace);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsISupportsArray> mProfileNames;
|
||||
nsCOMPtr<nsISupportsArray> mProfileLocations;
|
||||
nsCOMPtr<nsIObserverService> mObserverService;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -160,13 +160,9 @@ NS_IMPL_ISUPPORTS1(nsProfileMigrator, nsIProfileMigrator)
|
||||
|
||||
#ifdef XP_WIN
|
||||
|
||||
#define INTERNAL_NAME_FIREBIRD "firebird"
|
||||
#define INTERNAL_NAME_FIREFOX "firefox"
|
||||
#define INTERNAL_NAME_PHOENIX "phoenix"
|
||||
#define INTERNAL_NAME_IEXPLORE "iexplore"
|
||||
#define INTERNAL_NAME_MOZILLA_SUITE "apprunner"
|
||||
#define INTERNAL_NAME_SEAMONKEY "seamonkey"
|
||||
#define INTERNAL_NAME_DOGBERT "netscape"
|
||||
#define INTERNAL_NAME_OPERA "opera"
|
||||
#endif
|
||||
|
||||
@ -252,22 +248,11 @@ nsProfileMigrator::GetDefaultBrowserMigratorKey(nsACString& aKey,
|
||||
aKey = "seamonkey";
|
||||
return NS_OK;
|
||||
}
|
||||
if (internalName.LowerCaseEqualsLiteral(INTERNAL_NAME_DOGBERT)) {
|
||||
aKey = "dogbert";
|
||||
return NS_OK;
|
||||
}
|
||||
if (internalName.LowerCaseEqualsLiteral(INTERNAL_NAME_OPERA)) {
|
||||
aKey = "opera";
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Migrate data from any existing Application Data\Phoenix\* installations.
|
||||
if (internalName.LowerCaseEqualsLiteral(INTERNAL_NAME_FIREBIRD) ||
|
||||
internalName.LowerCaseEqualsLiteral(INTERNAL_NAME_FIREFOX) ||
|
||||
internalName.LowerCaseEqualsLiteral(INTERNAL_NAME_PHOENIX)) {
|
||||
aKey = "phoenix";
|
||||
return NS_OK;
|
||||
}
|
||||
#else
|
||||
PRBool exists = PR_FALSE;
|
||||
#define CHECK_MIGRATOR(browser) do {\
|
||||
@ -281,9 +266,7 @@ nsProfileMigrator::GetDefaultBrowserMigratorKey(nsACString& aKey,
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
CHECK_MIGRATOR("safari");
|
||||
CHECK_MIGRATOR("macie");
|
||||
#endif
|
||||
CHECK_MIGRATOR("phoenix");
|
||||
CHECK_MIGRATOR("seamonkey");
|
||||
CHECK_MIGRATOR("opera");
|
||||
|
||||
|
@ -60,7 +60,7 @@ protected:
|
||||
nsCOMPtr<nsIBrowserProfileMigrator>& bpm);
|
||||
|
||||
/**
|
||||
* Import profiles from ~/.firefox/ or ~/.phoenix/
|
||||
* Import profiles from ~/.firefox/
|
||||
* @return PR_TRUE if any profiles imported.
|
||||
*/
|
||||
PRBool ImportRegistryProfiles(const nsACString& aAppName);
|
||||
|
@ -749,7 +749,8 @@ PlacesViewBase.prototype = {
|
||||
aPopup._endOptOpenAllInTabs = document.createElement("menuitem");
|
||||
aPopup._endOptOpenAllInTabs.className = "openintabs-menuitem";
|
||||
aPopup._endOptOpenAllInTabs.setAttribute("oncommand",
|
||||
"PlacesUIUtils.openContainerNodeInTabs(this.parentNode._placesNode, event);");
|
||||
"PlacesUIUtils.openContainerNodeInTabs(this.parentNode._placesNode, event, " +
|
||||
"PlacesUIUtils.getViewForNode(this));");
|
||||
aPopup._endOptOpenAllInTabs.setAttribute("onclick",
|
||||
"checkForMiddleClick(this, event); event.stopPropagation();");
|
||||
aPopup._endOptOpenAllInTabs.setAttribute("label",
|
||||
|
@ -187,12 +187,12 @@
|
||||
|
||||
<toolbox id="placesToolbox">
|
||||
<toolbar class="chromeclass-toolbar" id="placesToolbar" align="center">
|
||||
<toolbarbutton id="back-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
|
||||
<toolbarbutton id="back-button"
|
||||
command="OrganizerCommand:Back"
|
||||
tooltiptext="&backButton.tooltip;"
|
||||
disabled="true"/>
|
||||
|
||||
<toolbarbutton id="forward-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
|
||||
<toolbarbutton id="forward-button"
|
||||
command="OrganizerCommand:Forward"
|
||||
tooltiptext="&forwardButton.tooltip;"
|
||||
disabled="true"/>
|
||||
|
@ -774,8 +774,9 @@ var PlacesUIUtils = {
|
||||
|
||||
// Prefer the caller window if it's a browser window, otherwise use
|
||||
// the top browser window.
|
||||
var browserWindow =
|
||||
aWindow.document.documentElement.getAttribute("windowtype") == "navigator:browser" ?
|
||||
var browserWindow = null;
|
||||
browserWindow =
|
||||
aWindow && aWindow.document.documentElement.getAttribute("windowtype") == "navigator:browser" ?
|
||||
aWindow : this._getTopBrowserWin();
|
||||
|
||||
// whereToOpenLink doesn't return "window" when there's no browser window
|
||||
@ -783,8 +784,16 @@ var PlacesUIUtils = {
|
||||
var where = browserWindow ?
|
||||
browserWindow.whereToOpenLink(aEvent, false, true) : "window";
|
||||
if (where == "window") {
|
||||
aWindow.openDialog(aWindow.getBrowserURL(), "_blank",
|
||||
"chrome,all,dialog=no", urls.join("|"));
|
||||
// There is no browser window open, thus open a new one.
|
||||
var uriList = Cc["@mozilla.org/supports-string;1"].
|
||||
createInstance(Ci.nsISupportsString);
|
||||
uriList.data = urls.join("|");
|
||||
var args = Cc["@mozilla.org/supports-array;1"].
|
||||
createInstance(Ci.nsISupportsArray);
|
||||
args.AppendElement(uriList);
|
||||
browserWindow = Services.ww.openWindow(aWindow,
|
||||
"chrome://browser/content/browser.xul",
|
||||
null, "chrome,dialog=no,all", args);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -247,10 +247,9 @@ var bookmarksObserver = {
|
||||
var index = null;
|
||||
[node, index] = getNodeForTreeItem(aItemId, gLibrary.PlacesOrganizer._places);
|
||||
// Left pane should not be updated for normal bookmarks or separators.
|
||||
var type = PlacesUtils.bookmarks.getItemType(aItemId);
|
||||
switch (type) {
|
||||
switch (aItemType) {
|
||||
case PlacesUtils.bookmarks.TYPE_BOOKMARK:
|
||||
var uriString = PlacesUtils.bookmarks.getBookmarkURI(aItemId).spec;
|
||||
var uriString = aURI.spec;
|
||||
var isQuery = uriString.substr(0, 6) == "place:";
|
||||
if (isQuery) {
|
||||
isnot(node, null, "Found new Places node in left pane");
|
||||
@ -276,13 +275,12 @@ var bookmarksObserver = {
|
||||
|
||||
onItemMoved: function(aItemId,
|
||||
aOldFolderId, aOldIndex,
|
||||
aNewFolderId, aNewIndex) {
|
||||
aNewFolderId, aNewIndex, aItemType) {
|
||||
var node = null;
|
||||
var index = null;
|
||||
[node, index] = getNodeForTreeItem(aItemId, gLibrary.PlacesOrganizer._places);
|
||||
// Left pane should not be updated for normal bookmarks or separators.
|
||||
var type = PlacesUtils.bookmarks.getItemType(aItemId);
|
||||
switch (type) {
|
||||
switch (aItemType) {
|
||||
case PlacesUtils.bookmarks.TYPE_BOOKMARK:
|
||||
var uriString = PlacesUtils.bookmarks.getBookmarkURI(aItemId).spec;
|
||||
var isQuery = uriString.substr(0, 6) == "place:";
|
||||
|
@ -319,11 +319,13 @@ var bookmarksObserver = {
|
||||
onItemVisited: function() {},
|
||||
|
||||
onItemChanged: function PSB_onItemChanged(aItemId, aProperty,
|
||||
aIsAnnotationProperty, aNewValue) {
|
||||
aIsAnnotationProperty, aNewValue,
|
||||
aLastModified, aItemType,
|
||||
aParentId) {
|
||||
if (aProperty !== "title")
|
||||
return;
|
||||
|
||||
var views = getViewsForFolder(PlacesUtils.bookmarks.getFolderIdForItem(aItemId));
|
||||
var views = getViewsForFolder(aParentId);
|
||||
ok(views.length > 0, "Found affected views (" + views.length + "): " + views);
|
||||
|
||||
// Check that item has been moved in the correct position.
|
||||
|
@ -123,7 +123,7 @@ _ABS_RUN_TEST_PROGRAM = $(call core_abspath,$(RUN_TEST_PROGRAM))
|
||||
endif
|
||||
|
||||
GENERATE_CACHE = \
|
||||
$(_ABS_RUN_TEST_PROGRAM) $(LIBXUL_DIST)/bin/xpcshell$(BIN_SUFFIX) -g "$$PWD" -f $(topsrcdir)/browser/installer/precompile_cache.js -e 'populate_startupcache("omni.jar", "startupCache.zip");' && \
|
||||
$(_ABS_RUN_TEST_PROGRAM) $(LIBXUL_DIST)/bin/xpcshell$(BIN_SUFFIX) -g "$$PWD" -a "$$PWD" -f $(topsrcdir)/browser/installer/precompile_cache.js -e 'populate_startupcache("omni.jar", "startupCache.zip");' && \
|
||||
rm -rf jsloader && \
|
||||
$(UNZIP) startupCache.zip && \
|
||||
rm startupCache.zip && \
|
||||
|
@ -65,23 +65,10 @@ function load(url) {
|
||||
function load_entries(entries, prefix) {
|
||||
while (entries.hasMore()) {
|
||||
var c = entries.getNext();
|
||||
// Required to ensure sync js is only loaded in load_custom_entries.
|
||||
// That function loads the sync js with the right URIs.
|
||||
if (c.indexOf("services-sync") >= 0)
|
||||
continue;
|
||||
if (c.indexOf("services-crypto") >= 0)
|
||||
continue;
|
||||
load(prefix + c);
|
||||
}
|
||||
}
|
||||
|
||||
function load_custom_entries(entries, subst) {
|
||||
while (entries.hasMore()) {
|
||||
var c = entries.getNext();
|
||||
load("resource://" + subst + "/" + c.replace("modules/" + subst + "/", ""));
|
||||
}
|
||||
}
|
||||
|
||||
function getGreDir() {
|
||||
return Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties).get("GreD", Ci.nsIFile);
|
||||
@ -103,27 +90,10 @@ function populate_startupcache(omnijarName, startupcacheName) {
|
||||
scFile.append(startupcacheName);
|
||||
setenv("MOZ_STARTUP_CACHE", scFile.path);
|
||||
|
||||
// the sync part below doesn't work as smoothly
|
||||
let ioService = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
let uri = ioService.newURI("resource:///modules/services-sync/",
|
||||
null, null);
|
||||
let resProt = ioService.getProtocolHandler("resource")
|
||||
.QueryInterface(Ci.nsIResProtocolHandler);
|
||||
resProt.setSubstitution("services-sync", uri);
|
||||
let prefix = "resource:///";
|
||||
|
||||
uri = ioService.newURI("resource:///modules/services-crypto/",
|
||||
null, null);
|
||||
resProt.setSubstitution("services-crypto", uri);
|
||||
|
||||
load_entries(zipreader.findEntries("components/*js"), "resource://gre/");
|
||||
|
||||
load_custom_entries(zipreader.findEntries("modules/services-sync/*js"),
|
||||
"services-sync");
|
||||
load_custom_entries(zipreader.findEntries("modules/services-crypto/*js"),
|
||||
"services-crypto");
|
||||
|
||||
load_entries(zipreader.findEntries("modules/*js"), "resource://gre/");
|
||||
load_entries(zipreader.findEntries("modules/*jsm"), "resource://gre/");
|
||||
load_entries(zipreader.findEntries("components/*js"), prefix);
|
||||
load_entries(zipreader.findEntries("modules/*js"), prefix);
|
||||
load_entries(zipreader.findEntries("modules/*jsm"), prefix);
|
||||
zipreader.close();
|
||||
}
|
||||
|
@ -7,30 +7,14 @@
|
||||
|
||||
<!ENTITY importFromIE.label "Microsoft Internet Explorer">
|
||||
<!ENTITY importFromIE.accesskey "M">
|
||||
<!ENTITY importFromPhoenix.label "Firefox 0.8, Firebird or Phoenix">
|
||||
<!ENTITY importFromPhoenix.accesskey "P">
|
||||
<!ENTITY importFromNothing.label "Don't import anything">
|
||||
<!ENTITY importFromNothing.accesskey "D">
|
||||
<!ENTITY importFromSeamonkey.label "Netscape 6, 7 or Mozilla 1.x">
|
||||
<!ENTITY importFromSeamonkey.accesskey "N">
|
||||
<!ENTITY importFromNetscape4.label "Netscape 4.x">
|
||||
<!ENTITY importFromNetscape4.accesskey "4">
|
||||
<!ENTITY importFromOpera.label "Opera">
|
||||
<!ENTITY importFromOpera.accesskey "O">
|
||||
<!ENTITY importFromCamino.label "Camino">
|
||||
<!ENTITY importFromCamino.accesskey "C">
|
||||
<!ENTITY importFromSafari.label "Safari">
|
||||
<!ENTITY importFromSafari.accesskey "S">
|
||||
<!ENTITY importFromOmniWeb.label "OmniWeb">
|
||||
<!ENTITY importFromOmniWeb.accesskey "W">
|
||||
<!ENTITY importFromICab.label "iCab">
|
||||
<!ENTITY importFromICab.accesskey "i">
|
||||
<!ENTITY importFromKonqueror.label "Konqueror">
|
||||
<!ENTITY importFromKonqueror.accesskey "K">
|
||||
<!ENTITY importFromEpiphany.label "Epiphany">
|
||||
<!ENTITY importFromEpiphany.accesskey "E">
|
||||
<!ENTITY importFromGaleon.label "Galeon">
|
||||
<!ENTITY importFromGaleon.accesskey "G">
|
||||
<!ENTITY importFromHTMLFile.label "From an HTML File">
|
||||
<!ENTITY importFromHTMLFile.accesskey "F">
|
||||
|
||||
|
@ -3,22 +3,14 @@ profileName_format=%S %S
|
||||
# Browser Specific
|
||||
sourceNameIE=Internet Explorer
|
||||
sourceNameSeamonkey=Netscape 6/7/Mozilla
|
||||
sourceNameDogbert=Netscape 4
|
||||
sourceNameOpera=Opera
|
||||
sourceNameSafari=Safari
|
||||
sourceNameOmniWeb=OmniWeb
|
||||
sourceNameCamino=Camino
|
||||
sourceNameICab=iCab
|
||||
sourceNameKonqueror=Konqueror
|
||||
sourceNameEpiphany=Epiphany
|
||||
sourceNameGaleon=Galeon
|
||||
|
||||
importedBookmarksFolder=From %S
|
||||
importedSearchURLsFolder=Keyword Searches (From %S)
|
||||
importedSearchURLsTitle=Search on %S
|
||||
importedSearchUrlDesc=Type "%S <search query>" in the Location Bar to perform a search on %S.
|
||||
|
||||
importedDogbertBookmarksTitle=From Netscape 4
|
||||
importedSeamonkeyBookmarksTitle=From Netscape 6/7/Mozilla
|
||||
importedSafariBookmarks=From Safari
|
||||
importedOperaHotlistTitle=From Opera
|
||||
@ -27,57 +19,36 @@ importedOperaSearchUrls=Keyword Searches (From Opera)
|
||||
# Import Sources
|
||||
1_ie=Internet Options
|
||||
1_opera=Preferences
|
||||
1_dogbert=Preferences
|
||||
1_seamonkey=Preferences
|
||||
1_phoenix=Preferences
|
||||
1_safari=Preferences
|
||||
1_macie=Preferences
|
||||
|
||||
2_ie=Cookies
|
||||
2_opera=Cookies
|
||||
2_dogbert=Cookies
|
||||
2_seamonkey=Cookies
|
||||
2_phoenix=Cookies
|
||||
2_safari=Cookies
|
||||
2_macie=Cookies
|
||||
|
||||
4_ie=Browsing History
|
||||
4_opera=Browsing History
|
||||
4_dogbert=Browsing History
|
||||
4_seamonkey=Browsing History
|
||||
4_phoenix=Browsing History
|
||||
4_safari=Browsing History
|
||||
4_macie=Browsing History
|
||||
|
||||
8_ie=Saved Form History
|
||||
8_opera=Saved Form History
|
||||
8_dogbert=Saved Form History
|
||||
8_seamonkey=Saved Form History
|
||||
8_phoenix=Saved Form History
|
||||
8_safari=Saved Form History
|
||||
8_macie=Saved Form History
|
||||
|
||||
16_ie=Saved Passwords
|
||||
16_opera=Saved Passwords
|
||||
16_dogbert=Saved Passwords
|
||||
16_seamonkey=Saved Passwords
|
||||
16_phoenix=Saved Passwords
|
||||
16_safari=Saved Passwords
|
||||
16_macie=Saved Passwords
|
||||
|
||||
32_ie=Favorites
|
||||
32_opera=Bookmarks
|
||||
32_dogbert=Bookmarks
|
||||
32_seamonkey=Bookmarks
|
||||
32_phoenix=Bookmarks
|
||||
32_safari=Bookmarks
|
||||
32_macie=Favorites
|
||||
|
||||
64_ie=Other Data
|
||||
64_opera=Other Data
|
||||
64_dogbert=Other Data
|
||||
64_seamonkey=Other Data
|
||||
64_phoenix=Other Data
|
||||
64_safari=Other Data
|
||||
64_macie=Other Data
|
||||
|
||||
|
@ -30,6 +30,7 @@ historyDaysCount.label = #1 day of history;#1 days of history
|
||||
passwordsCount.label = #1 password;#1 passwords
|
||||
|
||||
save.synckey.title = Save Sync Key
|
||||
save.default.label = Firefox Sync Key.html
|
||||
|
||||
newAccount.action.label = Firefox Sync is now set up to automatically sync all of your browser data.
|
||||
newAccount.change.label = You can choose exactly what to sync by selecting Sync Options below.
|
||||
|
@ -66,7 +66,6 @@ browser.jar:
|
||||
skin/classic/browser/places/calendar.png (places/calendar.png)
|
||||
skin/classic/browser/places/toolbarDropMarker.png (places/toolbarDropMarker.png)
|
||||
skin/classic/browser/places/editBookmarkOverlay.css (places/editBookmarkOverlay.css)
|
||||
skin/classic/browser/places/libraryNavigation.png (places/libraryNavigation.png)
|
||||
skin/classic/browser/places/libraryToolbar.png (places/libraryToolbar.png)
|
||||
skin/classic/browser/places/starred48.png (places/starred48.png)
|
||||
skin/classic/browser/places/unstarred48.png (places/unstarred48.png)
|
||||
@ -177,10 +176,8 @@ browser.jar:
|
||||
skin/classic/aero/browser/places/bookmarksMenu.png (places/bookmarksMenu-aero.png)
|
||||
skin/classic/aero/browser/places/bookmarksToolbar.png (places/bookmarksToolbar-aero.png)
|
||||
skin/classic/aero/browser/places/calendar.png (places/calendar-aero.png)
|
||||
skin/classic/aero/browser/places/dropDown.png (places/dropDown-aero.png)
|
||||
skin/classic/aero/browser/places/toolbarDropMarker.png (places/toolbarDropMarker-aero.png)
|
||||
skin/classic/aero/browser/places/editBookmarkOverlay.css (places/editBookmarkOverlay.css)
|
||||
skin/classic/aero/browser/places/libraryNavigation.png (places/libraryNavigation-aero.png)
|
||||
skin/classic/aero/browser/places/libraryToolbar.png (places/libraryToolbar-aero.png)
|
||||
skin/classic/aero/browser/places/starred48.png (places/starred48-aero.png)
|
||||
skin/classic/aero/browser/places/unstarred48.png (places/unstarred48.png)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 120 B |
Binary file not shown.
Before Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.9 KiB |
@ -1,64 +1,91 @@
|
||||
%include organizer.css
|
||||
|
||||
#placesView:-moz-system-metric(windows-default-theme) {
|
||||
%filter substitution
|
||||
%define toolbarHighlight rgba(255,255,255,.5)
|
||||
%define navbarTextboxCustomBorder border-color: rgba(0,0,0,.32);
|
||||
%define customToolbarColor hsl(214,44%,87%)
|
||||
|
||||
#placesView {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
#placesToolbar {
|
||||
-moz-appearance: -moz-win-media-toolbox;
|
||||
color: -moz-win-mediatext;
|
||||
@media not all and (-moz-windows-classic) {
|
||||
#placesToolbox {
|
||||
-moz-appearance: none;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#placesToolbar {
|
||||
-moz-appearance: none;
|
||||
background-color: -moz-Dialog;
|
||||
color: -moz-dialogText;
|
||||
}
|
||||
}
|
||||
|
||||
#placesToolbar:-moz-system-metric(windows-default-theme) {
|
||||
min-height: 36px;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
-moz-padding-start: 6px;
|
||||
-moz-padding-end: 8px;
|
||||
@media all and (-moz-windows-compositor) {
|
||||
#placesToolbox {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
#placesToolbar {
|
||||
background-image: -moz-linear-gradient(@toolbarHighlight@, rgba(255,255,255,0));
|
||||
}
|
||||
}
|
||||
|
||||
#placesMenu > menu {
|
||||
color: -moz-win-mediatext;
|
||||
}
|
||||
@media all and (-moz-windows-default-theme) {
|
||||
#placesView,
|
||||
#searchModifiers,
|
||||
#infoPane,
|
||||
#placesList,
|
||||
#placeContent {
|
||||
background-color: #EEF3FA;
|
||||
}
|
||||
|
||||
#placesMenu > menu > .menubar-text:-moz-system-metric(windows-default-theme) {
|
||||
-moz-padding-end: 15px;
|
||||
background-image: url(chrome://browser/skin/places/dropDown.png);
|
||||
}
|
||||
#placesToolbar {
|
||||
background-color: @customToolbarColor@;
|
||||
color: black;
|
||||
}
|
||||
|
||||
#placesView > splitter:-moz-system-metric(windows-default-theme) {
|
||||
border: 0;
|
||||
-moz-border-end: 1px solid #A9B7C9;
|
||||
min-width: 0;
|
||||
width: 3px;
|
||||
background-color: transparent;
|
||||
-moz-margin-start: -3px;
|
||||
position: relative;
|
||||
}
|
||||
#placesView > splitter {
|
||||
border: 0;
|
||||
-moz-border-end: 1px solid #A9B7C9;
|
||||
min-width: 0;
|
||||
width: 3px;
|
||||
background-color: transparent;
|
||||
-moz-margin-start: -3px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#searchModifiers:-moz-system-metric(windows-default-theme) {
|
||||
border-bottom: 1px solid #A9B7C9;
|
||||
}
|
||||
#searchModifiers {
|
||||
border-bottom: 1px solid #A9B7C9;
|
||||
}
|
||||
|
||||
#organizerScopeBar:-moz-system-metric(windows-default-theme) {
|
||||
-moz-appearance: none;
|
||||
border: none;
|
||||
}
|
||||
#organizerScopeBar {
|
||||
-moz-appearance: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#infoPaneBox:-moz-system-metric(windows-default-theme) {
|
||||
border-top-color: #A9B7C9;
|
||||
}
|
||||
#infoPaneBox {
|
||||
border-top-color: #A9B7C9;
|
||||
}
|
||||
|
||||
#placesView:-moz-system-metric(windows-default-theme),
|
||||
#searchModifiers:-moz-system-metric(windows-default-theme),
|
||||
#infoPane:-moz-system-metric(windows-default-theme),
|
||||
#placesList:-moz-system-metric(windows-default-theme),
|
||||
#placeContent:-moz-system-metric(windows-default-theme) {
|
||||
background-color: #EEF3FA;
|
||||
}
|
||||
#searchFilter {
|
||||
-moz-appearance: none;
|
||||
background-color: rgba(255,255,255,.725);
|
||||
color: black;
|
||||
padding: 2px;
|
||||
-moz-padding-start: 4px;
|
||||
background-clip: padding-box;
|
||||
border: 1px solid ThreeDDarkShadow;
|
||||
border-radius: 3.5px;
|
||||
@navbarTextboxCustomBorder@
|
||||
}
|
||||
|
||||
/**** Vista default theme: Library's search box needs to be vertically centered ****/
|
||||
#searchFilter:-moz-system-metric(windows-default-theme) {
|
||||
padding-top: 3px;
|
||||
padding-bottom: 2px;
|
||||
#searchFilter:hover {
|
||||
background-color: rgba(255,255,255,.898);
|
||||
}
|
||||
|
||||
#searchFilter[focused] {
|
||||
background-color: white;
|
||||
}
|
||||
}
|
||||
|
@ -1,61 +1,34 @@
|
||||
|
||||
/* Toolbar */
|
||||
#placesToolbar {
|
||||
padding: 3px; /* b/f buttons have a 1px image padding */
|
||||
-moz-padding-end: 4px;
|
||||
padding: 3px;
|
||||
-moz-padding-end: 6px;
|
||||
}
|
||||
|
||||
/* back & forward buttons */
|
||||
#back-button, #forward-button {
|
||||
list-style-image: url(libraryNavigation.png);
|
||||
-moz-appearance: none;
|
||||
padding: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#placesToolbar > toolbarbutton > .toolbarbutton-icon,
|
||||
#placesToolbar > toolbarbutton > .toolbarbutton-text {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
#placesToolbar > toolbarbutton[disabled] > .toolbarbutton-icon {
|
||||
opacity: .4;
|
||||
}
|
||||
|
||||
#back-button,
|
||||
#forward-button:-moz-locale-dir(rtl) {
|
||||
-moz-image-region: rect(0px, 24px, 24px, 0px);
|
||||
}
|
||||
#back-button:not([disabled="true"]):hover,
|
||||
#forward-button:not([disabled="true"]):hover:-moz-locale-dir(rtl) {
|
||||
-moz-image-region: rect(24px, 24px, 48px, 0px);
|
||||
}
|
||||
#back-button[disabled="true"],
|
||||
#forward-button:-moz-locale-dir(rtl)[disabled="true"] {
|
||||
-moz-image-region: rect(48px, 24px, 72px, 0px) !important;
|
||||
}
|
||||
#back-button:not([disabled="true"]):hover:active,
|
||||
#forward-button:not([disabled="true"]):hover:active:-moz-locale-dir(rtl) {
|
||||
-moz-image-region: rect(72px, 24px, 96px, 0px);
|
||||
#forward-button {
|
||||
list-style-image: url("chrome://browser/skin/Toolbar.png");
|
||||
}
|
||||
|
||||
#forward-button,
|
||||
#back-button:-moz-locale-dir(rtl) {
|
||||
-moz-image-region: rect(0px, 48px, 24px, 24px);
|
||||
#back-button {
|
||||
-moz-image-region: rect(0, 18px, 18px, 0);
|
||||
}
|
||||
#forward-button:not([disabled="true"]):hover,
|
||||
#back-button:not([disabled="true"]):hover:-moz-locale-dir(rtl) {
|
||||
-moz-image-region: rect(24px, 48px, 48px, 24px);
|
||||
|
||||
#forward-button {
|
||||
-moz-image-region: rect(0, 36px, 18px, 18px);
|
||||
}
|
||||
#forward-button[disabled="true"],
|
||||
#back-button:-moz-locale-dir(rtl)[disabled="true"] {
|
||||
-moz-image-region: rect(48px, 48px, 72px, 24px) !important;
|
||||
}
|
||||
#forward-button:not([disabled="true"]):hover:active,
|
||||
#back-button:not([disabled="true"]):hover:active:-moz-locale-dir(rtl) {
|
||||
-moz-image-region: rect(72px, 48px, 96px, 24px);
|
||||
|
||||
#back-button:-moz-locale-dir(rtl) > .toolbarbutton-icon,
|
||||
#forward-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
|
||||
-moz-transform: scaleX(-1);
|
||||
}
|
||||
|
||||
/* Menu */
|
||||
#placesMenu {
|
||||
-moz-margin-start: 8px;
|
||||
-moz-margin-start: 6px;
|
||||
-moz-appearance: none;
|
||||
border: none;
|
||||
}
|
||||
@ -207,3 +180,7 @@
|
||||
#organizerScopeBar > toolbarbutton[checked="true"] {
|
||||
border-color: ThreeDDarkShadow !important;
|
||||
}
|
||||
|
||||
#searchFilter {
|
||||
margin: 0;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ from automationutils import getDebuggerInfo, addCommonOptions
|
||||
|
||||
PORT = 8888
|
||||
PROFILE_DIRECTORY = os.path.abspath(os.path.join(SCRIPT_DIR, "./pgoprofile"))
|
||||
MOZ_JAR_LOG_DIR = os.path.abspath(os.path.join(os.path.join(os.getenv("OBJDIR"), "dist"), "jarlog"))
|
||||
MOZ_JAR_LOG_DIR = os.path.abspath(os.path.join(os.getenv("OBJDIR"), "jarlog"))
|
||||
os.chdir(SCRIPT_DIR)
|
||||
|
||||
class EasyServer(SocketServer.TCPServer):
|
||||
|
@ -72,7 +72,6 @@
|
||||
#include "nsIFile.h"
|
||||
#include "nsIFileURL.h"
|
||||
#include "nsIZipReader.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
@ -3289,27 +3288,6 @@ nsScriptSecurityManager::CheckXPCPermissions(JSContext* cx,
|
||||
}
|
||||
}
|
||||
|
||||
//-- If user allows scripting of plugins by untrusted scripts,
|
||||
// and the target object is a plugin, allow the access.
|
||||
if(aObj)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPluginInstance> plugin(do_QueryInterface(aObj, &rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
static PRBool prefSet = PR_FALSE;
|
||||
static PRBool allowPluginAccess = PR_FALSE;
|
||||
if (!prefSet)
|
||||
{
|
||||
rv = mPrefBranch->GetBoolPref("security.xpconnect.plugin.unrestricted",
|
||||
&allowPluginAccess);
|
||||
prefSet = PR_TRUE;
|
||||
}
|
||||
if (allowPluginAccess)
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
//-- Access tests failed
|
||||
return NS_ERROR_DOM_XPCONNECT_ACCESS_DENIED;
|
||||
}
|
||||
|
@ -39,11 +39,15 @@
|
||||
|
||||
interface nsIFrame;
|
||||
interface nsIObjectFrame;
|
||||
interface nsIPluginInstance;
|
||||
interface nsIPluginTag;
|
||||
interface nsIDOMElement;
|
||||
interface nsIDOMClientRect;
|
||||
|
||||
%{C++
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
%}
|
||||
[ptr] native nsNPAPIPluginInstancePtr(nsNPAPIPluginInstance);
|
||||
|
||||
/**
|
||||
* This interface represents a content node that loads objects.
|
||||
*/
|
||||
@ -80,7 +84,7 @@ interface nsIObjectLoadingContent : nsISupports
|
||||
* will never instantiate the plugin and so is safe to call even when
|
||||
* content script must not execute.
|
||||
*/
|
||||
[noscript] readonly attribute nsIPluginInstance pluginInstance;
|
||||
[noscript] readonly attribute nsNPAPIPluginInstancePtr pluginInstance;
|
||||
|
||||
/**
|
||||
* Makes sure that a frame for this object exists, and that the plugin is
|
||||
@ -98,7 +102,7 @@ interface nsIObjectLoadingContent : nsISupports
|
||||
* trigger fallback to replacement content, and the type will change (and
|
||||
* this method will return a failure code)
|
||||
*/
|
||||
[noscript] nsIPluginInstance ensureInstantiation();
|
||||
[noscript] nsNPAPIPluginInstancePtr ensureInstantiation();
|
||||
|
||||
/**
|
||||
* Tells the content about an associated object frame.
|
||||
|
@ -56,8 +56,7 @@
|
||||
#include "nsEventStates.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsIPluginDocument.h"
|
||||
#include "nsIPluginHost.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
#include "nsPluginHost.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
@ -844,7 +843,7 @@ nsObjectLoadingContent::GetDisplayedType(PRUint32* aType)
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::EnsureInstantiation(nsIPluginInstance** aInstance)
|
||||
nsObjectLoadingContent::EnsureInstantiation(nsNPAPIPluginInstance** aInstance)
|
||||
{
|
||||
// Must set our out parameter to null as we have various early returns with
|
||||
// an NS_OK result.
|
||||
@ -912,11 +911,11 @@ nsObjectLoadingContent::EnsureInstantiation(nsIPluginInstance** aInstance)
|
||||
nsWeakFrame weakFrame(nsiframe);
|
||||
|
||||
// We may have a plugin instance already; if so, do nothing
|
||||
nsresult rv = frame->GetPluginInstance(*aInstance);
|
||||
nsresult rv = frame->GetPluginInstance(aInstance);
|
||||
if (!*aInstance && weakFrame.IsAlive()) {
|
||||
rv = Instantiate(frame, mContentType, mURI);
|
||||
if (NS_SUCCEEDED(rv) && weakFrame.IsAlive()) {
|
||||
rv = frame->GetPluginInstance(*aInstance);
|
||||
rv = frame->GetPluginInstance(aInstance);
|
||||
} else {
|
||||
Fallback(PR_TRUE);
|
||||
}
|
||||
@ -942,8 +941,8 @@ nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame)
|
||||
// date data (frame pointer etc).
|
||||
mPendingInstantiateEvent = nsnull;
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> instance;
|
||||
aFrame->GetPluginInstance(*getter_AddRefs(instance));
|
||||
nsRefPtr<nsNPAPIPluginInstance> instance;
|
||||
aFrame->GetPluginInstance(getter_AddRefs(instance));
|
||||
|
||||
if (instance) {
|
||||
// The frame already has a plugin instance, that means the plugin
|
||||
@ -990,7 +989,7 @@ nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::GetPluginInstance(nsIPluginInstance** aInstance)
|
||||
nsObjectLoadingContent::GetPluginInstance(nsNPAPIPluginInstance** aInstance)
|
||||
{
|
||||
*aInstance = nsnull;
|
||||
|
||||
@ -999,7 +998,7 @@ nsObjectLoadingContent::GetPluginInstance(nsIPluginInstance** aInstance)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return objFrame->GetPluginInstance(*aInstance);
|
||||
return objFrame->GetPluginInstance(aInstance);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1834,8 +1833,8 @@ nsObjectLoadingContent::TryInstantiate(const nsACString& aMIMEType,
|
||||
return NS_OK; // Not a failure to have no frame
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> instance;
|
||||
frame->GetPluginInstance(*getter_AddRefs(instance));
|
||||
nsRefPtr<nsNPAPIPluginInstance> instance;
|
||||
frame->GetPluginInstance(getter_AddRefs(instance));
|
||||
|
||||
if (!instance) {
|
||||
// The frame has no plugin instance yet. If the frame hasn't been
|
||||
@ -1899,14 +1898,15 @@ nsObjectLoadingContent::Instantiate(nsIObjectFrame* aFrame,
|
||||
|
||||
mInstantiating = oldInstantiatingValue;
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> pluginInstance;
|
||||
nsRefPtr<nsNPAPIPluginInstance> pluginInstance;
|
||||
if (weakFrame.IsAlive()) {
|
||||
aFrame->GetPluginInstance(*getter_AddRefs(pluginInstance));
|
||||
aFrame->GetPluginInstance(getter_AddRefs(pluginInstance));
|
||||
}
|
||||
if (pluginInstance) {
|
||||
nsCOMPtr<nsIPluginTag> pluginTag;
|
||||
nsCOMPtr<nsIPluginHost> host(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID));
|
||||
host->GetPluginTagForInstance(pluginInstance, getter_AddRefs(pluginTag));
|
||||
static_cast<nsPluginHost*>(host.get())->
|
||||
GetPluginTagForInstance(pluginInstance, getter_AddRefs(pluginTag));
|
||||
|
||||
nsCOMPtr<nsIBlocklistService> blocklist =
|
||||
do_GetService("@mozilla.org/extensions/blocklist;1");
|
||||
|
@ -36,6 +36,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsObjectLoadingContent.h"
|
||||
#include "nsGkAtoms.h"
|
||||
@ -49,7 +50,7 @@
|
||||
#include "nsIDOMHTMLObjectElement.h"
|
||||
#include "nsFormSubmission.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
@ -396,8 +397,8 @@ nsHTMLObjectElement::SubmitNamesValues(nsFormSubmission *aFormSubmission)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> pi;
|
||||
objFrame->GetPluginInstance(*getter_AddRefs(pi));
|
||||
nsRefPtr<nsNPAPIPluginInstance> pi;
|
||||
objFrame->GetPluginInstance(getter_AddRefs(pi));
|
||||
if (!pi)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
@ -352,9 +352,8 @@ nsPluginDocument::Print()
|
||||
nsIObjectFrame* objectFrame =
|
||||
do_QueryFrame(mPluginContent->GetPrimaryFrame());
|
||||
if (objectFrame) {
|
||||
nsCOMPtr<nsIPluginInstance> pi;
|
||||
objectFrame->GetPluginInstance(*getter_AddRefs(pi));
|
||||
|
||||
nsCOMPtr<nsNPAPIPluginInstance> pi;
|
||||
objectFrame->GetPluginInstance(getter_AddRefs(pi));
|
||||
if (pi) {
|
||||
NPPrint npprint;
|
||||
npprint.mode = NP_FULL;
|
||||
|
@ -7756,8 +7756,12 @@ nsDocShell::SetDocCurrentStateObj(nsISHEntry *shEntry)
|
||||
NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIStructuredCloneContainer> scContainer;
|
||||
nsresult rv = shEntry->GetStateData(getter_AddRefs(scContainer));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (shEntry) {
|
||||
nsresult rv = shEntry->GetStateData(getter_AddRefs(scContainer));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// If shEntry is null, just set the document's state object to null.
|
||||
}
|
||||
|
||||
// It's OK for scContainer too be null here; that just means there's no
|
||||
// state data associated with this history entry.
|
||||
|
@ -150,7 +150,7 @@
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
|
||||
// HTMLEmbed/ObjectElement helper includes
|
||||
#include "nsIPluginInstance.h"
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsIObjectLoadingContent.h"
|
||||
#include "nsIPluginHost.h"
|
||||
@ -9698,7 +9698,7 @@ nsHTMLSelectElementSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
|
||||
nsresult
|
||||
nsHTMLPluginObjElementSH::GetPluginInstanceIfSafe(nsIXPConnectWrappedNative *wrapper,
|
||||
JSObject *obj,
|
||||
nsIPluginInstance **_result)
|
||||
nsNPAPIPluginInstance **_result)
|
||||
{
|
||||
*_result = nsnull;
|
||||
|
||||
@ -9801,7 +9801,7 @@ nsHTMLPluginObjElementSH::SetupProtoChain(nsIXPConnectWrappedNative *wrapper,
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> pi;
|
||||
nsRefPtr<nsNPAPIPluginInstance> pi;
|
||||
nsresult rv = GetPluginInstanceIfSafe(wrapper, obj, getter_AddRefs(pi));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -10018,7 +10018,7 @@ nsHTMLPluginObjElementSH::Call(nsIXPConnectWrappedNative *wrapper,
|
||||
JSContext *cx, JSObject *obj, PRUint32 argc,
|
||||
jsval *argv, jsval *vp, PRBool *_retval)
|
||||
{
|
||||
nsCOMPtr<nsIPluginInstance> pi;
|
||||
nsRefPtr<nsNPAPIPluginInstance> pi;
|
||||
nsresult rv = GetPluginInstanceIfSafe(wrapper, obj, getter_AddRefs(pi));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -10050,7 +10050,7 @@ nsHTMLPluginObjElementSH::Call(nsIXPConnectWrappedNative *wrapper,
|
||||
|
||||
nsresult
|
||||
nsHTMLPluginObjElementSH::GetPluginJSObject(JSContext *cx, JSObject *obj,
|
||||
nsIPluginInstance *plugin_inst,
|
||||
nsNPAPIPluginInstance *plugin_inst,
|
||||
JSObject **plugin_obj,
|
||||
JSObject **plugin_proto)
|
||||
{
|
||||
@ -10086,7 +10086,7 @@ nsHTMLPluginObjElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper,
|
||||
// Make sure the plugin instance is loaded and instantiated, if
|
||||
// possible.
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> pi;
|
||||
nsRefPtr<nsNPAPIPluginInstance> pi;
|
||||
nsresult rv = GetPluginInstanceIfSafe(wrapper, obj, getter_AddRefs(pi));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -72,7 +72,7 @@ class nsIDOMSVGTransformList;
|
||||
class nsIDOMWindow;
|
||||
class nsIForm;
|
||||
class nsIHTMLDocument;
|
||||
class nsIPluginInstance;
|
||||
class nsNPAPIPluginInstance;
|
||||
class nsSVGTransformList;
|
||||
|
||||
struct nsDOMClassInfoData;
|
||||
@ -1093,10 +1093,10 @@ protected:
|
||||
|
||||
static nsresult GetPluginInstanceIfSafe(nsIXPConnectWrappedNative *aWrapper,
|
||||
JSObject *obj,
|
||||
nsIPluginInstance **aResult);
|
||||
nsNPAPIPluginInstance **aResult);
|
||||
|
||||
static nsresult GetPluginJSObject(JSContext *cx, JSObject *obj,
|
||||
nsIPluginInstance *plugin_inst,
|
||||
nsNPAPIPluginInstance *plugin_inst,
|
||||
JSObject **plugin_obj,
|
||||
JSObject **plugin_proto);
|
||||
|
||||
|
@ -459,7 +459,7 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsDummyJavaPluginOwner)
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIPluginInstance> mInstance;
|
||||
nsRefPtr<nsNPAPIPluginInstance> mInstance;
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
};
|
||||
|
||||
@ -489,7 +489,7 @@ nsDummyJavaPluginOwner::Destroy()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDummyJavaPluginOwner::SetInstance(nsIPluginInstance *aInstance)
|
||||
nsDummyJavaPluginOwner::SetInstance(nsNPAPIPluginInstance *aInstance)
|
||||
{
|
||||
// If we're going to null out mInstance after use, be sure to call
|
||||
// mInstance->InvalidateOwner() here, since it now won't be called
|
||||
@ -503,9 +503,10 @@ nsDummyJavaPluginOwner::SetInstance(nsIPluginInstance *aInstance)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDummyJavaPluginOwner::GetInstance(nsIPluginInstance *&aInstance)
|
||||
nsDummyJavaPluginOwner::GetInstance(nsNPAPIPluginInstance **aInstance)
|
||||
{
|
||||
NS_IF_ADDREF(aInstance = mInstance);
|
||||
NS_IF_ADDREF(mInstance);
|
||||
*aInstance = mInstance;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -6570,8 +6571,8 @@ nsGlobalWindow::InitJavaProperties()
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> dummyPlugin;
|
||||
mDummyJavaPluginOwner->GetInstance(*getter_AddRefs(dummyPlugin));
|
||||
nsRefPtr<nsNPAPIPluginInstance> dummyPlugin;
|
||||
mDummyJavaPluginOwner->GetInstance(getter_AddRefs(dummyPlugin));
|
||||
|
||||
if (dummyPlugin) {
|
||||
// A dummy plugin was instantiated. This means we have a Java
|
||||
|
@ -57,7 +57,6 @@ XPIDLSRCS = \
|
||||
nsIPluginDocument.idl \
|
||||
nsIPluginHost.idl \
|
||||
nsIPluginInputStream.idl \
|
||||
nsIPluginInstance.idl \
|
||||
nsIPluginInstanceOwner.idl \
|
||||
nsIPluginStreamInfo.idl \
|
||||
nsIPluginStreamListener.idl \
|
||||
@ -75,6 +74,11 @@ EXPORTS = \
|
||||
nsPluginError.h \
|
||||
nsPluginNativeWindow.h \
|
||||
nsPluginsCID.h \
|
||||
nsNPAPIPluginInstance.h \
|
||||
nsPluginsDir.h \
|
||||
nsPluginTags.h \
|
||||
nsPluginDirServiceProvider.h \
|
||||
nsPluginHost.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS_mozilla = \
|
||||
|
@ -63,7 +63,7 @@ interface nsIPluginStreamListener;
|
||||
[ptr] native PRLibraryPtr(PRLibrary);
|
||||
[ptr] native nsPluginNativeWindowPtr(nsPluginNativeWindow);
|
||||
|
||||
[scriptable, uuid(FB2E7827-1E7D-4DCC-93A8-94098A4B588D)]
|
||||
[scriptable, uuid(17523504-EC17-4B6A-B803-2B465D26DB44)]
|
||||
interface nsIPluginHost : nsISupports
|
||||
{
|
||||
[noscript] void init();
|
||||
@ -106,10 +106,6 @@ interface nsIPluginHost : nsISupports
|
||||
void getPluginTags([optional] out unsigned long aPluginCount,
|
||||
[retval, array, size_is(aPluginCount)] out nsIPluginTag aResults);
|
||||
|
||||
[noscript] void stopPluginInstance(in nsIPluginInstance aInstance);
|
||||
|
||||
[noscript] void handleBadPlugin(in PRLibraryPtr aLibrary, in nsIPluginInstance instance);
|
||||
|
||||
/**
|
||||
* Fetches a URL.
|
||||
*
|
||||
@ -252,22 +248,6 @@ interface nsIPluginHost : nsISupports
|
||||
*/
|
||||
[noscript] void instantiateDummyJavaPlugin(in nsIPluginInstanceOwner aOwner);
|
||||
|
||||
/**
|
||||
* Get the plugin name for the plugin instance.
|
||||
* @param aInstance the plugin instance object
|
||||
* @param aPluginName returns a pointer to a shared readonly string value,
|
||||
* it's only valid for the lifetime of the plugin instance - you must
|
||||
* copy the string value if you need it longer than that.
|
||||
*/
|
||||
[noscript] void getPluginName(in nsIPluginInstance aInstance, [shared] out string aPluginName);
|
||||
|
||||
/**
|
||||
* Get the plugin tag associated with a given plugin instance.
|
||||
* @param aInstance the plugin instance object
|
||||
* @return plugin tag object
|
||||
*/
|
||||
[noscript] nsIPluginTag getPluginTagForInstance(in nsIPluginInstance aInstance);
|
||||
|
||||
[noscript, notxpcom] void addIdleTimeTarget(in nsIPluginInstanceOwner objectFrame, in boolean isVisible);
|
||||
[noscript, notxpcom] void removeIdleTimeTarget(in nsIPluginInstanceOwner objectFrame);
|
||||
|
||||
|
@ -1,286 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* 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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIPluginStreamListener.idl"
|
||||
|
||||
interface nsIPluginInstanceOwner;
|
||||
interface nsIOutputStream;
|
||||
|
||||
%{C++
|
||||
#include "npapi.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "gfxASurface.h"
|
||||
#include "ImageLayers.h"
|
||||
struct JSContext;
|
||||
struct JSObject;
|
||||
class gfxASurface;
|
||||
class gfxContext;
|
||||
struct nsIntRect;
|
||||
struct nsIntSize;
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
class Image;
|
||||
class ImageContainer;
|
||||
}
|
||||
}
|
||||
|
||||
#define NPRUNTIME_JSCLASS_NAME "NPObject JS wrapper class"
|
||||
%}
|
||||
|
||||
[ptr] native JSContextPtr(JSContext);
|
||||
[ptr] native JSObjectPtr(JSObject);
|
||||
[ptr] native gfxASurfacePtr(gfxASurface);
|
||||
[ptr] native gfxContextPtr(gfxContext);
|
||||
[ptr] native ImagePtr(mozilla::layers::Image);
|
||||
[ptr] native ImageContainerPtr(mozilla::layers::ImageContainer);
|
||||
[ptr] native nsIntRectPtr(nsIntRect);
|
||||
[ptr] native nsIntSizePtr(nsIntSize);
|
||||
|
||||
[uuid(84994340-E120-4051-824F-D4EE8AEF1A3E)]
|
||||
interface nsIPluginInstance : nsISupports
|
||||
{
|
||||
/**
|
||||
* Initializes a newly created plugin instance.
|
||||
*
|
||||
* @param aOwner - the plugin instance owner
|
||||
* @param aMime - the mime type for the instance
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void initialize(in nsIPluginInstanceOwner aOwner, in string aMIMEType);
|
||||
|
||||
/**
|
||||
* Called to instruct the plugin instance to start. This will be
|
||||
* called after the plugin is first created and initialized, and
|
||||
* may be called after the plugin is stopped (via the Stop method)
|
||||
* if the plugin instance is returned to in the browser window's
|
||||
* history.
|
||||
*
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void start();
|
||||
|
||||
/**
|
||||
* Called to instruct the plugin instance to stop, thereby
|
||||
* suspending its state. This method will be called whenever the
|
||||
* browser window goes on to display another page and the page
|
||||
* containing the plugin goes into the window's history list.
|
||||
*
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* Called when the window containing the plugin instance changes.
|
||||
*
|
||||
* (Corresponds to NPP_SetWindow.)
|
||||
*
|
||||
* @param aWindow - the plugin window structure
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void setWindow(in NPWindowPtr aWindow);
|
||||
|
||||
/**
|
||||
* Called to tell the plugin that the initial src/data stream is
|
||||
* ready. Expects the plugin to return a nsIPluginStreamListener.
|
||||
*
|
||||
* (Corresponds to NPP_NewStream.)
|
||||
*
|
||||
* @param aListener - listener the browser will use to give the plugin the data
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void newStreamToPlugin(out nsIPluginStreamListener aListener);
|
||||
|
||||
/**
|
||||
* This operation is called by the plugin instance when it wishes to send
|
||||
* a stream of data to the browser. It constructs a new output stream to which
|
||||
* the plugin may send the data. When complete, the Close and Release methods
|
||||
* should be called on the output stream.
|
||||
*
|
||||
* (Corresponds to NPN_NewStream.)
|
||||
*
|
||||
* @param aType - MIME type of the stream to create
|
||||
* @param aTarget - the target window name to receive the data
|
||||
* @param aResult - the resulting output stream
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void newStreamFromPlugin(in string aType, in string aTarget, out nsIOutputStream aResult);
|
||||
|
||||
/**
|
||||
* Called to instruct the plugin instance to print itself to a printer.
|
||||
*
|
||||
* (Corresponds to NPP_Print.)
|
||||
*
|
||||
* @param aPlatformPrint - platform-specific printing information
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void print(in NPPrintPtr aPlatformPrint);
|
||||
|
||||
/**
|
||||
* Handles an event.
|
||||
*
|
||||
* Note that for Unix and Mac the nsPluginEvent structure is different
|
||||
* from the old NPEvent structure -- it's no longer the native event
|
||||
* record, but is instead a struct. This was done for future extensibility,
|
||||
* and so that the Mac could receive the window argument too. For Windows
|
||||
* and OS2, it's always been a struct, so there's no change for them.
|
||||
*
|
||||
* (Corresponds to NPP_HandleEvent.)
|
||||
*
|
||||
* @param aEvent - the event to be handled
|
||||
* @param aHandled - if non-NULL, set to the NPAPI NPP_HandleEvent
|
||||
* return value
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void handleEvent(in voidPtr aEvent, out PRInt16 aHandled);
|
||||
|
||||
/**
|
||||
* Corresponds to NPN_InvalidateRect
|
||||
*/
|
||||
void invalidateRect(in NPRectPtr aRect);
|
||||
|
||||
/**
|
||||
* Corresponds to NPN_InvalidateRegion
|
||||
*/
|
||||
void invalidateRegion(in NPRegion aRegion);
|
||||
|
||||
/**
|
||||
* Corresponds to NPN_ForceRedraw
|
||||
*/
|
||||
void forceRedraw();
|
||||
|
||||
/**
|
||||
* Returns the MIME type of the plugin instance.
|
||||
*
|
||||
* (Corresponds to NPP_New's MIMEType argument.)
|
||||
*
|
||||
* @param aMIMEType - resulting MIME type
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void getMIMEType([const, shared] out string aValue);
|
||||
|
||||
/**
|
||||
* Get the JavaScript context to this plugin instance.
|
||||
*
|
||||
* @param aJSContext - the resulting JavaScript context
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
readonly attribute JSContextPtr JSContext;
|
||||
|
||||
attribute nsIPluginInstanceOwner owner;
|
||||
|
||||
/**
|
||||
* This operation causes status information to be displayed on the window
|
||||
* associated with the plugin instance.
|
||||
*
|
||||
* (Corresponds to NPN_Status.)
|
||||
*
|
||||
* @param aMessage - the status message to display
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void showStatus(in string aMessage);
|
||||
|
||||
/**
|
||||
* Drop our reference to our owner.
|
||||
*/
|
||||
void invalidateOwner();
|
||||
|
||||
JSObjectPtr GetJSObject(in JSContextPtr cx);
|
||||
|
||||
readonly attribute AString formValue;
|
||||
|
||||
void pushPopupsEnabledState(in boolean aEnabled);
|
||||
void popPopupsEnabledState();
|
||||
|
||||
readonly attribute PRUint16 pluginAPIVersion;
|
||||
|
||||
void defineJavaProperties();
|
||||
|
||||
PRBool shouldCache();
|
||||
|
||||
PRBool isWindowless();
|
||||
|
||||
PRBool isTransparent();
|
||||
|
||||
void getValueFromPlugin(in NPPVariable variable, in voidPtr aValue);
|
||||
|
||||
PRInt32 getDrawingModel();
|
||||
|
||||
/**
|
||||
* async version of SetWindow call
|
||||
*
|
||||
* @param aWindow - the plugin window structure
|
||||
*/
|
||||
void asyncSetWindow(in NPWindowPtr aWindow);
|
||||
|
||||
/**
|
||||
* Call this each time after the plugin has been painted to the screen
|
||||
*/
|
||||
void notifyPainted();
|
||||
|
||||
/**
|
||||
* @return true if plugin module supports async rendering
|
||||
*/
|
||||
PRBool useAsyncPainting();
|
||||
|
||||
PRBool isRemoteDrawingCoreAnimation();
|
||||
|
||||
/**
|
||||
* Returns a new Image object which draws an asynchronously-rendered
|
||||
* plugin. The Image is created using aContainer.
|
||||
* Fails if the plugin is using async rendering but no image has yet
|
||||
* been received, or if the plugin is not using async rendering.
|
||||
*/
|
||||
void getImage(in ImageContainerPtr aContainer, out ImagePtr aImage);
|
||||
|
||||
/**
|
||||
* Returns the size of the Image object that would be created if we called
|
||||
* getImage.
|
||||
* Fails if the plugin is using async rendering but no image has yet
|
||||
* been received, or if the plugin is not using async rendering.
|
||||
*/
|
||||
void getImageSize(in nsIntSizePtr aSize);
|
||||
|
||||
/**
|
||||
* This is the second leg in the trip to PluginInstanceParent. It
|
||||
* approximately follows the ReadbackSink API.
|
||||
*/
|
||||
void setBackgroundUnknown();
|
||||
void beginUpdateBackground(in nsIntRectPtr rect, out gfxContextPtr ctx);
|
||||
void endUpdateBackground(in gfxContextPtr ctx, in nsIntRectPtr rect);
|
||||
};
|
@ -39,35 +39,28 @@
|
||||
#include "nspluginroot.idl"
|
||||
#include "nsIInputStream.idl"
|
||||
|
||||
interface nsIPluginInstance;
|
||||
interface nsIDocument;
|
||||
|
||||
%{C++
|
||||
#include "npapi.h"
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
class nsPluginEvent;
|
||||
%}
|
||||
|
||||
[ref] native nsIPluginInstanceRef(nsIPluginInstance*);
|
||||
[ptr] native nsNPAPIPluginInstancePtr(nsNPAPIPluginInstance);
|
||||
|
||||
[uuid(B48DC23E-C20B-4292-974E-E8FF97B9F1CC)]
|
||||
[uuid(17E89C1F-AE62-448E-83D5-C33FA6E07A19)]
|
||||
interface nsIPluginInstanceOwner : nsISupports
|
||||
{
|
||||
/**
|
||||
* Let the owner know what its instance is
|
||||
*/
|
||||
void setInstance(in nsIPluginInstance aInstance);
|
||||
void setInstance(in nsNPAPIPluginInstancePtr aInstance);
|
||||
|
||||
/**
|
||||
* Get the instance associated with this owner.
|
||||
*/
|
||||
void getInstance(in nsIPluginInstanceRef aInstance);
|
||||
|
||||
%{C++
|
||||
// make getter_AddRefs work
|
||||
inline nsresult GetInstance(nsIPluginInstance** aInstance) {
|
||||
return GetInstance(*aInstance);
|
||||
}
|
||||
%}
|
||||
nsNPAPIPluginInstancePtr getInstance();
|
||||
|
||||
/**
|
||||
* Get a handle to the window structure of the owner.
|
||||
|
@ -55,6 +55,8 @@
|
||||
#include "prmem.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
#define NPRUNTIME_JSCLASS_NAME "NPObject JS wrapper class"
|
||||
|
||||
using namespace mozilla::plugins::parent;
|
||||
|
||||
#include "mozilla/plugins/PluginScriptableObjectParent.h"
|
||||
|
@ -535,7 +535,7 @@ nsNPAPIPlugin::PluginFuncs()
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNPAPIPlugin::CreatePluginInstance(nsIPluginInstance **aResult)
|
||||
nsNPAPIPlugin::CreatePluginInstance(nsNPAPIPluginInstance **aResult)
|
||||
{
|
||||
if (!aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
@ -547,7 +547,7 @@ nsNPAPIPlugin::CreatePluginInstance(nsIPluginInstance **aResult)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(inst);
|
||||
*aResult = static_cast<nsIPluginInstance*>(inst);
|
||||
*aResult = inst;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1048,7 +1048,7 @@ _newstream(NPP npp, NPMIMEType type, const char* target, NPStream* *result)
|
||||
|
||||
NPError err = NPERR_INVALID_INSTANCE_ERROR;
|
||||
if (npp && npp->ndata) {
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance*)npp->ndata;
|
||||
|
||||
PluginDestructionGuard guard(inst);
|
||||
|
||||
@ -1168,7 +1168,7 @@ _status(NPP npp, const char *message)
|
||||
return;
|
||||
}
|
||||
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance*)npp->ndata;
|
||||
|
||||
PluginDestructionGuard guard(inst);
|
||||
|
||||
@ -1233,7 +1233,7 @@ _invalidaterect(NPP npp, NPRect *invalidRect)
|
||||
return;
|
||||
}
|
||||
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance*)npp->ndata;
|
||||
|
||||
PluginDestructionGuard guard(inst);
|
||||
|
||||
@ -1256,7 +1256,7 @@ _invalidateregion(NPP npp, NPRegion invalidRegion)
|
||||
return;
|
||||
}
|
||||
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *)npp->ndata;
|
||||
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance*)npp->ndata;
|
||||
|
||||
PluginDestructionGuard guard(inst);
|
||||
|
||||
@ -1277,7 +1277,7 @@ _forceredraw(NPP npp)
|
||||
return;
|
||||
}
|
||||
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance*)npp->ndata;
|
||||
|
||||
PluginDestructionGuard guard(inst);
|
||||
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
|
||||
static PRBool RunPluginOOP(const nsPluginTag *aPluginTag);
|
||||
|
||||
nsresult CreatePluginInstance(nsIPluginInstance **aResult);
|
||||
nsresult CreatePluginInstance(nsNPAPIPluginInstance **aResult);
|
||||
nsresult Shutdown();
|
||||
|
||||
protected:
|
||||
|
@ -64,7 +64,7 @@ using namespace mozilla::plugins::parent;
|
||||
static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID);
|
||||
static NS_DEFINE_IID(kIPluginStreamListenerIID, NS_IPLUGINSTREAMLISTENER_IID);
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsNPAPIPluginInstance, nsIPluginInstance)
|
||||
NS_IMPL_ISUPPORTS0(nsNPAPIPluginInstance)
|
||||
|
||||
nsNPAPIPluginInstance::nsNPAPIPluginInstance(nsNPAPIPlugin* plugin)
|
||||
:
|
||||
@ -134,7 +134,7 @@ nsNPAPIPluginInstance::LastStopTime()
|
||||
return mStopTime;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::Initialize(nsIPluginInstanceOwner* aOwner, const char* aMIMEType)
|
||||
nsresult nsNPAPIPluginInstance::Initialize(nsIPluginInstanceOwner* aOwner, const char* aMIMEType)
|
||||
{
|
||||
PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsNPAPIPluginInstance::Initialize this=%p\n",this));
|
||||
|
||||
@ -150,7 +150,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Initialize(nsIPluginInstanceOwner* aOwner,
|
||||
return InitializePlugin();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::Start()
|
||||
nsresult nsNPAPIPluginInstance::Start()
|
||||
{
|
||||
PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsNPAPIPluginInstance::Start this=%p\n",this));
|
||||
|
||||
@ -160,7 +160,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Start()
|
||||
return InitializePlugin();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::Stop()
|
||||
nsresult nsNPAPIPluginInstance::Stop()
|
||||
{
|
||||
PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsNPAPIPluginInstance::Stop this=%p\n",this));
|
||||
|
||||
@ -431,7 +431,7 @@ nsNPAPIPluginInstance::InitializePlugin()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::SetWindow(NPWindow* window)
|
||||
nsresult nsNPAPIPluginInstance::SetWindow(NPWindow* window)
|
||||
{
|
||||
// NPAPI plugins don't want a SetWindow(NULL).
|
||||
if (!window || RUNNING != mRunning)
|
||||
@ -477,14 +477,14 @@ NS_IMETHODIMP nsNPAPIPluginInstance::SetWindow(NPWindow* window)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::NewStreamToPlugin(nsIPluginStreamListener** listener)
|
||||
{
|
||||
// This method can be removed at the next opportunity.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::NewStreamFromPlugin(const char* type, const char* target,
|
||||
nsIOutputStream* *result)
|
||||
{
|
||||
@ -507,7 +507,7 @@ nsNPAPIPluginInstance::NewStreamListener(const char* aURL, void* notifyData,
|
||||
return stream->QueryInterface(kIPluginStreamListenerIID, (void**)listener);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::Print(NPPrint* platformPrint)
|
||||
nsresult nsNPAPIPluginInstance::Print(NPPrint* platformPrint)
|
||||
{
|
||||
NS_ENSURE_TRUE(platformPrint, NS_ERROR_NULL_POINTER);
|
||||
|
||||
@ -557,7 +557,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Print(NPPrint* platformPrint)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::HandleEvent(void* event, PRInt16* result)
|
||||
nsresult nsNPAPIPluginInstance::HandleEvent(void* event, PRInt16* result)
|
||||
{
|
||||
if (RUNNING != mRunning)
|
||||
return NS_OK;
|
||||
@ -593,7 +593,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::HandleEvent(void* event, PRInt16* result)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::GetValueFromPlugin(NPPVariable variable, void* value)
|
||||
nsresult nsNPAPIPluginInstance::GetValueFromPlugin(NPPVariable variable, void* value)
|
||||
{
|
||||
#if (MOZ_PLATFORM_MAEMO == 5)
|
||||
// The maemo flash plugin does not remember this. It sets the
|
||||
@ -726,7 +726,7 @@ void nsNPAPIPluginInstance::SetEventModel(NPEventModel aModel)
|
||||
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::GetDrawingModel(PRInt32* aModel)
|
||||
nsresult nsNPAPIPluginInstance::GetDrawingModel(PRInt32* aModel)
|
||||
{
|
||||
#ifdef XP_MACOSX
|
||||
*aModel = (PRInt32)mDrawingModel;
|
||||
@ -736,7 +736,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::GetDrawingModel(PRInt32* aModel)
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::IsRemoteDrawingCoreAnimation(PRBool* aDrawing)
|
||||
nsresult nsNPAPIPluginInstance::IsRemoteDrawingCoreAnimation(PRBool* aDrawing)
|
||||
{
|
||||
#ifdef XP_MACOSX
|
||||
if (!mPlugin)
|
||||
@ -752,7 +752,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::IsRemoteDrawingCoreAnimation(PRBool* aDrawi
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::GetJSObject(JSContext *cx, JSObject** outObject)
|
||||
{
|
||||
NPObject *npobj = nsnull;
|
||||
@ -767,7 +767,7 @@ nsNPAPIPluginInstance::GetJSObject(JSContext *cx, JSObject** outObject)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::DefineJavaProperties()
|
||||
{
|
||||
NPObject *plugin_obj = nsnull;
|
||||
@ -831,14 +831,14 @@ nsNPAPIPluginInstance::SetCached(PRBool aCache)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::ShouldCache(PRBool* shouldCache)
|
||||
{
|
||||
*shouldCache = mCached;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::IsWindowless(PRBool* isWindowless)
|
||||
{
|
||||
*isWindowless = mWindowless;
|
||||
@ -864,7 +864,7 @@ private:
|
||||
PluginLibrary* mLibrary;
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::AsyncSetWindow(NPWindow* window)
|
||||
{
|
||||
if (RUNNING != mRunning)
|
||||
@ -877,7 +877,7 @@ nsNPAPIPluginInstance::AsyncSetWindow(NPWindow* window)
|
||||
return library->AsyncSetWindow(&mNPP, window);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::GetImage(ImageContainer* aContainer, Image** aImage)
|
||||
{
|
||||
*aImage = nsnull;
|
||||
@ -889,7 +889,7 @@ nsNPAPIPluginInstance::GetImage(ImageContainer* aContainer, Image** aImage)
|
||||
return !library ? NS_ERROR_FAILURE : library->GetImage(&mNPP, aContainer, aImage);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::GetImageSize(nsIntSize* aSize)
|
||||
{
|
||||
*aSize = nsIntSize(0, 0);
|
||||
@ -901,14 +901,14 @@ nsNPAPIPluginInstance::GetImageSize(nsIntSize* aSize)
|
||||
return !library ? NS_ERROR_FAILURE : library->GetImageSize(&mNPP, aSize);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::NotifyPainted(void)
|
||||
{
|
||||
NS_NOTREACHED("Dead code, shouldn't be called.");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::UseAsyncPainting(PRBool* aIsAsync)
|
||||
{
|
||||
if (!mUsePluginLayersPref) {
|
||||
@ -924,7 +924,7 @@ nsNPAPIPluginInstance::UseAsyncPainting(PRBool* aIsAsync)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::SetBackgroundUnknown()
|
||||
{
|
||||
if (RUNNING != mRunning)
|
||||
@ -937,7 +937,7 @@ nsNPAPIPluginInstance::SetBackgroundUnknown()
|
||||
return library->SetBackgroundUnknown(&mNPP);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::BeginUpdateBackground(nsIntRect* aRect,
|
||||
gfxContext** aContext)
|
||||
{
|
||||
@ -951,7 +951,7 @@ nsNPAPIPluginInstance::BeginUpdateBackground(nsIntRect* aRect,
|
||||
return library->BeginUpdateBackground(&mNPP, *aRect, aContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::EndUpdateBackground(gfxContext* aContext,
|
||||
nsIntRect* aRect)
|
||||
{
|
||||
@ -965,14 +965,14 @@ nsNPAPIPluginInstance::EndUpdateBackground(gfxContext* aContext,
|
||||
return library->EndUpdateBackground(&mNPP, aContext, *aRect);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::IsTransparent(PRBool* isTransparent)
|
||||
{
|
||||
*isTransparent = mTransparent;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::GetFormValue(nsAString& aValue)
|
||||
{
|
||||
aValue.Truncate();
|
||||
@ -991,7 +991,7 @@ nsNPAPIPluginInstance::GetFormValue(nsAString& aValue)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::PushPopupsEnabledState(PRBool aEnabled)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetDOMWindow();
|
||||
@ -1011,7 +1011,7 @@ nsNPAPIPluginInstance::PushPopupsEnabledState(PRBool aEnabled)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::PopPopupsEnabledState()
|
||||
{
|
||||
PRInt32 last = mPopupStates.Length() - 1;
|
||||
@ -1034,7 +1034,7 @@ nsNPAPIPluginInstance::PopPopupsEnabledState()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::GetPluginAPIVersion(PRUint16* version)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(version);
|
||||
@ -1208,7 +1208,7 @@ nsNPAPIPluginInstance::GetDOMElement(nsIDOMElement* *result)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::InvalidateRect(NPRect *invalidRect)
|
||||
{
|
||||
if (RUNNING != mRunning)
|
||||
@ -1222,7 +1222,7 @@ nsNPAPIPluginInstance::InvalidateRect(NPRect *invalidRect)
|
||||
return owner->InvalidateRect(invalidRect);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::InvalidateRegion(NPRegion invalidRegion)
|
||||
{
|
||||
if (RUNNING != mRunning)
|
||||
@ -1236,7 +1236,7 @@ nsNPAPIPluginInstance::InvalidateRegion(NPRegion invalidRegion)
|
||||
return owner->InvalidateRegion(invalidRegion);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::ForceRedraw()
|
||||
{
|
||||
if (RUNNING != mRunning)
|
||||
@ -1250,7 +1250,7 @@ nsNPAPIPluginInstance::ForceRedraw()
|
||||
return owner->ForceRedraw();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::GetMIMEType(const char* *result)
|
||||
{
|
||||
if (!mMIMEType)
|
||||
@ -1261,7 +1261,7 @@ nsNPAPIPluginInstance::GetMIMEType(const char* *result)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::GetJSContext(JSContext* *outContext)
|
||||
{
|
||||
nsCOMPtr<nsIPluginInstanceOwner> owner;
|
||||
@ -1289,7 +1289,7 @@ nsNPAPIPluginInstance::GetJSContext(JSContext* *outContext)
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::GetOwner(nsIPluginInstanceOwner **aOwner)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOwner);
|
||||
@ -1298,14 +1298,14 @@ nsNPAPIPluginInstance::GetOwner(nsIPluginInstanceOwner **aOwner)
|
||||
return (mOwner ? NS_OK : NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::SetOwner(nsIPluginInstanceOwner *aOwner)
|
||||
{
|
||||
mOwner = aOwner;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::ShowStatus(const char* message)
|
||||
{
|
||||
if (mOwner)
|
||||
@ -1314,7 +1314,7 @@ nsNPAPIPluginInstance::ShowStatus(const char* message)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::InvalidateOwner()
|
||||
{
|
||||
mOwner = nsnull;
|
||||
|
@ -42,7 +42,6 @@
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsIPluginTagInfo.h"
|
||||
@ -54,9 +53,13 @@
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/PluginLibrary.h"
|
||||
|
||||
struct JSObject;
|
||||
|
||||
class nsPluginStreamListenerPeer; // browser-initiated stream class
|
||||
class nsNPAPIPluginStreamListener; // plugin-initiated stream class
|
||||
class nsIPluginInstanceOwner;
|
||||
class nsIPluginStreamListener;
|
||||
class nsIOutputStream;
|
||||
|
||||
class nsNPAPITimer
|
||||
{
|
||||
@ -67,14 +70,51 @@ public:
|
||||
void (*callback)(NPP npp, uint32_t timerID);
|
||||
};
|
||||
|
||||
class nsNPAPIPluginInstance : public nsIPluginInstance
|
||||
class nsNPAPIPluginInstance : public nsISupports
|
||||
{
|
||||
private:
|
||||
typedef mozilla::PluginLibrary PluginLibrary;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPLUGININSTANCE
|
||||
|
||||
nsresult Initialize(nsIPluginInstanceOwner* aOwner, const char* aMIMEType);
|
||||
nsresult Start();
|
||||
nsresult Stop();
|
||||
nsresult SetWindow(NPWindow* window);
|
||||
nsresult NewStreamToPlugin(nsIPluginStreamListener** listener);
|
||||
nsresult NewStreamFromPlugin(const char* type, const char* target, nsIOutputStream* *result);
|
||||
nsresult Print(NPPrint* platformPrint);
|
||||
nsresult HandleEvent(void* event, PRInt16* result);
|
||||
nsresult GetValueFromPlugin(NPPVariable variable, void* value);
|
||||
nsresult GetDrawingModel(PRInt32* aModel);
|
||||
nsresult IsRemoteDrawingCoreAnimation(PRBool* aDrawing);
|
||||
nsresult GetJSObject(JSContext *cx, JSObject** outObject);
|
||||
nsresult DefineJavaProperties();
|
||||
nsresult ShouldCache(PRBool* shouldCache);
|
||||
nsresult IsWindowless(PRBool* isWindowless);
|
||||
nsresult AsyncSetWindow(NPWindow* window);
|
||||
nsresult GetImage(ImageContainer* aContainer, Image** aImage);
|
||||
nsresult GetImageSize(nsIntSize* aSize);
|
||||
nsresult NotifyPainted(void);
|
||||
nsresult UseAsyncPainting(PRBool* aIsAsync);
|
||||
nsresult SetBackgroundUnknown();
|
||||
nsresult BeginUpdateBackground(nsIntRect* aRect, gfxContext** aContext);
|
||||
nsresult EndUpdateBackground(gfxContext* aContext, nsIntRect* aRect);
|
||||
nsresult IsTransparent(PRBool* isTransparent);
|
||||
nsresult GetFormValue(nsAString& aValue);
|
||||
nsresult PushPopupsEnabledState(PRBool aEnabled);
|
||||
nsresult PopPopupsEnabledState();
|
||||
nsresult GetPluginAPIVersion(PRUint16* version);
|
||||
nsresult InvalidateRect(NPRect *invalidRect);
|
||||
nsresult InvalidateRegion(NPRegion invalidRegion);
|
||||
nsresult ForceRedraw();
|
||||
nsresult GetMIMEType(const char* *result);
|
||||
nsresult GetJSContext(JSContext* *outContext);
|
||||
nsresult GetOwner(nsIPluginInstanceOwner **aOwner);
|
||||
nsresult SetOwner(nsIPluginInstanceOwner *aOwner);
|
||||
nsresult ShowStatus(const char* message);
|
||||
nsresult InvalidateOwner();
|
||||
|
||||
nsNPAPIPlugin* GetPlugin();
|
||||
|
||||
|
@ -1064,11 +1064,12 @@ nsPluginHost::InstantiateEmbeddedPlugin(const char *aMimeType, nsIURI* aURL,
|
||||
PLUGIN_LOG(PLUGIN_LOG_NOISY,
|
||||
("nsPluginHost::InstantiateEmbeddedPlugin FoundStopped mime=%s\n", aMimeType));
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> instanceCOMPtr;
|
||||
aOwner->GetInstance(getter_AddRefs(instanceCOMPtr));
|
||||
nsNPAPIPluginInstance *instance = static_cast<nsNPAPIPluginInstance*>(instanceCOMPtr.get());
|
||||
if (!isJava && bCanHandleInternally)
|
||||
rv = NewEmbeddedPluginStream(aURL, aOwner, instance);
|
||||
if (!isJava && bCanHandleInternally) {
|
||||
nsNPAPIPluginInstance* instance;
|
||||
aOwner->GetInstance(&instance);
|
||||
NewEmbeddedPluginStream(aURL, aOwner, instance);
|
||||
NS_IF_RELEASE(instance);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1083,16 +1084,13 @@ nsPluginHost::InstantiateEmbeddedPlugin(const char *aMimeType, nsIURI* aURL,
|
||||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> instanceCOMPtr;
|
||||
rv = aOwner->GetInstance(getter_AddRefs(instanceCOMPtr));
|
||||
nsRefPtr<nsNPAPIPluginInstance> instance;
|
||||
rv = aOwner->GetInstance(getter_AddRefs(instance));
|
||||
// if we have a failure error, it means we found a plugin for the mimetype,
|
||||
// but we had a problem with the entry point
|
||||
if (rv == NS_ERROR_FAILURE)
|
||||
return rv;
|
||||
|
||||
// if we are here then we have loaded a plugin for this mimetype
|
||||
nsNPAPIPluginInstance *instance = static_cast<nsNPAPIPluginInstance*>(instanceCOMPtr.get());
|
||||
|
||||
if (instance) {
|
||||
instance->Start();
|
||||
aOwner->CreateWidget();
|
||||
@ -1113,7 +1111,7 @@ nsPluginHost::InstantiateEmbeddedPlugin(const char *aMimeType, nsIURI* aURL,
|
||||
}
|
||||
|
||||
if (havedata && !isJava && bCanHandleInternally)
|
||||
rv = NewEmbeddedPluginStream(aURL, aOwner, instance);
|
||||
rv = NewEmbeddedPluginStream(aURL, aOwner, instance.get());
|
||||
}
|
||||
|
||||
#ifdef PLUGIN_LOGGING
|
||||
@ -1150,9 +1148,9 @@ nsresult nsPluginHost::InstantiateFullPagePlugin(const char *aMimeType,
|
||||
|
||||
nsPluginTag* pluginTag = FindPluginForType(aMimeType, PR_TRUE);
|
||||
if (!pluginTag || !pluginTag->mIsJavaPlugin) {
|
||||
nsCOMPtr<nsIPluginInstance> instanceCOMPtr;
|
||||
aOwner->GetInstance(getter_AddRefs(instanceCOMPtr));
|
||||
NewFullPagePluginStream(aURI, static_cast<nsNPAPIPluginInstance*>(instanceCOMPtr.get()), aStreamListener);
|
||||
nsRefPtr<nsNPAPIPluginInstance> instance;
|
||||
aOwner->GetInstance(getter_AddRefs(instance));
|
||||
NewFullPagePluginStream(aURI, instance.get(), aStreamListener);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1160,9 +1158,8 @@ nsresult nsPluginHost::InstantiateFullPagePlugin(const char *aMimeType,
|
||||
nsresult rv = SetUpPluginInstance(aMimeType, aURI, aOwner);
|
||||
|
||||
if (NS_OK == rv) {
|
||||
nsCOMPtr<nsIPluginInstance> instanceCOMPtr;
|
||||
aOwner->GetInstance(getter_AddRefs(instanceCOMPtr));
|
||||
nsNPAPIPluginInstance *instance = static_cast<nsNPAPIPluginInstance*>(instanceCOMPtr.get());
|
||||
nsRefPtr<nsNPAPIPluginInstance> instance;
|
||||
aOwner->GetInstance(getter_AddRefs(instance));
|
||||
|
||||
NPWindow* win = nsnull;
|
||||
aOwner->GetWindow(win);
|
||||
@ -1174,7 +1171,7 @@ nsresult nsPluginHost::InstantiateFullPagePlugin(const char *aMimeType,
|
||||
// If we've got a native window, the let the plugin know about it.
|
||||
aOwner->SetWindow();
|
||||
|
||||
rv = NewFullPagePluginStream(aURI, instance, aStreamListener);
|
||||
rv = NewFullPagePluginStream(aURI, instance.get(), aStreamListener);
|
||||
|
||||
// If we've got a native window, the let the plugin know about it.
|
||||
aOwner->SetWindow();
|
||||
@ -1325,7 +1322,8 @@ nsPluginHost::TrySetUpPluginInstance(const char *aMimeType,
|
||||
nsRefPtr<nsNPAPIPlugin> plugin;
|
||||
GetPlugin(mimetype, getter_AddRefs(plugin));
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> instance;
|
||||
nsRefPtr<nsNPAPIPluginInstance> instance;
|
||||
|
||||
if (plugin) {
|
||||
#if defined(XP_WIN)
|
||||
static BOOL firstJavaPlugin = FALSE;
|
||||
@ -1361,7 +1359,7 @@ nsPluginHost::TrySetUpPluginInstance(const char *aMimeType,
|
||||
return rv;
|
||||
|
||||
// it is adreffed here
|
||||
aOwner->SetInstance(instance);
|
||||
aOwner->SetInstance(instance.get());
|
||||
|
||||
// this should not addref the instance or owner
|
||||
// except in some cases not Java, see bug 140931
|
||||
@ -1372,7 +1370,7 @@ nsPluginHost::TrySetUpPluginInstance(const char *aMimeType,
|
||||
return rv;
|
||||
}
|
||||
|
||||
mInstances.AppendElement(static_cast<nsNPAPIPluginInstance*>(instance.get()));
|
||||
mInstances.AppendElement(instance.get());
|
||||
|
||||
#ifdef PLUGIN_LOGGING
|
||||
nsCAutoString urlSpec2;
|
||||
@ -3293,8 +3291,8 @@ nsPluginHost::AddHeadersToChannel(const char *aHeadersData,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginHost::StopPluginInstance(nsIPluginInstance* aInstance)
|
||||
nsresult
|
||||
nsPluginHost::StopPluginInstance(nsNPAPIPluginInstance* aInstance)
|
||||
{
|
||||
if (PluginDestructionGuard::DelayDestroy(aInstance)) {
|
||||
return NS_OK;
|
||||
@ -3303,7 +3301,7 @@ nsPluginHost::StopPluginInstance(nsIPluginInstance* aInstance)
|
||||
PLUGIN_LOG(PLUGIN_LOG_NORMAL,
|
||||
("nsPluginHost::StopPluginInstance called instance=%p\n",aInstance));
|
||||
|
||||
nsNPAPIPluginInstance* instance = static_cast<nsNPAPIPluginInstance*>(aInstance);
|
||||
nsNPAPIPluginInstance* instance = aInstance;
|
||||
if (instance->HasStartedDestroying())
|
||||
return NS_OK;
|
||||
|
||||
@ -3444,8 +3442,8 @@ NS_IMETHODIMP nsPluginHost::Observe(nsISupports *aSubject,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginHost::HandleBadPlugin(PRLibrary* aLibrary, nsIPluginInstance *aInstance)
|
||||
nsresult
|
||||
nsPluginHost::HandleBadPlugin(PRLibrary* aLibrary, nsNPAPIPluginInstance *aInstance)
|
||||
{
|
||||
// the |aLibrary| parameter is not needed anymore, after we added |aInstance| which
|
||||
// can also be used to look up the plugin name, but we cannot get rid of it because
|
||||
@ -3501,9 +3499,7 @@ nsPluginHost::HandleBadPlugin(PRLibrary* aLibrary, nsIPluginInstance *aInstance)
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsNPAPIPluginInstance *instance = static_cast<nsNPAPIPluginInstance*>(aInstance);
|
||||
|
||||
nsNPAPIPlugin *plugin = instance->GetPlugin();
|
||||
nsNPAPIPlugin *plugin = aInstance->GetPlugin();
|
||||
if (!plugin)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -3821,8 +3817,8 @@ nsPluginHost::InstantiateDummyJavaPlugin(nsIPluginInstanceOwner *aOwner)
|
||||
nsresult rv = SetUpPluginInstance("application/x-java-vm", nsnull, aOwner);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> instance;
|
||||
aOwner->GetInstance(*getter_AddRefs(instance));
|
||||
nsRefPtr<nsNPAPIPluginInstance> instance;
|
||||
aOwner->GetInstance(getter_AddRefs(instance));
|
||||
if (!instance)
|
||||
return NS_OK;
|
||||
|
||||
@ -3831,8 +3827,8 @@ nsPluginHost::InstantiateDummyJavaPlugin(nsIPluginInstanceOwner *aOwner)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginHost::GetPluginName(nsIPluginInstance *aPluginInstance,
|
||||
nsresult
|
||||
nsPluginHost::GetPluginName(nsNPAPIPluginInstance *aPluginInstance,
|
||||
const char** aPluginName)
|
||||
{
|
||||
nsNPAPIPluginInstance *instance = static_cast<nsNPAPIPluginInstance*>(aPluginInstance);
|
||||
@ -3848,15 +3844,14 @@ nsPluginHost::GetPluginName(nsIPluginInstance *aPluginInstance,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginHost::GetPluginTagForInstance(nsIPluginInstance *aPluginInstance,
|
||||
nsresult
|
||||
nsPluginHost::GetPluginTagForInstance(nsNPAPIPluginInstance *aPluginInstance,
|
||||
nsIPluginTag **aPluginTag)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPluginInstance);
|
||||
NS_ENSURE_ARG_POINTER(aPluginTag);
|
||||
|
||||
nsNPAPIPluginInstance *instance = static_cast<nsNPAPIPluginInstance*>(aPluginInstance);
|
||||
nsNPAPIPlugin *plugin = instance->GetPlugin();
|
||||
nsNPAPIPlugin *plugin = aPluginInstance->GetPlugin();
|
||||
if (!plugin)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -4160,7 +4155,7 @@ class nsPluginDestroyRunnable : public nsRunnable,
|
||||
public PRCList
|
||||
{
|
||||
public:
|
||||
nsPluginDestroyRunnable(nsIPluginInstance *aInstance)
|
||||
nsPluginDestroyRunnable(nsNPAPIPluginInstance *aInstance)
|
||||
: mInstance(aInstance)
|
||||
{
|
||||
PR_INIT_CLIST(this);
|
||||
@ -4174,7 +4169,7 @@ public:
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
nsCOMPtr<nsIPluginInstance> instance;
|
||||
nsRefPtr<nsNPAPIPluginInstance> instance;
|
||||
|
||||
// Null out mInstance to make sure this code in another runnable
|
||||
// will do the right thing even if someone was holding on to this
|
||||
@ -4213,7 +4208,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIPluginInstance> mInstance;
|
||||
nsRefPtr<nsNPAPIPluginInstance> mInstance;
|
||||
|
||||
static PRCList sRunnableListHead;
|
||||
};
|
||||
@ -4243,7 +4238,7 @@ PluginDestructionGuard::~PluginDestructionGuard()
|
||||
|
||||
// static
|
||||
PRBool
|
||||
PluginDestructionGuard::DelayDestroy(nsIPluginInstance *aInstance)
|
||||
PluginDestructionGuard::DelayDestroy(nsNPAPIPluginInstance *aInstance)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on the main thread");
|
||||
NS_ASSERTION(aInstance, "Uh, I need an instance!");
|
||||
|
@ -106,6 +106,11 @@ public:
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
nsresult GetPluginName(nsNPAPIPluginInstance *aPluginInstance, const char** aPluginName);
|
||||
nsresult StopPluginInstance(nsNPAPIPluginInstance* aInstance);
|
||||
nsresult HandleBadPlugin(PRLibrary* aLibrary, nsNPAPIPluginInstance *aInstance);
|
||||
nsresult GetPluginTagForInstance(nsNPAPIPluginInstance *aPluginInstance, nsIPluginTag **aPluginTag);
|
||||
|
||||
nsresult
|
||||
NewPluginURLStream(const nsString& aURL,
|
||||
nsNPAPIPluginInstance *aInstance,
|
||||
@ -301,7 +306,7 @@ private:
|
||||
class NS_STACK_CLASS PluginDestructionGuard : protected PRCList
|
||||
{
|
||||
public:
|
||||
PluginDestructionGuard(nsIPluginInstance *aInstance)
|
||||
PluginDestructionGuard(nsNPAPIPluginInstance *aInstance)
|
||||
: mInstance(aInstance)
|
||||
{
|
||||
Init();
|
||||
@ -315,7 +320,7 @@ public:
|
||||
|
||||
~PluginDestructionGuard();
|
||||
|
||||
static PRBool DelayDestroy(nsIPluginInstance *aInstance);
|
||||
static PRBool DelayDestroy(nsNPAPIPluginInstance *aInstance);
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
@ -328,7 +333,7 @@ protected:
|
||||
PR_INSERT_BEFORE(this, &sListHead);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> mInstance;
|
||||
nsRefPtr<nsNPAPIPluginInstance> mInstance;
|
||||
PRBool mDelayedDestroy;
|
||||
|
||||
static PRCList sListHead;
|
||||
|
@ -42,8 +42,9 @@
|
||||
#define _nsPluginNativeWindow_h_
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
#include "npapi.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
@ -73,11 +74,11 @@ public:
|
||||
*/
|
||||
|
||||
public:
|
||||
nsresult GetPluginInstance(nsCOMPtr<nsIPluginInstance> &aPluginInstance) {
|
||||
nsresult GetPluginInstance(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance) {
|
||||
aPluginInstance = mPluginInstance;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult SetPluginInstance(nsIPluginInstance *aPluginInstance) {
|
||||
nsresult SetPluginInstance(nsNPAPIPluginInstance *aPluginInstance) {
|
||||
if (mPluginInstance != aPluginInstance)
|
||||
mPluginInstance = aPluginInstance;
|
||||
return NS_OK;
|
||||
@ -93,7 +94,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
virtual nsresult CallSetWindow(nsCOMPtr<nsIPluginInstance> &aPluginInstance) {
|
||||
virtual nsresult CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance) {
|
||||
// null aPluginInstance means that we want to call SetWindow(null)
|
||||
if (aPluginInstance)
|
||||
aPluginInstance->SetWindow(this);
|
||||
@ -114,8 +115,8 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIPluginInstance> mPluginInstance;
|
||||
nsCOMPtr<nsIWidget> mWidget;
|
||||
nsRefPtr<nsNPAPIPluginInstance> mPluginInstance;
|
||||
nsCOMPtr<nsIWidget> mWidget;
|
||||
};
|
||||
|
||||
nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow);
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
nsPluginNativeWindowGtk2();
|
||||
virtual ~nsPluginNativeWindowGtk2();
|
||||
|
||||
virtual nsresult CallSetWindow(nsCOMPtr<nsIPluginInstance> &aPluginInstance);
|
||||
virtual nsresult CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance);
|
||||
private:
|
||||
NPSetWindowCallbackStruct mWsInfo;
|
||||
/**
|
||||
@ -179,7 +179,7 @@ nsPluginNativeWindowGtk2::plugin_composite_filter_func (GdkXEvent *xevent,
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult nsPluginNativeWindowGtk2::CallSetWindow(nsCOMPtr<nsIPluginInstance> &aPluginInstance)
|
||||
nsresult nsPluginNativeWindowGtk2::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance)
|
||||
{
|
||||
if (aPluginInstance) {
|
||||
if (type == NPWindowTypeWindow) {
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
nsPluginNativeWindowQt();
|
||||
virtual ~nsPluginNativeWindowQt();
|
||||
|
||||
virtual nsresult CallSetWindow(nsCOMPtr<nsIPluginInstance> &aPluginInstance);
|
||||
virtual nsresult CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance);
|
||||
private:
|
||||
|
||||
NPSetWindowCallbackStruct mWsInfo;
|
||||
@ -105,7 +105,7 @@ nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindo
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsPluginNativeWindowQt::CallSetWindow(nsCOMPtr<nsIPluginInstance> &aPluginInstance)
|
||||
nsresult nsPluginNativeWindowQt::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance)
|
||||
{
|
||||
if (aPluginInstance) {
|
||||
if (type == NPWindowTypeWindow) {
|
||||
|
@ -143,7 +143,7 @@ public:
|
||||
nsPluginNativeWindowWin();
|
||||
virtual ~nsPluginNativeWindowWin();
|
||||
|
||||
virtual nsresult CallSetWindow(nsCOMPtr<nsIPluginInstance> &aPluginInstance);
|
||||
virtual nsresult CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance);
|
||||
|
||||
private:
|
||||
nsresult SubclassAndAssociateWindow();
|
||||
@ -175,7 +175,7 @@ static PRBool sInMessageDispatch = PR_FALSE;
|
||||
static PRBool sInPreviousMessageDispatch = PR_FALSE;
|
||||
static UINT sLastMsg = 0;
|
||||
|
||||
static PRBool ProcessFlashMessageDelayed(nsPluginNativeWindowWin * aWin, nsIPluginInstance * aInst,
|
||||
static PRBool ProcessFlashMessageDelayed(nsPluginNativeWindowWin * aWin, nsNPAPIPluginInstance * aInst,
|
||||
HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
NS_ENSURE_TRUE(aWin, NS_ERROR_NULL_POINTER);
|
||||
@ -204,14 +204,14 @@ static PRBool ProcessFlashMessageDelayed(nsPluginNativeWindowWin * aWin, nsIPlug
|
||||
class nsDelayedPopupsEnabledEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
nsDelayedPopupsEnabledEvent(nsIPluginInstance *inst)
|
||||
nsDelayedPopupsEnabledEvent(nsNPAPIPluginInstance *inst)
|
||||
: mInst(inst)
|
||||
{}
|
||||
|
||||
NS_DECL_NSIRUNNABLE
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIPluginInstance> mInst;
|
||||
nsRefPtr<nsNPAPIPluginInstance> mInst;
|
||||
};
|
||||
|
||||
NS_IMETHODIMP nsDelayedPopupsEnabledEvent::Run()
|
||||
@ -232,7 +232,7 @@ static LRESULT CALLBACK PluginWndProcInternal(HWND hWnd, UINT msg, WPARAM wParam
|
||||
// The DispatchEvent(NS_PLUGIN_ACTIVATE) below can trigger a reentrant focus
|
||||
// event which might destroy us. Hold a strong ref on the plugin instance
|
||||
// to prevent that, bug 374229.
|
||||
nsCOMPtr<nsIPluginInstance> inst;
|
||||
nsRefPtr<nsNPAPIPluginInstance> inst;
|
||||
win->GetPluginInstance(inst);
|
||||
|
||||
// Real may go into a state where it recursivly dispatches the same event
|
||||
@ -564,7 +564,7 @@ NS_IMETHODIMP PluginWindowEvent::Run()
|
||||
if (!hWnd)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> inst;
|
||||
nsRefPtr<nsNPAPIPluginInstance> inst;
|
||||
win->GetPluginInstance(inst);
|
||||
|
||||
if (GetMsg() == WM_USER_FLASH) {
|
||||
@ -621,7 +621,7 @@ nsPluginNativeWindowWin::GetPluginWindowEvent(HWND aWnd, UINT aMsg, WPARAM aWPar
|
||||
return event;
|
||||
}
|
||||
|
||||
nsresult nsPluginNativeWindowWin::CallSetWindow(nsCOMPtr<nsIPluginInstance> &aPluginInstance)
|
||||
nsresult nsPluginNativeWindowWin::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance)
|
||||
{
|
||||
// Note, 'window' can be null
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
#define nsPluginSafety_h_
|
||||
|
||||
#include "npapi.h"
|
||||
#include "nsIPluginHost.h"
|
||||
#include "nsPluginHost.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include <prinrval.h>
|
||||
@ -78,7 +78,7 @@ PR_BEGIN_MACRO \
|
||||
nsresult res; \
|
||||
nsCOMPtr<nsIPluginHost> host(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID, &res));\
|
||||
if(NS_SUCCEEDED(res) && (host != nsnull)) \
|
||||
host->HandleBadPlugin(nsnull, pluginInst); \
|
||||
static_cast<nsPluginHost*>(host.get())->HandleBadPlugin(nsnull, pluginInst); \
|
||||
ret = (NPError)NS_ERROR_FAILURE; \
|
||||
} \
|
||||
} \
|
||||
@ -101,7 +101,7 @@ PR_BEGIN_MACRO \
|
||||
nsresult res; \
|
||||
nsCOMPtr<nsIPluginHost> host(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID, &res));\
|
||||
if(NS_SUCCEEDED(res) && (host != nsnull))\
|
||||
host->HandleBadPlugin(nsnull, pluginInst);\
|
||||
static_cast<nsPluginHost*>(host.get())->HandleBadPlugin(nsnull, pluginInst);\
|
||||
} \
|
||||
} \
|
||||
NS_NotifyPluginCall(startTime); \
|
||||
|
@ -643,9 +643,9 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request,
|
||||
// NOTE: we don't want to try again if we didn't get the MIME type this time
|
||||
|
||||
if (!mPluginInstance && mOwner && !aContentType.IsEmpty()) {
|
||||
nsCOMPtr<nsIPluginInstance> pluginInstCOMPtr;
|
||||
mOwner->GetInstance(getter_AddRefs(pluginInstCOMPtr));
|
||||
mPluginInstance = static_cast<nsNPAPIPluginInstance*>(pluginInstCOMPtr.get());
|
||||
nsRefPtr<nsNPAPIPluginInstance> pluginInstRefPtr;
|
||||
mOwner->GetInstance(getter_AddRefs(pluginInstRefPtr));
|
||||
mPluginInstance = pluginInstRefPtr.get();
|
||||
|
||||
mOwner->GetWindow(window);
|
||||
if (!mPluginInstance && window) {
|
||||
@ -666,8 +666,8 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request,
|
||||
}
|
||||
|
||||
if (NS_OK == rv) {
|
||||
mOwner->GetInstance(getter_AddRefs(pluginInstCOMPtr));
|
||||
mPluginInstance = static_cast<nsNPAPIPluginInstance*>(pluginInstCOMPtr.get());
|
||||
mOwner->GetInstance(getter_AddRefs(pluginInstRefPtr));
|
||||
mPluginInstance = pluginInstRefPtr.get();
|
||||
if (mPluginInstance) {
|
||||
mPluginInstance->Start();
|
||||
mOwner->CreateWidget();
|
||||
|
@ -115,9 +115,7 @@ ReplaceAll(const string& haystack, const string& needle, const string& with)
|
||||
string
|
||||
MungePluginDsoPath(const string& path)
|
||||
{
|
||||
#if defined(XP_WIN)
|
||||
return "\""+ path +"\"";
|
||||
#elif defined(OS_LINUX)
|
||||
#if defined(OS_LINUX)
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=519601
|
||||
return ReplaceAll(path, "netscape", "netsc@pe");
|
||||
#else
|
||||
|
@ -377,7 +377,7 @@ public class GeckoAppShell
|
||||
GeckoAppShell.setSurfaceView(GeckoApp.surfaceView);
|
||||
|
||||
// First argument is the .apk path
|
||||
String combinedArgs = apkPath + " -omnijar " + apkPath;
|
||||
String combinedArgs = apkPath + " -greomni " + apkPath;
|
||||
if (args != null)
|
||||
combinedArgs += " " + args;
|
||||
if (url != null)
|
||||
|
@ -3161,6 +3161,7 @@ _cairo_d2d_mask(void *surface,
|
||||
cairo_rectangle_int_t extents;
|
||||
|
||||
cairo_clip_t *actual_clip = clip;
|
||||
cairo_clip_t temporary_clip;
|
||||
|
||||
cairo_int_status_t status;
|
||||
|
||||
@ -3207,10 +3208,21 @@ _cairo_d2d_mask(void *surface,
|
||||
box.p2.y = MIN(box.p2.y, boxes->p2.y);
|
||||
|
||||
if (clip->path != d2dsurf->clip.path) {
|
||||
// Only reset the clip if we don't have the right clip set. Otherwise
|
||||
// just leave the clip as it is. If we have the right clip set we
|
||||
// should not do a needless pop of the clip.
|
||||
actual_clip = NULL;
|
||||
// If we have a clip set, but it's not the right one. We want to
|
||||
// pop as much as we need to, to be sure the area affected by
|
||||
// the operation is not clipped. To do this we set the clip path
|
||||
// to the common ancestor of the currently set clip path and the
|
||||
// clip path for this operation. This will cause
|
||||
// _cairo_d2d_set_clip to pop to that common ancestor, but not
|
||||
// needlessly push the additional clips we're trying to avoid.
|
||||
temporary_clip.path = find_common_ancestor(clip->path, d2dsurf->clip.path);
|
||||
|
||||
// We're not going to be using this down the line so it doesn't
|
||||
// really matter what the value is. If all -was- clipped this
|
||||
// call shouldn't even have reached the surface backend.
|
||||
temporary_clip.all_clipped = FALSE;
|
||||
|
||||
actual_clip = &temporary_clip;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,24 +264,55 @@ void CommandLine::AppendSwitch(const std::wstring& switch_string) {
|
||||
switches_[WideToASCII(switch_string)] = L"";
|
||||
}
|
||||
|
||||
void CommandLine::AppendSwitchWithValue(const std::wstring& switch_string,
|
||||
const std::wstring& value_string) {
|
||||
std::wstring value_string_edit;
|
||||
|
||||
// NOTE(jhughes): If the value contains a quotation mark at one
|
||||
// end but not both, you may get unusable output.
|
||||
if (!value_string.empty() &&
|
||||
(value_string.find(L" ") != std::wstring::npos) &&
|
||||
(value_string[0] != L'"') &&
|
||||
(value_string[value_string.length() - 1] != L'"')) {
|
||||
// need to provide quotes
|
||||
value_string_edit = StringPrintf(L"\"%ls\"", value_string.c_str());
|
||||
} else {
|
||||
value_string_edit = value_string;
|
||||
// Quote a string if necessary, such that CommandLineToArgvW() will
|
||||
// always process it as a single argument.
|
||||
static std::wstring WindowsStyleQuote(const std::wstring& arg) {
|
||||
// We follow the quoting rules of CommandLineToArgvW.
|
||||
// http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
|
||||
if (arg.find_first_of(L" \\\"\t") == std::wstring::npos) {
|
||||
// No quoting necessary.
|
||||
return arg;
|
||||
}
|
||||
|
||||
std::wstring out;
|
||||
out.push_back(L'"');
|
||||
for (size_t i = 0; i < arg.size(); ++i) {
|
||||
if (arg[i] == '\\') {
|
||||
// Find the extent of this run of backslashes.
|
||||
size_t start = i, end = start + 1;
|
||||
for (; end < arg.size() && arg[end] == '\\'; ++end)
|
||||
/* empty */;
|
||||
size_t backslash_count = end - start;
|
||||
|
||||
// Backslashes are escapes only if the run is followed by a double quote.
|
||||
// Since we also will end the string with a double quote, we escape for
|
||||
// either a double quote or the end of the string.
|
||||
if (end == arg.size() || arg[end] == '"') {
|
||||
// To quote, we need to output 2x as many backslashes.
|
||||
backslash_count *= 2;
|
||||
}
|
||||
for (size_t j = 0; j < backslash_count; ++j)
|
||||
out.push_back('\\');
|
||||
|
||||
// Advance i to one before the end to balance i++ in loop.
|
||||
i = end - 1;
|
||||
} else if (arg[i] == '"') {
|
||||
out.push_back('\\');
|
||||
out.push_back('"');
|
||||
} else {
|
||||
out.push_back(arg[i]);
|
||||
}
|
||||
}
|
||||
out.push_back('"');
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void CommandLine::AppendSwitchWithValue(const std::wstring& switch_string,
|
||||
const std::wstring& value_string) {
|
||||
std::wstring quoted_value_string = WindowsStyleQuote(value_string);
|
||||
std::wstring combined_switch_string =
|
||||
PrefixedSwitchStringWithValue(switch_string, value_string_edit);
|
||||
PrefixedSwitchStringWithValue(switch_string, quoted_value_string);
|
||||
|
||||
command_line_string_.append(L" ");
|
||||
command_line_string_.append(combined_switch_string);
|
||||
@ -290,9 +321,8 @@ void CommandLine::AppendSwitchWithValue(const std::wstring& switch_string,
|
||||
}
|
||||
|
||||
void CommandLine::AppendLooseValue(const std::wstring& value) {
|
||||
// TODO(evan): quoting?
|
||||
command_line_string_.append(L" ");
|
||||
command_line_string_.append(value);
|
||||
command_line_string_.append(WindowsStyleQuote(value));
|
||||
}
|
||||
|
||||
void CommandLine::AppendArguments(const CommandLine& other,
|
||||
|
@ -261,9 +261,7 @@ void GeckoChildProcessHost::InitWindowsGroupID()
|
||||
taskbarInfo->GetAvailable(&isSupported);
|
||||
nsAutoString appId;
|
||||
if (isSupported && NS_SUCCEEDED(taskbarInfo->GetDefaultGroupId(appId))) {
|
||||
mGroupId.Assign(PRUnichar('\"'));
|
||||
mGroupId.Append(appId);
|
||||
mGroupId.Append(PRUnichar('\"'));
|
||||
} else {
|
||||
mGroupId.AssignLiteral("-");
|
||||
}
|
||||
@ -492,16 +490,19 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
|
||||
|
||||
childArgv.insert(childArgv.end(), aExtraOpts.begin(), aExtraOpts.end());
|
||||
|
||||
#ifdef MOZ_OMNIJAR
|
||||
// Make sure the child process can find the omnijar
|
||||
// See XRE_InitCommandLine in nsAppRunner.cpp
|
||||
nsCAutoString omnijarPath;
|
||||
if (mozilla::OmnijarPath()) {
|
||||
mozilla::OmnijarPath()->GetNativePath(omnijarPath);
|
||||
childArgv.push_back("-omnijar");
|
||||
childArgv.push_back(omnijarPath.get());
|
||||
nsCAutoString path;
|
||||
nsCOMPtr<nsIFile> file = mozilla::Omnijar::GetPath(mozilla::Omnijar::GRE);
|
||||
if (file && NS_SUCCEEDED(file->GetNativePath(path))) {
|
||||
childArgv.push_back("-greomni");
|
||||
childArgv.push_back(path.get());
|
||||
}
|
||||
file = mozilla::Omnijar::GetPath(mozilla::Omnijar::APP);
|
||||
if (file && NS_SUCCEEDED(file->GetNativePath(path))) {
|
||||
childArgv.push_back("-appomni");
|
||||
childArgv.push_back(path.get());
|
||||
}
|
||||
#endif
|
||||
|
||||
childArgv.push_back(pidstring);
|
||||
|
||||
@ -604,16 +605,19 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
|
||||
|
||||
cmdLine.AppendLooseValue(std::wstring(mGroupId.get()));
|
||||
|
||||
#ifdef MOZ_OMNIJAR
|
||||
// Make sure the child process can find the omnijar
|
||||
// See XRE_InitCommandLine in nsAppRunner.cpp
|
||||
nsAutoString omnijarPath;
|
||||
if (mozilla::OmnijarPath()) {
|
||||
mozilla::OmnijarPath()->GetPath(omnijarPath);
|
||||
cmdLine.AppendLooseValue(UTF8ToWide("-omnijar"));
|
||||
cmdLine.AppendLooseValue(omnijarPath.get());
|
||||
nsAutoString path;
|
||||
nsCOMPtr<nsIFile> file = mozilla::Omnijar::GetPath(mozilla::Omnijar::GRE);
|
||||
if (file && NS_SUCCEEDED(file->GetPath(path))) {
|
||||
cmdLine.AppendLooseValue(UTF8ToWide("-greomni"));
|
||||
cmdLine.AppendLooseValue(path.get());
|
||||
}
|
||||
file = mozilla::Omnijar::GetPath(mozilla::Omnijar::APP);
|
||||
if (file && NS_SUCCEEDED(file->GetPath(path))) {
|
||||
cmdLine.AppendLooseValue(UTF8ToWide("-appomni"));
|
||||
cmdLine.AppendLooseValue(path.get());
|
||||
}
|
||||
#endif
|
||||
|
||||
cmdLine.AppendLooseValue(UTF8ToWide(pidstring));
|
||||
|
||||
|
@ -84,6 +84,7 @@
|
||||
#include "nsILocalFileWin.h"
|
||||
#endif
|
||||
#include "xpcprivate.h"
|
||||
#include "nsIResProtocolHandler.h"
|
||||
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
#include "mozilla/scache/StartupCache.h"
|
||||
@ -621,24 +622,11 @@ mozJSComponentLoader::LoadModuleFromJAR(nsILocalFile *aJarFile,
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCAutoString fullSpec;
|
||||
|
||||
#ifdef MOZ_OMNIJAR
|
||||
PRBool equal;
|
||||
rv = aJarFile->Equals(mozilla::OmnijarPath(), &equal);
|
||||
if (NS_SUCCEEDED(rv) && equal) {
|
||||
fullSpec = "resource://gre/";
|
||||
} else {
|
||||
#endif
|
||||
nsCAutoString fileSpec;
|
||||
NS_GetURLSpecFromActualFile(aJarFile, fileSpec);
|
||||
fullSpec = "jar:";
|
||||
fullSpec += fileSpec;
|
||||
fullSpec += "!/";
|
||||
#ifdef MOZ_OMNIJAR
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCAutoString fullSpec, fileSpec;
|
||||
NS_GetURLSpecFromActualFile(aJarFile, fileSpec);
|
||||
fullSpec = "jar:";
|
||||
fullSpec += fileSpec;
|
||||
fullSpec += "!/";
|
||||
fullSpec += aComponentPath;
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
@ -819,47 +807,128 @@ class JSPrincipalsHolder
|
||||
JSPrincipals *mPrincipals;
|
||||
};
|
||||
|
||||
static const char baseName[2][5] = { "gre/", "app/" };
|
||||
|
||||
static inline PRBool
|
||||
canonicalizeBase(nsCAutoString &spec, nsACString &out, mozilla::Omnijar::Type aType)
|
||||
{
|
||||
nsCAutoString base;
|
||||
nsresult rv = mozilla::Omnijar::GetURIString(aType, base);
|
||||
|
||||
if (NS_FAILED(rv) || !base.Length())
|
||||
return PR_FALSE;
|
||||
|
||||
if (base.Compare(spec.get(), PR_FALSE, base.Length()))
|
||||
return PR_FALSE;
|
||||
|
||||
out.Append("/resource/");
|
||||
out.Append(baseName[aType]);
|
||||
out.Append(Substring(spec, base.Length()));
|
||||
return PR_TRUE;
|
||||
}
|
||||
/**
|
||||
* PathifyURI transforms mozilla .js uris into useful zip paths
|
||||
* to make it makes it easier to manipulate startup cache entries
|
||||
* using standard zip tools.
|
||||
* Transformations applied:
|
||||
* * jsloader/<scheme> prefix is used to group mozJSComponentLoader cache entries in
|
||||
* * jsloader/ prefix is used to group mozJSComponentLoader cache entries in
|
||||
* a top-level zip directory.
|
||||
* * In MOZ_OMNIJAR case resource:/// and resource://gre/ URIs refer to the same path
|
||||
* so treat both of them as resource://gre/
|
||||
* * resource:// URIs are resolved to their corresponding file/jar URI to
|
||||
* canonicalize resources URIs other than gre and app.
|
||||
* * Paths under GRE or APP directory have their base path replaced with
|
||||
* resource/gre or resource/app to avoid depending on install location.
|
||||
* * jar:file:///path/to/file.jar!/sub/path urls are replaced with
|
||||
* /path/to/file.jar/sub/path
|
||||
* * .bin suffix is added to the end of the path to indicate that jsloader/ entries
|
||||
* are binary representations of JS source.
|
||||
* For example:
|
||||
* resource://gre/modules/XPCOMUtils.jsm becomes
|
||||
* jsloader/resource/gre/modules/XPCOMUtils.jsm.bin
|
||||
* resource://gre/modules/XPCOMUtils.jsm or
|
||||
* file://$GRE_DIR/modules/XPCOMUtils.jsm or
|
||||
* jar:file://$GRE_DIR/omni.jar!/modules/XPCOMUtils.jsm become
|
||||
* jsloader/resource/gre/modules/XPCOMUtils.jsm.bin
|
||||
* file://$PROFILE_DIR/extensions/{uuid}/components/component.js becomes
|
||||
* jsloader/$PROFILE_DIR/extensions/%7Buuid%7D/components/component.js.bin
|
||||
* jar:file://$PROFILE_DIR/extensions/some.xpi!/components/component.js becomes
|
||||
* jsloader/$PROFILE_DIR/extensions/some.xpi/components/component.js.bin
|
||||
*/
|
||||
static nsresult
|
||||
PathifyURI(nsIURI *in, nsACString &out)
|
||||
{
|
||||
out = "jsloader/";
|
||||
nsCAutoString scheme;
|
||||
nsresult rv = in->GetScheme(scheme);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
out.Append(scheme);
|
||||
nsCAutoString host;
|
||||
// OK for GetHost to fail since it's not implemented sometimes
|
||||
in->GetHost(host);
|
||||
#ifdef MOZ_OMNIJAR
|
||||
if (scheme.Equals("resource") && host.Length() == 0){
|
||||
host = "gre";
|
||||
}
|
||||
#endif
|
||||
if (host.Length()) {
|
||||
out.Append("/");
|
||||
out.Append(host);
|
||||
}
|
||||
nsCAutoString path;
|
||||
rv = in->GetPath(path);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
out.Append(path);
|
||||
out.Append(".bin");
|
||||
return NS_OK;
|
||||
PRBool equals;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURI> uri = in;
|
||||
nsCAutoString spec;
|
||||
|
||||
out = "jsloader";
|
||||
|
||||
// Resolve resource:// URIs. At the end of this if/else block, we
|
||||
// have both spec and uri variables identifying the same URI.
|
||||
if (NS_SUCCEEDED(in->SchemeIs("resource", &equals)) && equals) {
|
||||
nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIProtocolHandler> ph;
|
||||
rv = ioService->GetProtocolHandler("resource", getter_AddRefs(ph));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIResProtocolHandler> irph(do_QueryInterface(ph, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = irph->ResolveURI(in, spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = ioService->NewURI(spec, nsnull, nsnull, getter_AddRefs(uri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
rv = in->GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (!canonicalizeBase(spec, out, mozilla::Omnijar::GRE) &&
|
||||
!canonicalizeBase(spec, out, mozilla::Omnijar::APP)) {
|
||||
if (NS_SUCCEEDED(uri->SchemeIs("file", &equals)) && equals) {
|
||||
nsCOMPtr<nsIFileURL> baseFileURL;
|
||||
baseFileURL = do_QueryInterface(uri, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCAutoString path;
|
||||
rv = baseFileURL->GetPath(path);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
out.Append(path);
|
||||
} else if (NS_SUCCEEDED(uri->SchemeIs("jar", &equals)) && equals) {
|
||||
nsCOMPtr<nsIJARURI> jarURI = do_QueryInterface(uri, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> jarFileURI;
|
||||
rv = jarURI->GetJARFile(getter_AddRefs(jarFileURI));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIFileURL> jarFileURL;
|
||||
jarFileURL = do_QueryInterface(jarFileURI, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCAutoString path;
|
||||
rv = jarFileURL->GetPath(path);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
out.Append(path);
|
||||
|
||||
rv = jarURI->GetJAREntry(path);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
out.Append("/");
|
||||
out.Append(path);
|
||||
} else { // Very unlikely
|
||||
nsCAutoString spec;
|
||||
rv = uri->GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
out.Append("/");
|
||||
out.Append(spec);
|
||||
}
|
||||
}
|
||||
|
||||
out.Append(".bin");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -1150,7 +1150,7 @@ static int
|
||||
usage(void)
|
||||
{
|
||||
fprintf(gErrFile, "%s\n", JS_GetImplementationVersion());
|
||||
fprintf(gErrFile, "usage: xpcshell [-g gredir] [-r manifest]... [-PsSwWxCij] [-v version] [-f scriptfile] [-e script] [scriptfile] [scriptarg...]\n");
|
||||
fprintf(gErrFile, "usage: xpcshell [-g gredir] [-a appdir] [-r manifest]... [-PsSwWxCij] [-v version] [-f scriptfile] [-e script] [scriptfile] [scriptarg...]\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
@ -1810,6 +1810,23 @@ main(int argc, char **argv, char **envp)
|
||||
argv += 2;
|
||||
}
|
||||
|
||||
if (argc > 1 && !strcmp(argv[1], "-a")) {
|
||||
if (argc < 3)
|
||||
return usage();
|
||||
|
||||
nsCOMPtr<nsILocalFile> dir;
|
||||
rv = XRE_GetFileFromPath(argv[2], getter_AddRefs(dir));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
appDir = do_QueryInterface(dir, &rv);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
printf("Couldn't use given appdir.\n");
|
||||
return 1;
|
||||
}
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
}
|
||||
|
||||
while (argc > 1 && !strcmp(argv[1], "-r")) {
|
||||
if (argc < 3)
|
||||
return usage();
|
||||
|
@ -148,7 +148,7 @@
|
||||
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsIObjectLoadingContent.h"
|
||||
#include "nsNetUtil.h"
|
||||
@ -7760,7 +7760,7 @@ ThawElement(nsIContent *aContent, void *aShell)
|
||||
{
|
||||
nsCOMPtr<nsIObjectLoadingContent> objlc(do_QueryInterface(aContent));
|
||||
if (objlc) {
|
||||
nsCOMPtr<nsIPluginInstance> inst;
|
||||
nsRefPtr<nsNPAPIPluginInstance> inst;
|
||||
objlc->EnsureInstantiation(getter_AddRefs(inst));
|
||||
}
|
||||
}
|
||||
|
@ -45,14 +45,14 @@
|
||||
|
||||
#include "nsIFrame.h"
|
||||
|
||||
class nsIPluginInstance;
|
||||
class nsNPAPIPluginInstance;
|
||||
|
||||
class nsIObjectFrame : public nsQueryFrame
|
||||
{
|
||||
public:
|
||||
NS_DECL_QUERYFRAME_TARGET(nsIObjectFrame)
|
||||
|
||||
NS_IMETHOD GetPluginInstance(nsIPluginInstance*& aPluginInstance) = 0;
|
||||
NS_IMETHOD GetPluginInstance(nsNPAPIPluginInstance** aPluginInstance) = 0;
|
||||
|
||||
/**
|
||||
* Instantiate a plugin for a channel, returning a stream listener for the
|
||||
|
@ -87,7 +87,6 @@ enum { XKeyPress = KeyPress };
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIPluginInstanceOwner.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
#include "nsIPluginTagInfo.h"
|
||||
#include "plstr.h"
|
||||
@ -283,8 +282,6 @@ public:
|
||||
virtual ~nsPluginInstanceOwner();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
//nsIPluginInstanceOwner interface
|
||||
NS_DECL_NSIPLUGININSTANCEOWNER
|
||||
|
||||
NS_IMETHOD GetURL(const char *aURL, const char *aTarget,
|
||||
@ -435,6 +432,7 @@ public:
|
||||
aDescription.Truncate();
|
||||
if (mInstance && mPluginHost) {
|
||||
nsCOMPtr<nsIPluginTag> pluginTag;
|
||||
|
||||
mPluginHost->GetPluginTagForInstance(mInstance,
|
||||
getter_AddRefs(pluginTag));
|
||||
if (pluginTag) {
|
||||
@ -509,13 +507,13 @@ private:
|
||||
void FixUpURLS(const nsString &name, nsAString &value);
|
||||
|
||||
nsPluginNativeWindow *mPluginWindow;
|
||||
nsCOMPtr<nsIPluginInstance> mInstance;
|
||||
nsRefPtr<nsNPAPIPluginInstance> mInstance;
|
||||
nsObjectFrame *mObjectFrame; // owns nsPluginInstanceOwner
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
nsCString mDocumentBase;
|
||||
char *mTagText;
|
||||
nsCOMPtr<nsIWidget> mWidget;
|
||||
nsCOMPtr<nsIPluginHost> mPluginHost;
|
||||
nsRefPtr<nsPluginHost> mPluginHost;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
NP_CGContext mCGPluginPortCopy;
|
||||
@ -1183,9 +1181,9 @@ nsObjectFrame::CallSetWindow(PRBool aCheckIsHidden)
|
||||
NPWindow *win = nsnull;
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIPluginInstance> pi;
|
||||
nsRefPtr<nsNPAPIPluginInstance> pi;
|
||||
if (!mInstanceOwner ||
|
||||
NS_FAILED(rv = mInstanceOwner->GetInstance(*getter_AddRefs(pi))) ||
|
||||
NS_FAILED(rv = mInstanceOwner->GetInstance(getter_AddRefs(pi))) ||
|
||||
!pi ||
|
||||
NS_FAILED(rv = mInstanceOwner->GetWindow(win)) ||
|
||||
!win)
|
||||
@ -1575,8 +1573,8 @@ nsObjectFrame::IsTransparentMode() const
|
||||
return PR_FALSE;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPluginInstance> pi;
|
||||
rv = mInstanceOwner->GetInstance(*getter_AddRefs(pi));
|
||||
nsRefPtr<nsNPAPIPluginInstance> pi;
|
||||
rv = mInstanceOwner->GetInstance(getter_AddRefs(pi));
|
||||
if (NS_FAILED(rv) || !pi)
|
||||
return PR_FALSE;
|
||||
|
||||
@ -1693,8 +1691,8 @@ nsObjectFrame::PrintPlugin(nsRenderingContext& aRenderingContext,
|
||||
return;
|
||||
|
||||
// finally we can get our plugin instance
|
||||
nsCOMPtr<nsIPluginInstance> pi;
|
||||
if (NS_FAILED(objectFrame->GetPluginInstance(*getter_AddRefs(pi))) || !pi)
|
||||
nsRefPtr<nsNPAPIPluginInstance> pi;
|
||||
if (NS_FAILED(objectFrame->GetPluginInstance(getter_AddRefs(pi))) || !pi)
|
||||
return;
|
||||
|
||||
// now we need to setup the correct location for printing
|
||||
@ -2233,8 +2231,8 @@ nsObjectFrame::PaintPlugin(nsDisplayListBuilder* aBuilder,
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> inst;
|
||||
GetPluginInstance(*getter_AddRefs(inst));
|
||||
nsRefPtr<nsNPAPIPluginInstance> inst;
|
||||
GetPluginInstance(getter_AddRefs(inst));
|
||||
if (!inst) {
|
||||
NS_WARNING("null plugin instance during PaintPlugin");
|
||||
nativeDrawing.EndNativeDrawing();
|
||||
@ -2320,8 +2318,8 @@ nsObjectFrame::PaintPlugin(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
}
|
||||
#elif defined(XP_WIN)
|
||||
nsCOMPtr<nsIPluginInstance> inst;
|
||||
GetPluginInstance(*getter_AddRefs(inst));
|
||||
nsRefPtr<nsNPAPIPluginInstance> inst;
|
||||
GetPluginInstance(getter_AddRefs(inst));
|
||||
if (inst) {
|
||||
gfxRect frameGfxRect =
|
||||
PresContext()->AppUnitsToGfxUnits(aPluginRect);
|
||||
@ -2424,8 +2422,8 @@ nsObjectFrame::PaintPlugin(nsDisplayListBuilder* aBuilder,
|
||||
ctx->SetMatrix(currentMatrix);
|
||||
}
|
||||
#elif defined(XP_OS2)
|
||||
nsCOMPtr<nsIPluginInstance> inst;
|
||||
GetPluginInstance(*getter_AddRefs(inst));
|
||||
nsRefPtr<nsNPAPIPluginInstance> inst;
|
||||
GetPluginInstance(getter_AddRefs(inst));
|
||||
if (inst) {
|
||||
// Look if it's windowless
|
||||
NPWindow *window;
|
||||
@ -2588,9 +2586,9 @@ nsObjectFrame::HandlePress(nsPresContext* aPresContext,
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsObjectFrame::GetPluginInstance(nsIPluginInstance*& aPluginInstance)
|
||||
nsObjectFrame::GetPluginInstance(nsNPAPIPluginInstance** aPluginInstance)
|
||||
{
|
||||
aPluginInstance = nsnull;
|
||||
*aPluginInstance = nsnull;
|
||||
|
||||
if (!mInstanceOwner)
|
||||
return NS_OK;
|
||||
@ -2746,8 +2744,8 @@ nsObjectFrame::Instantiate(const char* aMimeType, nsIURI* aURI)
|
||||
void
|
||||
nsObjectFrame::TryNotifyContentObjectWrapper()
|
||||
{
|
||||
nsCOMPtr<nsIPluginInstance> inst;
|
||||
mInstanceOwner->GetInstance(*getter_AddRefs(inst));
|
||||
nsRefPtr<nsNPAPIPluginInstance> inst;
|
||||
mInstanceOwner->GetInstance(getter_AddRefs(inst));
|
||||
if (inst) {
|
||||
// The plugin may have set up new interfaces; we need to mess with our JS
|
||||
// wrapper. Note that we DO NOT want to call this if there is no plugin
|
||||
@ -2783,7 +2781,7 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsStopPluginRunnable, nsRunnable, nsITimerCallback)
|
||||
|
||||
#if defined(XP_MACOSX) || defined (XP_WIN)
|
||||
static const char*
|
||||
GetMIMEType(nsIPluginInstance *aPluginInstance)
|
||||
GetMIMEType(nsNPAPIPluginInstance *aPluginInstance)
|
||||
{
|
||||
if (aPluginInstance) {
|
||||
const char* mime = nsnull;
|
||||
@ -2823,13 +2821,13 @@ DoDelayedStop(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop)
|
||||
static void
|
||||
DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop)
|
||||
{
|
||||
nsCOMPtr<nsIPluginInstance> inst;
|
||||
aInstanceOwner->GetInstance(*getter_AddRefs(inst));
|
||||
nsRefPtr<nsNPAPIPluginInstance> inst;
|
||||
aInstanceOwner->GetInstance(getter_AddRefs(inst));
|
||||
if (inst) {
|
||||
NPWindow *win;
|
||||
aInstanceOwner->GetWindow(win);
|
||||
nsPluginNativeWindow *window = (nsPluginNativeWindow *)win;
|
||||
nsCOMPtr<nsIPluginInstance> nullinst;
|
||||
nsRefPtr<nsNPAPIPluginInstance> nullinst;
|
||||
|
||||
if (window)
|
||||
window->CallSetWindow(nullinst);
|
||||
@ -2845,7 +2843,7 @@ DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop)
|
||||
|
||||
nsCOMPtr<nsIPluginHost> pluginHost = do_GetService(MOZ_PLUGIN_HOST_CONTRACTID);
|
||||
NS_ASSERTION(pluginHost, "Without a pluginHost, how can we have an instance to destroy?");
|
||||
pluginHost->StopPluginInstance(inst);
|
||||
static_cast<nsPluginHost*>(pluginHost.get())->StopPluginInstance(inst);
|
||||
|
||||
// the frame is going away along with its widget so tell the
|
||||
// window to forget its widget too
|
||||
@ -2900,9 +2898,9 @@ nsObjectFrame::StopPlugin()
|
||||
{
|
||||
PRBool delayedStop = PR_FALSE;
|
||||
#ifdef XP_WIN
|
||||
nsCOMPtr<nsIPluginInstance> inst;
|
||||
nsRefPtr<nsNPAPIPluginInstance> inst;
|
||||
if (mInstanceOwner)
|
||||
mInstanceOwner->GetInstance(*getter_AddRefs(inst));
|
||||
mInstanceOwner->GetInstance(getter_AddRefs(inst));
|
||||
if (inst) {
|
||||
// Delayed stop for Real plugin only; see bug 420886, 426852.
|
||||
const char* pluginType = ::GetMIMEType(inst);
|
||||
@ -2995,8 +2993,8 @@ nsObjectFrame::GetCursor(const nsPoint& aPoint, nsIFrame::Cursor& aCursor)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPluginInstance> inst;
|
||||
mInstanceOwner->GetInstance(*getter_AddRefs(inst));
|
||||
nsRefPtr<nsNPAPIPluginInstance> inst;
|
||||
mInstanceOwner->GetInstance(getter_AddRefs(inst));
|
||||
if (!inst) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -3055,8 +3053,8 @@ nsObjectFrame::GetNextObjectFrame(nsPresContext* aPresContext, nsIFrame* aRoot)
|
||||
while (child) {
|
||||
nsIObjectFrame* outFrame = do_QueryFrame(child);
|
||||
if (outFrame) {
|
||||
nsCOMPtr<nsIPluginInstance> pi;
|
||||
outFrame->GetPluginInstance(*getter_AddRefs(pi)); // make sure we have a REAL plugin
|
||||
nsRefPtr<nsNPAPIPluginInstance> pi;
|
||||
outFrame->GetPluginInstance(getter_AddRefs(pi)); // make sure we have a REAL plugin
|
||||
if (pi)
|
||||
return outFrame;
|
||||
}
|
||||
@ -3311,8 +3309,8 @@ NS_INTERFACE_MAP_BEGIN(nsPluginInstanceOwner)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPluginInstanceOwner)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginInstanceOwner::SetInstance(nsIPluginInstance *aInstance)
|
||||
nsresult
|
||||
nsPluginInstanceOwner::SetInstance(nsNPAPIPluginInstance *aInstance)
|
||||
{
|
||||
NS_ASSERTION(!mInstance || !aInstance, "mInstance should only be set or unset!");
|
||||
|
||||
@ -3388,10 +3386,12 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetDOMElement(nsIDOMElement* *result)
|
||||
return CallQueryInterface(mContent, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::GetInstance(nsIPluginInstance *&aInstance)
|
||||
nsresult nsPluginInstanceOwner::GetInstance(nsNPAPIPluginInstance **aInstance)
|
||||
{
|
||||
NS_IF_ADDREF(aInstance = mInstance);
|
||||
NS_ENSURE_ARG_POINTER(aInstance);
|
||||
|
||||
NS_IF_ADDREF(mInstance);
|
||||
*aInstance = mInstance;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -6350,7 +6350,7 @@ nsPluginInstanceOwner::Renderer::DrawWithXlib(gfxXlibSurface* xsurface,
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsIPluginInstance *instance = mInstanceOwner->mInstance;
|
||||
nsNPAPIPluginInstance *instance = mInstanceOwner->mInstance;
|
||||
if (!instance)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -6738,7 +6738,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
|
||||
|
||||
void nsPluginInstanceOwner::SetPluginHost(nsIPluginHost* aHost)
|
||||
{
|
||||
mPluginHost = aHost;
|
||||
mPluginHost = static_cast<nsPluginHost*>(aHost);
|
||||
}
|
||||
|
||||
#ifdef MOZ_USE_IMAGE_EXPOSE
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
|
||||
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
|
||||
|
||||
NS_IMETHOD GetPluginInstance(nsIPluginInstance*& aPluginInstance);
|
||||
NS_METHOD GetPluginInstance(nsNPAPIPluginInstance** aPluginInstance);
|
||||
virtual nsresult Instantiate(nsIChannel* aChannel, nsIStreamListener** aStreamListener);
|
||||
virtual nsresult Instantiate(const char* aMimeType, nsIURI* aURI);
|
||||
virtual void TryNotifyContentObjectWrapper();
|
||||
|
@ -177,16 +177,13 @@ nsJAR::Open(nsIFile* zipFile)
|
||||
mOuterZipEntry.Truncate();
|
||||
mOpened = PR_TRUE;
|
||||
|
||||
#ifdef MOZ_OMNIJAR
|
||||
// The omnijar is special, it is opened early on and closed late
|
||||
// this avoids reopening it
|
||||
PRBool equals;
|
||||
nsresult rv = zipFile->Equals(mozilla::OmnijarPath(), &equals);
|
||||
if (NS_SUCCEEDED(rv) && equals) {
|
||||
mZip = mozilla::OmnijarReader();
|
||||
nsZipArchive *zip = mozilla::Omnijar::GetReader(zipFile);
|
||||
if (zip) {
|
||||
mZip = zip;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
return mZip->OpenArchive(zipFile);
|
||||
}
|
||||
|
||||
@ -235,13 +232,12 @@ nsJAR::Close()
|
||||
mGlobalStatus = JAR_MANIFEST_NOT_PARSED;
|
||||
mTotalItemsInManifest = 0;
|
||||
|
||||
#ifdef MOZ_OMNIJAR
|
||||
if (mZip == mozilla::OmnijarReader()) {
|
||||
if ((mZip == mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE)) ||
|
||||
(mZip == mozilla::Omnijar::GetReader(mozilla::Omnijar::APP))) {
|
||||
mZip.forget();
|
||||
mZip = new nsZipArchive();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
return mZip->CloseArchive();
|
||||
}
|
||||
|
||||
@ -392,12 +388,11 @@ nsJAR::GetCertificatePrincipal(const char* aFilename, nsIPrincipal** aPrincipal)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*aPrincipal = nsnull;
|
||||
|
||||
#ifdef MOZ_OMNIJAR
|
||||
// Don't check signatures in the omnijar - this is only
|
||||
// interesting for extensions/XPIs.
|
||||
if (mZip == mozilla::OmnijarReader())
|
||||
if ((mZip == mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE)) ||
|
||||
(mZip == mozilla::Omnijar::GetReader(mozilla::Omnijar::APP)))
|
||||
return NS_OK;
|
||||
#endif
|
||||
|
||||
//-- Parse the manifest
|
||||
nsresult rv = ParseManifest();
|
||||
|
@ -70,10 +70,8 @@
|
||||
|
||||
#include "nsITimelineService.h"
|
||||
|
||||
#ifdef MOZ_OMNIJAR
|
||||
#include "mozilla/Omnijar.h"
|
||||
#include "nsZipArchive.h"
|
||||
#endif
|
||||
|
||||
// Definitions
|
||||
#define INITIAL_PREF_FILES 10
|
||||
@ -784,30 +782,6 @@ static nsresult pref_LoadPrefsInDirList(const char *listId)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Initialize default preference JavaScript buffers from
|
||||
// appropriate TEXT resources
|
||||
//----------------------------------------------------------------------------------------
|
||||
static nsresult pref_InitDefaults()
|
||||
{
|
||||
nsCOMPtr<nsIFile> greprefsFile;
|
||||
nsresult rv;
|
||||
|
||||
rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(greprefsFile));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = greprefsFile->AppendNative(NS_LITERAL_CSTRING("greprefs.js"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = openPrefFile(greprefsFile);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Error parsing GRE default preferences. Is this an old-style embedding app?");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OMNIJAR
|
||||
static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name)
|
||||
{
|
||||
nsZipItemPtr<char> manifest(jarReader, name, true);
|
||||
@ -821,77 +795,121 @@ static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name)
|
||||
return rv;
|
||||
}
|
||||
|
||||
static nsresult pref_InitAppDefaultsFromOmnijar()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsZipArchive* jarReader = mozilla::OmnijarReader();
|
||||
if (!jarReader)
|
||||
return pref_InitDefaults();
|
||||
|
||||
rv = pref_ReadPrefFromJar(jarReader, "greprefs.js");
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsZipFind *findPtr;
|
||||
rv = jarReader->FindInit("defaults/pref/*.js$", &findPtr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<nsZipFind> find(findPtr);
|
||||
|
||||
nsTArray<nsCString> prefEntries;
|
||||
const char *entryName;
|
||||
PRUint16 entryNameLen;
|
||||
while (NS_SUCCEEDED(find->FindNext(&entryName, &entryNameLen))) {
|
||||
prefEntries.AppendElement(Substring(entryName, entryName + entryNameLen));
|
||||
}
|
||||
|
||||
prefEntries.Sort();
|
||||
for (PRUint32 i = prefEntries.Length(); i--; ) {
|
||||
rv = pref_ReadPrefFromJar(jarReader, prefEntries[i].get());
|
||||
if (NS_FAILED(rv))
|
||||
NS_WARNING("Error parsing preferences.");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Initialize default preference JavaScript buffers from
|
||||
// appropriate TEXT resources
|
||||
//----------------------------------------------------------------------------------------
|
||||
static nsresult pref_InitInitialObjects()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// first we parse the GRE default prefs. This also works if we're not using a GRE,
|
||||
#ifdef MOZ_OMNIJAR
|
||||
rv = pref_InitAppDefaultsFromOmnijar();
|
||||
#else
|
||||
rv = pref_InitDefaults();
|
||||
#endif
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// In omni.jar case, we load the following prefs:
|
||||
// - jar:$gre/omni.jar!/greprefs.js
|
||||
// - jar:$gre/omni.jar!/defaults/pref/*.js
|
||||
// In non omni.jar case, we load:
|
||||
// - $gre/greprefs.js
|
||||
//
|
||||
// When $app == $gre, we additionally load, in all cases:
|
||||
// - $gre/defaults/pref/*.js
|
||||
// This is kept for bug 591866 (channel-prefs.js should not be in omni.jar).
|
||||
// We load all files instead of channel-prefs.js only to have the same
|
||||
// behaviour as $app != $gre.
|
||||
//
|
||||
// When $app != $gre, we additionally load, in omni.jar case:
|
||||
// - jar:$app/omni.jar!/defaults/preferences/*.js
|
||||
// - $app/defaults/preferences/*.js
|
||||
// and in non omni.jar case:
|
||||
// - $app/defaults/preferences/*.js
|
||||
|
||||
nsCOMPtr<nsIFile> defaultPrefDir;
|
||||
// now parse the "application" default preferences
|
||||
rv = NS_GetSpecialDirectory(NS_APP_PREF_DEFAULTS_50_DIR, getter_AddRefs(defaultPrefDir));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsZipFind *findPtr;
|
||||
nsAutoPtr<nsZipFind> find;
|
||||
nsTArray<nsCString> prefEntries;
|
||||
const char *entryName;
|
||||
PRUint16 entryNameLen;
|
||||
|
||||
/* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */
|
||||
static const char* specialFiles[] = {
|
||||
nsZipArchive* jarReader = mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE);
|
||||
if (jarReader) {
|
||||
// Load jar:$gre/omni.jar!/greprefs.js
|
||||
rv = pref_ReadPrefFromJar(jarReader, "greprefs.js");
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Load jar:$gre/omni.jar!/defaults/pref/*.js
|
||||
rv = jarReader->FindInit("defaults/pref/*.js$", &findPtr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
find = findPtr;
|
||||
while (NS_SUCCEEDED(find->FindNext(&entryName, &entryNameLen))) {
|
||||
prefEntries.AppendElement(Substring(entryName, entryName + entryNameLen));
|
||||
}
|
||||
|
||||
prefEntries.Sort();
|
||||
for (PRUint32 i = prefEntries.Length(); i--; ) {
|
||||
rv = pref_ReadPrefFromJar(jarReader, prefEntries[i].get());
|
||||
if (NS_FAILED(rv))
|
||||
NS_WARNING("Error parsing preferences.");
|
||||
}
|
||||
} else {
|
||||
// Load $gre/greprefs.js
|
||||
nsCOMPtr<nsIFile> greprefsFile;
|
||||
rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(greprefsFile));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = greprefsFile->AppendNative(NS_LITERAL_CSTRING("greprefs.js"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = openPrefFile(greprefsFile);
|
||||
if (NS_FAILED(rv))
|
||||
NS_WARNING("Error parsing GRE default preferences. Is this an old-style embedding app?");
|
||||
}
|
||||
|
||||
if (!mozilla::Omnijar::HasOmnijar(mozilla::Omnijar::APP)) {
|
||||
// Load $gre/defaults/pref/*.js
|
||||
nsCOMPtr<nsIFile> defaultPrefDir;
|
||||
|
||||
rv = NS_GetSpecialDirectory(NS_APP_PREF_DEFAULTS_50_DIR, getter_AddRefs(defaultPrefDir));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
/* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */
|
||||
static const char* specialFiles[] = {
|
||||
#if defined(XP_MACOSX)
|
||||
"macprefs.js"
|
||||
#elif defined(XP_WIN)
|
||||
"winpref.js"
|
||||
#elif defined(XP_UNIX)
|
||||
"unix.js"
|
||||
#if defined(_AIX)
|
||||
#if defined(VMS)
|
||||
, "openvms.js"
|
||||
#elif defined(_AIX)
|
||||
, "aix.js"
|
||||
#endif
|
||||
#elif defined(XP_OS2)
|
||||
"os2pref.js"
|
||||
#elif defined(XP_BEOS)
|
||||
"beos.js"
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, NS_ARRAY_LENGTH(specialFiles));
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Error parsing application default preferences.");
|
||||
rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, NS_ARRAY_LENGTH(specialFiles));
|
||||
if (NS_FAILED(rv))
|
||||
NS_WARNING("Error parsing application default preferences.");
|
||||
}
|
||||
|
||||
// Load jar:$app/omni.jar!/defaults/preferences/*.js
|
||||
nsZipArchive *appJarReader = mozilla::Omnijar::GetReader(mozilla::Omnijar::APP);
|
||||
if (appJarReader) {
|
||||
rv = appJarReader->FindInit("defaults/preferences/*.js$", &findPtr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
find = findPtr;
|
||||
prefEntries.Clear();
|
||||
while (NS_SUCCEEDED(find->FindNext(&entryName, &entryNameLen))) {
|
||||
prefEntries.AppendElement(Substring(entryName, entryName + entryNameLen));
|
||||
}
|
||||
prefEntries.Sort();
|
||||
for (PRUint32 i = prefEntries.Length(); i--; ) {
|
||||
rv = pref_ReadPrefFromJar(appJarReader, prefEntries[i].get());
|
||||
if (NS_FAILED(rv))
|
||||
NS_WARNING("Error parsing preferences.");
|
||||
}
|
||||
}
|
||||
|
||||
rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST);
|
||||
|
@ -76,6 +76,7 @@ static nsResProtocolHandler *gResHandler = nsnull;
|
||||
static PRLogModuleInfo *gResLog;
|
||||
#endif
|
||||
|
||||
#define kAPP NS_LITERAL_CSTRING("app")
|
||||
#define kGRE NS_LITERAL_CSTRING("gre")
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@ -153,20 +154,6 @@ nsResProtocolHandler::~nsResProtocolHandler()
|
||||
gResHandler = nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsResProtocolHandler::AddSpecialDir(const char* aSpecialDir, const nsACString& aSubstitution)
|
||||
{
|
||||
nsCOMPtr<nsIFile> file;
|
||||
nsresult rv = NS_GetSpecialDirectory(aSpecialDir, getter_AddRefs(file));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = mIOService->NewFileURI(file, getter_AddRefs(uri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return SetSubstitution(aSubstitution, uri);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsResProtocolHandler::Init()
|
||||
{
|
||||
@ -178,24 +165,37 @@ nsResProtocolHandler::Init()
|
||||
mIOService = do_GetIOService(&rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
#ifdef MOZ_OMNIJAR
|
||||
nsCOMPtr<nsIFile> omniJar(mozilla::OmnijarPath());
|
||||
if (omniJar)
|
||||
return Init(omniJar);
|
||||
#endif
|
||||
|
||||
// these entries should be kept in sync with the omnijar Init function
|
||||
nsCAutoString appURI, greURI;
|
||||
rv = mozilla::Omnijar::GetURIString(mozilla::Omnijar::APP, appURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = mozilla::Omnijar::GetURIString(mozilla::Omnijar::GRE, greURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
//
|
||||
// make resource:/// point to the application directory
|
||||
// make resource:/// point to the application directory or omnijar
|
||||
//
|
||||
rv = AddSpecialDir(NS_OS_CURRENT_PROCESS_DIR, EmptyCString());
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = NS_NewURI(getter_AddRefs(uri), appURI.Length() ? appURI : greURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = SetSubstitution(EmptyCString(), uri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
//
|
||||
// make resource://app/ point to the application directory or omnijar
|
||||
//
|
||||
rv = SetSubstitution(kAPP, uri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
//
|
||||
// make resource://gre/ point to the GRE directory
|
||||
//
|
||||
rv = AddSpecialDir(NS_GRE_DIR, kGRE);
|
||||
if (appURI.Length()) { // We already have greURI in uri if appURI.Length() is 0.
|
||||
rv = NS_NewURI(getter_AddRefs(uri), greURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
rv = SetSubstitution(kGRE, uri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
//XXXbsmedberg Neil wants a resource://pchrome/ for the profile chrome dir...
|
||||
@ -207,34 +207,6 @@ nsResProtocolHandler::Init()
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OMNIJAR
|
||||
nsresult
|
||||
nsResProtocolHandler::Init(nsIFile *aOmniJar)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsCAutoString omniJarSpec;
|
||||
NS_GetURLSpecFromActualFile(aOmniJar, omniJarSpec, mIOService);
|
||||
|
||||
nsCAutoString urlStr("jar:");
|
||||
urlStr += omniJarSpec;
|
||||
urlStr += "!/";
|
||||
|
||||
rv = mIOService->NewURI(urlStr, nsnull, nsnull, getter_AddRefs(uri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// these entries should be kept in sync with the normal Init function
|
||||
|
||||
// resource:/// points to jar:omni.jar!/
|
||||
SetSubstitution(EmptyCString(), uri);
|
||||
|
||||
// resource://gre/ points to jar:omni.jar!/
|
||||
SetSubstitution(kGRE, uri);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
static PLDHashOperator
|
||||
EnumerateSubstitution(const nsACString& aKey,
|
||||
nsIURI* aURI,
|
||||
|
@ -767,7 +767,7 @@ ChildProcessInit(int argc, char* argv[])
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < (argc - 1); i++) {
|
||||
if (strcmp(argv[i], "-omnijar"))
|
||||
if (strcmp(argv[i], "-greomni"))
|
||||
continue;
|
||||
|
||||
i = i + 1;
|
||||
|
@ -1,9 +1,10 @@
|
||||
error.login.reason.network = Failed to connect to the server
|
||||
error.login.reason.synckey = Wrong Sync Key
|
||||
error.login.reason.account = Incorrect account name or password
|
||||
error.login.reason.no_password= No saved password to use
|
||||
error.login.reason.no_synckey = No saved Sync Key to use
|
||||
error.login.reason.server = Server incorrectly configured
|
||||
error.login.reason.network = Failed to connect to the server
|
||||
error.login.reason.synckey = Wrong Sync Key
|
||||
error.login.reason.account = Incorrect account name or password
|
||||
error.login.reason.no_username = Missing account name
|
||||
error.login.reason.no_password2 = Missing password
|
||||
error.login.reason.no_synckey = No saved Sync Key to use
|
||||
error.login.reason.server = Server incorrectly configured
|
||||
|
||||
error.sync.failed_partial = One or more data types could not be synced
|
||||
|
||||
|
@ -149,7 +149,7 @@ ENGINE_SUCCEEDED: "success.engine",
|
||||
|
||||
// login failure status codes:
|
||||
LOGIN_FAILED_NO_USERNAME: "error.login.reason.no_username",
|
||||
LOGIN_FAILED_NO_PASSWORD: "error.login.reason.no_password",
|
||||
LOGIN_FAILED_NO_PASSWORD: "error.login.reason.no_password2",
|
||||
LOGIN_FAILED_NO_PASSPHRASE: "error.login.reason.no_synckey",
|
||||
LOGIN_FAILED_NETWORK_ERROR: "error.login.reason.network",
|
||||
LOGIN_FAILED_SERVER_ERROR: "error.login.reason.server",
|
||||
|
@ -250,17 +250,26 @@ StartupCache::GetBuffer(const char* id, char** outbuf, PRUint32* length)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OMNIJAR
|
||||
if (mozilla::OmnijarReader()) {
|
||||
if (mozilla::Omnijar::GetReader(mozilla::Omnijar::APP)) {
|
||||
// no need to checksum omnijarred entries
|
||||
nsZipItemPtr<char> zipItem(mozilla::OmnijarReader(), id);
|
||||
nsZipItemPtr<char> zipItem(mozilla::Omnijar::GetReader(mozilla::Omnijar::APP), id);
|
||||
if (zipItem) {
|
||||
*outbuf = zipItem.Forget();
|
||||
*length = zipItem.Length();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE)) {
|
||||
// no need to checksum omnijarred entries
|
||||
nsZipItemPtr<char> zipItem(mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE), id);
|
||||
if (zipItem) {
|
||||
*outbuf = zipItem.Forget();
|
||||
*length = zipItem.Length();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
http://hg.mozilla.org/projects/addon-sdk/archive/57c1bcf4c033.tar.bz2
|
||||
http://hg.mozilla.org/projects/addon-sdk/archive/b790c159474d.tar.bz2
|
@ -86,7 +86,6 @@ _SERV_FILES = \
|
||||
$(topsrcdir)/build/mobile/remoteautomation.py \
|
||||
gen_template.pl \
|
||||
server.js \
|
||||
harness-a11y.xul \
|
||||
harness-overlay.xul \
|
||||
harness.xul \
|
||||
browser-test-overlay.xul \
|
||||
@ -95,7 +94,6 @@ _SERV_FILES = \
|
||||
ipc-overlay.xul \
|
||||
ipc.js \
|
||||
browser-harness.xul \
|
||||
redirect-a11y.html \
|
||||
redirect.html \
|
||||
redirect.js \
|
||||
$(topsrcdir)/build/pgo/server-locations.txt \
|
||||
|
@ -104,13 +104,13 @@
|
||||
var gDumper = {
|
||||
get fileLogger() {
|
||||
let logger = null;
|
||||
if (gConfig.logPath) {
|
||||
if (gConfig.logFile) {
|
||||
try {
|
||||
MozillaFileLogger.init(gConfig.logPath);
|
||||
MozillaFileLogger.init(gConfig.logFile);
|
||||
logger = MozillaFileLogger;
|
||||
} catch (ex) {
|
||||
dump("TEST-UNEXPECTED-FAIL | (browser-harness.xul) | " +
|
||||
"Error trying to log to " + gConfig.logPath + ": " + ex + "\n");
|
||||
"Error trying to log to " + gConfig.logFile + ": " + ex + "\n");
|
||||
}
|
||||
}
|
||||
delete this.fileLogger;
|
||||
@ -140,39 +140,10 @@
|
||||
document.getElementById("runTestsButton").label =
|
||||
"Run " + gConfig.testPath + " tests";
|
||||
|
||||
if (gConfig.autoRun)
|
||||
if (gConfig.autorun)
|
||||
setTimeout(runTests, 0);
|
||||
}
|
||||
|
||||
function readConfig() {
|
||||
var fileLocator = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
var configFile = fileLocator.get("ProfD", Ci.nsIFile);
|
||||
configFile.append("testConfig.js");
|
||||
|
||||
if (!configFile.exists())
|
||||
return;
|
||||
|
||||
var fileInStream = Cc["@mozilla.org/network/file-input-stream;1"].
|
||||
createInstance(Ci.nsIFileInputStream);
|
||||
var sstream = Cc["@mozilla.org/scriptableinputstream;1"].
|
||||
createInstance(Ci.nsIScriptableInputStream);
|
||||
fileInStream.init(configFile, -1, 0, 0);
|
||||
sstream.init(fileInStream);
|
||||
|
||||
var config = "";
|
||||
var str = sstream.read(4096);
|
||||
while (str.length > 0) {
|
||||
config += str;
|
||||
str = sstream.read(4096);
|
||||
}
|
||||
|
||||
sstream.close();
|
||||
fileInStream.close();
|
||||
|
||||
return eval(config);
|
||||
}
|
||||
|
||||
var gErrorCount = 0;
|
||||
|
||||
function browserTest(aTestFile) {
|
||||
@ -229,31 +200,14 @@
|
||||
|
||||
// Returns an array of browserTest objects for all the selected tests
|
||||
function listTests() {
|
||||
var baseURL = 'chrome://mochitests/content';
|
||||
var testsURI = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties)
|
||||
.get("ProfD", Components.interfaces.nsILocalFile);
|
||||
testsURI.append("tests.manifest");
|
||||
var ioSvc = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService);
|
||||
var manifestFile = ioSvc.newFileURI(testsURI)
|
||||
.QueryInterface(Components.interfaces.nsIFileURL).file;
|
||||
|
||||
Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar).
|
||||
autoRegister(manifestFile);
|
||||
[links, singleTestPath] = getTestList();
|
||||
|
||||
// load server.js in so we can share template functions
|
||||
var scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
getService(Ci.mozIJSSubScriptLoader);
|
||||
getService(Ci.mozIJSSubScriptLoader);
|
||||
var srvScope = {};
|
||||
scriptLoader.loadSubScript('chrome://mochikit/content/server.js', srvScope);
|
||||
|
||||
var jar = getJar(baseURL);
|
||||
if (jar != null) {
|
||||
var [links, singleTestPath] = getMochitestJarListing(baseURL, gConfig.testPath, "browser");
|
||||
} else {
|
||||
var [links, singleTestPath] = getFileListing(baseURL, gConfig.testPath, "browser", srvScope);
|
||||
}
|
||||
scriptLoader.loadSubScript('chrome://mochikit/content/server.js',
|
||||
srvScope);
|
||||
|
||||
var fileNames = [];
|
||||
var fileNameRegexp = /browser_.+\.js$/;
|
||||
|
@ -40,5 +40,6 @@
|
||||
|
||||
<overlay id="browserTestOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"/>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/browser-test.js"/>
|
||||
</overlay>
|
||||
|
@ -17,15 +17,18 @@ function testOnLoad() {
|
||||
return;
|
||||
|
||||
prefs.setBoolPref("testing.browserTestHarness.running", true);
|
||||
gConfig = readConfig();
|
||||
|
||||
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
||||
getService(Ci.nsIWindowWatcher);
|
||||
var sstring = Cc["@mozilla.org/supports-string;1"].
|
||||
createInstance(Ci.nsISupportsString);
|
||||
sstring.data = location.search;
|
||||
if (gConfig.testRoot == "browser") {
|
||||
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
||||
getService(Ci.nsIWindowWatcher);
|
||||
var sstring = Cc["@mozilla.org/supports-string;1"].
|
||||
createInstance(Ci.nsISupportsString);
|
||||
sstring.data = location.search;
|
||||
|
||||
ww.openWindow(window, "chrome://mochikit/content/browser-harness.xul", "browserTest",
|
||||
"chrome,centerscreen,dialog=no,resizable,titlebar,toolbar=no,width=800,height=600", sstring);
|
||||
ww.openWindow(window, "chrome://mochikit/content/browser-harness.xul", "browserTest",
|
||||
"chrome,centerscreen,dialog=no,resizable,titlebar,toolbar=no,width=800,height=600", sstring);
|
||||
}
|
||||
}
|
||||
|
||||
function Tester(aTests, aDumper, aCallback) {
|
||||
|
@ -38,6 +38,8 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
/*
|
||||
* getChromeURI converts a URL to a URI
|
||||
*
|
||||
@ -353,3 +355,68 @@ function buildRelativePath(jarentryname, destdir, basepath)
|
||||
return targetFile;
|
||||
}
|
||||
|
||||
function readConfig() {
|
||||
var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"].
|
||||
getService(Components.interfaces.nsIProperties);
|
||||
var configFile = fileLocator.get("ProfD", Components.interfaces.nsIFile);
|
||||
configFile.append("testConfig.js");
|
||||
|
||||
if (!configFile.exists())
|
||||
return;
|
||||
|
||||
var fileInStream = Components.classes["@mozilla.org/network/file-input-stream;1"].
|
||||
createInstance(Components.interfaces.nsIFileInputStream);
|
||||
fileInStream.init(configFile, -1, 0, 0);
|
||||
|
||||
var str = NetUtil.readInputStreamToString(fileInStream, fileInStream.available());
|
||||
fileInStream.close();
|
||||
return JSON.parse(str);
|
||||
}
|
||||
|
||||
function getTestList() {
|
||||
var params = {};
|
||||
if (window.parseQueryString) {
|
||||
params = parseQueryString(location.search.substring(1), true);
|
||||
}
|
||||
|
||||
var config = readConfig();
|
||||
for (p in params) {
|
||||
if (params[p] == 1) {
|
||||
config[p] = true;
|
||||
} else if (params[p] == 0) {
|
||||
config[p] = false;
|
||||
} else {
|
||||
config[p] = params[p];
|
||||
}
|
||||
}
|
||||
params = config;
|
||||
|
||||
var baseurl = 'chrome://mochitests/content';
|
||||
var testsURI = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties)
|
||||
.get("ProfD", Components.interfaces.nsILocalFile);
|
||||
testsURI.append("tests.manifest");
|
||||
var ioSvc = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService);
|
||||
var manifestFile = ioSvc.newFileURI(testsURI)
|
||||
.QueryInterface(Components.interfaces.nsIFileURL).file;
|
||||
|
||||
Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar).
|
||||
autoRegister(manifestFile);
|
||||
|
||||
// load server.js in so we can share template functions
|
||||
var scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
getService(Ci.mozIJSSubScriptLoader);
|
||||
var srvScope = {};
|
||||
scriptLoader.loadSubScript('chrome://mochikit/content/server.js',
|
||||
srvScope);
|
||||
var singleTestPath;
|
||||
var links;
|
||||
|
||||
if (getResolvedURI(baseurl).JARFile) {
|
||||
[links, singleTestPath] = getMochitestJarListing(baseurl, params.testPath, params.testRoot);
|
||||
} else {
|
||||
[links, singleTestPath] = getFileListing(baseurl, params.testPath, params.testRoot, srvScope);
|
||||
}
|
||||
return [links, singleTestPath];
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/static/harness.css"
|
||||
type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://mochikit/content/harness-overlay.xul"?>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="Accessibility Chrome Test Harness"
|
||||
directory="a11y">
|
||||
</window>
|
@ -1,7 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/static/harness.css"
|
||||
type="text/css"?>
|
||||
|
||||
<overlay id="browserTestOverlay"
|
||||
<overlay id="chromeTestOverlay"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
@ -15,30 +17,21 @@
|
||||
src="chrome://mochikit/content/tests/SimpleTest/MozillaFileLogger.js"/>
|
||||
<script type="text/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/quit.js" />
|
||||
<script type="text/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/setup.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/chrome-harness.js" />
|
||||
<script type="text/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/setup.js" />
|
||||
<script type="application/javascript;version=1.7"><![CDATA[
|
||||
|
||||
if (Cc === undefined) {
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
}
|
||||
|
||||
function loadTests()
|
||||
{
|
||||
window.removeEventListener("load", loadTests, false);
|
||||
|
||||
var baseurl = 'chrome://mochitests/content';
|
||||
var testsURI = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties)
|
||||
.get("ProfD", Components.interfaces.nsILocalFile);
|
||||
testsURI.append("tests.manifest");
|
||||
var ioSvc = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService);
|
||||
var manifestFile = ioSvc.newFileURI(testsURI)
|
||||
.QueryInterface(Components.interfaces.nsIFileURL).file;
|
||||
|
||||
Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar).
|
||||
autoRegister(manifestFile);
|
||||
|
||||
var dir = document.documentElement.getAttribute('directory');
|
||||
[links, singleTestPath] = getTestList();
|
||||
|
||||
// load server.js in so we can share template functions
|
||||
var scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
@ -46,18 +39,9 @@ function loadTests()
|
||||
var srvScope = {};
|
||||
scriptLoader.loadSubScript('chrome://mochikit/content/server.js',
|
||||
srvScope);
|
||||
|
||||
// generate our test list
|
||||
srvScope.makeTags();
|
||||
|
||||
var singleTestPath;
|
||||
var links;
|
||||
|
||||
if (getResolvedURI(baseurl).JARFile) {
|
||||
[links, singleTestPath] = getMochitestJarListing(baseurl, params.testPath, dir);
|
||||
} else {
|
||||
[links, singleTestPath] = getFileListing(baseurl, params.testPath, dir, srvScope);
|
||||
}
|
||||
|
||||
var tableContent = srvScope.linksToTableRows(links, 0);
|
||||
|
||||
function populate() {
|
||||
|
@ -4,13 +4,11 @@ mochikit.jar:
|
||||
content/browser-test.js (browser-test.js)
|
||||
content/browser-test-overlay.xul (browser-test-overlay.xul)
|
||||
content/chrome-harness.js (chrome-harness.js)
|
||||
content/harness-a11y.xul (harness-a11y.xul)
|
||||
content/harness-overlay.xul (harness-overlay.xul)
|
||||
content/harness.xul (harness.xul)
|
||||
content/ipc.js (ipc.js)
|
||||
content/ipc-overlay.xul (ipc-overlay.xul)
|
||||
content/mozprefs.js (mozprefs.js)
|
||||
content/redirect-a11y.html (redirect-a11y.html)
|
||||
content/redirect.html (redirect.html)
|
||||
content/redirect.js (redirect.js)
|
||||
content/server.js (server.js)
|
||||
|
@ -1,14 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>redirecting...</title>
|
||||
|
||||
<script type="text/javascript" src="redirect.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
redirect("chrome://mochikit/content/harness-a11y.xul");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
redirecting...
|
||||
</body>
|
||||
</html>
|
@ -405,7 +405,6 @@ class Mochitest(object):
|
||||
# Path to the test script on the server
|
||||
TEST_PATH = "/tests/"
|
||||
CHROME_PATH = "/redirect.html";
|
||||
A11Y_PATH = "/redirect-a11y.html"
|
||||
urlOpts = []
|
||||
runSSLTunnel = True
|
||||
vmwareHelper = None
|
||||
@ -434,14 +433,8 @@ class Mochitest(object):
|
||||
""" Build the url path to the specific test harness and test file or directory """
|
||||
testHost = "http://mochi.test:8888"
|
||||
testURL = testHost + self.TEST_PATH + options.testPath
|
||||
if options.chrome:
|
||||
testURL = testHost + self.CHROME_PATH
|
||||
if options.testPath:
|
||||
self.urlOpts.append("testPath=" + encodeURIComponent(options.testPath))
|
||||
elif options.a11y:
|
||||
testURL = testHost + self.A11Y_PATH
|
||||
if options.testPath:
|
||||
self.urlOpts.append("testPath=" + encodeURIComponent(options.testPath))
|
||||
if options.chrome or options.a11y:
|
||||
testURL = testHost + self.CHROME_PATH
|
||||
elif options.browserChrome:
|
||||
testURL = "about:blank"
|
||||
elif options.ipcplugins:
|
||||
@ -554,7 +547,7 @@ class Mochitest(object):
|
||||
# allow relative paths for logFile
|
||||
if options.logFile:
|
||||
options.logFile = self.getLogFilePath(options.logFile)
|
||||
if options.browserChrome:
|
||||
if options.browserChrome or options.chrome or options.a11y:
|
||||
self.makeTestConfig(options)
|
||||
else:
|
||||
if options.autorun:
|
||||
@ -679,23 +672,54 @@ class Mochitest(object):
|
||||
|
||||
def makeTestConfig(self, options):
|
||||
"Creates a test configuration file for customizing test execution."
|
||||
def boolString(b):
|
||||
if b:
|
||||
return "true"
|
||||
return "false"
|
||||
def jsonString(val):
|
||||
if isinstance(val, bool):
|
||||
if val:
|
||||
return "true"
|
||||
return "false"
|
||||
elif val is None:
|
||||
return '""'
|
||||
elif isinstance(val, basestring):
|
||||
return '"%s"' % (val.replace('\\', '\\\\'))
|
||||
elif isinstance(val, int):
|
||||
return '%s' % (val)
|
||||
elif isinstance(val, list):
|
||||
content = '['
|
||||
first = True
|
||||
for item in val:
|
||||
if first:
|
||||
first = False
|
||||
else:
|
||||
content += ", "
|
||||
content += jsonString(item)
|
||||
content += ']'
|
||||
return content
|
||||
else:
|
||||
print "unknown type: %s: %s" % (opt, val)
|
||||
sys.exit(1)
|
||||
|
||||
logFile = options.logFile.replace("\\", "\\\\")
|
||||
testPath = options.testPath.replace("\\", "\\\\")
|
||||
content = """\
|
||||
({
|
||||
autoRun: %(autorun)s,
|
||||
closeWhenDone: %(closeWhenDone)s,
|
||||
logPath: "%(logPath)s",
|
||||
testPath: "%(testPath)s"
|
||||
})""" % {"autorun": boolString(options.autorun),
|
||||
"closeWhenDone": boolString(options.closeWhenDone),
|
||||
"logPath": logFile,
|
||||
"testPath": testPath}
|
||||
options.logFile = options.logFile.replace("\\", "\\\\")
|
||||
options.testPath = options.testPath.replace("\\", "\\\\")
|
||||
testRoot = 'chrome'
|
||||
if (options.browserChrome):
|
||||
testRoot = 'browser'
|
||||
elif (options.a11y):
|
||||
testRoot = 'a11y'
|
||||
|
||||
#TODO: when we upgrade to python 2.6, just use json.dumps(options.__dict__)
|
||||
content = "{"
|
||||
content += '"testRoot": "%s", ' % (testRoot)
|
||||
first = True
|
||||
for opt in options.__dict__.keys():
|
||||
val = options.__dict__[opt]
|
||||
if first:
|
||||
first = False
|
||||
else:
|
||||
content += ", "
|
||||
|
||||
content += '"' + opt + '": '
|
||||
content += jsonString(val)
|
||||
content += "}"
|
||||
|
||||
with open(os.path.join(options.profilePath, "testConfig.js"), "w") as config:
|
||||
config.write(content)
|
||||
@ -742,12 +766,12 @@ toolbar#nav-bar {
|
||||
|
||||
# Support Firefox (browser) and SeaMonkey (navigator).
|
||||
chrome = ""
|
||||
if options.browserChrome:
|
||||
if options.browserChrome or options.chrome or options.a11y:
|
||||
chrome += """
|
||||
overlay chrome://browser/content/browser.xul chrome://mochikit/content/browser-test-overlay.xul
|
||||
overlay chrome://navigator/content/navigator.xul chrome://mochikit/content/browser-test-overlay.xul
|
||||
"""
|
||||
elif (options.chrome == False) and (options.a11y == False):
|
||||
else:
|
||||
#only do the ipc-overlay.xul for mochitest-plain.
|
||||
#Currently there are focus issues in chrome tests and issues with new windows and dialogs when using ipc
|
||||
chrome += """
|
||||
|
@ -42,6 +42,24 @@ TestRunner.logger = new Logger();
|
||||
// Check the query string for arguments
|
||||
var params = parseQueryString(location.search.substring(1), true);
|
||||
|
||||
var config = {};
|
||||
if (window.readConfig) {
|
||||
config = readConfig();
|
||||
}
|
||||
|
||||
if (config.testRoot == "chrome" || config.testRoot == "a11y") {
|
||||
for (p in params) {
|
||||
if (params[p] == 1) {
|
||||
config[p] = true;
|
||||
} else if (params[p] == 0) {
|
||||
config[p] = false;
|
||||
} else {
|
||||
config[p] = params[p];
|
||||
}
|
||||
}
|
||||
params = config;
|
||||
}
|
||||
|
||||
// set the per-test timeout if specified in the query string
|
||||
if (params.timeout) {
|
||||
TestRunner.timeout = parseInt(params.timeout) * 1000;
|
||||
|
@ -24,6 +24,7 @@
|
||||
* Joe Hughes <joe@retrovirus.com>
|
||||
* Dietrich Ayala <dietrich@mozilla.com>
|
||||
* Asaf Romano <mano@mozilla.com>
|
||||
* Marco Bonardo <mak77@bonardo.net>
|
||||
*
|
||||
* 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
|
||||
@ -47,62 +48,89 @@ interface nsITransaction;
|
||||
interface nsINavHistoryBatchCallback;
|
||||
|
||||
/**
|
||||
* Observer for bookmark changes.
|
||||
* Observer for bookmarks changes.
|
||||
*/
|
||||
[scriptable, uuid(76f892d9-31ea-4061-b38c-6b40fad57e9d)]
|
||||
[scriptable, uuid(2fb820a9-9331-4c02-ae41-32a82a4b7aa1)]
|
||||
interface nsINavBookmarkObserver : nsISupports
|
||||
{
|
||||
/**
|
||||
* Notify this observer that a batch transaction has started.
|
||||
* Other notifications will be sent during the batch change,
|
||||
* but the observer is guaranteed that onEndUpdateBatch() will be called
|
||||
* at the completion of changes.
|
||||
* Notifies that a batch transaction has started.
|
||||
* Other notifications will be sent during the batch, but the observer is
|
||||
* guaranteed that onEndUpdateBatch() will be called at its completion.
|
||||
* During a batch the observer should do its best to reduce the work done to
|
||||
* handle notifications, since multiple changes are going to happen in a short
|
||||
* timeframe.
|
||||
*/
|
||||
void onBeginUpdateBatch();
|
||||
|
||||
/**
|
||||
* Notify this observer that a batch transaction has ended.
|
||||
* Notifies that a batch transaction has ended.
|
||||
*/
|
||||
void onEndUpdateBatch();
|
||||
|
||||
/**
|
||||
* Notify this observer that an item was added. Called after the actual
|
||||
* add took place. The items following the index will be shifted down, but
|
||||
* no additional notifications will be sent.
|
||||
* Notifies that an item (any type) was added. Called after the actual
|
||||
* addition took place.
|
||||
* When a new item is created, all the items following it in the same folder
|
||||
* will have their index shifted down, but no additional notifications will
|
||||
* be sent.
|
||||
*
|
||||
* @param aItemId
|
||||
* The id of the bookmark that was added.
|
||||
* The id of the item that was added.
|
||||
* @param aParentId
|
||||
* The id of the folder to which the item was added.
|
||||
* @param aIndex
|
||||
* The item's index in the folder.
|
||||
* @param aItemType
|
||||
* The type of the item that was added (one of the TYPE_* constants
|
||||
* defined above).
|
||||
* The type of the added item (see TYPE_* constants below).
|
||||
* @param aURI
|
||||
* The URI of the item that was added when aItemType is TYPE_BOOKMARK,
|
||||
* null otherwise.
|
||||
* The URI of the added item if it was TYPE_BOOKMARK, null otherwise.
|
||||
* @param aTitle
|
||||
* The title of the added item.
|
||||
* @param aDateAdded
|
||||
* The stored date added value, in microseconds from the epoch.
|
||||
* @param aGUID
|
||||
* The unique ID associated with the item.
|
||||
* @param aParentGUID
|
||||
* The unique ID associated with the item's parent.
|
||||
*/
|
||||
void onItemAdded(in long long aItemId, in long long aParentId,
|
||||
in long aIndex, in unsigned short aItemType,
|
||||
in nsIURI aURI);
|
||||
void onItemAdded(in long long aItemId,
|
||||
in long long aParentId,
|
||||
in long aIndex,
|
||||
in unsigned short aItemType,
|
||||
in nsIURI aURI,
|
||||
in AUTF8String aTitle,
|
||||
in PRTime aDateAdded,
|
||||
in ACString aGUID,
|
||||
in ACString aParentGUID);
|
||||
|
||||
/**
|
||||
* Notify this observer that an item is about to be removed. Called before
|
||||
* the actual removal will take place.
|
||||
* Notifies that an item is about to be removed. Called before the actual
|
||||
* removal will take place.
|
||||
*
|
||||
* @param aItemId
|
||||
* The id of the bookmark to be removed.
|
||||
* @param aItemType
|
||||
* The type of the item to be removed (one of the TYPE_* constants
|
||||
* defined above).
|
||||
* The type of the item to be removed (see TYPE_* constants below).
|
||||
* @param aParentId
|
||||
* The id of the folder containing the item.
|
||||
* @param aGUID
|
||||
* The unique ID associated with the item.
|
||||
* @param aParentGUID
|
||||
* The unique ID associated with the item's parent.
|
||||
*/
|
||||
void onBeforeItemRemoved(in long long aItemId, in unsigned short aItemType);
|
||||
void onBeforeItemRemoved(in long long aItemId,
|
||||
in unsigned short aItemType,
|
||||
in long long aParentId,
|
||||
in ACString aGUID,
|
||||
in ACString aParentGUID);
|
||||
|
||||
/**
|
||||
* Notify this observer that an item was removed. Called after the actual
|
||||
* remove took place. The items following the index will be shifted up, but
|
||||
* no additional notifications will be sent.
|
||||
* Notifies that an item was removed. Called after the actual remove took
|
||||
* place.
|
||||
* When an item is removed, all the items following it in the same folder
|
||||
* will have their index shifted down, but no additional notifications will
|
||||
* be sent.
|
||||
*
|
||||
* @param aItemId
|
||||
* The id of the item that was removed.
|
||||
@ -111,84 +139,140 @@ interface nsINavBookmarkObserver : nsISupports
|
||||
* @param aIndex
|
||||
* The bookmark's index in the folder.
|
||||
* @param aItemType
|
||||
* The type of the item that was removed (one of the TYPE_* constants
|
||||
* defined above).
|
||||
* The type of the item to be removed (see TYPE_* constants below).
|
||||
* @param aURI
|
||||
* The URI of the added item if it was TYPE_BOOKMARK, null otherwise.
|
||||
* @param aGUID
|
||||
* The unique ID associated with the item.
|
||||
* @param aParentGUID
|
||||
* The unique ID associated with the item's parent.
|
||||
*/
|
||||
void onItemRemoved(in long long aItemId, in long long aParentId,
|
||||
in long aIndex, in unsigned short aItemType);
|
||||
void onItemRemoved(in long long aItemId,
|
||||
in long long aParentId,
|
||||
in long aIndex,
|
||||
in unsigned short aItemType,
|
||||
in nsIURI aURI,
|
||||
in ACString aGUID,
|
||||
in ACString aParentGUID);
|
||||
|
||||
/**
|
||||
* Notify this observer that an item's information has changed. This
|
||||
* will be called whenever any attributes like "title" are changed.
|
||||
* Notifies that an item's information has changed. This will be called
|
||||
* whenever any attributes like "title" are changed.
|
||||
*
|
||||
* @param aItemId
|
||||
* The id of the item that was changed.
|
||||
* @param aProperty
|
||||
* The property which changed.
|
||||
* The property which changed. Can be null for the removal of all of
|
||||
* the annotations, in this case aIsAnnotationProperty is true.
|
||||
* @param aIsAnnotationProperty
|
||||
* Whether or not aProperty the name of an item annotation.
|
||||
* @param aProperty
|
||||
* The property which has been changed (see list below).
|
||||
* Whether or not aProperty is the name of an annotation. If true
|
||||
* aNewValue is always an empty string.
|
||||
* @param aNewValue
|
||||
* For certain properties, this is set to the new value of the
|
||||
* property (see list below).
|
||||
* property (see the list below).
|
||||
* @param aLastModified
|
||||
* If the item's lastModified field has changed, this parameter is
|
||||
* set to the new value, otherwise it's set to 0.
|
||||
* If lastModified changed, this parameter is the new value, otherwise
|
||||
* it's set to 0.
|
||||
* @param aItemType
|
||||
* The type of the item that has been changed(one of the TYPE_* constants
|
||||
* defined above).
|
||||
* The type of the item to be removed (see TYPE_* constants below).
|
||||
* @param aParentId
|
||||
* The id of the folder containing the item.
|
||||
* @param aGUID
|
||||
* The unique ID associated with the item.
|
||||
* @param aParentGUID
|
||||
* The unique ID associated with the item's parent.
|
||||
*
|
||||
* property = "cleartime": (history was deleted, there is no last visit date):
|
||||
* value = empty string.
|
||||
* property = "title": value = new title.
|
||||
* property = "favicon": value = new "moz-anno" URL of favicon image
|
||||
* property = "uri": value = new uri spec.
|
||||
* property = "tags: (tags set for the bookmarked uri have changed)
|
||||
* value = empty string.
|
||||
* property = "dateAdded": value = PRTime when the item was first added
|
||||
* property = "lastModified": value = PRTime when the item was last modified
|
||||
* aIsAnnotationProperty = true: value = empty string.
|
||||
* @note List of values that may be associated with properties:
|
||||
* aProperty | aNewValue
|
||||
* =====================================================================
|
||||
* cleartime | Empty string (all visits to this item were removed).
|
||||
* title | The new title.
|
||||
* favicon | The "moz-anno" URL of the new favicon.
|
||||
* uri | new URL.
|
||||
* tags | Empty string (tags for this item changed)
|
||||
* dateAdded | PRTime (as string) when the item was first added.
|
||||
* lastModified | PRTime (as string) when the item was last modified.
|
||||
*/
|
||||
void onItemChanged(in long long aItemId, in ACString aProperty,
|
||||
void onItemChanged(in long long aItemId,
|
||||
in ACString aProperty,
|
||||
in boolean aIsAnnotationProperty,
|
||||
in AUTF8String aNewValue, in PRTime aLastModified,
|
||||
in unsigned short aItemType);
|
||||
in AUTF8String aNewValue,
|
||||
in PRTime aLastModified,
|
||||
in unsigned short aItemType,
|
||||
in long long aParentId,
|
||||
in ACString aGUID,
|
||||
in ACString aParentGUID);
|
||||
|
||||
/**
|
||||
* Notify that the item was visited. Normally in bookmarks we use the last
|
||||
* visit date, and normally the time will be a new visit that will be more
|
||||
* recent, but this is not guaranteed. You should check to see if it's
|
||||
* actually more recent before using this new time.
|
||||
* Notifies that the item was visited. Can be invoked only for TYPE_BOOKMARK
|
||||
* items.
|
||||
*
|
||||
* @param aBookmarkId
|
||||
* @param aItemId
|
||||
* The id of the bookmark that was visited.
|
||||
* @see onItemChanged property = "cleartime" for when all visit dates are
|
||||
* deleted for the URI.
|
||||
* @param aVisitId
|
||||
* The id of the visit.
|
||||
* @param aTime
|
||||
* The time of the visit.
|
||||
* @param aTransitionType
|
||||
* The transition for the visit. See nsINavHistoryService::TRANSITION_*
|
||||
* constants for a list of possible values.
|
||||
* @param aURI
|
||||
* The nsIURI for this bookmark.
|
||||
* @param aParentId
|
||||
* The id of the folder containing the item.
|
||||
* @param aGUID
|
||||
* The unique ID associated with the item.
|
||||
* @param aParentGUID
|
||||
* The unique ID associated with the item's parent.
|
||||
*
|
||||
* @see onItemChanged with property = "cleartime" for when all visits to an
|
||||
* item are removed.
|
||||
*
|
||||
* @note The reported time is the time of the visit that was added, which may
|
||||
* be well in the past since the visit time can be specified. This
|
||||
* means that the visit the observer is told about may not be the most
|
||||
* recent visit for that page.
|
||||
*/
|
||||
void onItemVisited(in long long aBookmarkId, in long long aVisitID,
|
||||
in PRTime time);
|
||||
void onItemVisited(in long long aItemId,
|
||||
in long long aVisitId,
|
||||
in PRTime aTime,
|
||||
in unsigned long aTransitionType,
|
||||
in nsIURI aURI,
|
||||
in long long aParentId,
|
||||
in ACString aGUID,
|
||||
in ACString aParentGUID);
|
||||
|
||||
/**
|
||||
* Notify this observer that an item has been moved.
|
||||
* @param aItemId
|
||||
* The id of the item that was moved.
|
||||
* @param aOldParentId
|
||||
* The id of the old parent.
|
||||
* @param aOldIndex
|
||||
* The old index inside the old parent.
|
||||
* @param aNewParentId
|
||||
* The id of the new parent.
|
||||
* @param aNewIndex
|
||||
* The index inside the new parent.
|
||||
* @param aItemType
|
||||
* The type of the item that was moved (one of the TYPE_* constants
|
||||
* defined above).
|
||||
* Notifies that an item has been moved.
|
||||
*
|
||||
* @param aItemId
|
||||
* The id of the item that was moved.
|
||||
* @param aOldParentId
|
||||
* The id of the old parent.
|
||||
* @param aOldIndex
|
||||
* The old index inside the old parent.
|
||||
* @param aNewParentId
|
||||
* The id of the new parent.
|
||||
* @param aNewIndex
|
||||
* The index inside the new parent.
|
||||
* @param aItemType
|
||||
* The type of the item to be removed (see TYPE_* constants below).
|
||||
* @param aGUID
|
||||
* The unique ID associated with the item.
|
||||
* @param aOldParentGUID
|
||||
* The unique ID associated with the old item's parent.
|
||||
* @param aNewParentGUID
|
||||
* The unique ID associated with the new item's parent.
|
||||
*/
|
||||
void onItemMoved(in long long aItemId,
|
||||
in long long aOldParentId, in long aOldIndex,
|
||||
in long long aNewParentId, in long aNewIndex,
|
||||
in unsigned short aItemType);
|
||||
in long long aOldParentId,
|
||||
in long aOldIndex,
|
||||
in long long aNewParentId,
|
||||
in long aNewIndex,
|
||||
in unsigned short aItemType,
|
||||
in ACString aGUID,
|
||||
in ACString aOldParentGUID,
|
||||
in ACString aNewParentGUID);
|
||||
};
|
||||
|
||||
/**
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user