mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 243621 Standardize QueryInterface without throw
r=neil sr=darin
This commit is contained in:
parent
39953021d3
commit
55a5e5ddbf
@ -3,20 +3,20 @@
|
||||
* 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 Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Contributor(s):
|
||||
* Seth Spitzer <sspitzer@netscape.com>
|
||||
* Robert Ginda <rginda@netscape.com>
|
||||
*/
|
||||
@ -50,7 +50,7 @@ const ICALPROT_HANDLER_CID =
|
||||
/* components used in this file */
|
||||
const MEDIATOR_CONTRACTID =
|
||||
"@mozilla.org/appshell/window-mediator;1";
|
||||
const STANDARDURL_CONTRACTID =
|
||||
const STANDARDURL_CONTRACTID =
|
||||
"@mozilla.org/network/standard-url;1";
|
||||
const ASS_CONTRACTID =
|
||||
"@mozilla.org/appshell/appShellService;1";
|
||||
@ -101,10 +101,12 @@ function ICALContentHandler ()
|
||||
ICALContentHandler.prototype.QueryInterface =
|
||||
function (iid) {
|
||||
|
||||
if (!iid.equals(nsIContentHandler))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
if (iid.equals(nsIContentHandler) ||
|
||||
iid.equals(nsISupports))
|
||||
return this;
|
||||
|
||||
return this;
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
|
||||
ICALContentHandler.prototype.handleContent =
|
||||
@ -112,7 +114,7 @@ function (aContentType, aWindowTarget, aRequest)
|
||||
{
|
||||
var e;
|
||||
var channel = aRequest.QueryInterface(nsIChannel);
|
||||
|
||||
|
||||
/*
|
||||
dump ("ICALContentHandler.handleContent (" + aContentType + ", " +
|
||||
aWindowTarget + ", " + channel.URI.spec + ")\n");
|
||||
@ -126,7 +128,7 @@ function (aContentType, aWindowTarget, aRequest)
|
||||
if (w)
|
||||
{
|
||||
w.focus();
|
||||
|
||||
|
||||
w.gCalendarWindow.calendarManager.checkCalendarURL( channel );
|
||||
}
|
||||
else
|
||||
@ -139,7 +141,7 @@ function (aContentType, aWindowTarget, aRequest)
|
||||
args.channel = channel;
|
||||
w.openDialog("chrome://calendar/content/calendar.xul", "calendar", "chrome,menubar,resizable,scrollbars,status,toolbar,dialog=no", args);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* content handler factory object (ICALContentHandler) */
|
||||
@ -163,7 +165,7 @@ function ICALProtocolHandler()
|
||||
|
||||
ICALProtocolHandler.prototype.scheme = "webcal";
|
||||
ICALProtocolHandler.prototype.defaultPort = 8080;
|
||||
ICALProtocolHandler.prototype.protocolFlags =
|
||||
ICALProtocolHandler.prototype.protocolFlags =
|
||||
nsIProtocolHandler.URI_NORELATIVE |
|
||||
nsIProtocolHandler.ALLOWS_PROXY;
|
||||
|
||||
@ -179,7 +181,7 @@ function (aSpec, aCharset, aBaseURI)
|
||||
var url = Components.classes[STANDARDURL_CONTRACTID].
|
||||
createInstance(nsIStandardURL);
|
||||
url.init(nsIStandardURL.URLTYPE_STANDARD, 8080, aSpec, aCharset, aBaseURI);
|
||||
|
||||
|
||||
return url.QueryInterface(nsIURI);
|
||||
}
|
||||
|
||||
@ -213,11 +215,13 @@ function BogusChannel (aURI)
|
||||
BogusChannel.prototype.QueryInterface =
|
||||
function (iid) {
|
||||
|
||||
if (!iid.equals(nsIChannel) && !iid.equals(nsIRequest) &&
|
||||
!iid.equals(nsISupports))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
if (iid.equals(nsIChannel) ||
|
||||
iid.equals(nsIRequest) ||
|
||||
iid.equals(nsISupports))
|
||||
return this;
|
||||
|
||||
return this;
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
|
||||
/* nsIChannel */
|
||||
@ -276,16 +280,16 @@ ChatzillaModule.registerSelf =
|
||||
function (compMgr, fileSpec, location, type)
|
||||
{
|
||||
dump("*** Registering -webcal handler.\n");
|
||||
|
||||
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
|
||||
compMgr.registerFactoryLocation(CLINE_SERVICE_CID,
|
||||
"Calendar CommandLine Service",
|
||||
CLINE_SERVICE_CONTRACTID,
|
||||
CLINE_SERVICE_CONTRACTID,
|
||||
fileSpec,
|
||||
location,
|
||||
location,
|
||||
type);
|
||||
|
||||
|
||||
catman = Components.classes["@mozilla.org/categorymanager;1"]
|
||||
.getService(nsICategoryManager);
|
||||
catman.addCategoryEntry("command-line-argument-handlers",
|
||||
@ -295,16 +299,16 @@ function (compMgr, fileSpec, location, type)
|
||||
dump("*** Registering text/calendar handler.\n");
|
||||
compMgr.registerFactoryLocation(ICALCNT_HANDLER_CID,
|
||||
"Webcal Content Handler",
|
||||
ICALCNT_HANDLER_CONTRACTID,
|
||||
ICALCNT_HANDLER_CONTRACTID,
|
||||
fileSpec,
|
||||
location,
|
||||
location,
|
||||
type);
|
||||
|
||||
dump("*** Registering webcal protocol handler.\n");
|
||||
compMgr.registerFactoryLocation(ICALPROT_HANDLER_CID,
|
||||
"Webcal protocol handler",
|
||||
ICALPROT_HANDLER_CONTRACTID,
|
||||
fileSpec,
|
||||
ICALPROT_HANDLER_CONTRACTID,
|
||||
fileSpec,
|
||||
location,
|
||||
type);
|
||||
}
|
||||
@ -315,7 +319,7 @@ function(compMgr, fileSpec, location)
|
||||
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
|
||||
compMgr.unregisterFactoryLocation(CLINE_SERVICE_CID,
|
||||
compMgr.unregisterFactoryLocation(CLINE_SERVICE_CID,
|
||||
fileSpec);
|
||||
catman = Components.classes["@mozilla.org/categorymanager;1"]
|
||||
.getService(nsICategoryManager);
|
||||
@ -333,12 +337,12 @@ function (compMgr, cid, iid) {
|
||||
|
||||
if (cid.equals(ICALPROT_HANDLER_CID))
|
||||
return ICALProtocolHandlerFactory;
|
||||
|
||||
|
||||
if (!iid.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
|
||||
}
|
||||
|
||||
ChatzillaModule.canUnload =
|
||||
|
@ -14,12 +14,12 @@
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001-2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): ArentJan Banck <ajbanck@planet.nl>
|
||||
* Contributor(s): ArentJan Banck <ajbanck@planet.nl>
|
||||
*
|
||||
* 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
|
||||
@ -58,7 +58,7 @@ function GetIOService()
|
||||
gPublishIOService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
|
||||
if (!gPublishIOService)
|
||||
dump("failed to get io service\n");
|
||||
|
||||
|
||||
return gPublishIOService;
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ function GetIOService()
|
||||
* This is the entry point into the file from calendar.js
|
||||
* contentType is always text/calendar
|
||||
*/
|
||||
|
||||
|
||||
function calendarPublish(aDataString, newLocation, login, password, contentType)
|
||||
{
|
||||
try
|
||||
@ -80,7 +80,7 @@ function calendarPublish(aDataString, newLocation, login, password, contentType)
|
||||
}
|
||||
output_string_to_channel(protocolChannel, aDataString, contentType);
|
||||
protocolChannel.asyncOpen(gPublishingListener, null);
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
alert("an error occurred in calendarPublish: " + e + "\n");
|
||||
@ -99,7 +99,7 @@ function calendarUploadFile(aSourceFilename, newLocation, login, password, conte
|
||||
}
|
||||
output_file_to_channel(protocolChannel, aSourceFilename, contentType);
|
||||
protocolChannel.asyncOpen(gPublishingListener, protocolChannel);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
catch (e)
|
||||
@ -124,13 +124,13 @@ function output_string_to_channel( aChannel, aDataString, contentType )
|
||||
function output_file_to_channel( aChannel, aFilePath, contentType )
|
||||
{
|
||||
var uploadChannel = aChannel.QueryInterface(Components.interfaces.nsIUploadChannel);
|
||||
|
||||
|
||||
var thisFile = new File( aFilePath );
|
||||
|
||||
|
||||
thisFile.open( "r" );
|
||||
|
||||
|
||||
var theFileContents = thisFile.read();
|
||||
|
||||
|
||||
output_string_to_channel( aChannel, theFileContents, contentType );
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ function get_destination_channel(destinationDirectoryLocation, login, password)
|
||||
catch(e) {
|
||||
dump(e+"\n");
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
switch(destChannel.URI.scheme)
|
||||
{
|
||||
@ -182,7 +182,7 @@ function get_destination_channel(destinationDirectoryLocation, login, password)
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch( e )
|
||||
catch( e )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@ -205,7 +205,7 @@ function create_channel_from_url(ioService, aURL, aLogin, aPassword)
|
||||
}
|
||||
return ioService.newChannelFromURI(nsiuri);
|
||||
}
|
||||
catch (e)
|
||||
catch (e)
|
||||
{
|
||||
alert(e+"\n");
|
||||
return null;
|
||||
@ -243,7 +243,7 @@ function PublishCopyFile(srcDirectoryLocation, destinationDirectoryLocation, aLo
|
||||
dump("failed to get ftp channel\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ftpChannel.open();
|
||||
protocolChannel.uploadStream = srcChannel.open();
|
||||
protocolChannel.asyncOpen(null, null);
|
||||
@ -260,13 +260,12 @@ var gPublishingListener =
|
||||
{
|
||||
QueryInterface: function(aIId, instance)
|
||||
{
|
||||
if (aIId.equals(Components.interfaces.nsIStreamListener))
|
||||
if (aIId.equals(Components.interfaces.nsIStreamListener) ||
|
||||
aIId.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
if (aIId.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
dump("QueryInterface " + aIId + "\n");
|
||||
throw Components.results.NS_NOINTERFACE;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
onStartRequest: function(request, ctxt)
|
||||
|
@ -47,7 +47,7 @@ const RDF_NAMESPACE_URI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
||||
const NC_NAMESPACE_URI = "http://home.netscape.com/NC-rdf#";
|
||||
const LDAPATTR_NAMESPACE_URI = "http://www.mozilla.org/LDAPATTR-rdf#";
|
||||
|
||||
// RDF-specific success nsresults
|
||||
// RDF-specific success nsresults
|
||||
//
|
||||
const NS_ERROR_RDF_BASE = 0x804f0000; // XXX is this right?
|
||||
const NS_RDF_CURSOR_EMPTY = NS_ERROR_RDF_BASE + 1;
|
||||
@ -108,15 +108,15 @@ function getProxyOnUIThread(aObject, aInterface) {
|
||||
classes["@mozilla.org/xpcomproxy;1"].
|
||||
getService(Components.interfaces.nsIProxyObjectManager);
|
||||
|
||||
return proxyMgr.getProxyForObject(uiQueue,
|
||||
aInterface, aObject, 5);
|
||||
return proxyMgr.getProxyForObject(uiQueue,
|
||||
aInterface, aObject, 5);
|
||||
// 5 == PROXY_ALWAYS | PROXY_SYNC
|
||||
}
|
||||
|
||||
|
||||
// the datasource object itself
|
||||
//
|
||||
const NS_LDAPDATASOURCE_CONTRACTID =
|
||||
const NS_LDAPDATASOURCE_CONTRACTID =
|
||||
'@mozilla.org/rdf/datasource;1?name=ldap';
|
||||
const NS_LDAPDATASOURCE_CID =
|
||||
Components.ID('{8da18684-6486-4a7e-b261-35331f3e7163}');
|
||||
@ -128,7 +128,7 @@ nsLDAPDataSource.prototype = {
|
||||
// who is watching us; XXX ok to use new Array?
|
||||
mObserverList: new Array(),
|
||||
|
||||
// RDF property constants.
|
||||
// RDF property constants.
|
||||
//
|
||||
// XXXdmose - can these can actually be statics (ie JS class
|
||||
// properties rather than JS instance properties)? or would that
|
||||
@ -140,17 +140,18 @@ nsLDAPDataSource.prototype = {
|
||||
kNC_recursiveChild: {},
|
||||
|
||||
mRdfSvc: {},
|
||||
|
||||
|
||||
// since we implement multiple interfaces, we have to provide QI
|
||||
//
|
||||
QueryInterface: function(iid) {
|
||||
if (!iid.equals(Components.interfaces.nsISupports) &&
|
||||
!iid.equals(Components.interfaces.nsIRDFDataSource) &&
|
||||
!iid.equals(Components.interfaces.nsIRDFRemoteDataSource) &&
|
||||
!iid.equals(Components.interfaces.nsIRDFObserver))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
if (iid.equals(Components.interfaces.nsISupports) ||
|
||||
iid.equals(Components.interfaces.nsIRDFDataSource) ||
|
||||
iid.equals(Components.interfaces.nsIRDFRemoteDataSource) ||
|
||||
iid.equals(Components.interfaces.nsIRDFObserver))
|
||||
return this;
|
||||
|
||||
return this;
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -179,14 +180,14 @@ nsLDAPDataSource.prototype = {
|
||||
dump("Init() called with args: \n\t" + aURI + "\n\n");
|
||||
}
|
||||
|
||||
// XXX - if this a "single-connection" datasource
|
||||
// XXX - if this a "single-connection" datasource
|
||||
// (ie non-anonymous to a specific server); we should figure
|
||||
// that out here by noticing that there is a ; after "rdf:ldap", and
|
||||
// that after that there is a cookie which happens to be an LDAP URL
|
||||
// designating the connection. for now, we just assume that this will
|
||||
// be a "universal" (anonymous to any & all servers) datasource.
|
||||
// be a "universal" (anonymous to any & all servers) datasource.
|
||||
//
|
||||
// XXX rayw changed the delimiter char; it's not a ; any more.
|
||||
// XXX rayw changed the delimiter char; it's not a ; any more.
|
||||
// I think it might be ? now. He or waterson would know. The code
|
||||
// that knows about this is somewhere in rdf, perhaps in the XUL
|
||||
// template builder.
|
||||
@ -225,7 +226,7 @@ nsLDAPDataSource.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Request that a data source write it's contents out to
|
||||
* Request that a data source write it's contents out to
|
||||
* permanent storage, if applicable.
|
||||
*/
|
||||
Flush: function()
|
||||
@ -252,7 +253,7 @@ nsLDAPDataSource.prototype = {
|
||||
*/
|
||||
GetSource: function(aProperty, aTarget, aTruthValue) {
|
||||
if (DEBUG) {
|
||||
dump("GetSource() called with args: \n\t" + aProperty.Value +
|
||||
dump("GetSource() called with args: \n\t" + aProperty.Value +
|
||||
"\n\t" + aTarget.Value + "\n\t" + aTruthValue + "\n\n");
|
||||
}
|
||||
|
||||
@ -274,7 +275,7 @@ nsLDAPDataSource.prototype = {
|
||||
*/
|
||||
GetSources: function(aProperty, aTarget, aTruthValue) {
|
||||
if (DEBUG) {
|
||||
dump("GetSources() called with args: \n\t" + aProperty.Value +
|
||||
dump("GetSources() called with args: \n\t" + aProperty.Value +
|
||||
"\n\t" + aTarget.Value + "\n\t" + aTruthValue + "\n\n");
|
||||
}
|
||||
|
||||
@ -294,7 +295,7 @@ nsLDAPDataSource.prototype = {
|
||||
*/
|
||||
GetTarget: function(aSource, aProperty, aTruthValue) {
|
||||
if (DEBUG) {
|
||||
dump("GetTarget() called with args: \n\t" + aSource.Value +
|
||||
dump("GetTarget() called with args: \n\t" + aSource.Value +
|
||||
"\n\t" + aProperty.Value + "\n\t" + aTruthValue + "\n\n");
|
||||
}
|
||||
|
||||
@ -352,7 +353,7 @@ nsLDAPDataSource.prototype = {
|
||||
// get the attribute array for the specified LDAP attribute and
|
||||
// return the first value if it isn't empty.
|
||||
var refStart = aProperty.Value.indexOf("#");
|
||||
if (aProperty.Value.slice(0, refStart + 1) ==
|
||||
if (aProperty.Value.slice(0, refStart + 1) ==
|
||||
LDAPATTR_NAMESPACE_URI) {
|
||||
|
||||
try {
|
||||
@ -391,10 +392,10 @@ nsLDAPDataSource.prototype = {
|
||||
*/
|
||||
GetTargets: function(aSource, aProperty, aTruthValue) {
|
||||
if (DEBUG) {
|
||||
dump("GetTargets() called with args: \n\t" + aSource.Value +
|
||||
dump("GetTargets() called with args: \n\t" + aSource.Value +
|
||||
"\n\t" + aProperty.Value + "\n\t" + aTruthValue + "\n\n");
|
||||
}
|
||||
|
||||
|
||||
// We don't handle negative assertions.
|
||||
// XXX Should we? Can we?
|
||||
if (!aTruthValue) {
|
||||
@ -441,7 +442,7 @@ nsLDAPDataSource.prototype = {
|
||||
// get the attribute array for the specified LDAP attribute and
|
||||
// an enumerator for the array.
|
||||
var refStart = aProperty.Value.indexOf("#");
|
||||
if (aProperty.Value.slice(0, refStart + 1) ==
|
||||
if (aProperty.Value.slice(0, refStart + 1) ==
|
||||
LDAPATTR_NAMESPACE_URI) {
|
||||
try {
|
||||
delegate = aSource.GetDelegate("message.ldap",
|
||||
@ -471,7 +472,7 @@ nsLDAPDataSource.prototype = {
|
||||
*/
|
||||
Assert: function(aSource, aProperty, aTarget, aTruthValue) {
|
||||
if (DEBUG) {
|
||||
dump("Assert() called with args: \n\t" + aSource.Value +
|
||||
dump("Assert() called with args: \n\t" + aSource.Value +
|
||||
"\n\t" + aProperty.Value + "\n\t" + aTarget.Value +
|
||||
"\n\t" + aTruthValue + "\n\n");
|
||||
}
|
||||
@ -486,7 +487,7 @@ nsLDAPDataSource.prototype = {
|
||||
*/
|
||||
Unassert: function(aSource, aProperty, aTarget) {
|
||||
if (DEBUG) {
|
||||
dump("Unassert() called with args: \n\t" + aSource.Value +
|
||||
dump("Unassert() called with args: \n\t" + aSource.Value +
|
||||
"\n\t" + aProperty.Value + "\n\t" + aTarget.Value + "\n\n");
|
||||
}
|
||||
},
|
||||
@ -497,7 +498,7 @@ nsLDAPDataSource.prototype = {
|
||||
* [aSource]--[aProperty]-->[aOldTarget]
|
||||
*
|
||||
* to
|
||||
*
|
||||
*
|
||||
* [aSource]--[aProperty]-->[aNewTarget]
|
||||
*
|
||||
* void Change (in nsIRDFResource aSource,
|
||||
@ -507,7 +508,7 @@ nsLDAPDataSource.prototype = {
|
||||
*/
|
||||
Change: function(aSource, aProperty, aOldTarget, aNewTarget) {
|
||||
if (DEBUG) {
|
||||
dump("Change() called with args: \n\t" + aSource.Value +
|
||||
dump("Change() called with args: \n\t" + aSource.Value +
|
||||
"\n\t" + aProperty.Value + "\n\t" + aOldTarget.Value +
|
||||
"\n\t" + aNewTarget.Value + "\n\n");
|
||||
}
|
||||
@ -519,7 +520,7 @@ nsLDAPDataSource.prototype = {
|
||||
* [aOldSource]--[aProperty]-->[aTarget]
|
||||
*
|
||||
* to
|
||||
*
|
||||
*
|
||||
* [aNewSource]--[aProperty]-->[aTarget]
|
||||
*
|
||||
* void Move (in nsIRDFResource aOldSource,
|
||||
@ -529,7 +530,7 @@ nsLDAPDataSource.prototype = {
|
||||
*/
|
||||
Move: function(aOldSource, aNewSource, aProperty, aTarget) {
|
||||
if (DEBUG) {
|
||||
dump("Move() called with args: \n\t" + aOldSource.Value +
|
||||
dump("Move() called with args: \n\t" + aOldSource.Value +
|
||||
"\n\t" + aNewSource.Value + "\n\t" + aProperty.Value +
|
||||
"\n\t" + aTarget.Value + "\n\n");
|
||||
}
|
||||
@ -624,7 +625,7 @@ nsLDAPDataSource.prototype = {
|
||||
// get the attribute array for the specified LDAP attribute and
|
||||
// an enumerator for the array.
|
||||
var refStart = aProperty.Value.indexOf("#");
|
||||
if (aProperty.Value.slice(0, refStart + 1) ==
|
||||
if (aProperty.Value.slice(0, refStart + 1) ==
|
||||
LDAPATTR_NAMESPACE_URI) {
|
||||
try {
|
||||
delegate = aSource.GetDelegate("message.ldap",
|
||||
@ -700,13 +701,13 @@ nsLDAPDataSource.prototype = {
|
||||
*/
|
||||
ArcLabelsIn: function(aNode) {
|
||||
if (DEBUG) {
|
||||
dump("ArcLabelsIn() called with args: \n\t" + aNode.Value +
|
||||
dump("ArcLabelsIn() called with args: \n\t" + aNode.Value +
|
||||
"\n\n");
|
||||
}
|
||||
|
||||
return new ArrayEnumerator(new Array());
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Get a cursor to iterate over all the arcs that originate in
|
||||
* a resource.
|
||||
@ -717,10 +718,10 @@ nsLDAPDataSource.prototype = {
|
||||
*
|
||||
* nsISimpleEnumerator ArcLabelsOut(in nsIRDFResource aSource);
|
||||
*/
|
||||
ArcLabelsOut: function(aSource)
|
||||
ArcLabelsOut: function(aSource)
|
||||
{
|
||||
if (DEBUG) {
|
||||
dump("ArcLabelsOut() called with args: \n\t" + aSource.Value +
|
||||
dump("ArcLabelsOut() called with args: \n\t" + aSource.Value +
|
||||
"\n\n");
|
||||
}
|
||||
|
||||
@ -735,10 +736,10 @@ nsLDAPDataSource.prototype = {
|
||||
* boolean hasArcIn (in nsIRDFNode aNode,
|
||||
* in nsIRDFResource aArc);
|
||||
*/
|
||||
hasArcIn: function(aNode, aArc)
|
||||
hasArcIn: function(aNode, aArc)
|
||||
{
|
||||
if (DEBUG) {
|
||||
dump("hasArcIn() called with args: \n\t" + aNode.Value +
|
||||
dump("hasArcIn() called with args: \n\t" + aNode.Value +
|
||||
"\n\t" + aArc.Value + "\n\n");
|
||||
}
|
||||
|
||||
@ -747,16 +748,16 @@ nsLDAPDataSource.prototype = {
|
||||
|
||||
/**
|
||||
* Returns true if the specified node has the specified outward arc.
|
||||
* Equivalent to enumerating ArcLabelsOut and comparing for the specified
|
||||
* Equivalent to enumerating ArcLabelsOut and comparing for the specified
|
||||
* arc.
|
||||
*
|
||||
* boolean hasArcOut (in nsIRDFResource aSource,
|
||||
* in nsIRDFResource aArc);
|
||||
*/
|
||||
hasArcOut: function(aSource, aArc)
|
||||
hasArcOut: function(aSource, aArc)
|
||||
{
|
||||
if (DEBUG) {
|
||||
dump("hasArcOut() called with args: \n\t" + aSource.Value +
|
||||
dump("hasArcOut() called with args: \n\t" + aSource.Value +
|
||||
"\n\t" + aArc.Value + "\n\n");
|
||||
}
|
||||
|
||||
@ -807,7 +808,7 @@ nsLDAPDataSource.prototype = {
|
||||
}
|
||||
if (delegate != null) {
|
||||
var attributeName = aArc.Value.slice(refStart + 1);
|
||||
var attributeArray = this.getAttributeArray(delegate,
|
||||
var attributeArray = this.getAttributeArray(delegate,
|
||||
attributeName);
|
||||
if (attributeArray.length > 0) {
|
||||
return true;
|
||||
@ -824,7 +825,7 @@ nsLDAPDataSource.prototype = {
|
||||
onAssert: function(aDataSource, aSource, aProperty, aTarget)
|
||||
{
|
||||
if (DEBUG) {
|
||||
dump("OnAssert() called with args: \n\t" + aSource.Value +
|
||||
dump("OnAssert() called with args: \n\t" + aSource.Value +
|
||||
"\n\t" + aProperty.Value + "\n\t" + aTarget.Value + "\n\n");
|
||||
}
|
||||
|
||||
@ -838,7 +839,7 @@ nsLDAPDataSource.prototype = {
|
||||
onUnassert: function(aDataSource, aSource, aProperty, aTarget)
|
||||
{
|
||||
if (DEBUG) {
|
||||
dump("onUnassert() called with args: \n\t" + aSource.Value +
|
||||
dump("onUnassert() called with args: \n\t" + aSource.Value +
|
||||
"\n\t" + aProperty.Value + "\n\t" + aTarget.Value + "\n\n");
|
||||
}
|
||||
|
||||
@ -852,7 +853,7 @@ nsLDAPDataSource.prototype = {
|
||||
onChange: function(aDataSource, aSource, aProperty, aOldTarget, aNewTarget)
|
||||
{
|
||||
if (DEBUG) {
|
||||
dump("onChange() called with args: \n\t" + aSource.Value +
|
||||
dump("onChange() called with args: \n\t" + aSource.Value +
|
||||
"\n\t" + aProperty.Value + "\n\t" + aOldTarget.Value +
|
||||
"\n\t" + aNewTarget.Value + "\n\n");
|
||||
}
|
||||
@ -915,18 +916,18 @@ nsLDAPDataSource.prototype = {
|
||||
|
||||
// the nsILDAPMessage associated with a given resource
|
||||
//
|
||||
const NS_LDAPMESSAGERDFDELEGATEFACTORY_CONTRACTID =
|
||||
const NS_LDAPMESSAGERDFDELEGATEFACTORY_CONTRACTID =
|
||||
'@mozilla.org/rdf/delegate-factory;1?key='+"message.ldap"+'&scheme=ldap'
|
||||
const NS_LDAPFLATMESSAGELISTRDFDELEGATEFACTORY_CONTRACTID =
|
||||
const NS_LDAPFLATMESSAGELISTRDFDELEGATEFACTORY_CONTRACTID =
|
||||
'@mozilla.org/rdf/delegate-factory;1?key=flat.messagelist.ldap&scheme=ldap'
|
||||
const NS_LDAPRECURSIVEMESSAGELISTRDFDELEGATEFACTORY_CONTRACTID =
|
||||
const NS_LDAPRECURSIVEMESSAGELISTRDFDELEGATEFACTORY_CONTRACTID =
|
||||
'@mozilla.org/rdf/delegate-factory;1?key=recursive.messagelist.ldap&scheme=ldap'
|
||||
const NS_LDAPMESSAGERDFDELEGATEFACTORY_CID =
|
||||
const NS_LDAPMESSAGERDFDELEGATEFACTORY_CID =
|
||||
Components.ID('{4b6fb566-1dd2-11b2-a1a9-889a3f852b0b}');
|
||||
|
||||
function nsLDAPMessageRDFDelegateFactory() {}
|
||||
|
||||
nsLDAPMessageRDFDelegateFactory.prototype =
|
||||
nsLDAPMessageRDFDelegateFactory.prototype =
|
||||
{
|
||||
mRdfSvc: {},
|
||||
mLDAPSvc: {},
|
||||
@ -959,9 +960,9 @@ nsLDAPMessageRDFDelegateFactory.prototype =
|
||||
|
||||
// get some RDF Resources that we'll need
|
||||
//
|
||||
this.kNC_child = this.mRdfSvc.GetResource(NC_NAMESPACE_URI +
|
||||
this.kNC_child = this.mRdfSvc.GetResource(NC_NAMESPACE_URI +
|
||||
"child");
|
||||
this.kNC_recursiveChild = this.mRdfSvc.GetResource(NC_NAMESPACE_URI +
|
||||
this.kNC_recursiveChild = this.mRdfSvc.GetResource(NC_NAMESPACE_URI +
|
||||
"recursiveChild");
|
||||
}
|
||||
},
|
||||
@ -970,11 +971,12 @@ nsLDAPMessageRDFDelegateFactory.prototype =
|
||||
if (DEBUG) {
|
||||
dump("QueryInterface called\n\n");
|
||||
}
|
||||
if (!iid.equals(Components.interfaces.nsISupports) &&
|
||||
!iid.equals(Components.interfaces.nsIRDFDelegateFactory))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
if (iid.equals(Components.interfaces.nsISupports) ||
|
||||
iid.equals(Components.interfaces.nsIRDFDelegateFactory))
|
||||
return this;
|
||||
|
||||
return this;
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
// from nsIRDFDelegateFactory:
|
||||
@ -989,21 +991,22 @@ nsLDAPMessageRDFDelegateFactory.prototype =
|
||||
// in nsIIDRef aIID,
|
||||
// [retval, iid_is(aIID)] out nsQIResult aResult);
|
||||
CreateDelegate: function (aOuter, aKey, aIID) {
|
||||
|
||||
|
||||
function generateGetTargetsBoundCallback() {
|
||||
function getTargetsBoundCallback() {
|
||||
}
|
||||
|
||||
getTargetsBoundCallback.prototype.QueryInterface =
|
||||
function(iid) {
|
||||
if (!iid.equals(Components.interfaces.nsISupports) &&
|
||||
!iid.equals(Components.interfaces.nsILDAPMessageListener))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
if (iid.equals(Components.interfaces.nsISupports) ||
|
||||
iid.equals(Components.interfaces.nsILDAPMessageListener))
|
||||
return this;
|
||||
|
||||
return this;
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
|
||||
getTargetsBoundCallback.prototype.onLDAPMessage =
|
||||
getTargetsBoundCallback.prototype.onLDAPMessage =
|
||||
function(aMessage) {
|
||||
if (DEBUG) {
|
||||
dump("getTargetsBoundCallback.onLDAPMessage()" +
|
||||
@ -1038,7 +1041,7 @@ nsLDAPMessageRDFDelegateFactory.prototype =
|
||||
0, -1);
|
||||
}
|
||||
|
||||
getTargetsBoundCallback.prototype.onLDAPInit =
|
||||
getTargetsBoundCallback.prototype.onLDAPInit =
|
||||
function(aConn, aStatus) {
|
||||
if (DEBUG) {
|
||||
dump("getTargetsBoundCallback.onLDAPInit()" +
|
||||
@ -1071,14 +1074,15 @@ nsLDAPMessageRDFDelegateFactory.prototype =
|
||||
}
|
||||
|
||||
getTargetsSearchCallback.prototype.QueryInterface = function(iid) {
|
||||
if (!iid.equals(Components.interfaces.nsISupports) &&
|
||||
!iid.equals(Components.interfaces.nsILDAPMessageListener))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
if (iid.equals(Components.interfaces.nsISupports) ||
|
||||
iid.equals(Components.interfaces.nsILDAPMessageListener))
|
||||
return this;
|
||||
|
||||
return this;
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
};
|
||||
|
||||
getTargetsSearchCallback.prototype.onLDAPMessage =
|
||||
getTargetsSearchCallback.prototype.onLDAPMessage =
|
||||
function(aMessage) {
|
||||
if (DEBUG) {
|
||||
dump("getTargetsSearchCallback() called with message" +
|
||||
@ -1088,8 +1092,8 @@ nsLDAPMessageRDFDelegateFactory.prototype =
|
||||
var listHash = caller.mMessagesListHash;
|
||||
if (aMessage.type == aMessage.RES_SEARCH_ENTRY) {
|
||||
if (DEBUG) {
|
||||
dump("getTargetsSearchCallback() called with " +
|
||||
"message " + aMessage.dn + " for " +
|
||||
dump("getTargetsSearchCallback() called with " +
|
||||
"message " + aMessage.dn + " for " +
|
||||
aOuter.Value + "\n\n");
|
||||
}
|
||||
|
||||
@ -1103,7 +1107,7 @@ nsLDAPMessageRDFDelegateFactory.prototype =
|
||||
newURL.dn = aMessage.dn;
|
||||
newURL.scope = SCOPE_BASE;
|
||||
newURL.filter = "(objectClass=*)";
|
||||
var newResource =
|
||||
var newResource =
|
||||
caller.mRdfSvc.GetResource(newURL.spec);
|
||||
|
||||
// Add the LDAP message for the new resource in our
|
||||
@ -1131,7 +1135,7 @@ nsLDAPMessageRDFDelegateFactory.prototype =
|
||||
// Add the LDAP message to the result array for
|
||||
// the query resource and onAssert the result
|
||||
// as a child of the query resource.
|
||||
var queryResource =
|
||||
var queryResource =
|
||||
caller.mRdfSvc.GetResource(queryURL.spec);
|
||||
if (!listHash.hasOwnProperty(queryURL.spec)) {
|
||||
// No entry for the query resource in the
|
||||
@ -1188,7 +1192,7 @@ nsLDAPMessageRDFDelegateFactory.prototype =
|
||||
// message too (cf. mInProgressHash for messagelist's).
|
||||
//
|
||||
if (DEBUG) {
|
||||
dump("GetDelegate() called with args: \n\t" + aOuter.Value +
|
||||
dump("GetDelegate() called with args: \n\t" + aOuter.Value +
|
||||
"\n\t" + aKey + "\n\t" + aIID + "\n\n");
|
||||
}
|
||||
|
||||
@ -1238,7 +1242,7 @@ nsLDAPMessageRDFDelegateFactory.prototype =
|
||||
queryURL.spec = aOuter.Value;
|
||||
}
|
||||
|
||||
// make sure that this if this URL is for a messagelist, it
|
||||
// make sure that this if this URL is for a messagelist, it
|
||||
// represents something other than a base search
|
||||
//
|
||||
if ((queryType == FLAT_LIST) && (queryURL.scope == SCOPE_BASE)) {
|
||||
@ -1288,8 +1292,8 @@ nsLDAPMessageRDFDelegateFactory.prototype =
|
||||
Components.interfaces.nsILDAPConnection.VERSION3);
|
||||
|
||||
// XXXdmose - in this case, we almost certainly shouldn't be
|
||||
// falling through to an error case, but instead returning
|
||||
// something reasonable, since this is actually a success
|
||||
// falling through to an error case, but instead returning
|
||||
// something reasonable, since this is actually a success
|
||||
// condition
|
||||
//
|
||||
debug("falling through!\n");
|
||||
@ -1305,12 +1309,12 @@ nsLDAPMessageRDFDelegateFactory.prototype =
|
||||
//
|
||||
const NS_LDAPURLRDFDELEGATEFACTORY_CONTRACTID =
|
||||
'@mozilla.org/rdf/delegate-factory/url.ldap;1';
|
||||
const NS_LDAPURLRDFDELEGATEFACTORY_CID =
|
||||
const NS_LDAPURLRDFDELEGATEFACTORY_CID =
|
||||
Components.ID('b6048700-1dd1-11b2-ae88-a5e18bb1f25e');
|
||||
|
||||
function nsLDAPURLRDFDelegateFactory() {}
|
||||
|
||||
nsLDAPURLRDFDelegateFactory.prototype =
|
||||
nsLDAPURLRDFDelegateFactory.prototype =
|
||||
{
|
||||
// from nsIRDFDelegateFactory:
|
||||
//
|
||||
@ -1329,14 +1333,14 @@ nsLDAPURLRDFDelegateFactory.prototype =
|
||||
|
||||
// the nsILDAPConnection associated with a given resource
|
||||
//
|
||||
const NS_LDAPCONNECTIONRDFDELEGATEFACTORY_CONTRACTID =
|
||||
const NS_LDAPCONNECTIONRDFDELEGATEFACTORY_CONTRACTID =
|
||||
'@mozilla.org/rdf/delegate-factory/connection.ldap;1';
|
||||
const NS_LDAPCONNECTIONRDFDELEGATEFACTORY_CID =
|
||||
const NS_LDAPCONNECTIONRDFDELEGATEFACTORY_CID =
|
||||
Components.ID('57075fc6-1dd2-11b2-9df5-dbb9111d1b38');
|
||||
|
||||
function nsLDAPConnectionRDFDelegateFactory() {}
|
||||
|
||||
nsLDAPConnectionRDFDelegateFactory.prototype =
|
||||
nsLDAPConnectionRDFDelegateFactory.prototype =
|
||||
{
|
||||
// from nsIRDFDelegateFactory:
|
||||
//
|
||||
@ -1357,48 +1361,48 @@ var Datasource = null;
|
||||
var MessageDelegateFactory = null;
|
||||
|
||||
// nsLDAPDataSource Module (for XPCOM registration)
|
||||
//
|
||||
//
|
||||
var nsLDAPDataSourceModule = {
|
||||
|
||||
registerSelf: function (compMgr, fileSpec, location, type) {
|
||||
debug("*** Registering LDAP datasource components" +
|
||||
" (all right -- a JavaScript module!)\n");
|
||||
|
||||
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
|
||||
|
||||
compMgr.registerFactoryLocation(
|
||||
NS_LDAPDATASOURCE_CID,
|
||||
'LDAP RDF DataSource',
|
||||
NS_LDAPDATASOURCE_CONTRACTID,
|
||||
fileSpec, location,
|
||||
NS_LDAPDATASOURCE_CID,
|
||||
'LDAP RDF DataSource',
|
||||
NS_LDAPDATASOURCE_CONTRACTID,
|
||||
fileSpec, location,
|
||||
type);
|
||||
|
||||
compMgr.registerFactoryLocation(
|
||||
NS_LDAPMESSAGERDFDELEGATEFACTORY_CID,
|
||||
'LDAP Message RDF Delegate',
|
||||
NS_LDAPMESSAGERDFDELEGATEFACTORY_CONTRACTID,
|
||||
fileSpec, location,
|
||||
NS_LDAPMESSAGERDFDELEGATEFACTORY_CID,
|
||||
'LDAP Message RDF Delegate',
|
||||
NS_LDAPMESSAGERDFDELEGATEFACTORY_CONTRACTID,
|
||||
fileSpec, location,
|
||||
type);
|
||||
|
||||
compMgr.registerFactoryLocation(
|
||||
NS_LDAPMESSAGERDFDELEGATEFACTORY_CID,
|
||||
'LDAP Flat MessageList RDF Delegate',
|
||||
NS_LDAPFLATMESSAGELISTRDFDELEGATEFACTORY_CONTRACTID,
|
||||
fileSpec, location,
|
||||
NS_LDAPMESSAGERDFDELEGATEFACTORY_CID,
|
||||
'LDAP Flat MessageList RDF Delegate',
|
||||
NS_LDAPFLATMESSAGELISTRDFDELEGATEFACTORY_CONTRACTID,
|
||||
fileSpec, location,
|
||||
type);
|
||||
|
||||
compMgr.registerFactoryLocation(
|
||||
NS_LDAPMESSAGERDFDELEGATEFACTORY_CID,
|
||||
'LDAP Recursive MessageList RDF Delegate',
|
||||
NS_LDAPRECURSIVEMESSAGELISTRDFDELEGATEFACTORY_CONTRACTID,
|
||||
fileSpec, location,
|
||||
NS_LDAPMESSAGERDFDELEGATEFACTORY_CID,
|
||||
'LDAP Recursive MessageList RDF Delegate',
|
||||
NS_LDAPRECURSIVEMESSAGELISTRDFDELEGATEFACTORY_CONTRACTID,
|
||||
fileSpec, location,
|
||||
type);
|
||||
|
||||
compMgr.registerFactoryLocation(
|
||||
NS_LDAPURLRDFDELEGATEFACTORY_CID,
|
||||
'LDAP URL RDF Delegate',
|
||||
NS_LDAPURLRDFDELEGATEFACTORY_CONTRACTID,
|
||||
fileSpec, location,
|
||||
NS_LDAPURLRDFDELEGATEFACTORY_CID,
|
||||
'LDAP URL RDF Delegate',
|
||||
NS_LDAPURLRDFDELEGATEFACTORY_CONTRACTID,
|
||||
fileSpec, location,
|
||||
type);
|
||||
},
|
||||
|
||||
@ -1408,7 +1412,7 @@ var nsLDAPDataSourceModule = {
|
||||
}
|
||||
|
||||
if (cid.equals(NS_LDAPDATASOURCE_CID))
|
||||
return this.nsLDAPDataSourceFactory;
|
||||
return this.nsLDAPDataSourceFactory;
|
||||
else if (cid.equals(NS_LDAPMESSAGERDFDELEGATEFACTORY_CID))
|
||||
return this.nsLDAPMessageRDFDelegateFactoryFactory;
|
||||
else if (cid.equals(NS_LDAPURLRDFDELEGATEFACTORY_CID))
|
||||
@ -1421,7 +1425,7 @@ var nsLDAPDataSourceModule = {
|
||||
createInstance: function(outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
|
||||
if (Datasource == null) {
|
||||
Datasource = new nsLDAPDataSource();
|
||||
}
|
||||
@ -1438,7 +1442,7 @@ var nsLDAPDataSourceModule = {
|
||||
if (MessageDelegateFactory == null) {
|
||||
MessageDelegateFactory = new nsLDAPMessageRDFDelegateFactory();
|
||||
}
|
||||
|
||||
|
||||
return MessageDelegateFactory.QueryInterface(iid);
|
||||
}
|
||||
},
|
||||
@ -1447,7 +1451,7 @@ var nsLDAPDataSourceModule = {
|
||||
createInstance: function(outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
|
||||
return (new nsLDAPURLRDFDelegateFactory()).QueryInterface(iid);
|
||||
}
|
||||
},
|
||||
|
@ -34,7 +34,7 @@
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
/* Main Composer window debug menu functions */
|
||||
|
||||
// --------------------------- Output ---------------------------
|
||||
@ -112,11 +112,11 @@ function EditorTestSelection()
|
||||
|
||||
dump("====== Selection as HTML ======================\n");
|
||||
output = editor.outputToString("text/html", 1);
|
||||
dump(output + "\n\n");
|
||||
dump(output + "\n\n");
|
||||
|
||||
dump("====== Selection as prettyprinted HTML ========\n");
|
||||
output = editor.outputToString("text/html", 3);
|
||||
dump(output + "\n\n");
|
||||
dump(output + "\n\n");
|
||||
|
||||
dump("====== Length and status =====================\n");
|
||||
output = "Document is ";
|
||||
@ -149,7 +149,7 @@ function EditorTestTableLayout()
|
||||
dump("Enclosing Table not found: Place caret in a table cell to do this test\n\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var cell;
|
||||
var startRowIndexObj = { value: null };
|
||||
var startColIndexObj = { value: null };
|
||||
@ -178,7 +178,7 @@ function EditorTestTableLayout()
|
||||
// but this tests using out-of-bounds offsets to detect end of row or column
|
||||
|
||||
while (!doneWithRow) // Iterate through rows
|
||||
{
|
||||
{
|
||||
dump("* Data for ROW="+row+":\n");
|
||||
while(!doneWithCol) // Iterate through cells in the row
|
||||
{
|
||||
@ -196,7 +196,7 @@ function EditorTestTableLayout()
|
||||
actualRowSpan = actualRowSpanObj.value;
|
||||
actualColSpan = actualColSpanObj.value;
|
||||
isSelected = isSelectedObj.value;
|
||||
|
||||
|
||||
dump(" Row="+row+", Col="+col+" StartRow="+startRowIndexObj.value+", StartCol="+startColIndexObj.value+"\n");
|
||||
dump(" RowSpan="+rowSpan+", ColSpan="+colSpan+" ActualRowSpan="+actualRowSpan+", ActualColSpan="+actualColSpan);
|
||||
if (isSelected)
|
||||
@ -239,7 +239,7 @@ function EditorTestTableLayout()
|
||||
col = 0;
|
||||
row++;
|
||||
doneWithCol = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
dump("Counted during scan: Number of rows="+rowCount+" Number of Columns="+maxColCount+"\n");
|
||||
rowCount = editor.getTableRowCount(table);
|
||||
@ -290,12 +290,12 @@ function EditorExecuteScript(theFile)
|
||||
inputStream = inputStream.QueryInterface(Components.interfaces.nsIFileInputStream);
|
||||
|
||||
inputStream.init(theFile, 1, 0, false); // open read only
|
||||
|
||||
|
||||
var scriptableInputStream = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance();
|
||||
scriptableInputStream = scriptableInputStream.QueryInterface(Components.interfaces.nsIScriptableInputStream);
|
||||
|
||||
|
||||
scriptableInputStream.init(inputStream); // open read only
|
||||
|
||||
|
||||
var buf = { value:null };
|
||||
var tmpBuf = { value:null };
|
||||
var didTruncate = { value:false };
|
||||
@ -334,9 +334,9 @@ function EditorExecuteScript(theFile)
|
||||
// suck in the entire file
|
||||
var fileSize = scriptableInputStream.available();
|
||||
var fileContents = scriptableInputStream.read(fileSize);
|
||||
|
||||
|
||||
dump(fileContents);
|
||||
|
||||
|
||||
try { eval(fileContents); }
|
||||
catch(ex) { dump("Playback ERROR: Line " + lineNum + " " + ex + "\n"); return; }
|
||||
}
|
||||
@ -506,13 +506,14 @@ sampleJSTransaction.prototype = {
|
||||
return false;
|
||||
},
|
||||
|
||||
QueryInterface: function(theUID, theResult)
|
||||
QueryInterface: function(aUID, theResult)
|
||||
{
|
||||
if (theUID == Components.interfaces.nsITransaction ||
|
||||
theUID == Components.interfaces.nsISupports)
|
||||
return this;
|
||||
if (aUID.equals(Components.interfaces.nsITransaction) ||
|
||||
aUID.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
return nsnull;
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
insert_node_at_point: function(node, container, offset)
|
||||
|
@ -527,7 +527,9 @@ function Startup()
|
||||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
|
||||
aIID.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
throw Components.results.NS_NOINTERFACE;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
// useful for debugging
|
||||
get wrappedJSObject() { return this; },
|
||||
|
@ -52,9 +52,9 @@ const kTotalSecurityHostingFlags =
|
||||
nsIActiveXSecurityPolicy.HOSTING_FLAGS_HOST_NOTHING;
|
||||
|
||||
// Host only safe controls, no downloading or scripting
|
||||
const kHighSecurityHostingFlags =
|
||||
const kHighSecurityHostingFlags =
|
||||
nsIActiveXSecurityPolicy.HOSTING_FLAGS_HOST_SAFE_OBJECTS;
|
||||
|
||||
|
||||
// Host and script safe controls and allow downloads
|
||||
const kMediumSecurityGlobalHostingFlags =
|
||||
nsIActiveXSecurityPolicy.HOSTING_FLAGS_HOST_SAFE_OBJECTS |
|
||||
@ -67,9 +67,9 @@ const kLowSecurityHostFlags =
|
||||
nsIActiveXSecurityPolicy.HOSTING_FLAGS_DOWNLOAD_CONTROLS |
|
||||
nsIActiveXSecurityPolicy.HOSTING_FLAGS_SCRIPT_SAFE_OBJECTS |
|
||||
nsIActiveXSecurityPolicy.HOSTING_FLAGS_HOST_ALL_OBJECTS;
|
||||
|
||||
|
||||
// Goodbye cruel world
|
||||
const kNoSecurityHostingFlags =
|
||||
const kNoSecurityHostingFlags =
|
||||
nsIActiveXSecurityPolicy.HOSTING_FLAGS_HOST_SAFE_OBJECTS |
|
||||
nsIActiveXSecurityPolicy.HOSTING_FLAGS_DOWNLOAD_CONTROLS |
|
||||
nsIActiveXSecurityPolicy.HOSTING_FLAGS_SCRIPT_SAFE_OBJECTS |
|
||||
@ -85,7 +85,7 @@ const kDefaultGlobalHostingFlags = kMediumSecurityGlobalHostingFlags;
|
||||
const kDefaultOtherHostingFlags = kMediumSecurityGlobalHostingFlags;
|
||||
|
||||
// Preferences security policy reads from
|
||||
const kHostingPrefPart1 = "security.xpconnect.activex.";
|
||||
const kHostingPrefPart1 = "security.xpconnect.activex.";
|
||||
const kHostingPrefPart2 = ".hosting_flags";
|
||||
const kGlobalHostingFlagsPref = kHostingPrefPart1 + "global" + kHostingPrefPart2;
|
||||
|
||||
@ -166,11 +166,13 @@ AxSecurityPolicy.prototype = {
|
||||
},
|
||||
// nsISupports
|
||||
QueryInterface: function(iid) {
|
||||
if (!iid.equals(nsISupports) &&
|
||||
!iid.equals(nsIActiveXSecurityPolicy) &&
|
||||
!iid.equals(nsIObserver))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return this;
|
||||
if (iid.equals(nsISupports) ||
|
||||
iid.equals(nsIActiveXSecurityPolicy) ||
|
||||
iid.equals(nsIObserver))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
@ -199,7 +201,7 @@ var AxSecurityPolicyModule = {
|
||||
"ActiveX Security Policy Service",
|
||||
NS_IACTIVEXSECURITYPOLICY_CONTRACTID,
|
||||
fileSpec,
|
||||
location,
|
||||
location,
|
||||
type);
|
||||
},
|
||||
unregisterSelf: function(compMgr, fileSpec, location)
|
||||
@ -215,7 +217,7 @@ var AxSecurityPolicyModule = {
|
||||
if (!iid.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
canUnload: function(compMgr)
|
||||
{
|
||||
|
@ -74,17 +74,18 @@ nsHelperAppDialog.prototype = {
|
||||
// Dump text (if debug is on).
|
||||
dump: function( text ) {
|
||||
if ( this.debug ) {
|
||||
dump( text );
|
||||
dump( text );
|
||||
}
|
||||
},
|
||||
|
||||
// This "class" supports nsIHelperAppLauncherDialog, and nsISupports.
|
||||
QueryInterface: function (iid) {
|
||||
if (!iid.equals(Components.interfaces.nsIHelperAppLauncherDialog) &&
|
||||
!iid.equals(Components.interfaces.nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
if (iid.equals(Components.interfaces.nsIHelperAppLauncherDialog) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
// ---------- nsIHelperAppLauncherDialog methods ----------
|
||||
@ -125,7 +126,7 @@ nsHelperAppDialog.prototype = {
|
||||
.createBundle( "chrome://global/locale/nsHelperAppDlg.properties");
|
||||
|
||||
var windowTitle = bundle.GetStringFromName( "saveDialogTitle" );
|
||||
|
||||
|
||||
var parent = aContext
|
||||
.QueryInterface( Components.interfaces.nsIInterfaceRequestor )
|
||||
.getInterface( Components.interfaces.nsIDOMWindowInternal );
|
||||
@ -179,7 +180,7 @@ nsHelperAppDialog.prototype = {
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
|
||||
// ---------- implementation methods ----------
|
||||
|
||||
// Web progress listener so we can detect errors while mLauncher is
|
||||
@ -253,7 +254,7 @@ nsHelperAppDialog.prototype = {
|
||||
|
||||
if (suggestedFileName)
|
||||
fname = suggestedFileName;
|
||||
|
||||
|
||||
|
||||
this.mTitle = this.replaceInsert( win.getAttribute( "title" ), 1, fname);
|
||||
win.setAttribute( "title", this.mTitle );
|
||||
@ -309,8 +310,8 @@ nsHelperAppDialog.prototype = {
|
||||
{
|
||||
// Use intro with descriptive text.
|
||||
modified = this.replaceInsert( this.getString( "intro.withDesc" ), 1, desc );
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use intro without descriptive text.
|
||||
modified = this.getString( "intro.noDesc" );
|
||||
@ -323,7 +324,7 @@ nsHelperAppDialog.prototype = {
|
||||
// if mSourcePath is a local file, then let's use the pretty path name instead of an ugly
|
||||
// url...
|
||||
var pathString = this.mSourcePath;
|
||||
try
|
||||
try
|
||||
{
|
||||
var fileURL = url.QueryInterface(Components.interfaces.nsIFileURL);
|
||||
if (fileURL)
|
||||
@ -361,10 +362,10 @@ nsHelperAppDialog.prototype = {
|
||||
// from the web), and, enable use of "system default" if it isn't
|
||||
// executable (because we will prompt the user for the default app
|
||||
// in that case).
|
||||
|
||||
|
||||
// Need to get temporary file and check for executable-ness.
|
||||
var tmpFile = this.mLauncher.targetFile;
|
||||
|
||||
|
||||
// Default is Ok if the file isn't executable (and vice-versa).
|
||||
result = !tmpFile.isExecutable();
|
||||
} else {
|
||||
@ -375,7 +376,7 @@ nsHelperAppDialog.prototype = {
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
|
||||
// Set "default" application description field.
|
||||
initDefaultApp: function() {
|
||||
// Use description, if we can get one.
|
||||
@ -393,14 +394,14 @@ nsHelperAppDialog.prototype = {
|
||||
|
||||
return file.path;
|
||||
},
|
||||
|
||||
|
||||
// initAppAndSaveToDiskValues:
|
||||
initAppAndSaveToDiskValues: function() {
|
||||
// Fill in helper app info, if there is any.
|
||||
this.chosenApp = this.mLauncher.MIMEInfo.preferredApplicationHandler;
|
||||
// Initialize "default application" field.
|
||||
this.initDefaultApp();
|
||||
|
||||
|
||||
// Fill application name textbox.
|
||||
if (this.chosenApp && this.chosenApp.path) {
|
||||
this.dialogElement( "appPath" ).value = this.getPath(this.chosenApp);
|
||||
@ -428,7 +429,7 @@ nsHelperAppDialog.prototype = {
|
||||
useDefault.radioGroup.selectedItem = this.dialogElement( "saveToDisk" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Enable/Disable choose application button and textfield
|
||||
this.toggleChoice();
|
||||
},
|
||||
@ -478,27 +479,27 @@ nsHelperAppDialog.prototype = {
|
||||
|
||||
updateOKButton: function() {
|
||||
var ok = false;
|
||||
if ( this.dialogElement( "saveToDisk" ).selected )
|
||||
if ( this.dialogElement( "saveToDisk" ).selected )
|
||||
{
|
||||
// This is always OK.
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
else if ( this.dialogElement( "useSystemDefault" ).selected )
|
||||
{
|
||||
// No app need be specified in this case.
|
||||
ok = true;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// only enable the OK button if we have a default app to use or if
|
||||
// only enable the OK button if we have a default app to use or if
|
||||
// the user chose an app....
|
||||
ok = this.chosenApp || /\S/.test( this.dialogElement( "appPath" ).value );
|
||||
}
|
||||
|
||||
|
||||
// Enable Ok button if ok to press.
|
||||
this.mDialog.document.documentElement.getButton( "accept" ).disabled = !ok;
|
||||
},
|
||||
|
||||
|
||||
// Returns true iff the user-specified helper app has been modified.
|
||||
appChanged: function() {
|
||||
return this.helperAppChoice() != this.mLauncher.MIMEInfo.preferredApplicationHandler;
|
||||
@ -535,7 +536,7 @@ nsHelperAppDialog.prototype = {
|
||||
{
|
||||
// We will also need to update if the "always ask" flag has changed.
|
||||
needUpdate = needUpdate || this.mLauncher.MIMEInfo.alwaysAskBeforeHandling == this.dialogElement( "alwaysHandle" ).checked;
|
||||
|
||||
|
||||
// One last special case: If the input "always ask" flag was false, then we always
|
||||
// update. In that case we are displaying the helper app dialog for the first
|
||||
// time for this mime type and we need to store the user's action in the mimeTypes.rdf
|
||||
@ -543,14 +544,14 @@ nsHelperAppDialog.prototype = {
|
||||
// to store the "always ask" flag so the helper app dialog will or won't display
|
||||
// next time, per the user's selection).
|
||||
needUpdate = needUpdate || !this.mLauncher.MIMEInfo.alwaysAskBeforeHandling;
|
||||
|
||||
|
||||
// Make sure mime info has updated setting for the "always ask" flag.
|
||||
this.mLauncher.MIMEInfo.alwaysAskBeforeHandling = !this.dialogElement( "alwaysHandle" ).checked;
|
||||
}
|
||||
|
||||
return needUpdate;
|
||||
return needUpdate;
|
||||
},
|
||||
|
||||
|
||||
// See if the user changed things, and if so, update the
|
||||
// mimeTypes.rdf entry for this mime type.
|
||||
updateHelperAppPref: function() {
|
||||
@ -562,14 +563,14 @@ nsHelperAppDialog.prototype = {
|
||||
"chrome,modal=yes,resizable=no",
|
||||
this );
|
||||
},
|
||||
|
||||
|
||||
// onOK:
|
||||
onOK: function() {
|
||||
// Verify typed app path, if necessary.
|
||||
if ( this.dialogElement( "openUsing" ).selected ) {
|
||||
var helperApp = this.helperAppChoice();
|
||||
if ( !helperApp || !helperApp.exists() ) {
|
||||
// Show alert and try again.
|
||||
// Show alert and try again.
|
||||
var msg = this.replaceInsert( this.getString( "badApp" ), 1, this.dialogElement( "appPath" ).value );
|
||||
var svc = Components.classes[ "@mozilla.org/embedcomp/prompt-service;1" ]
|
||||
.getService( Components.interfaces.nsIPromptService );
|
||||
@ -588,12 +589,12 @@ nsHelperAppDialog.prototype = {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Remove our web progress listener (a progress dialog will be
|
||||
// taking over).
|
||||
this.mLauncher.setWebProgressListener( null );
|
||||
|
||||
// saveToDisk and launchWithApplication can return errors in
|
||||
|
||||
// saveToDisk and launchWithApplication can return errors in
|
||||
// certain circumstances (e.g. The user clicks cancel in the
|
||||
// "Save to Disk" dialog. In those cases, we don't want to
|
||||
// update the helper application preferences in the RDF file.
|
||||
@ -603,7 +604,7 @@ nsHelperAppDialog.prototype = {
|
||||
this.mLauncher.saveToDisk( null, false );
|
||||
else
|
||||
this.mLauncher.launchWithApplication( null, false );
|
||||
|
||||
|
||||
// Update user pref for this mime type (if necessary). We do not
|
||||
// store anything in the mime type preferences for the ambiguous
|
||||
// type application/octet-stream.
|
||||
@ -612,12 +613,12 @@ nsHelperAppDialog.prototype = {
|
||||
{
|
||||
this.updateHelperAppPref();
|
||||
}
|
||||
|
||||
|
||||
} catch(e) { }
|
||||
|
||||
|
||||
// Unhook dialog from this object.
|
||||
this.mDialog.dialog = null;
|
||||
|
||||
|
||||
// Close up dialog by returning true.
|
||||
return true;
|
||||
},
|
||||
@ -632,7 +633,7 @@ nsHelperAppDialog.prototype = {
|
||||
this.mLauncher.Cancel();
|
||||
} catch( exception ) {
|
||||
}
|
||||
|
||||
|
||||
// Unhook dialog from this object.
|
||||
this.mDialog.dialog = null;
|
||||
|
||||
@ -660,7 +661,7 @@ nsHelperAppDialog.prototype = {
|
||||
|
||||
// XXX - We want to say nsIFilePicker.filterExecutable or something
|
||||
fp.appendFilters( nsIFilePicker.filterAll );
|
||||
|
||||
|
||||
if ( fp.show() == nsIFilePicker.returnOK && fp.file ) {
|
||||
// Remember the file they chose to run.
|
||||
this.chosenApp = fp.file;
|
||||
|
@ -133,7 +133,7 @@ nsProgressDialog.prototype = {
|
||||
get cancelDownloadOnClose() { return this.mCancelDownloadOnClose; },
|
||||
set cancelDownloadOnClose(newval) { return this.mCancelDownloadOnClose = newval; },
|
||||
|
||||
set target(newval) {
|
||||
set target(newval) {
|
||||
// If newval references a file on the local filesystem, then grab a
|
||||
// reference to its corresponding nsIFile.
|
||||
if (newval instanceof nsIFileURL && newval.file instanceof nsILocalFile) {
|
||||
@ -168,7 +168,7 @@ nsProgressDialog.prototype = {
|
||||
this.dialogFeatures,
|
||||
this );
|
||||
},
|
||||
|
||||
|
||||
init: function( aSource, aTarget, aDisplayName, aMIMEInfo, aStartTime, aOperation ) {
|
||||
this.source = aSource;
|
||||
this.target = aTarget;
|
||||
@ -220,7 +220,7 @@ nsProgressDialog.prototype = {
|
||||
|
||||
// If interval hasn't elapsed, ignore it.
|
||||
if ( now - this.lastUpdate < this.interval &&
|
||||
aMaxTotalProgress != "-1" &&
|
||||
aMaxTotalProgress != "-1" &&
|
||||
parseInt( aCurTotalProgress ) < parseInt( aMaxTotalProgress ) ) {
|
||||
return;
|
||||
}
|
||||
@ -259,7 +259,7 @@ nsProgressDialog.prototype = {
|
||||
} else {
|
||||
status = this.replaceInsert( status, 2, "??" );
|
||||
}
|
||||
|
||||
|
||||
// Insert 3 is the download rate.
|
||||
if ( this.elapsed ) {
|
||||
this.rate = ( aCurTotalProgress * 1000 ) / this.elapsed;
|
||||
@ -268,10 +268,10 @@ nsProgressDialog.prototype = {
|
||||
// Rate not established, yet.
|
||||
status = this.replaceInsert( status, 3, "??.?" );
|
||||
}
|
||||
|
||||
|
||||
// All 3 inserts are taken care of, now update status msg.
|
||||
this.setValue( "status", status );
|
||||
|
||||
|
||||
// Update time remaining.
|
||||
if ( this.rate && ( aMaxTotalProgress > 0 ) ) {
|
||||
// Calculate how much time to download remaining at this rate.
|
||||
@ -293,10 +293,10 @@ nsProgressDialog.prototype = {
|
||||
.getService( Components.interfaces.nsIPromptService );
|
||||
// Display error alert (using text supplied by back-end).
|
||||
var title = this.getProperty( this.saving ? "savingAlertTitle" : "openingAlertTitle",
|
||||
[ this.fileName() ],
|
||||
[ this.fileName() ],
|
||||
1 );
|
||||
prompter.alert( this.dialog, title, aMessage );
|
||||
|
||||
|
||||
// Close the dialog.
|
||||
if ( !this.completed ) {
|
||||
this.onCancel();
|
||||
@ -356,16 +356,17 @@ nsProgressDialog.prototype = {
|
||||
// This "class" supports nsIProgressDialog, nsIWebProgressListener (by virtue
|
||||
// of interface inheritance), nsIObserver, and nsISupports.
|
||||
QueryInterface: function (iid) {
|
||||
if (!iid.equals(Components.interfaces.nsIProgressDialog) &&
|
||||
!iid.equals(Components.interfaces.nsIDownload) &&
|
||||
!iid.equals(Components.interfaces.nsITransfer) &&
|
||||
!iid.equals(Components.interfaces.nsIWebProgressListener) &&
|
||||
!iid.equals(Components.interfaces.nsIObserver) &&
|
||||
!iid.equals(Components.interfaces.nsIInterfaceRequestor) &&
|
||||
!iid.equals(Components.interfaces.nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
if (iid.equals(Components.interfaces.nsIProgressDialog) ||
|
||||
iid.equals(Components.interfaces.nsIDownload) ||
|
||||
iid.equals(Components.interfaces.nsITransfer) ||
|
||||
iid.equals(Components.interfaces.nsIWebProgressListener) ||
|
||||
iid.equals(Components.interfaces.nsIObserver) ||
|
||||
iid.equals(Components.interfaces.nsIInterfaceRequestor) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
// ---------- nsIInterfaceRequestor methods ----------
|
||||
@ -587,7 +588,7 @@ nsProgressDialog.prototype = {
|
||||
if ( this.targetFile != null )
|
||||
return this.targetFile.leafName;
|
||||
try {
|
||||
var escapedFileName = this.target.QueryInterface(nsIURL).fileName;
|
||||
var escapedFileName = this.target.QueryInterface(nsIURL).fileName;
|
||||
var textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
|
||||
.getService(nsITextToSubURI);
|
||||
return textToSubURI.unEscapeURIForUI(this.target.originCharset, escapedFileName);
|
||||
@ -599,7 +600,7 @@ nsProgressDialog.prototype = {
|
||||
setTitle: function() {
|
||||
// Start with saving/opening template.
|
||||
// If percentage is not known (-1), use alternate template
|
||||
var title = this.saving
|
||||
var title = this.saving
|
||||
? ( this.percent != -1 ? this.getString( "savingTitle" ) : this.getString( "unknownSavingTitle" ) )
|
||||
: ( this.percent != -1 ? this.getString( "openingTitle" ) : this.getString( "unknownOpeningTitle" ) );
|
||||
|
||||
@ -649,7 +650,7 @@ nsProgressDialog.prototype = {
|
||||
// Update progress meter percentage text.
|
||||
this.setValue( "progressText", this.replaceInsert( this.getString( "percentMsg" ), 1, percent ) );
|
||||
}
|
||||
|
||||
|
||||
// Update title.
|
||||
this.setTitle();
|
||||
}
|
||||
@ -782,19 +783,19 @@ nsProgressDialog.prototype = {
|
||||
result = this.getString( "longTimeFormat" );
|
||||
else
|
||||
result = this.getString( "shortTimeFormat" );
|
||||
|
||||
|
||||
if ( hours < 10 )
|
||||
hours = "0" + hours;
|
||||
if ( mins < 10 )
|
||||
mins = "0" + mins;
|
||||
if ( secs < 10 )
|
||||
secs = "0" + secs;
|
||||
|
||||
|
||||
// Insert hours, minutes, and seconds into result string.
|
||||
result = this.replaceInsert( result, 1, hours );
|
||||
result = this.replaceInsert( result, 2, mins );
|
||||
result = this.replaceInsert( result, 3, secs );
|
||||
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
@ -806,7 +807,7 @@ nsProgressDialog.prototype = {
|
||||
try {
|
||||
this.fields[ id ] = this.dialog.document.getElementById( id );
|
||||
} catch(e) {
|
||||
this.fields[ id ] = {
|
||||
this.fields[ id ] = {
|
||||
value: "",
|
||||
setAttribute: function(id,val) {},
|
||||
removeAttribute: function(id) {}
|
||||
@ -849,7 +850,7 @@ nsProgressDialog.prototype = {
|
||||
}
|
||||
return this.strings[ stringId ];
|
||||
},
|
||||
|
||||
|
||||
// Replaces insert ("#n") with input text.
|
||||
replaceInsert: function( text, index, value ) {
|
||||
var result = text;
|
||||
|
@ -48,7 +48,9 @@ sessionHistoryListener.prototype =
|
||||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
|
||||
aIID.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
throw Components.results.NS_NOINTERFACE;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
OnHistoryNewEntry: function(newUrl)
|
||||
|
@ -56,7 +56,7 @@ const LOAD_POLICY = 2;
|
||||
const LOAD_SUMMARY = 3;
|
||||
const LOAD_OPTIONS = 4;
|
||||
|
||||
const POLICY_ERROR = 5;
|
||||
const POLICY_ERROR = 5;
|
||||
const SUMMARY_ERROR = 6;
|
||||
const OPTIONS_ERROR = 7;
|
||||
|
||||
@ -69,16 +69,16 @@ var gStrBundle = null;
|
||||
var gBrandName = null;
|
||||
|
||||
/* class nsPolicyViewer
|
||||
*
|
||||
*
|
||||
* Used for viewing site's privacy policy, policy summary ( generated ),
|
||||
* and opt-ins/opt-outs
|
||||
* and opt-ins/opt-outs
|
||||
* @param - aMainURI -> The URI of the loaded document.
|
||||
*
|
||||
*/
|
||||
function nsPolicyViewer(aDoc)
|
||||
{
|
||||
if (!gIOService) {
|
||||
gIOService =
|
||||
gIOService =
|
||||
Components.classes["@mozilla.org/network/io-service;1"].getService(nsIIOService);
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ function nsPolicyViewer(aDoc)
|
||||
|
||||
}
|
||||
|
||||
nsPolicyViewer.prototype =
|
||||
nsPolicyViewer.prototype =
|
||||
{
|
||||
mAction : null,
|
||||
mPolicyLocation : null,
|
||||
@ -109,8 +109,8 @@ nsPolicyViewer.prototype =
|
||||
mFragment : null,
|
||||
mFlag : 0,
|
||||
|
||||
/*
|
||||
* Initiate privacy policy loading for a URI selected
|
||||
/*
|
||||
* Initiate privacy policy loading for a URI selected
|
||||
* in the Page-Info-Privacy tab window.
|
||||
* @param - aSelectedURI -> Absolute URI that requests a privacy policy
|
||||
* @param - aAction -> HUMAN READABLE | GENERATE SUMMARY | OPT-IN/OPT-OUT
|
||||
@ -131,25 +131,25 @@ nsPolicyViewer.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
/*
|
||||
* Initialize nsPolicyViewer
|
||||
* @param - aSelectedURI -> URI that requests a privacy policy
|
||||
* @param - aAction -> HUMAN READABLE | MACHINE READABLE | OPT-IN/OPT-OUT
|
||||
*/
|
||||
init : function(aSelectedURI, aAction)
|
||||
init : function(aSelectedURI, aAction)
|
||||
{
|
||||
try {
|
||||
if (!this.mPolicyReference) {
|
||||
this.mPolicyReference =
|
||||
this.mPolicyReference =
|
||||
Components.classes["@mozilla.org/p3p/policyreference;1"].createInstance(nsIPolicyReference);
|
||||
|
||||
|
||||
this.mPolicyTarget = this.mPolicyReference.QueryInterface(nsIPolicyTarget);
|
||||
this.mPolicyTarget.setupPolicyListener(this);
|
||||
this.mPolicyReference.initialize(this.mMainURI);
|
||||
}
|
||||
|
||||
this.mAction = aAction;
|
||||
|
||||
this.mAction = aAction;
|
||||
|
||||
// aSelectedURI is already absolute spec
|
||||
if (!this.mSelectedURI) {
|
||||
this.mSelectedURI = gIOService.newURI(aSelectedURI, null, null);
|
||||
@ -171,7 +171,7 @@ nsPolicyViewer.prototype =
|
||||
catch (ex) {
|
||||
this.reportError(aAction);
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
@ -194,13 +194,13 @@ nsPolicyViewer.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
/*
|
||||
* Initiate policy reference file ( PRF ) loading. A policy reference file
|
||||
* is used for locating the full p3p policy location.
|
||||
* @param - aURI -> URI that requests a privacy policy
|
||||
* @param - aFlag -> IS_MAIN_URI - The loaded document's URI
|
||||
* IS_EMBEDDED_URI - URI, embedded in the current document, with a different host.
|
||||
* IS_LINKED_URI - URI referenced via HTML/XHTML LINK tag.
|
||||
* IS_LINKED_URI - URI referenced via HTML/XHTML LINK tag.
|
||||
*/
|
||||
handleURI : function (aURI, aFlag)
|
||||
{
|
||||
@ -209,7 +209,7 @@ nsPolicyViewer.prototype =
|
||||
}
|
||||
catch(ex) {
|
||||
this.reportError(this.mAction);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
@ -217,7 +217,7 @@ nsPolicyViewer.prototype =
|
||||
* @param - aLocation -> A full p3p policy location
|
||||
* @param - aError -> POLICY_LOAD_SUCCESS | POLICY_LOAD_FAILURE
|
||||
*/
|
||||
notifyPolicyLocation : function (aLocation, aError)
|
||||
notifyPolicyLocation : function (aLocation, aError)
|
||||
{
|
||||
if (aError == nsIPolicyReference.POLICY_LOAD_SUCCESS) {
|
||||
if (!this.mPolicyURL) {
|
||||
@ -226,21 +226,21 @@ nsPolicyViewer.prototype =
|
||||
else {
|
||||
this.mPolicyURL.spec = aLocation;
|
||||
}
|
||||
|
||||
|
||||
// We have located the full p3p policy location from
|
||||
// the policy reference file. Now let's try to load full p3p
|
||||
// policy document.
|
||||
if (!this.mXMLHttpRequest) {
|
||||
this.mXMLHttpRequest = new XMLHttpRequest();
|
||||
}
|
||||
|
||||
|
||||
// If a fragment identifier is specified then we have to locate
|
||||
// the POLICY with a name specified by the fragment.
|
||||
// Ex. <POLICY name="one"> .... </POLICY> <POLICY name="two"> ...</POLICY>
|
||||
// if the fragment identifier is "#two" then we should find the POLICY named "two"
|
||||
this.mFragment = this.mPolicyURL.ref;
|
||||
|
||||
// If we've already loaded a full p3p policy then the policy
|
||||
// If we've already loaded a full p3p policy then the policy
|
||||
// document should be available ( note: Only for the same host's URIs ).
|
||||
if (this.mFlag & nsIPolicyReference.IS_MAIN_URI) {
|
||||
if (this.mDocument) {
|
||||
@ -261,7 +261,7 @@ nsPolicyViewer.prototype =
|
||||
}
|
||||
|
||||
this.mXMLHttpRequest.onload = this;
|
||||
// Override the mime type because without it XMLHttpRequest hangs
|
||||
// Override the mime type because without it XMLHttpRequest hangs
|
||||
// on certain sites that serve HTML instead ofXML.
|
||||
this.mXMLHttpRequest.overrideMimeType("text/xml");
|
||||
this.mXMLHttpRequest.open("GET", aLocation);
|
||||
@ -294,7 +294,7 @@ nsPolicyViewer.prototype =
|
||||
}
|
||||
this.reportError(this.mAction);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
this.reportError(this.mAction);
|
||||
}
|
||||
},
|
||||
@ -303,7 +303,7 @@ nsPolicyViewer.prototype =
|
||||
* Called on a policy load error.
|
||||
* @param - aError -> POLICY_LOAD_SUCCESS | POLICY_LOAD_FAILURE
|
||||
*/
|
||||
notifyPolicyError : function (aError)
|
||||
notifyPolicyError : function (aError)
|
||||
{
|
||||
this.reportError(this.mAction);
|
||||
},
|
||||
@ -313,24 +313,25 @@ nsPolicyViewer.prototype =
|
||||
* with the policy viewer and therefore all the objects can
|
||||
* be released
|
||||
*/
|
||||
finalize: function ()
|
||||
finalize: function ()
|
||||
{
|
||||
if (this.mPolicyReference) {
|
||||
this.mPolicyReference.finalize();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* This is required to make the wrapper code happy
|
||||
*/
|
||||
QueryInterface: function (iid)
|
||||
QueryInterface: function (iid)
|
||||
{
|
||||
if (!iid.equals(Components.interfaces.nsISupports) &&
|
||||
!iid.equals(Components.interfaces.nsISupportsWeakReference) &&
|
||||
!iid.equals(Components.interfaces.nsIDOMEventListener)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
if (iid.equals(Components.interfaces.nsISupports) ||
|
||||
iid.equals(Components.interfaces.nsISupportsWeakReference) ||
|
||||
iid.equals(Components.interfaces.nsIDOMEventListener))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
/*
|
||||
@ -338,12 +339,12 @@ nsPolicyViewer.prototype =
|
||||
* version of the site's policy. That is, we load, on a new window,
|
||||
* the value of the "discuri" attribute of the POLICY node.
|
||||
*/
|
||||
viewHumanReadablePolicy : function ()
|
||||
{
|
||||
viewHumanReadablePolicy : function ()
|
||||
{
|
||||
var document = this.getDocument();
|
||||
if (document) {
|
||||
// Note: P3P policies can be associated with at least five
|
||||
// different namespaces. For performance reasons intentionally
|
||||
// different namespaces. For performance reasons intentionally
|
||||
// accessing element by name without namespace.
|
||||
var nodelist = document.getElementsByTagName("POLICY");
|
||||
var length = nodelist.length;
|
||||
@ -351,7 +352,7 @@ nsPolicyViewer.prototype =
|
||||
for (index = 0; index < length; index++) {
|
||||
var node = nodelist[index];
|
||||
var name = node.getAttribute("name");
|
||||
|
||||
|
||||
// If a fragment identifier is specified then we have to locate
|
||||
// the POLICY with a name specified by that fragment.
|
||||
if (!this.mFragment || this.mFragment == name) {
|
||||
@ -359,7 +360,7 @@ nsPolicyViewer.prototype =
|
||||
if (discuri) {
|
||||
discuri = this.mPolicyURL.resolve(discuri);
|
||||
if (discuri.match(/^\s*https?:/i)) {
|
||||
window.open(discuri);
|
||||
window.open(discuri);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -378,12 +379,12 @@ nsPolicyViewer.prototype =
|
||||
* The purpose of this method is to generate a summary ( using XSLT )
|
||||
* based on the machine readable format ( XML ) of the full p3p policy.
|
||||
*/
|
||||
viewMachineReadablePolicy : function ()
|
||||
viewMachineReadablePolicy : function ()
|
||||
{
|
||||
var document = this.getDocument();
|
||||
var document = this.getDocument();
|
||||
if (document) {
|
||||
// Note: P3P policies can be associated with at least five
|
||||
// different namespaces. For performance reasons intentionally
|
||||
// different namespaces. For performance reasons intentionally
|
||||
// accessing element by name without namespace.
|
||||
var nodelist = document.getElementsByTagName("POLICY");
|
||||
var length = nodelist.length;
|
||||
@ -392,16 +393,16 @@ nsPolicyViewer.prototype =
|
||||
while (index < length) {
|
||||
var node = nodelist[index];
|
||||
var name = node.getAttribute("name");
|
||||
|
||||
|
||||
// If a fragment identifier is specified then target
|
||||
// the POLICY with that fragment name. To achieve that
|
||||
// remove all other POLICY nodes that don't match the name.
|
||||
// By doing this the XSLT code doesn't have to know what
|
||||
// part of the full policy needs to be transformed.
|
||||
// part of the full policy needs to be transformed.
|
||||
if (this.mFragment && this.mFragment != name) {
|
||||
node.parentNode.removeChild(node);
|
||||
// When a node gets removed it will be reflected on the nodelist.
|
||||
// That is, the nodelist length will decrease. To stay within
|
||||
// That is, the nodelist length will decrease. To stay within
|
||||
// bounds of the nodelist array do not increment index.
|
||||
--length;
|
||||
}
|
||||
@ -410,24 +411,24 @@ nsPolicyViewer.prototype =
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.preTransform();
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* The purpose of this method is to display a human readable
|
||||
* version of the site's opt-in / opt-out policy. That is, we
|
||||
* load, on a new window, the value of the "opturi" attribute
|
||||
* version of the site's opt-in / opt-out policy. That is, we
|
||||
* load, on a new window, the value of the "opturi" attribute
|
||||
* of the POLICY node.
|
||||
*/
|
||||
viewOptInOptOutPolicy : function ()
|
||||
viewOptInOptOutPolicy : function ()
|
||||
{
|
||||
var document = this.getDocument();
|
||||
|
||||
|
||||
if (document) {
|
||||
// Note: P3P policies can be associated with at least five
|
||||
// different namespaces. For performance reasons intentionally
|
||||
// different namespaces. For performance reasons intentionally
|
||||
// accessing element by name without namespace.
|
||||
var nodelist = document.getElementsByTagName("POLICY");
|
||||
var length = nodelist.length;
|
||||
@ -443,11 +444,11 @@ nsPolicyViewer.prototype =
|
||||
if (opturi) {
|
||||
opturi = this.mPolicyURL.resolve(opturi);
|
||||
if (opturi.match(/^\s*https?:/i)) {
|
||||
window.open(opturi);
|
||||
window.open(opturi);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.reportError(OPTIONS_ERROR);
|
||||
@ -490,7 +491,7 @@ nsPolicyViewer.prototype =
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return document;
|
||||
},
|
||||
|
||||
@ -499,7 +500,7 @@ nsPolicyViewer.prototype =
|
||||
* based on the document's namespace and then initiate transformation
|
||||
* of the machine readable privacy policy into a human readable summary.
|
||||
*/
|
||||
preTransform : function ()
|
||||
preTransform : function ()
|
||||
{
|
||||
try {
|
||||
this.mStyle = document.implementation.createDocument("", "", null);
|
||||
@ -508,7 +509,7 @@ nsPolicyViewer.prototype =
|
||||
|
||||
var sheet = null;
|
||||
var ns = this.getDocument().documentElement.namespaceURI;
|
||||
|
||||
|
||||
if (ns == "http://www.w3.org/2002/01/P3Pv1") {
|
||||
sheet = STYLESHEET_URL_200201;
|
||||
} else if (ns == "http://www.w3.org/2001/09/P3Pv1") {
|
||||
@ -545,11 +546,11 @@ nsPolicyViewer.prototype =
|
||||
if (!this.mXSLTProcessor) {
|
||||
this.mXSLTProcessor = new XSLTProcessor();
|
||||
}
|
||||
|
||||
|
||||
// An onload event ( triggered when a result window is opened )
|
||||
// would start the transformation.
|
||||
var resultWin = window.openDialog("chrome://p3p/content/p3pSummary.xul", "_blank",
|
||||
"chrome,all,dialog=no", this.mXSLTProcessor,
|
||||
var resultWin = window.openDialog("chrome://p3p/content/p3pSummary.xul", "_blank",
|
||||
"chrome,all,dialog=no", this.mXSLTProcessor,
|
||||
this.getDocument(), this.mStyle, this.mPolicyURL);
|
||||
},
|
||||
|
||||
@ -583,7 +584,7 @@ nsPolicyViewer.prototype =
|
||||
spec = this.mSelectedURI;
|
||||
this.mSelectedURI = null;
|
||||
}
|
||||
|
||||
|
||||
var errorMessage = getBundle().formatStringFromName(name, [spec], 1);
|
||||
alertMessage(errorMessage);
|
||||
}
|
||||
@ -592,15 +593,15 @@ nsPolicyViewer.prototype =
|
||||
/*
|
||||
* @return string bundle service.
|
||||
*/
|
||||
function getStrBundleService ()
|
||||
function getStrBundleService ()
|
||||
{
|
||||
if (!gStrBundleService) {
|
||||
gStrBundleService =
|
||||
gStrBundleService =
|
||||
Components.classes["@mozilla.org/intl/stringbundle;1"].getService(nsIStringBundleService);
|
||||
}
|
||||
return gStrBundleService;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This method is required for localized messages.
|
||||
* @return string bundle.
|
||||
@ -611,12 +612,12 @@ function getBundle ()
|
||||
gStrBundle = getStrBundleService().createBundle("chrome://p3p/locale/P3P.properties");
|
||||
}
|
||||
return gStrBundle;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @return brand name.
|
||||
*/
|
||||
function getBrandName ()
|
||||
function getBrandName ()
|
||||
{
|
||||
if (!gBrandName) {
|
||||
var brandBundle = getStrBundleService().createBundle("chrome://global/locale/brand.properties");
|
||||
@ -649,7 +650,7 @@ function isEquivalent (aLHS, aRHS)
|
||||
port1 = (port1 == 443) ? -1 : port1;
|
||||
port2 = (port2 == 443) ? -1 : port2;
|
||||
}
|
||||
|
||||
|
||||
if (port1 == port2) {
|
||||
return true;
|
||||
}
|
||||
|
@ -57,19 +57,19 @@ const MISSING_INTERFACE = "@"; // flag to indicate missing interfaceinfo
|
||||
// accumulate a string with a stream-ish abstraction
|
||||
|
||||
function Buffer() {
|
||||
this.buffer = "";
|
||||
this.buffer = "";
|
||||
}
|
||||
|
||||
Buffer.prototype = {
|
||||
write : function(s) {
|
||||
if(s)
|
||||
this.buffer += s;
|
||||
this.buffer += s;
|
||||
},
|
||||
|
||||
writeln : function(s) {
|
||||
if(s)
|
||||
this.buffer += s + "\n";
|
||||
else
|
||||
else
|
||||
this.buffer += "\n";
|
||||
}
|
||||
}
|
||||
@ -80,14 +80,14 @@ Buffer.prototype = {
|
||||
* takes: {xxx}
|
||||
* returns: uuid(xxx)
|
||||
*/
|
||||
function formatID(str)
|
||||
function formatID(str)
|
||||
{
|
||||
return "uuid("+str.substring(1,str.length-1)+")";
|
||||
}
|
||||
|
||||
function formatConstType(type)
|
||||
{
|
||||
switch(type)
|
||||
switch(type)
|
||||
{
|
||||
case nsIDataType.VTYPE_INT16:
|
||||
return "PRInt16";
|
||||
@ -102,10 +102,10 @@ function formatConstType(type)
|
||||
}
|
||||
}
|
||||
|
||||
function formatTypeName(info, methodIndex, param, dimension)
|
||||
function formatTypeName(info, methodIndex, param, dimension)
|
||||
{
|
||||
var type = info.getTypeForParam(methodIndex, param, dimension);
|
||||
|
||||
|
||||
switch(type.dataType)
|
||||
{
|
||||
case nsIDataType.VTYPE_INT8 :
|
||||
@ -155,12 +155,12 @@ function formatTypeName(info, methodIndex, param, dimension)
|
||||
try {
|
||||
return info.getInfoForParam(methodIndex, param).name;
|
||||
} catch(e) {
|
||||
return "/*!!! missing interface info, guessing!!!*/ nsISupports";
|
||||
return "/*!!! missing interface info, guessing!!!*/ nsISupports";
|
||||
}
|
||||
case nsIDataType.VTYPE_INTERFACE_IS:
|
||||
return "nsQIResult";
|
||||
case nsIDataType.VTYPE_ARRAY:
|
||||
return formatTypeName(info, methodIndex, param, dimension+1);
|
||||
return formatTypeName(info, methodIndex, param, dimension+1);
|
||||
case nsIDataType.VTYPE_STRING_SIZE_IS:
|
||||
return "string";
|
||||
case nsIDataType.VTYPE_WSTRING_SIZE_IS:
|
||||
@ -186,31 +186,31 @@ function formatBracketForParam(info, methodIndex, param)
|
||||
|
||||
if(param.isRetval)
|
||||
{
|
||||
if(found++)
|
||||
if(found++)
|
||||
str += ", ";
|
||||
str += "retval"
|
||||
}
|
||||
|
||||
if(param.isShared)
|
||||
{
|
||||
if(found++)
|
||||
if(found++)
|
||||
str += ", ";
|
||||
str += "shared"
|
||||
}
|
||||
|
||||
if(type.isArray)
|
||||
{
|
||||
if(found++)
|
||||
if(found++)
|
||||
str += ", ";
|
||||
str += "array"
|
||||
}
|
||||
|
||||
if(type.dataType == nsIDataType.VTYPE_INTERFACE_IS)
|
||||
{
|
||||
if(found++)
|
||||
if(found++)
|
||||
str += ", ";
|
||||
str += "iid_is("+
|
||||
PARAM_NAME_PREFIX +
|
||||
str += "iid_is("+
|
||||
PARAM_NAME_PREFIX +
|
||||
info.getInterfaceIsArgNumberForParam(methodIndex, param) + ")";
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ function formatBracketForParam(info, methodIndex, param)
|
||||
type.dataType == nsIDataType.VTYPE_STRING_SIZE_IS ||
|
||||
type.dataType == nsIDataType.VTYPE_WSTRING_SIZE_IS)
|
||||
{
|
||||
if(found++)
|
||||
if(found++)
|
||||
str += ", ";
|
||||
|
||||
size_is_ArgNum =
|
||||
@ -252,18 +252,18 @@ function doInterface(out, iid)
|
||||
var constBaseIndex = parent ? parent.constantCount : 0;
|
||||
var constTotalCount = info.constantCount;
|
||||
var constLocalCount = constTotalCount - constBaseIndex;
|
||||
|
||||
|
||||
var methodBaseIndex = parent ? parent.methodCount : 0;
|
||||
var methodTotalCount = info.methodCount;
|
||||
var methodLocalCount = methodTotalCount - methodBaseIndex;
|
||||
|
||||
|
||||
|
||||
// maybe recurring to emit parent declarations is not a good idea...
|
||||
// if(parent)
|
||||
// doInterface(parent.interfaceID);
|
||||
|
||||
out.writeln();
|
||||
|
||||
|
||||
// comment out nsISupports
|
||||
// if(iid.equals(nsISupports))
|
||||
// out.writeln("/*\n");
|
||||
@ -271,7 +271,7 @@ function doInterface(out, iid)
|
||||
out.writeln("[" + (info.isScriptable ? "scriptable, " : "") +
|
||||
formatID(info.interfaceID.number) + "]");
|
||||
|
||||
out.writeln("interface "+ info.name +
|
||||
out.writeln("interface "+ info.name +
|
||||
(parent ? (" : "+parent.name) : "") + " {");
|
||||
|
||||
if(constLocalCount)
|
||||
@ -282,7 +282,7 @@ function doInterface(out, iid)
|
||||
out.writeln(" const " + formatConstType(c.type.dataType) + " " +
|
||||
c.name + " = " + c.value + ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(constLocalCount && methodLocalCount)
|
||||
out.writeln();
|
||||
@ -294,9 +294,9 @@ function doInterface(out, iid)
|
||||
m = info.getMethodInfo(i);
|
||||
|
||||
if(m.isNotXPCOM)
|
||||
bracketed = "[notxpcom] "
|
||||
bracketed = "[notxpcom] "
|
||||
else if(m.isHidden)
|
||||
bracketed = "[noscript] "
|
||||
bracketed = "[noscript] "
|
||||
else
|
||||
bracketed = "";
|
||||
|
||||
@ -314,8 +314,8 @@ function doInterface(out, iid)
|
||||
" " + m.name + ";\n");
|
||||
|
||||
if(!readonly)
|
||||
i++; // skip the next one, we have it covered.
|
||||
|
||||
i++; // skip the next one, we have it covered.
|
||||
|
||||
continue;
|
||||
}
|
||||
// else...
|
||||
@ -338,13 +338,13 @@ function doInterface(out, iid)
|
||||
retvalTypeName = formatTypeName(info, i, p, 0);
|
||||
// no need to print it in the param list
|
||||
paramCount-- ;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
retvalTypeName = "void";
|
||||
|
||||
|
||||
// print method name
|
||||
|
||||
out.writeln(" " + bracketed + retvalTypeName + " " + m.name +
|
||||
out.writeln(" " + bracketed + retvalTypeName + " " + m.name +
|
||||
"(" + (paramCount ? "" : ");"));
|
||||
|
||||
// print params
|
||||
@ -352,7 +352,7 @@ function doInterface(out, iid)
|
||||
for(k = 0; k < paramCount; k++)
|
||||
{
|
||||
p = m.getParam(k);
|
||||
out.writeln(" "+
|
||||
out.writeln(" "+
|
||||
formatBracketForParam(info, i, p) +
|
||||
(p.isOut ? p.isIn ? "inout " : "out " : "in ") +
|
||||
formatTypeName(info, i, p, 0) + " " +
|
||||
@ -380,24 +380,24 @@ function appendForwardDeclarations(list, info)
|
||||
for(i = 0; i < info.methodCount; i++)
|
||||
{
|
||||
m = info.getMethodInfo(i);
|
||||
|
||||
|
||||
for(k = 0; k < m.paramCount; k++)
|
||||
{
|
||||
p = m.getParam(k);
|
||||
|
||||
|
||||
if(p.type.dataType == nsIDataType.VTYPE_INTERFACE)
|
||||
{
|
||||
var name;
|
||||
try {
|
||||
name = info.getInfoForParam(i, p).name;
|
||||
} catch(e) {
|
||||
name = MISSING_INTERFACE;
|
||||
name = MISSING_INTERFACE;
|
||||
}
|
||||
list.push(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function doForwardDeclarations(out, iid)
|
||||
{
|
||||
@ -405,23 +405,23 @@ function doForwardDeclarations(out, iid)
|
||||
var list = [];
|
||||
appendForwardDeclarations(list, new IInfo(iid));
|
||||
list.sort();
|
||||
|
||||
|
||||
out.writeln("// forward declarations...");
|
||||
|
||||
for(i = 0; i < list.length; i++)
|
||||
for(i = 0; i < list.length; i++)
|
||||
{
|
||||
cur = list[i];
|
||||
if(cur != prev && cur != "nsISupports")
|
||||
if(cur != prev && cur != "nsISupports")
|
||||
{
|
||||
if(cur == MISSING_INTERFACE)
|
||||
if(cur == MISSING_INTERFACE)
|
||||
out.writeln("/*\n * !!! Unable to find details for a declared "+
|
||||
"interface (name unknown)!!!\n */");
|
||||
else
|
||||
out.writeln("interface " + cur +";");
|
||||
prev = cur;
|
||||
}
|
||||
prev = cur;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function buildForwardDeclarationsList(iid)
|
||||
{
|
||||
@ -430,19 +430,19 @@ function buildForwardDeclarationsList(iid)
|
||||
var outList = [];
|
||||
appendForwardDeclarations(list, new IInfo(iid));
|
||||
list.sort();
|
||||
|
||||
for(i = 0; i < list.length; i++)
|
||||
|
||||
for(i = 0; i < list.length; i++)
|
||||
{
|
||||
cur = list[i];
|
||||
if(cur != prev && cur != "nsISupports")
|
||||
if(cur != prev && cur != "nsISupports")
|
||||
{
|
||||
if(cur != MISSING_INTERFACE)
|
||||
outList.push(cur);
|
||||
prev = cur;
|
||||
}
|
||||
if(cur != MISSING_INTERFACE)
|
||||
outList.push(cur);
|
||||
prev = cur;
|
||||
}
|
||||
}
|
||||
return outList;
|
||||
}
|
||||
return outList;
|
||||
}
|
||||
|
||||
/*********************************************************/
|
||||
|
||||
@ -454,17 +454,17 @@ nsInterfaceInfoToIDL.prototype =
|
||||
{
|
||||
// nsIInterfaceInfoToIDL methods...
|
||||
|
||||
// string generateIDL(in nsIIDRef aIID,
|
||||
// string generateIDL(in nsIIDRef aIID,
|
||||
// in PRBool withIncludes,
|
||||
// in PRBool withForwardDeclarations);
|
||||
generateIDL : function(aIID, withIncludes, withForwardDeclarations) {
|
||||
var out = new Buffer;
|
||||
out.writeln();
|
||||
out.writeln();
|
||||
|
||||
if(withIncludes)
|
||||
{
|
||||
out.writeln('#include "nsISupports.idl"');
|
||||
out.writeln();
|
||||
out.writeln('#include "nsISupports.idl"');
|
||||
out.writeln();
|
||||
}
|
||||
|
||||
if(withForwardDeclarations)
|
||||
@ -472,13 +472,13 @@ nsInterfaceInfoToIDL.prototype =
|
||||
doForwardDeclarations(out, aIID);
|
||||
out.writeln("");
|
||||
}
|
||||
|
||||
|
||||
doInterface(out, aIID);
|
||||
|
||||
return out.buffer;
|
||||
},
|
||||
|
||||
// void getReferencedInterfaceNames(in nsIIDRef aIID,
|
||||
// void getReferencedInterfaceNames(in nsIIDRef aIID,
|
||||
// out PRUint32 aArrayLength,
|
||||
// [retval, array, size_is(aArrayLength)]
|
||||
// out string aNames);
|
||||
@ -491,11 +491,12 @@ nsInterfaceInfoToIDL.prototype =
|
||||
|
||||
// nsISupports methods...
|
||||
QueryInterface: function (iid) {
|
||||
if (!iid.equals(Components.interfaces.nsIInterfaceInfoToIDL) &&
|
||||
!iid.equals(Components.interfaces.nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
if (iid.equals(Components.interfaces.nsIInterfaceInfoToIDL) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -513,8 +514,8 @@ const MODULE_CTOR = nsInterfaceInfoToIDL;
|
||||
// generic nsIModule part...
|
||||
|
||||
function NSGetModule(compMgr, fileSpec) {
|
||||
return new GenericModule(MODULE_NAME, MODULE_CONTRACT_ID,
|
||||
MODULE_CID, MODULE_CTOR);
|
||||
return new GenericModule(MODULE_NAME, MODULE_CONTRACT_ID,
|
||||
MODULE_CID, MODULE_CTOR);
|
||||
}
|
||||
|
||||
function GenericModule (name, contractID, CID, ctor) {
|
||||
@ -535,7 +536,7 @@ GenericModule.prototype = {
|
||||
*/
|
||||
registerSelf: function (compMgr, fileSpec, location, type) {
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
compMgr.registerFactoryLocation(this.CID, this.name, this.contractID,
|
||||
compMgr.registerFactoryLocation(this.CID, this.name, this.contractID,
|
||||
fileSpec, location, type);
|
||||
},
|
||||
|
||||
@ -556,7 +557,7 @@ GenericModule.prototype = {
|
||||
|
||||
/* factory object */
|
||||
myFactory: {
|
||||
|
||||
|
||||
/*
|
||||
* Construct an instance of the interface specified by iid, possibly
|
||||
* aggregating it with the provided outer. (If you don't know what
|
||||
|
@ -66,7 +66,7 @@ const XMLTERMPROT_HANDLER_CID =
|
||||
/* components used in this file */
|
||||
const MEDIATOR_CONTRACTID =
|
||||
"@mozilla.org/appshell/window-mediator;1"
|
||||
const SIMPLEURI_CONTRACTID =
|
||||
const SIMPLEURI_CONTRACTID =
|
||||
"@mozilla.org/network/simple-uri;1";
|
||||
const ASS_CONTRACTID =
|
||||
"@mozilla.org/appshell/appShellService;1";
|
||||
@ -122,10 +122,12 @@ function XMLTermContentHandler ()
|
||||
XMLTermContentHandler.prototype.QueryInterface =
|
||||
function (iid) {
|
||||
|
||||
if (!iid.equals(nsIContentHandler))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
if (iid.equals(nsIContentHandler) ||
|
||||
iid.equals(nsISupports))
|
||||
return this;
|
||||
|
||||
return this;
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
|
||||
XMLTermContentHandler.prototype.handleContent =
|
||||
@ -168,7 +170,7 @@ function XMLTermProtocolHandler()
|
||||
|
||||
XMLTermProtocolHandler.prototype.scheme = "terminal";
|
||||
XMLTermProtocolHandler.prototype.defaultPort = -1;
|
||||
XMLTermProtocolHandler.prototype.URIType =
|
||||
XMLTermProtocolHandler.prototype.URIType =
|
||||
Components.interfaces.nsIProtocolHandler.URI_NORELATIVE;
|
||||
|
||||
XMLTermProtocolHandler.prototype.newURI =
|
||||
@ -176,7 +178,7 @@ function (aSpec, aCharset, aBaseURI)
|
||||
{
|
||||
var uri = Components.classes[SIMPLEURI_CONTRACTID].createInstance(nsIURI);
|
||||
uri.spec = aSpec;
|
||||
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
@ -216,10 +218,10 @@ function (aURI)
|
||||
//dump("gSystemPrincipal="+gSystemPrincipal+"\n");
|
||||
|
||||
// Cancel XUL request and release channel
|
||||
|
||||
|
||||
// why are you canceling here?! you have not even opened anything yet - dougt.
|
||||
// temChannel.cancel(Components.results.NS_BINDING_ABORTED);
|
||||
|
||||
|
||||
temChannel = null;
|
||||
|
||||
// Get current process directory
|
||||
@ -272,11 +274,13 @@ function BogusChannel (aURI)
|
||||
BogusChannel.prototype.QueryInterface =
|
||||
function (iid) {
|
||||
|
||||
if (!iid.equals(nsIChannel) && !iid.equals(nsIRequest) &&
|
||||
!iid.equals(nsISupports))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
if (iid.equals(nsIChannel) ||
|
||||
iid.equals(nsIRequest) ||
|
||||
iid.equals(nsISupports))
|
||||
return this;
|
||||
|
||||
return this;
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
|
||||
/* nsIChannel */
|
||||
@ -331,16 +335,16 @@ XMLtermModule.registerSelf =
|
||||
function (compMgr, fileSpec, location, type)
|
||||
{
|
||||
debug("*** Registering -terminal handler.\n");
|
||||
|
||||
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
|
||||
compMgr.registerFactoryLocation(XMLTERMCLINE_SERVICE_CID,
|
||||
"XMLterm CommandLine Service",
|
||||
XMLTERMCLINE_SERVICE_CONTRACTID,
|
||||
XMLTERMCLINE_SERVICE_CONTRACTID,
|
||||
fileSpec,
|
||||
location,
|
||||
location,
|
||||
type);
|
||||
|
||||
|
||||
catman = Components.classes["@mozilla.org/categorymanager;1"]
|
||||
.getService(nsICategoryManager);
|
||||
catman.addCategoryEntry("command-line-argument-handlers",
|
||||
@ -350,16 +354,16 @@ function (compMgr, fileSpec, location, type)
|
||||
debug("*** Registering x-application-terminal handler.\n");
|
||||
compMgr.registerFactoryLocation(XMLTERMCNT_HANDLER_CID,
|
||||
"XMLTerm Content Handler",
|
||||
XMLTERMCNT_HANDLER_CONTRACTID,
|
||||
XMLTERMCNT_HANDLER_CONTRACTID,
|
||||
fileSpec,
|
||||
location,
|
||||
location,
|
||||
type);
|
||||
|
||||
debug("*** Registering terminal protocol handler.\n");
|
||||
compMgr.registerFactoryLocation(XMLTERMPROT_HANDLER_CID,
|
||||
"XMLTerm protocol handler",
|
||||
XMLTERMPROT_HANDLER_CONTRACTID,
|
||||
fileSpec,
|
||||
XMLTERMPROT_HANDLER_CONTRACTID,
|
||||
fileSpec,
|
||||
location,
|
||||
type);
|
||||
|
||||
@ -386,12 +390,12 @@ function (compMgr, cid, iid) {
|
||||
|
||||
if (cid.equals(XMLTERMPROT_HANDLER_CID))
|
||||
return XMLTermProtocolHandlerFactory;
|
||||
|
||||
|
||||
if (!iid.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
|
||||
}
|
||||
|
||||
XMLtermModule.canUnload =
|
||||
|
@ -5,20 +5,21 @@ var observerService = observerClazz.getService(observerInterface);
|
||||
|
||||
var observer1 = {
|
||||
observe : function(aSubject, aTopic, someData) {
|
||||
print("observer1 notified for: "+aTopic+" with: "+someData);
|
||||
print("observer1 notified for: "+aTopic+" with: "+someData);
|
||||
},
|
||||
QueryInterface: function (iid) {
|
||||
if (iid.equals(Components.interfaces.nsISupportsWeakReference) ||
|
||||
iid.equals(Components.interfaces.nsISupports)) {
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
}
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
var observer2 = {
|
||||
observe : function(aSubject, aTopic, someData) {
|
||||
print("observer2 notified for: "+aTopic+" with: "+someData);
|
||||
print("observer2 notified for: "+aTopic+" with: "+someData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ function nsLDAPPrefsService() {
|
||||
var dirType;
|
||||
for (var i = 0; i < prefCount.value; i++)
|
||||
{
|
||||
if ((arrayOfDirectories[i] != "ldap_2.servers.pab") &&
|
||||
if ((arrayOfDirectories[i] != "ldap_2.servers.pab") &&
|
||||
(arrayOfDirectories[i] != "ldap_2.servers.history")) {
|
||||
try{
|
||||
position = gPrefInt.getIntPref(arrayOfDirectories[i]+".position");
|
||||
@ -120,34 +120,35 @@ nsLDAPPrefsService.prototype.availDirectories = null;
|
||||
nsLDAPPrefsService.prototype.QueryInterface =
|
||||
function (iid) {
|
||||
|
||||
if (!iid.equals(nsISupports) &&
|
||||
!iid.equals(nsILDAPPrefsService))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
if (iid.equals(nsISupports) ||
|
||||
iid.equals(nsILDAPPrefsService))
|
||||
return this;
|
||||
|
||||
return this;
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
|
||||
const prefRoot = "ldap_2.servers";
|
||||
const parent = "ldap_2.servers.";
|
||||
|
||||
nsLDAPPrefsService.prototype.getServerList =
|
||||
nsLDAPPrefsService.prototype.getServerList =
|
||||
function (prefBranch, aCount) {
|
||||
var prefCount = {value:0};
|
||||
|
||||
|
||||
// get all the preferences with prefix ldap_2.servers
|
||||
var directoriesList = prefBranch.getChildList(prefRoot, prefCount);
|
||||
|
||||
|
||||
var childList = new Array();
|
||||
var count = 0;
|
||||
if (directoriesList) {
|
||||
directoriesList.sort();
|
||||
var prefixLen;
|
||||
// lastDirectory contains the last entry that is added to the
|
||||
// lastDirectory contains the last entry that is added to the
|
||||
// array childList.
|
||||
var lastDirectory = "";
|
||||
|
||||
// only add toplevel prefnames to the list,
|
||||
// i.e. add ldap_2.servers.<server-name>
|
||||
// i.e. add ldap_2.servers.<server-name>
|
||||
// but not ldap_2.servers.<server-name>.foo
|
||||
for(var i=0; i<prefCount.value; i++) {
|
||||
// Assign the prefix ldap_2.servers.<server-name> to directoriesList
|
||||
@ -155,7 +156,7 @@ function (prefBranch, aCount) {
|
||||
if (prefixLen != -1) {
|
||||
directoriesList[i] = directoriesList[i].substr(0, prefixLen);
|
||||
if (directoriesList[i] != lastDirectory) {
|
||||
// add the entry to childList
|
||||
// add the entry to childList
|
||||
// only if it is not added yet
|
||||
lastDirectory = directoriesList[i];
|
||||
childList[count] = directoriesList[i];
|
||||
@ -173,10 +174,10 @@ function (prefBranch, aCount) {
|
||||
return childList;
|
||||
}
|
||||
|
||||
/* migrate 4.x ldap prefs to mozilla format.
|
||||
Converts hostname, basedn, port to uri (nsLDAPURL).
|
||||
/* migrate 4.x ldap prefs to mozilla format.
|
||||
Converts hostname, basedn, port to uri (nsLDAPURL).
|
||||
*/
|
||||
nsLDAPPrefsService.prototype.migrate =
|
||||
nsLDAPPrefsService.prototype.migrate =
|
||||
function () {
|
||||
var pref_string;
|
||||
var ldapUrl=null;
|
||||
@ -255,14 +256,14 @@ function () {
|
||||
uri.data = ldapUrl.spec;
|
||||
gPrefInt.setComplexValue(pref_string + ".uri", Components.interfaces.nsISupportsString, uri);
|
||||
|
||||
/* is this server selected for autocompletion?
|
||||
/* is this server selected for autocompletion?
|
||||
if yes, convert the preference to mozilla format.
|
||||
Atmost one server is selected for autocompletion.
|
||||
Atmost one server is selected for autocompletion.
|
||||
*/
|
||||
if (useDirectory && !enable){
|
||||
try {
|
||||
enable = gPrefInt.getBoolPref(pref_string + ".autocomplete.enabled");
|
||||
}
|
||||
}
|
||||
catch(ex) {}
|
||||
if (enable) {
|
||||
gPrefInt.setCharPref("ldap_2.servers.directoryServer", pref_string);
|
||||
@ -277,7 +278,7 @@ function () {
|
||||
svc.savePrefFile(null);
|
||||
}
|
||||
catch (ex) {dump ("ERROR:" + ex + "\n");}
|
||||
|
||||
|
||||
this.prefs_migrated = true;
|
||||
}
|
||||
|
||||
@ -305,7 +306,7 @@ function (compMgr, fileSpec, location, type)
|
||||
|
||||
compMgr.registerFactoryLocation(NS_LDAPPREFSSERVICE_CID,
|
||||
"nsLDAPPrefs Service",
|
||||
NS_LDAPPREFSSERVICE_CONTRACTID,
|
||||
NS_LDAPPREFSSERVICE_CONTRACTID,
|
||||
fileSpec,
|
||||
location,
|
||||
type);
|
||||
@ -322,7 +323,7 @@ nsLDAPPrefsModule.getClassObject =
|
||||
function (compMgr, cid, iid) {
|
||||
if (cid.equals(nsILDAPPrefsService))
|
||||
return nsLDAPPrefsFactory;
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
nsLDAPPrefsModule.canUnload =
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Bienvenu <bienvenu@nventure.com> (Original Author)
|
||||
* David Bienvenu <bienvenu@nventure.com> (Original Author)
|
||||
*
|
||||
* 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
|
||||
@ -39,7 +39,7 @@ var gOfflineStartupMode; //0 = remember last state, 1 = ask me, 2 == online, 3 =
|
||||
const kRememberLastState = 0;
|
||||
const kAskForOnlineState = 1;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// nsOfflineStartup : nsIProfileStartupListener, nsIObserver
|
||||
//
|
||||
// Check if the user has set the pref to be prompted for
|
||||
@ -49,7 +49,7 @@ const kAskForOnlineState = 1;
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var nsOfflineStartup =
|
||||
var nsOfflineStartup =
|
||||
{
|
||||
onProfileStartup: function(aProfileName)
|
||||
{
|
||||
@ -58,11 +58,11 @@ var nsOfflineStartup =
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
|
||||
|
||||
|
||||
gOfflineStartupMode = prefs.getIntPref(kOfflineStartupPref);
|
||||
|
||||
if (gOfflineStartupMode == kRememberLastState)
|
||||
{
|
||||
{
|
||||
var offline = !prefs.getBoolPref("network.online");
|
||||
ioService.offline = offline;
|
||||
var observerService = Components.
|
||||
@ -77,7 +77,7 @@ var nsOfflineStartup =
|
||||
var promptService = Components.
|
||||
classes["@mozilla.org/embedcomp/prompt-service;1"].
|
||||
getService(Components.interfaces.nsIPromptService);
|
||||
|
||||
|
||||
var bundle = getBundle(kBundleURI);
|
||||
if (!bundle)
|
||||
return;
|
||||
@ -88,7 +88,7 @@ var nsOfflineStartup =
|
||||
var button1Text = bundle.GetStringFromName("workOffline");
|
||||
var checkVal = {value:0};
|
||||
|
||||
var result = promptService.confirmEx(null, title, desc,
|
||||
var result = promptService.confirmEx(null, title, desc,
|
||||
(promptService.BUTTON_POS_0 * promptService.BUTTON_TITLE_IS_STRING) +
|
||||
(promptService.BUTTON_POS_1 * promptService.BUTTON_TITLE_IS_STRING),
|
||||
button0Text, button1Text, null, null, checkVal);
|
||||
@ -124,17 +124,18 @@ var nsOfflineStartup =
|
||||
|
||||
QueryInterface: function(aIID)
|
||||
{
|
||||
if (!aIID.equals(Components.interfaces.nsIObserver) &&
|
||||
!aIID.equals(Components.interfaces.nsIProfileStartupListener) &&
|
||||
!aIID.equals(Components.interfaces.nsISupports))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
if (aIID.equals(Components.interfaces.nsIObserver) ||
|
||||
aIID.equals(Components.interfaces.nsIProfileStartupListener) ||
|
||||
aIID.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
return this;
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var nsOfflineStartupModule =
|
||||
var nsOfflineStartupModule =
|
||||
{
|
||||
mClassName: "Offline Startup",
|
||||
mContractID: "@mozilla.org/offline-startup;1",
|
||||
@ -157,12 +158,12 @@ var nsOfflineStartupModule =
|
||||
|
||||
aCompMgr = aCompMgr.QueryInterface(
|
||||
Components.interfaces.nsIComponentRegistrar);
|
||||
aCompMgr.registerFactoryLocation(this.mClassID, this.mClassName,
|
||||
aCompMgr.registerFactoryLocation(this.mClassID, this.mClassName,
|
||||
this.mContractID, aFileSpec, aLocation, aType);
|
||||
|
||||
// receive startup notification from the profile manager
|
||||
// (we get |createInstance()|d at startup-notification time)
|
||||
this.getCategoryManager().addCategoryEntry("profile-startup-category",
|
||||
this.getCategoryManager().addCategoryEntry("profile-startup-category",
|
||||
this.mContractID, "", true, true);
|
||||
},
|
||||
|
||||
@ -172,7 +173,7 @@ var nsOfflineStartupModule =
|
||||
Components.interfaces.nsIComponentRegistrar);
|
||||
aCompMgr.unregisterFactoryLocation(this.mClassID, aFileSpec);
|
||||
|
||||
this.getCategoryManager().deleteCategoryEntry("profile-startup-category",
|
||||
this.getCategoryManager().deleteCategoryEntry("profile-startup-category",
|
||||
this.mContractID, true);
|
||||
},
|
||||
|
||||
@ -203,7 +204,7 @@ var nsOfflineStartupModule =
|
||||
!aIID.equals(Components.interfaces.nsISupports))
|
||||
throw Components.results.NS_ERROR_INVALID_ARG;
|
||||
|
||||
// return the singleton
|
||||
// return the singleton
|
||||
return nsOfflineStartup.QueryInterface(aIID);
|
||||
},
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
When bound, kick off the searches.
|
||||
On finding certificates, import into permanent cert database.
|
||||
When all searches are finished, close the dialog.
|
||||
*/
|
||||
*/
|
||||
|
||||
const nsIX509CertDB = Components.interfaces.nsIX509CertDB;
|
||||
const nsX509CertDB = "@mozilla.org/security/x509certdb;1";
|
||||
@ -77,7 +77,7 @@ function search()
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
var prefs = prefService.getBranch(null);
|
||||
|
||||
gLdapServerURL =
|
||||
gLdapServerURL =
|
||||
Components.classes["@mozilla.org/network/ldap-url;1"]
|
||||
.createInstance().QueryInterface(Components.interfaces.nsILDAPURL);
|
||||
|
||||
@ -181,7 +181,7 @@ function kickOffSearch()
|
||||
for (var i = 0; i < gEmailAddresses.length; ++i) {
|
||||
mailFilter += "(mail=" + gEmailAddresses[i] + ")";
|
||||
}
|
||||
|
||||
|
||||
var filter = prefix1 + prefix2 + mailFilter + suffix2 + suffix1;
|
||||
|
||||
var wanted_attributes = new Array();
|
||||
@ -193,7 +193,7 @@ function kickOffSearch()
|
||||
// one for signing, one for encrypting.
|
||||
// Maybe that number should be larger, to allow for deployments,
|
||||
// where even more certs can be stored per user???
|
||||
|
||||
|
||||
var maxEntriesWanted = gEmailAddresses.length * 2;
|
||||
|
||||
getLDAPOperation();
|
||||
@ -211,18 +211,19 @@ function boundListener() {
|
||||
|
||||
boundListener.prototype.QueryInterface =
|
||||
function(iid) {
|
||||
if (!iid.equals(Components.interfaces.nsISupports) &&
|
||||
!iid.equals(Components.interfaces.nsILDAPMessageListener))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
if (iid.equals(Components.interfaces.nsISupports) ||
|
||||
iid.equals(Components.interfaces.nsILDAPMessageListener))
|
||||
return this;
|
||||
|
||||
return this;
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
|
||||
boundListener.prototype.onLDAPMessage =
|
||||
boundListener.prototype.onLDAPMessage =
|
||||
function(aMessage) {
|
||||
}
|
||||
|
||||
boundListener.prototype.onLDAPInit =
|
||||
boundListener.prototype.onLDAPInit =
|
||||
function(aConn, aStatus) {
|
||||
kickOffBind();
|
||||
}
|
||||
@ -233,14 +234,15 @@ function ldapMessageListener() {
|
||||
|
||||
ldapMessageListener.prototype.QueryInterface =
|
||||
function(iid) {
|
||||
if (!iid.equals(Components.interfaces.nsISupports) &&
|
||||
!iid.equals(Components.interfaces.nsILDAPMessageListener))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
if (iid.equals(Components.interfaces.nsISupports) ||
|
||||
iid.equals(Components.interfaces.nsILDAPMessageListener))
|
||||
return this;
|
||||
|
||||
return this;
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
|
||||
ldapMessageListener.prototype.onLDAPMessage =
|
||||
ldapMessageListener.prototype.onLDAPMessage =
|
||||
function(aMessage) {
|
||||
if (Components.interfaces.nsILDAPMessage.RES_SEARCH_RESULT == aMessage.type) {
|
||||
window.close();
|
||||
@ -273,7 +275,7 @@ ldapMessageListener.prototype.onLDAPMessage =
|
||||
}
|
||||
}
|
||||
|
||||
ldapMessageListener.prototype.onLDAPInit =
|
||||
ldapMessageListener.prototype.onLDAPInit =
|
||||
function(aConn, aStatus) {
|
||||
}
|
||||
|
||||
@ -291,7 +293,7 @@ function getProxyOnUIThread(aObject, aInterface) {
|
||||
classes["@mozilla.org/xpcomproxy;1"].
|
||||
getService(Components.interfaces.nsIProxyObjectManager);
|
||||
|
||||
return proxyMgr.getProxyForObject(uiQueue,
|
||||
aInterface, aObject, 5);
|
||||
return proxyMgr.getProxyForObject(uiQueue,
|
||||
aInterface, aObject, 5);
|
||||
// 5 == PROXY_ALWAYS | PROXY_SYNC
|
||||
}
|
||||
|
@ -62,11 +62,13 @@ nsTestServ.prototype =
|
||||
{
|
||||
QueryInterface: function(iid)
|
||||
{
|
||||
if (!iid.equals(nsIObserver) &&
|
||||
!iid.equals(nsIServerSocketListener) &&
|
||||
!iid.equals(nsISupports))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return this;
|
||||
if (iid.equals(nsIObserver) ||
|
||||
iid.equals(nsIServerSocketListener) ||
|
||||
iid.equals(nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
observe: function(subject, topic, data)
|
||||
@ -139,8 +141,8 @@ function (compMgr, fileSpec, location, type)
|
||||
compMgr.registerFactoryLocation(kTESTSERV_CID,
|
||||
"nsTestServ",
|
||||
kTESTSERV_CONTRACTID,
|
||||
fileSpec,
|
||||
location,
|
||||
fileSpec,
|
||||
location,
|
||||
type);
|
||||
|
||||
const CATMAN_CONTRACTID = "@mozilla.org/categorymanager;1";
|
||||
|
@ -32,11 +32,12 @@ mySample.prototype = {
|
||||
poke: function (aValue) { this.val = aValue; },
|
||||
|
||||
QueryInterface: function (iid) {
|
||||
if (!iid.equals(Components.interfaces.nsISample) &&
|
||||
!iid.equals(Components.interfaces.nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
if (iid.equals(Components.interfaces.nsISample) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
val: "<default value>"
|
||||
@ -63,7 +64,7 @@ var myModule = {
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
compMgr.registerFactoryLocation(this.myCID,
|
||||
"Sample JS Component",
|
||||
this.myProgID,
|
||||
this.myProgID,
|
||||
fileSpec,
|
||||
location,
|
||||
type);
|
||||
|
@ -52,18 +52,19 @@ nsCloseAllWindows.prototype = {
|
||||
|
||||
// This "class" supports nsICloseAllWindows, and nsISupports.
|
||||
QueryInterface: function (iid) {
|
||||
if (!iid.equals(Components.interfaces.nsICloseAllWindows) &&
|
||||
!iid.equals(Components.interfaces.nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
if (iid.equals(Components.interfaces.nsICloseAllWindows) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
// ---------- nsICloseAllWindows methods ----------
|
||||
|
||||
// closeAll: Close all open windows
|
||||
closeAll: function(aAskToSave) {
|
||||
|
||||
|
||||
var windowMediator = Components.classes['@mozilla.org/appshell/window-mediator;1'].
|
||||
getService(Components.interfaces.nsIWindowMediator);
|
||||
var enumerator = windowMediator.getEnumerator(null);
|
||||
@ -76,7 +77,7 @@ nsCloseAllWindows.prototype = {
|
||||
}
|
||||
domWindow.close();
|
||||
};
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ function nsBrowserContentListener(toplevelWindow, contentWindow)
|
||||
// this one is not as easy as you would hope.
|
||||
// need to convert toplevelWindow to an XPConnected object, instead
|
||||
// of a DOM-based object, to be able to QI() it to nsIXULWindow
|
||||
|
||||
|
||||
this.init(toplevelWindow, contentWindow);
|
||||
}
|
||||
|
||||
@ -61,9 +61,9 @@ nsBrowserContentListener.prototype =
|
||||
var windowDocShell = this.convertWindowToDocShell(toplevelWindow);
|
||||
if (windowDocShell)
|
||||
windowDocshell.parentURIContentListener = this;
|
||||
|
||||
|
||||
var registerWindow = false;
|
||||
try {
|
||||
try {
|
||||
var treeItem = contentWindow.docShell.QueryInterface(Components.interfaces.nsIDocShellTreeItem);
|
||||
var treeOwner = treeItem.treeOwner;
|
||||
var interfaceRequestor = treeOwner.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
|
||||
@ -74,11 +74,11 @@ nsBrowserContentListener.prototype =
|
||||
var res = chromeFlags & nsIWebBrowserChrome.CHROME_ALL;
|
||||
var res2 = chromeFlags & nsIWebBrowserChrome.CHROME_DEFAULT;
|
||||
if ( res == nsIWebBrowserChrome.CHROME_ALL || res2 == nsIWebBrowserChrome.CHROME_DEFAULT)
|
||||
{
|
||||
{
|
||||
registerWindow = true;
|
||||
}
|
||||
}
|
||||
} catch (ex) {}
|
||||
} catch (ex) {}
|
||||
|
||||
// register ourselves
|
||||
if (registerWindow)
|
||||
@ -100,8 +100,9 @@ nsBrowserContentListener.prototype =
|
||||
iid.equals(Components.interfaces.nsISupportsWeakReference) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
throw Components.results.NS_NOINTERFACE;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
onStartURIOpen: function(uri)
|
||||
{
|
||||
@ -121,11 +122,11 @@ nsBrowserContentListener.prototype =
|
||||
} catch (ex) {
|
||||
dump(ex);
|
||||
}
|
||||
|
||||
|
||||
if (!contentListener) return false;
|
||||
|
||||
|
||||
return contentListener.doContent(contentType, isContentPreferred, request, contentHandler);
|
||||
|
||||
|
||||
},
|
||||
|
||||
isPreferred: function(contentType, desiredContentType)
|
||||
@ -157,7 +158,7 @@ nsBrowserContentListener.prototype =
|
||||
dump(ex);
|
||||
}
|
||||
if (!contentListener) return false;
|
||||
|
||||
|
||||
return contentListener.canHandleContent(contentType, isContentPreferred, desiredContentType);
|
||||
},
|
||||
convertWindowToDocShell: function(win) {
|
||||
|
@ -51,7 +51,7 @@ function isContentFrame(aFocusedWindow)
|
||||
return (focusedTop == window.content);
|
||||
}
|
||||
|
||||
function urlSecurityCheck(url, doc)
|
||||
function urlSecurityCheck(url, doc)
|
||||
{
|
||||
// URL Loading Security Check
|
||||
var focusedWindow = doc.commandDispatcher.focusedWindow;
|
||||
@ -84,7 +84,7 @@ function getReferrer(doc)
|
||||
}
|
||||
}
|
||||
|
||||
function openNewWindowWith(url, sendReferrer)
|
||||
function openNewWindowWith(url, sendReferrer)
|
||||
{
|
||||
urlSecurityCheck(url, document);
|
||||
|
||||
@ -116,7 +116,7 @@ function openTopBrowserWith(url)
|
||||
window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", url, null, null);
|
||||
}
|
||||
|
||||
function openNewTabWith(url, sendReferrer, reverseBackgroundPref)
|
||||
function openNewTabWith(url, sendReferrer, reverseBackgroundPref)
|
||||
{
|
||||
var browser;
|
||||
try {
|
||||
@ -140,7 +140,7 @@ function openNewTabWith(url, sendReferrer, reverseBackgroundPref)
|
||||
//
|
||||
if (!browserWin) {
|
||||
urlSecurityCheck(url, document);
|
||||
window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no",
|
||||
window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no",
|
||||
url, null, referrer);
|
||||
return;
|
||||
}
|
||||
@ -160,7 +160,7 @@ function openNewTabWith(url, sendReferrer, reverseBackgroundPref)
|
||||
var referrer = sendReferrer ? getReferrer(browserDocument) : null;
|
||||
|
||||
// As in openNewWindowWith(), we want to pass the charset of the
|
||||
// current document over to a new tab.
|
||||
// current document over to a new tab.
|
||||
var wintype = browserDocument.firstChild.getAttribute('windowtype');
|
||||
var originCharset;
|
||||
if (wintype == "navigator:browser") {
|
||||
@ -168,7 +168,7 @@ function openNewTabWith(url, sendReferrer, reverseBackgroundPref)
|
||||
}
|
||||
|
||||
// open link in new tab
|
||||
var tab = browser.addTab(url, referrer, originCharset);
|
||||
var tab = browser.addTab(url, referrer, originCharset);
|
||||
if (pref) {
|
||||
var loadInBackground = pref.getBoolPref("browser.tabs.loadInBackground");
|
||||
if (reverseBackgroundPref)
|
||||
@ -214,7 +214,7 @@ function findParentNode(node, parentNode)
|
||||
// - An image with an extension (e.g. .jpg) in its file name, using
|
||||
// Context->Save Image As...
|
||||
// - An image without an extension (e.g. a banner ad on cnn.com) using
|
||||
// the above method.
|
||||
// the above method.
|
||||
// - A linked document using Save Link As...
|
||||
// - A linked document using shift-click Save Link As...
|
||||
//
|
||||
@ -232,15 +232,15 @@ function saveFrameDocument()
|
||||
|
||||
function saveDocument(aDocument)
|
||||
{
|
||||
// In both cases here, we want to use cached data because the
|
||||
// document is currently visible.
|
||||
if (aDocument)
|
||||
// In both cases here, we want to use cached data because the
|
||||
// document is currently visible.
|
||||
if (aDocument)
|
||||
saveInternal(aDocument.location.href, aDocument, false);
|
||||
else
|
||||
saveInternal(_content.location.href, null, false);
|
||||
}
|
||||
|
||||
function saveInternal(aURL, aDocument,
|
||||
function saveInternal(aURL, aDocument,
|
||||
aFileName, aFilePickerTitleKey,
|
||||
aShouldBypassCache)
|
||||
{
|
||||
@ -281,7 +281,7 @@ function foundHeaderInfo(aSniffer, aData)
|
||||
var fp = makeFilePicker();
|
||||
var titleKey = aData.filePickerTitle || "SaveLinkTitle";
|
||||
var bundle = getStringBundle();
|
||||
fp.init(window, bundle.GetStringFromName(titleKey),
|
||||
fp.init(window, bundle.GetStringFromName(titleKey),
|
||||
Components.interfaces.nsIFilePicker.modeSave);
|
||||
|
||||
var saveMode = GetSaveModeForContentType(contentType);
|
||||
@ -299,9 +299,9 @@ function foundHeaderInfo(aSniffer, aData)
|
||||
isDocument ? saveMode : SAVEMODE_FILEONLY);
|
||||
|
||||
const prefSvcContractID = "@mozilla.org/preferences-service;1";
|
||||
const prefSvcIID = Components.interfaces.nsIPrefService;
|
||||
const prefSvcIID = Components.interfaces.nsIPrefService;
|
||||
var prefs = Components.classes[prefSvcContractID].getService(prefSvcIID).getBranch("browser.download.");
|
||||
|
||||
|
||||
const nsILocalFile = Components.interfaces.nsILocalFile;
|
||||
try {
|
||||
fp.displayDirectory = prefs.getComplexValue("dir", nsILocalFile);
|
||||
@ -316,21 +316,21 @@ function foundHeaderInfo(aSniffer, aData)
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
// Determine what the 'default' string to display in the File Picker dialog
|
||||
// should be.
|
||||
var defaultFileName = getDefaultFileName(aData.fileName,
|
||||
aSniffer.suggestedFileName,
|
||||
|
||||
// Determine what the 'default' string to display in the File Picker dialog
|
||||
// should be.
|
||||
var defaultFileName = getDefaultFileName(aData.fileName,
|
||||
aSniffer.suggestedFileName,
|
||||
aSniffer.uri,
|
||||
aData.document);
|
||||
var defaultExtension = getDefaultExtension(defaultFileName, aSniffer.uri, contentType);
|
||||
fp.defaultExtension = defaultExtension;
|
||||
fp.defaultString = getNormalizedLeafName(defaultFileName, defaultExtension);
|
||||
|
||||
|
||||
if (fp.show() == Components.interfaces.nsIFilePicker.returnCancel || !fp.file)
|
||||
return;
|
||||
|
||||
if (isDocument)
|
||||
if (isDocument)
|
||||
prefs.setIntPref("save_converter_index", fp.filterIndex);
|
||||
var directory = fp.file.parent.QueryInterface(nsILocalFile);
|
||||
prefs.setComplexValue("dir", nsILocalFile, directory);
|
||||
@ -344,7 +344,7 @@ function foundHeaderInfo(aSniffer, aData)
|
||||
((saveMode & SAVEMODE_COMPLETE_DOM && fp.filterIndex == 0) ||
|
||||
(saveMode & SAVEMODE_COMPLETE_TEXT && fp.filterIndex == 2));
|
||||
|
||||
// If we're saving a document, and are saving either in complete mode or
|
||||
// If we're saving a document, and are saving either in complete mode or
|
||||
// as converted text, pass the document to the web browser persist component.
|
||||
// If we're just saving the HTML (second option in the list), send only the URI.
|
||||
var source = useSaveDocument ? aData.document : aSniffer.uri;
|
||||
@ -355,7 +355,7 @@ function foundHeaderInfo(aSniffer, aData)
|
||||
postData : isDocument ? getPostData() : null,
|
||||
bypassCache : aData.bypassCache
|
||||
};
|
||||
|
||||
|
||||
var persist = makeWebBrowserPersist();
|
||||
|
||||
// Calculate persist flags.
|
||||
@ -363,12 +363,12 @@ function foundHeaderInfo(aSniffer, aData)
|
||||
const flags = nsIWBP.PERSIST_FLAGS_NO_CONVERSION | nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES;
|
||||
if (aData.bypassCache)
|
||||
persist.persistFlags = flags | nsIWBP.PERSIST_FLAGS_BYPASS_CACHE;
|
||||
else
|
||||
else
|
||||
persist.persistFlags = flags | nsIWBP.PERSIST_FLAGS_FROM_CACHE;
|
||||
|
||||
if (shouldDecode)
|
||||
persist.persistFlags &= ~nsIWBP.PERSIST_FLAGS_NO_CONVERSION;
|
||||
|
||||
|
||||
// Create download and initiate it (below)
|
||||
var dl = Components.classes["@mozilla.org/download;1"].createInstance(Components.interfaces.nsIDownload);
|
||||
|
||||
@ -376,9 +376,9 @@ function foundHeaderInfo(aSniffer, aData)
|
||||
// Saving a Document, not a URI:
|
||||
var filesFolder = null;
|
||||
if (persistArgs.contentType != "text/plain") {
|
||||
// Create the local directory into which to save associated files.
|
||||
// Create the local directory into which to save associated files.
|
||||
filesFolder = fp.file.clone();
|
||||
|
||||
|
||||
var nameWithoutExtension = filesFolder.leafName.replace(/\.[^.]*$/, "");
|
||||
var filesFolderLeafName = getStringBundle().formatStringFromName("filesFolder",
|
||||
[nameWithoutExtension],
|
||||
@ -386,12 +386,12 @@ function foundHeaderInfo(aSniffer, aData)
|
||||
|
||||
filesFolder.leafName = filesFolderLeafName;
|
||||
}
|
||||
|
||||
|
||||
var encodingFlags = 0;
|
||||
if (persistArgs.contentType == "text/plain") {
|
||||
encodingFlags |= nsIWBP.ENCODE_FLAGS_FORMATTED;
|
||||
encodingFlags |= nsIWBP.ENCODE_FLAGS_ABSOLUTE_LINKS;
|
||||
encodingFlags |= nsIWBP.ENCODE_FLAGS_NOFRAMES_CONTENT;
|
||||
encodingFlags |= nsIWBP.ENCODE_FLAGS_NOFRAMES_CONTENT;
|
||||
}
|
||||
else {
|
||||
encodingFlags |= nsIWBP.ENCODE_FLAGS_ENCODE_BASIC_ENTITIES;
|
||||
@ -399,7 +399,7 @@ function foundHeaderInfo(aSniffer, aData)
|
||||
|
||||
const kWrapColumn = 80;
|
||||
dl.init(aSniffer.uri, persistArgs.target, null, null, null, persist);
|
||||
persist.saveDocument(persistArgs.source, persistArgs.target, filesFolder,
|
||||
persist.saveDocument(persistArgs.source, persistArgs.target, filesFolder,
|
||||
persistArgs.contentType, encodingFlags, kWrapColumn);
|
||||
} else {
|
||||
dl.init(source, persistArgs.target, null, null, null, persist);
|
||||
@ -412,9 +412,9 @@ function nsHeaderSniffer(aURL, aCallback, aData)
|
||||
{
|
||||
this.mCallback = aCallback;
|
||||
this.mData = aData;
|
||||
|
||||
|
||||
this.uri = makeURL(aURL);
|
||||
|
||||
|
||||
this.linkChecker = Components.classes["@mozilla.org/network/urichecker;1"]
|
||||
.createInstance(Components.interfaces.nsIURIChecker);
|
||||
this.linkChecker.init(this.uri);
|
||||
@ -441,12 +441,13 @@ nsHeaderSniffer.prototype = {
|
||||
|
||||
// ---------- nsISupports methods ----------
|
||||
QueryInterface: function (iid) {
|
||||
if (!iid.equals(Components.interfaces.nsIRequestObserver) &&
|
||||
!iid.equals(Components.interfaces.nsISupports) &&
|
||||
!iid.equals(Components.interfaces.nsIInterfaceRequestor)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
if (iid.equals(Components.interfaces.nsIRequestObserver) ||
|
||||
iid.equals(Components.interfaces.nsISupports) ||
|
||||
iid.equals(Components.interfaces.nsIInterfaceRequestor))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
// ---------- nsIInterfaceRequestor methods ----------
|
||||
@ -463,7 +464,7 @@ nsHeaderSniffer.prototype = {
|
||||
|
||||
// ---------- nsIRequestObserver methods ----------
|
||||
onStartRequest: function (aRequest, aContext) { },
|
||||
|
||||
|
||||
onStopRequest: function (aRequest, aContext, aStatus) {
|
||||
try {
|
||||
if (aStatus == 0) { // NS_BINDING_SUCCEEDED, so there's something there
|
||||
@ -544,7 +545,7 @@ nsHeaderSniffer.prototype = {
|
||||
|
||||
try {
|
||||
fileName = mhp.getParameter(this.mContentDisposition, "filename", charset, true, dummy);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
try {
|
||||
fileName = mhp.getParameter(this.mContentDisposition, "name", charset, true, dummy);
|
||||
@ -604,7 +605,7 @@ function appendFiltersForContentType(aFilePicker, aContentType, aFileExtension,
|
||||
|
||||
var mimeInfo = getMIMEInfoForType(aContentType, aFileExtension);
|
||||
if (mimeInfo) {
|
||||
|
||||
|
||||
var extEnumerator = mimeInfo.getFileExtensions();
|
||||
|
||||
var extString = "";
|
||||
@ -615,7 +616,7 @@ function appendFiltersForContentType(aFilePicker, aContentType, aFileExtension,
|
||||
// separate by semi-colon
|
||||
extString += "*." + extension;
|
||||
}
|
||||
|
||||
|
||||
if (extString) {
|
||||
aFilePicker.appendFilter(mimeInfo.description, extString);
|
||||
}
|
||||
@ -637,7 +638,7 @@ function appendFiltersForContentType(aFilePicker, aContentType, aFileExtension,
|
||||
|
||||
// Always append the all files (*) filter
|
||||
aFilePicker.appendFilters(Components.interfaces.nsIFilePicker.filterAll);
|
||||
}
|
||||
}
|
||||
|
||||
function getPostData()
|
||||
{
|
||||
@ -655,16 +656,16 @@ function getPostData()
|
||||
function getStringBundle()
|
||||
{
|
||||
const bundleURL = "chrome://communicator/locale/contentAreaCommands.properties";
|
||||
|
||||
|
||||
const sbsContractID = "@mozilla.org/intl/stringbundle;1";
|
||||
const sbsIID = Components.interfaces.nsIStringBundleService;
|
||||
const sbs = Components.classes[sbsContractID].getService(sbsIID);
|
||||
|
||||
|
||||
const lsContractID = "@mozilla.org/intl/nslocaleservice;1";
|
||||
const lsIID = Components.interfaces.nsILocaleService;
|
||||
const ls = Components.classes[lsContractID].getService(lsIID);
|
||||
var appLocale = ls.getApplicationLocale();
|
||||
return sbs.createBundle(bundleURL, appLocale);
|
||||
return sbs.createBundle(bundleURL, appLocale);
|
||||
}
|
||||
|
||||
function makeWebBrowserPersist()
|
||||
@ -705,7 +706,7 @@ function getMIMEService()
|
||||
|
||||
function getMIMETypeForURI(aURI)
|
||||
{
|
||||
try {
|
||||
try {
|
||||
return getMIMEService().getTypeFromURI(aURI);
|
||||
}
|
||||
catch (e) {
|
||||
@ -715,7 +716,7 @@ function getMIMETypeForURI(aURI)
|
||||
|
||||
function getMIMEInfoForType(aMIMEType, aExtension)
|
||||
{
|
||||
try {
|
||||
try {
|
||||
return getMIMEService().getFromTypeAndExtension(aMIMEType, aExtension);
|
||||
}
|
||||
catch (e) {
|
||||
@ -748,7 +749,7 @@ function getDefaultFileName(aDefaultFileName, aNameFromHeaders, aDocumentURI, aD
|
||||
// URI... no usable filename here.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (aDocument) {
|
||||
var docTitle = GenerateValidFilename(aDocument.title, "");
|
||||
|
||||
@ -757,7 +758,7 @@ function getDefaultFileName(aDefaultFileName, aNameFromHeaders, aDocumentURI, aD
|
||||
return docTitle;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (aDefaultFileName)
|
||||
// 4) Use the caller-provided name, if any
|
||||
return validateFileName(aDefaultFileName);
|
||||
@ -789,13 +790,13 @@ function getNormalizedLeafName(aFile, aDefaultExtension)
|
||||
{
|
||||
if (!aDefaultExtension)
|
||||
return aFile;
|
||||
|
||||
|
||||
// Fix up the file name we're saving to to include the default extension
|
||||
const stdURLContractID = "@mozilla.org/network/standard-url;1";
|
||||
const stdURLIID = Components.interfaces.nsIURL;
|
||||
var url = Components.classes[stdURLContractID].createInstance(stdURLIID);
|
||||
url.filePath = aFile;
|
||||
|
||||
|
||||
if (url.fileExtension != aDefaultExtension) {
|
||||
return aFile + "." + aDefaultExtension;
|
||||
}
|
||||
@ -818,13 +819,13 @@ function getDefaultExtension(aFilename, aURI, aContentType)
|
||||
|
||||
// This mirrors some code in nsExternalHelperAppService::DoContent
|
||||
// Use the filename first and then the URI if that fails
|
||||
|
||||
|
||||
var mimeInfo = getMIMEInfoForType(aContentType, ext);
|
||||
|
||||
if (ext && mimeInfo && mimeInfo.extensionExists(ext)) {
|
||||
return ext;
|
||||
}
|
||||
|
||||
|
||||
// Well, that failed. Now try the extension from the URI
|
||||
var urlext;
|
||||
try {
|
||||
|
@ -110,7 +110,7 @@ nsFilePicker.prototype = {
|
||||
|
||||
/* readonly attribute nsIFileURL fileURL; */
|
||||
set fileURL(a) { throw "readonly property"; },
|
||||
get fileURL() {
|
||||
get fileURL() {
|
||||
if (this.mFilesEnumerator) {
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
@ -127,7 +127,7 @@ nsFilePicker.prototype = {
|
||||
/* attribute wstring defaultExtension */
|
||||
set defaultExtension(ext) { },
|
||||
get defaultExtension() { return ""; },
|
||||
|
||||
|
||||
/* attribute long filterIndex; */
|
||||
set filterIndex(a) { this.mFilterIndex = a; },
|
||||
get filterIndex() { return this.mFilterIndex; },
|
||||
@ -181,10 +181,12 @@ nsFilePicker.prototype = {
|
||||
},
|
||||
|
||||
QueryInterface: function(iid) {
|
||||
if (!iid.equals(nsIFilePicker) &&
|
||||
!iid.equals(nsISupports))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return this;
|
||||
if (iid.equals(nsIFilePicker) ||
|
||||
iid.equals(nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
show: function() {
|
||||
@ -260,10 +262,10 @@ function (compMgr, fileSpec, location, type)
|
||||
debug("registering (all right -- a JavaScript module!)");
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
|
||||
compMgr.registerFactoryLocation(FILEPICKER_CID,
|
||||
compMgr.registerFactoryLocation(FILEPICKER_CID,
|
||||
"FilePicker JS Component",
|
||||
FILEPICKER_CONTRACTID,
|
||||
fileSpec,
|
||||
FILEPICKER_CONTRACTID,
|
||||
fileSpec,
|
||||
location,
|
||||
type);
|
||||
}
|
||||
@ -272,10 +274,10 @@ filePickerModule.getClassObject =
|
||||
function (compMgr, cid, iid) {
|
||||
if (!cid.equals(FILEPICKER_CID))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
|
||||
if (!iid.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
|
||||
return filePickerFactory;
|
||||
}
|
||||
|
||||
@ -285,7 +287,7 @@ function(compMgr)
|
||||
debug("Unloading component.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* factory object */
|
||||
var filePickerFactory = new Object();
|
||||
|
||||
@ -323,7 +325,7 @@ function srGetStrBundle(path)
|
||||
}
|
||||
}
|
||||
|
||||
strBundle = strBundleService.createBundle(path);
|
||||
strBundle = strBundleService.createBundle(path);
|
||||
if (!strBundle) {
|
||||
dump("\n--** strBundle createInstance failed **--\n");
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ nsFilePicker.prototype = {
|
||||
|
||||
/* readonly attribute nsIFileURL fileURL; */
|
||||
set fileURL(a) { throw "readonly property"; },
|
||||
get fileURL() {
|
||||
get fileURL() {
|
||||
if (this.mFilesEnumerator) {
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
@ -127,7 +127,7 @@ nsFilePicker.prototype = {
|
||||
/* attribute wstring defaultExtension */
|
||||
set defaultExtension(ext) { },
|
||||
get defaultExtension() { return ""; },
|
||||
|
||||
|
||||
/* attribute long filterIndex; */
|
||||
set filterIndex(a) { this.mFilterIndex = a; },
|
||||
get filterIndex() { return this.mFilterIndex; },
|
||||
@ -181,10 +181,12 @@ nsFilePicker.prototype = {
|
||||
},
|
||||
|
||||
QueryInterface: function(iid) {
|
||||
if (!iid.equals(nsIFilePicker) &&
|
||||
!iid.equals(nsISupports))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return this;
|
||||
if (iid.equals(nsIFilePicker) ||
|
||||
iid.equals(nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
show: function() {
|
||||
@ -260,10 +262,10 @@ function (compMgr, fileSpec, location, type)
|
||||
debug("registering (all right -- a JavaScript module!)");
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
|
||||
compMgr.registerFactoryLocation(FILEPICKER_CID,
|
||||
compMgr.registerFactoryLocation(FILEPICKER_CID,
|
||||
"FilePicker JS Component",
|
||||
FILEPICKER_CONTRACTID,
|
||||
fileSpec,
|
||||
FILEPICKER_CONTRACTID,
|
||||
fileSpec,
|
||||
location,
|
||||
type);
|
||||
}
|
||||
@ -272,10 +274,10 @@ filePickerModule.getClassObject =
|
||||
function (compMgr, cid, iid) {
|
||||
if (!cid.equals(FILEPICKER_CID))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
|
||||
if (!iid.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
|
||||
return filePickerFactory;
|
||||
}
|
||||
|
||||
@ -285,7 +287,7 @@ function(compMgr)
|
||||
debug("Unloading component.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* factory object */
|
||||
var filePickerFactory = new Object();
|
||||
|
||||
@ -323,7 +325,7 @@ function srGetStrBundle(path)
|
||||
}
|
||||
}
|
||||
|
||||
strBundle = strBundleService.createBundle(path);
|
||||
strBundle = strBundleService.createBundle(path);
|
||||
if (!strBundle) {
|
||||
dump("\n--** strBundle createInstance failed **--\n");
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ nsKillAll.prototype = {
|
||||
get commandLineArgument() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get prefNameForStartup() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
|
||||
get chromeUrlForTask() {
|
||||
get chromeUrlForTask() {
|
||||
|
||||
// turn off server mode
|
||||
|
||||
@ -129,19 +129,20 @@ nsKillAll.prototype = {
|
||||
},
|
||||
|
||||
get helpText() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get handlesArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get defaultArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get openWindowWithArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get handlesArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get defaultArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get openWindowWithArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
|
||||
// nsISupports interface
|
||||
|
||||
// This "class" supports nsICmdLineHandler and nsISupports.
|
||||
QueryInterface: function (iid) {
|
||||
if (!iid.equals(Components.interfaces.nsICmdLineHandler) &&
|
||||
!iid.equals(Components.interfaces.nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
if (iid.equals(Components.interfaces.nsICmdLineHandler) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
// This Component's module implementation. All the code below is used to get this
|
||||
@ -157,35 +158,35 @@ nsKillAll.prototype = {
|
||||
location,
|
||||
type );
|
||||
},
|
||||
|
||||
|
||||
// getClassObject: Return this component's factory object.
|
||||
getClassObject: function (compMgr, cid, iid) {
|
||||
if (!cid.equals(this.cid))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
|
||||
if (!iid.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
|
||||
return this.factory;
|
||||
},
|
||||
|
||||
|
||||
/* CID for this class */
|
||||
cid: Components.ID("{F1F25940-4C8F-11d6-A651-0010A401EB10}"),
|
||||
|
||||
|
||||
/* Contract ID for this class */
|
||||
contractId: "@mozilla.org/commandlinehandler/general-startup;1?type=killAll",
|
||||
|
||||
|
||||
/* factory object */
|
||||
factory: {
|
||||
// createInstance: Return a new nsKillAll object.
|
||||
createInstance: function (outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
|
||||
return (new nsKillAll()).QueryInterface(iid);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// canUnload: n/a (returns true)
|
||||
canUnload: function(compMgr) {
|
||||
return true;
|
||||
|
@ -67,7 +67,7 @@ nsResetPref.prototype = {
|
||||
// nsICmdLineHandler interface
|
||||
get commandLineArgument() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get prefNameForStartup() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get chromeUrlForTask() {
|
||||
get chromeUrlForTask() {
|
||||
try {
|
||||
// We trust that this has been called during command-line handling during
|
||||
// startup from nsAppRunner.cpp.
|
||||
@ -97,19 +97,20 @@ nsResetPref.prototype = {
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
get helpText() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get handlesArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get defaultArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get openWindowWithArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get handlesArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get defaultArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get openWindowWithArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
|
||||
// nsISupports interface
|
||||
|
||||
// This "class" supports nsICmdLineHandler and nsISupports.
|
||||
QueryInterface: function (iid) {
|
||||
if (!iid.equals(Components.interfaces.nsICmdLineHandler) &&
|
||||
!iid.equals(Components.interfaces.nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
if (iid.equals(Components.interfaces.nsICmdLineHandler) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
// Dump text (if debug is on).
|
||||
@ -132,35 +133,35 @@ nsResetPref.prototype = {
|
||||
location,
|
||||
type );
|
||||
},
|
||||
|
||||
|
||||
// getClassObject: Return this component's factory object.
|
||||
getClassObject: function (compMgr, cid, iid) {
|
||||
if (!cid.equals(this.cid))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
|
||||
if (!iid.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
|
||||
return this.factory;
|
||||
},
|
||||
|
||||
|
||||
/* CID for this class */
|
||||
cid: Components.ID("{15ABFAF7-AD4F-4450-899B-0373EE9FAD95}"),
|
||||
|
||||
|
||||
/* Contract ID for this class */
|
||||
contractId: "@mozilla.org/commandlinehandler/general-startup;1?type=resetPref",
|
||||
|
||||
|
||||
/* factory object */
|
||||
factory: {
|
||||
// createInstance: Return a new nsResetPref object.
|
||||
createInstance: function (outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
|
||||
return (new nsResetPref()).QueryInterface(iid);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// canUnload: n/a (returns true)
|
||||
canUnload: function(compMgr) {
|
||||
return true;
|
||||
|
@ -74,7 +74,7 @@ function nsSidebar()
|
||||
{
|
||||
const RDF_CONTRACTID = "@mozilla.org/rdf/rdf-service;1";
|
||||
const nsIRDFService = Components.interfaces.nsIRDFService;
|
||||
|
||||
|
||||
this.rdf = Components.classes[RDF_CONTRACTID].getService(nsIRDFService);
|
||||
this.datasource_uri = getSidebarDatasourceURI(PANELS_RDF_FILE);
|
||||
debug('datasource_uri is ' + this.datasource_uri);
|
||||
@ -92,13 +92,13 @@ nsSidebar.prototype.nc = "http://home.netscape.com/NC-rdf#";
|
||||
nsSidebar.prototype.isPanel =
|
||||
function (aContentURL)
|
||||
{
|
||||
var container =
|
||||
var container =
|
||||
Components.classes[CONTAINER_CONTRACTID].createInstance(nsIRDFContainer);
|
||||
|
||||
container.Init(this.datasource, this.rdf.GetResource(this.resource));
|
||||
|
||||
|
||||
/* Create a resource for the new panel and add it to the list */
|
||||
var panel_resource =
|
||||
var panel_resource =
|
||||
this.rdf.GetResource("urn:sidebar:3rdparty-panel:" + aContentURL);
|
||||
|
||||
return (container.IndexOf(panel_resource) != -1);
|
||||
@ -116,11 +116,11 @@ function (aTitle, aContentURL, aCustomizeURL)
|
||||
{
|
||||
debug("addPanel(" + aTitle + ", " + aContentURL + ", " +
|
||||
aCustomizeURL + ")");
|
||||
|
||||
|
||||
return this.addPanelInternal(aTitle, aContentURL, aCustomizeURL, false);
|
||||
}
|
||||
|
||||
nsSidebar.prototype.addPersistentPanel =
|
||||
nsSidebar.prototype.addPersistentPanel =
|
||||
function(aTitle, aContentURL, aCustomizeURL)
|
||||
{
|
||||
debug("addPersistentPanel(" + aTitle + ", " + aContentURL + ", " +
|
||||
@ -148,7 +148,7 @@ function (aTitle, aContentURL, aCustomizeURL, aPersist)
|
||||
container.Init(this.datasource, panel_list);
|
||||
|
||||
/* Create a resource for the new panel and add it to the list */
|
||||
var panel_resource =
|
||||
var panel_resource =
|
||||
this.rdf.GetResource("urn:sidebar:3rdparty-panel:" + aContentURL);
|
||||
var panel_index = container.IndexOf(panel_resource);
|
||||
var stringBundle, brandStringBundle, titleMessage, dialogMessage;
|
||||
@ -169,7 +169,7 @@ function (aTitle, aContentURL, aCustomizeURL, aPersist)
|
||||
titleMessage = "Sidebar";
|
||||
dialogMessage = aContentURL + " already exists in Sidebar. No string bundle";
|
||||
}
|
||||
|
||||
|
||||
this.promptService.alert(null, titleMessage, dialogMessage);
|
||||
|
||||
return;
|
||||
@ -197,9 +197,9 @@ function (aTitle, aContentURL, aCustomizeURL, aPersist)
|
||||
titleMessage = "Add Tab to Sidebar";
|
||||
dialogMessage = "No string bundle. Add the Tab '" + aTitle + "' to Sidebar?\n\n" + "Source: " + aContentURL;
|
||||
}
|
||||
|
||||
|
||||
var rv = this.promptService.confirm(null, titleMessage, dialogMessage);
|
||||
|
||||
|
||||
if (!rv)
|
||||
return;
|
||||
|
||||
@ -222,7 +222,7 @@ function (aTitle, aContentURL, aCustomizeURL, aPersist)
|
||||
this.rdf.GetResource(this.nc + "persist"),
|
||||
this.rdf.GetLiteral(persistValue),
|
||||
true);
|
||||
|
||||
|
||||
container.AppendElement(panel_resource);
|
||||
|
||||
// Use an assertion to pass a "refresh" event to all the sidebars.
|
||||
@ -289,7 +289,7 @@ function (engineURL, iconURL, suggestedTitle, suggestedCategory)
|
||||
var stringBundle = srGetStrBundle("chrome://communicator/locale/sidebar/sidebar.properties");
|
||||
var brandStringBundle = srGetStrBundle("chrome://global/locale/brand.properties");
|
||||
if (stringBundle) {
|
||||
sidebarName = brandStringBundle.GetStringFromName("sidebarName");
|
||||
sidebarName = brandStringBundle.GetStringFromName("sidebarName");
|
||||
titleMessage = stringBundle.GetStringFromName("addEngineConfirmTitle");
|
||||
dialogMessage = stringBundle.GetStringFromName("addEngineConfirmMessage");
|
||||
dialogMessage = dialogMessage.replace(/%title%/, suggestedTitle);
|
||||
@ -305,14 +305,14 @@ function (engineURL, iconURL, suggestedTitle, suggestedCategory)
|
||||
dialogMessage += "\nSearch Category: " + suggestedCategory;
|
||||
dialogMessage += "\nSource: " + engineURL;
|
||||
}
|
||||
|
||||
|
||||
var rv = this.promptService.confirm(null, titleMessage, dialogMessage);
|
||||
|
||||
|
||||
if (!rv)
|
||||
return;
|
||||
|
||||
var internetSearch = Components.classes[NETSEARCH_CONTRACTID].getService();
|
||||
if (internetSearch)
|
||||
if (internetSearch)
|
||||
internetSearch = internetSearch.QueryInterface(nsIInternetSearchService);
|
||||
if (internetSearch)
|
||||
{
|
||||
@ -339,11 +339,13 @@ nsSidebar.prototype.getHelperForLanguage = function(count) {return null;}
|
||||
|
||||
nsSidebar.prototype.QueryInterface =
|
||||
function (iid) {
|
||||
if (!iid.equals(nsISidebar) &&
|
||||
!iid.equals(nsIClassInfo) &&
|
||||
!iid.equals(nsISupports))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return this;
|
||||
if (iid.equals(nsISidebar) ||
|
||||
iid.equals(nsIClassInfo) ||
|
||||
iid.equals(nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
|
||||
var sidebarModule = new Object();
|
||||
@ -354,10 +356,10 @@ function (compMgr, fileSpec, location, type)
|
||||
debug("registering (all right -- a JavaScript module!)");
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
|
||||
compMgr.registerFactoryLocation(SIDEBAR_CID,
|
||||
compMgr.registerFactoryLocation(SIDEBAR_CID,
|
||||
"Sidebar JS Component",
|
||||
SIDEBAR_CONTRACTID,
|
||||
fileSpec,
|
||||
SIDEBAR_CONTRACTID,
|
||||
fileSpec,
|
||||
location,
|
||||
type);
|
||||
|
||||
@ -378,10 +380,10 @@ sidebarModule.getClassObject =
|
||||
function (compMgr, cid, iid) {
|
||||
if (!cid.equals(SIDEBAR_CID))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
|
||||
if (!iid.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
|
||||
return sidebarFactory;
|
||||
}
|
||||
|
||||
@ -391,7 +393,7 @@ function(compMgr)
|
||||
debug("Unloading component.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* factory object */
|
||||
var sidebarFactory = new Object();
|
||||
|
||||
@ -417,9 +419,9 @@ else
|
||||
|
||||
function getSidebarDatasourceURI(panels_file_id)
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
/* use the fileLocator to look in the profile directory
|
||||
/* use the fileLocator to look in the profile directory
|
||||
* to find 'panels.rdf', which is the
|
||||
* database of the user's currently selected panels. */
|
||||
var directory_service = Components.classes[DIR_SERV_CONTRACTID].getService(Components.interfaces.nsIProperties);
|
||||
@ -458,15 +460,15 @@ function srGetStrBundle(path)
|
||||
if (!strBundleService) {
|
||||
try {
|
||||
strBundleService =
|
||||
Components.classes["@mozilla.org/intl/stringbundle;1"].getService();
|
||||
strBundleService =
|
||||
Components.classes["@mozilla.org/intl/stringbundle;1"].getService();
|
||||
strBundleService =
|
||||
strBundleService.QueryInterface(Components.interfaces.nsIStringBundleService);
|
||||
} catch (ex) {
|
||||
dump("\n--** strBundleService failed: " + ex + "\n");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
strBundle = strBundleService.createBundle(path);
|
||||
strBundle = strBundleService.createBundle(path);
|
||||
if (!strBundle) {
|
||||
dump("\n--** strBundle createInstance failed **--\n");
|
||||
}
|
||||
|
@ -52,18 +52,19 @@ nsCloseAllWindows.prototype = {
|
||||
|
||||
// This "class" supports nsICloseAllWindows, and nsISupports.
|
||||
QueryInterface: function (iid) {
|
||||
if (!iid.equals(Components.interfaces.nsICloseAllWindows) &&
|
||||
!iid.equals(Components.interfaces.nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
if (iid.equals(Components.interfaces.nsICloseAllWindows) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
// ---------- nsICloseAllWindows methods ----------
|
||||
|
||||
// closeAll: Close all open windows
|
||||
closeAll: function(aAskToSave) {
|
||||
|
||||
|
||||
var windowMediator = Components.classes['@mozilla.org/appshell/window-mediator;1'].
|
||||
getService(Components.interfaces.nsIWindowMediator);
|
||||
var enumerator = windowMediator.getEnumerator(null);
|
||||
@ -76,7 +77,7 @@ nsCloseAllWindows.prototype = {
|
||||
}
|
||||
domWindow.close();
|
||||
};
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,13 @@
|
||||
*
|
||||
* The Original Code is the Update Notifier.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com> (Original Author)
|
||||
* Samir Gehani <sgehani@netscape.com> (Original Author)
|
||||
*
|
||||
* 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
|
||||
@ -42,11 +42,11 @@ const kUNEnabledPref = "update_notifications.enabled";
|
||||
const kUNDatasourceURIPref = "update_notifications.provider.0.datasource";
|
||||
const kUNFrequencyPref = "update_notifications.provider.0.frequency";
|
||||
const kUNLastCheckedPref = "update_notifications.provider.0.last_checked";
|
||||
const kUNBundleURI =
|
||||
const kUNBundleURI =
|
||||
"chrome://communicator/locale/update-notifications.properties";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// nsUpdateNotifier : nsIProfileStartupListener, nsIObserver
|
||||
//
|
||||
// Checks for updates of the client by polling a distributor's website
|
||||
@ -55,7 +55,7 @@ const kUNBundleURI =
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var nsUpdateNotifier =
|
||||
var nsUpdateNotifier =
|
||||
{
|
||||
onProfileStartup: function(aProfileName)
|
||||
{
|
||||
@ -76,7 +76,7 @@ var nsUpdateNotifier =
|
||||
|
||||
if (aTopic == "domwindowopened")
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
const kITimer = Components.interfaces.nsITimer;
|
||||
this.mTimer = Components.classes["@mozilla.org/timer;1"].
|
||||
@ -116,7 +116,7 @@ var nsUpdateNotifier =
|
||||
checkForUpdate: function()
|
||||
{
|
||||
debug("checkForUpdate");
|
||||
|
||||
|
||||
if (this.shouldCheckForUpdate())
|
||||
{
|
||||
try
|
||||
@ -131,7 +131,7 @@ var nsUpdateNotifier =
|
||||
var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].
|
||||
getService(Components.interfaces.nsIRDFService);
|
||||
var ds = rdf.GetDataSource(updateDatasourceURI);
|
||||
|
||||
|
||||
ds = ds.QueryInterface(Components.interfaces.nsIRDFXMLSink);
|
||||
ds.addXMLSinkObserver(nsUpdateDatasourceObserver);
|
||||
}
|
||||
@ -152,7 +152,7 @@ var nsUpdateNotifier =
|
||||
{
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
|
||||
if (prefs.getBoolPref(kUNEnabledPref))
|
||||
{
|
||||
var freq = prefs.getIntPref(kUNFrequencyPref) * (24 * 60 * 60); // secs
|
||||
@ -160,7 +160,7 @@ var nsUpdateNotifier =
|
||||
|
||||
if (!prefs.prefHasUserValue(kUNLastCheckedPref))
|
||||
{
|
||||
// setting last_checked pref first time so must randomize in
|
||||
// setting last_checked pref first time so must randomize in
|
||||
// order that servers don't get flooded with updates.rdf checks
|
||||
// (and eventually downloads of new clients) all at the same time
|
||||
|
||||
@ -173,7 +173,7 @@ var nsUpdateNotifier =
|
||||
var lastChecked = prefs.getIntPref(kUNLastCheckedPref);
|
||||
if ((lastChecked + freq) > now)
|
||||
return false;
|
||||
|
||||
|
||||
prefs.setIntPref(kUNLastCheckedPref, now);
|
||||
prefs = prefs.QueryInterface(Components.interfaces.nsIPrefService);
|
||||
prefs.savePrefFile(null); // flush prefs now
|
||||
@ -192,12 +192,13 @@ var nsUpdateNotifier =
|
||||
|
||||
QueryInterface: function(aIID)
|
||||
{
|
||||
if (!aIID.equals(Components.interfaces.nsIObserver) &&
|
||||
!aIID.equals(Components.interfaces.nsIProfileStartupListener) &&
|
||||
!aIID.equals(Components.interfaces.nsISupports))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
if (aIID.equals(Components.interfaces.nsIObserver) ||
|
||||
aIID.equals(Components.interfaces.nsIProfileStartupListener) ||
|
||||
aIID.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
return this;
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,7 +211,7 @@ var nsUpdateNotifier =
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var nsUpdateDatasourceObserver =
|
||||
var nsUpdateDatasourceObserver =
|
||||
{
|
||||
onBeginLoad: function(aSink)
|
||||
{
|
||||
@ -227,7 +228,7 @@ var nsUpdateDatasourceObserver =
|
||||
onEndLoad: function(aSink)
|
||||
{
|
||||
debug("onEndLoad");
|
||||
|
||||
|
||||
aSink.removeXMLSinkObserver(this);
|
||||
|
||||
var ds = aSink.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
||||
@ -240,29 +241,29 @@ var nsUpdateDatasourceObserver =
|
||||
var winWatcher = Components.
|
||||
classes["@mozilla.org/embedcomp/window-watcher;1"].
|
||||
getService(Components.interfaces.nsIWindowWatcher);
|
||||
|
||||
|
||||
var unBundle = this.getBundle(kUNBundleURI);
|
||||
if (!unBundle)
|
||||
return;
|
||||
|
||||
var title = unBundle.formatStringFromName("title",
|
||||
var title = unBundle.formatStringFromName("title",
|
||||
[updateInfo.productName], 1);
|
||||
var desc = unBundle.formatStringFromName("desc",
|
||||
var desc = unBundle.formatStringFromName("desc",
|
||||
[updateInfo.productName], 1);
|
||||
var button0Text = unBundle.GetStringFromName("getItNow");
|
||||
var button1Text = unBundle.GetStringFromName("noThanks");
|
||||
var checkMsg = unBundle.GetStringFromName("dontAskAgain");
|
||||
var checkVal = {value:0};
|
||||
|
||||
var result = promptService.confirmEx(winWatcher.activeWindow, title, desc,
|
||||
var result = promptService.confirmEx(winWatcher.activeWindow, title, desc,
|
||||
(promptService.BUTTON_POS_0 * promptService.BUTTON_TITLE_IS_STRING) +
|
||||
(promptService.BUTTON_POS_1 * promptService.BUTTON_TITLE_IS_STRING),
|
||||
button0Text, button1Text, null, checkMsg, checkVal);
|
||||
|
||||
// user wants update now so open new window
|
||||
// user wants update now so open new window
|
||||
// (result => 0 is button0)
|
||||
if (result == 0)
|
||||
winWatcher.openWindow(winWatcher.activeWindow, updateInfo.URL,
|
||||
winWatcher.openWindow(winWatcher.activeWindow, updateInfo.URL,
|
||||
"_blank", "", null);
|
||||
|
||||
// if "Don't ask again" was checked disable update notifications
|
||||
@ -302,17 +303,17 @@ var nsUpdateDatasourceObserver =
|
||||
info = null;
|
||||
debug("Exception getting update info: " + ex);
|
||||
|
||||
// NOTE: If the (possibly remote) datasource doesn't exist
|
||||
// NOTE: If the (possibly remote) datasource doesn't exist
|
||||
// or fails to load the first |GetTarget()| call will fail
|
||||
// bringing us to this exception handler. In turn, we
|
||||
// will fail silently. Testing has revealed that for a
|
||||
// non-existent datasource (invalid URI) the
|
||||
// bringing us to this exception handler. In turn, we
|
||||
// will fail silently. Testing has revealed that for a
|
||||
// non-existent datasource (invalid URI) the
|
||||
// |nsIRDFXMLSinkObserver.onEndLoad()| is called instead of
|
||||
// |nsIRDFXMLSinkObserver.onError()| as one may expect. In
|
||||
// addition, if we QI the aSink parameter of |onEndLoad()|
|
||||
// to an |nsIRDFRemoteDataSource| and check the |loaded|
|
||||
// boolean, it reflects true so we can't use that. The
|
||||
// safe way to know we have failed to load the datasource
|
||||
// |nsIRDFXMLSinkObserver.onError()| as one may expect. In
|
||||
// addition, if we QI the aSink parameter of |onEndLoad()|
|
||||
// to an |nsIRDFRemoteDataSource| and check the |loaded|
|
||||
// boolean, it reflects true so we can't use that. The
|
||||
// safe way to know we have failed to load the datasource
|
||||
// is by handling the first exception as we are doing now.
|
||||
}
|
||||
|
||||
@ -329,7 +330,7 @@ var nsUpdateDatasourceObserver =
|
||||
|
||||
newerVersionAvailable: function(aUpdateInfo)
|
||||
{
|
||||
// sanity check
|
||||
// sanity check
|
||||
if (!aUpdateInfo.registryName || !aUpdateInfo.version)
|
||||
{
|
||||
debug("Sanity check failed: aUpdateInfo is invalid!");
|
||||
@ -352,10 +353,10 @@ var nsUpdateDatasourceObserver =
|
||||
var httpHandler = Components.
|
||||
classes["@mozilla.org/network/protocol;1?name=http"].
|
||||
getService(Components.interfaces.nsIHttpProtocolHandler);
|
||||
var synthesized = this.synthesizeVersion(httpHandler.misc,
|
||||
var synthesized = this.synthesizeVersion(httpHandler.misc,
|
||||
httpHandler.productSub);
|
||||
var local = new nsVersion(synthesized);
|
||||
var server = new nsVersion(aUpdateInfo.version);
|
||||
var server = new nsVersion(aUpdateInfo.version);
|
||||
|
||||
return (server.isNewerThan(local));
|
||||
}
|
||||
@ -367,23 +368,23 @@ var nsUpdateDatasourceObserver =
|
||||
}
|
||||
|
||||
return false; // return value expected from this function
|
||||
},
|
||||
},
|
||||
|
||||
xpinstallHaveNewer: function(aUpdateInfo)
|
||||
{
|
||||
// XXX Once InstallTrigger is a component we will be able to
|
||||
// get at it without needing to reference it from hiddenDOMWindow.
|
||||
// This will enable us to |compareVersion()|s even when
|
||||
// This will enable us to |compareVersion()|s even when
|
||||
// XPInstall is disabled but update notifications are enabled.
|
||||
// See <http://bugzilla.mozilla.org/show_bug.cgi?id=121506>.
|
||||
var ass = Components.classes["@mozilla.org/appshell/appShellService;1"].
|
||||
getService(Components.interfaces.nsIAppShellService);
|
||||
var trigger = ass.hiddenDOMWindow.InstallTrigger;
|
||||
var diffLevel = trigger.compareVersion(aUpdateInfo.registryName,
|
||||
var diffLevel = trigger.compareVersion(aUpdateInfo.registryName,
|
||||
aUpdateInfo.version);
|
||||
if (diffLevel < trigger.EQUAL && diffLevel != trigger.NOT_FOUND)
|
||||
return true;
|
||||
return false; // already have newer version or
|
||||
return false; // already have newer version or
|
||||
// fail silently if old version not found on disk
|
||||
},
|
||||
|
||||
@ -394,14 +395,14 @@ var nsUpdateDatasourceObserver =
|
||||
// with a default 0 value. We are interested in the first 3
|
||||
// numbers delimited by periods. The 4th comes from aProductSub.
|
||||
// e.g., x => x.0.0, x.1 => x.1.0, x.1.2 => x.1.2, x.1.2.3 => x.1.2
|
||||
|
||||
|
||||
var synthesized = "0.0.0.";
|
||||
|
||||
// match only digits and periods after "rv:" in the misc
|
||||
var onlyVer = /rv:([0-9.]+)/.exec(aMisc);
|
||||
|
||||
// original string in onlyVer[0], matched substring in onlyVer[1]
|
||||
if (onlyVer && onlyVer.length >= 2)
|
||||
if (onlyVer && onlyVer.length >= 2)
|
||||
{
|
||||
var parts = onlyVer[1].split('.');
|
||||
var len = parts.length;
|
||||
@ -419,7 +420,7 @@ var nsUpdateDatasourceObserver =
|
||||
|
||||
// tack on productSub for nsVersion.mBuild field if available
|
||||
synthesized += aProductSub ? aProductSub : "0";
|
||||
|
||||
|
||||
return synthesized;
|
||||
},
|
||||
|
||||
@ -452,7 +453,7 @@ var nsUpdateDatasourceObserver =
|
||||
//
|
||||
// Constructs a version object given a string representation. This
|
||||
// constructor populates the mMajor, mMinor, mRelease, and mBuild
|
||||
// fields regardless of whether string contains all the fields.
|
||||
// fields regardless of whether string contains all the fields.
|
||||
// The default for all unspecified fields is 0.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@ -468,7 +469,7 @@ function nsVersion(aStringVersion)
|
||||
this.mBuild = (len >= 4) ? this.getValidInt(parts[3]) : 0;
|
||||
}
|
||||
|
||||
nsVersion.prototype =
|
||||
nsVersion.prototype =
|
||||
{
|
||||
isNewerThan: function(aOther)
|
||||
{
|
||||
@ -516,7 +517,7 @@ nsVersion.prototype =
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var nsUpdateNotifierModule =
|
||||
var nsUpdateNotifierModule =
|
||||
{
|
||||
mClassName: "Update Notifier",
|
||||
mContractID: "@mozilla.org/update-notifier;1",
|
||||
@ -539,12 +540,12 @@ var nsUpdateNotifierModule =
|
||||
|
||||
aCompMgr = aCompMgr.QueryInterface(
|
||||
Components.interfaces.nsIComponentRegistrar);
|
||||
aCompMgr.registerFactoryLocation(this.mClassID, this.mClassName,
|
||||
aCompMgr.registerFactoryLocation(this.mClassID, this.mClassName,
|
||||
this.mContractID, aFileSpec, aLocation, aType);
|
||||
|
||||
// receive startup notification from the profile manager
|
||||
// (we get |createInstance()|d at startup-notification time)
|
||||
this.getCategoryManager().addCategoryEntry("profile-startup-category",
|
||||
this.getCategoryManager().addCategoryEntry("profile-startup-category",
|
||||
this.mContractID, "", true, true);
|
||||
},
|
||||
|
||||
@ -554,7 +555,7 @@ var nsUpdateNotifierModule =
|
||||
Components.interfaces.nsIComponentRegistrar);
|
||||
aCompMgr.unregisterFactoryLocation(this.mClassID, aFileSpec);
|
||||
|
||||
this.getCategoryManager().deleteCategoryEntry("profile-startup-category",
|
||||
this.getCategoryManager().deleteCategoryEntry("profile-startup-category",
|
||||
this.mContractID, true);
|
||||
},
|
||||
|
||||
@ -585,7 +586,7 @@ var nsUpdateNotifierModule =
|
||||
!aIID.equals(Components.interfaces.nsISupports))
|
||||
throw Components.results.NS_ERROR_INVALID_ARG;
|
||||
|
||||
// return the singleton
|
||||
// return the singleton
|
||||
return nsUpdateNotifier.QueryInterface(aIID);
|
||||
},
|
||||
|
||||
|
@ -66,7 +66,7 @@ nsSetDefaultBrowser.prototype = {
|
||||
get commandLineArgument() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get prefNameForStartup() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
|
||||
get chromeUrlForTask() {
|
||||
get chromeUrlForTask() {
|
||||
// First, get winhooks service.
|
||||
var winHooks = Components.classes[ "@mozilla.org/winhooks;1" ]
|
||||
.getService( Components.interfaces.nsIWindowsHooks );
|
||||
@ -112,19 +112,20 @@ nsSetDefaultBrowser.prototype = {
|
||||
},
|
||||
|
||||
get helpText() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get handlesArgs() { return false; },
|
||||
get defaultArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get openWindowWithArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get handlesArgs() { return false; },
|
||||
get defaultArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get openWindowWithArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
|
||||
// nsISupports interface
|
||||
|
||||
// This "class" supports nsICmdLineHandler and nsISupports.
|
||||
QueryInterface: function (iid) {
|
||||
if (!iid.equals(Components.interfaces.nsICmdLineHandler) &&
|
||||
!iid.equals(Components.interfaces.nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
if (iid.equals(Components.interfaces.nsICmdLineHandler) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
// This Component's module implementation. All the code below is used to get this
|
||||
@ -140,35 +141,35 @@ nsSetDefaultBrowser.prototype = {
|
||||
location,
|
||||
type );
|
||||
},
|
||||
|
||||
|
||||
// getClassObject: Return this component's factory object.
|
||||
getClassObject: function (compMgr, cid, iid) {
|
||||
if (!cid.equals(this.cid))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
|
||||
if (!iid.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
|
||||
return this.factory;
|
||||
},
|
||||
|
||||
|
||||
/* CID for this class */
|
||||
cid: Components.ID("{C66E05DC-509C-4972-A1F2-EE5AC34B9800}"),
|
||||
|
||||
|
||||
/* Contract ID for this class */
|
||||
contractId: "@mozilla.org/commandlinehandler/general-startup;1?type=setDefaultBrowser",
|
||||
|
||||
|
||||
/* factory object */
|
||||
factory: {
|
||||
// createInstance: Return a new nsSetDefaultBrowser object.
|
||||
createInstance: function (outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
|
||||
return (new nsSetDefaultBrowser()).QueryInterface(iid);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// canUnload: n/a (returns true)
|
||||
canUnload: function(compMgr) {
|
||||
return true;
|
||||
|
@ -66,11 +66,11 @@ nsSetDefaultMail.prototype = {
|
||||
get commandLineArgument() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get prefNameForStartup() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
|
||||
get chromeUrlForTask() {
|
||||
get chromeUrlForTask() {
|
||||
|
||||
var mapiRegistry;
|
||||
try {
|
||||
var mapiRegistryProgID = "@mozilla.org/mapiregistry;1"
|
||||
var mapiRegistryProgID = "@mozilla.org/mapiregistry;1"
|
||||
// make sure mail is installed
|
||||
if (mapiRegistryProgID in Components.classes) {
|
||||
mapiRegistry = Components.classes[mapiRegistryProgID].getService(Components.interfaces.nsIMapiRegistry);
|
||||
@ -79,7 +79,7 @@ nsSetDefaultMail.prototype = {
|
||||
mapiRegistry = null;
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
catch (ex) {
|
||||
mapiRegistry = null;
|
||||
}
|
||||
|
||||
@ -113,19 +113,20 @@ nsSetDefaultMail.prototype = {
|
||||
},
|
||||
|
||||
get helpText() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get handlesArgs() { return false; },
|
||||
get defaultArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get openWindowWithArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get handlesArgs() { return false; },
|
||||
get defaultArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get openWindowWithArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
|
||||
// nsISupports interface
|
||||
|
||||
// This "class" supports nsICmdLineHandler and nsISupports.
|
||||
QueryInterface: function (iid) {
|
||||
if (!iid.equals(Components.interfaces.nsICmdLineHandler) &&
|
||||
!iid.equals(Components.interfaces.nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
if (iid.equals(Components.interfaces.nsICmdLineHandler) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
// This Component's module implementation. All the code below is used to get this
|
||||
@ -141,35 +142,35 @@ nsSetDefaultMail.prototype = {
|
||||
location,
|
||||
type );
|
||||
},
|
||||
|
||||
|
||||
// getClassObject: Return this component's factory object.
|
||||
getClassObject: function (compMgr, cid, iid) {
|
||||
if (!cid.equals(this.cid))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
|
||||
if (!iid.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
|
||||
return this.factory;
|
||||
},
|
||||
|
||||
|
||||
/* CID for this class */
|
||||
cid: Components.ID("{8b26281d-c3b2-4b57-9653-419fc705a02d}"),
|
||||
|
||||
|
||||
/* Contract ID for this class */
|
||||
contractId: "@mozilla.org/commandlinehandler/general-startup;1?type=setDefaultMail",
|
||||
|
||||
|
||||
/* factory object */
|
||||
factory: {
|
||||
// createInstance: Return a new nsSetDefaultMail object.
|
||||
createInstance: function (outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
|
||||
return (new nsSetDefaultMail()).QueryInterface(iid);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// canUnload: n/a (returns true)
|
||||
canUnload: function(compMgr) {
|
||||
return true;
|
||||
|
@ -66,11 +66,11 @@ nsUnsetDefaultMail.prototype = {
|
||||
get commandLineArgument() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get prefNameForStartup() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
|
||||
get chromeUrlForTask() {
|
||||
get chromeUrlForTask() {
|
||||
|
||||
var mapiRegistry;
|
||||
try {
|
||||
var mapiRegistryProgID = "@mozilla.org/mapiregistry;1"
|
||||
var mapiRegistryProgID = "@mozilla.org/mapiregistry;1"
|
||||
// make sure mail is installed
|
||||
if (mapiRegistryProgID in Components.classes) {
|
||||
mapiRegistry = Components.classes[mapiRegistryProgID].getService(Components.interfaces.nsIMapiRegistry);
|
||||
@ -79,7 +79,7 @@ nsUnsetDefaultMail.prototype = {
|
||||
mapiRegistry = null;
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
catch (ex) {
|
||||
mapiRegistry = null;
|
||||
}
|
||||
|
||||
@ -113,19 +113,20 @@ nsUnsetDefaultMail.prototype = {
|
||||
},
|
||||
|
||||
get helpText() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get handlesArgs() { return false; },
|
||||
get defaultArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get openWindowWithArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get handlesArgs() { return false; },
|
||||
get defaultArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get openWindowWithArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
|
||||
// nsISupports interface
|
||||
|
||||
// This "class" supports nsICmdLineHandler and nsISupports.
|
||||
QueryInterface: function (iid) {
|
||||
if (!iid.equals(Components.interfaces.nsICmdLineHandler) &&
|
||||
!iid.equals(Components.interfaces.nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
if (iid.equals(Components.interfaces.nsICmdLineHandler) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
// This Component's module implementation. All the code below is used to get this
|
||||
@ -141,35 +142,35 @@ nsUnsetDefaultMail.prototype = {
|
||||
location,
|
||||
type );
|
||||
},
|
||||
|
||||
|
||||
// getClassObject: Return this component's factory object.
|
||||
getClassObject: function (compMgr, cid, iid) {
|
||||
if (!cid.equals(this.cid))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
|
||||
if (!iid.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
|
||||
return this.factory;
|
||||
},
|
||||
|
||||
|
||||
/* CID for this class */
|
||||
cid: Components.ID("{ae9c026a-3bb4-485f-bab8-d7142f336ec1}"),
|
||||
|
||||
|
||||
/* Contract ID for this class */
|
||||
contractId: "@mozilla.org/commandlinehandler/general-startup;1?type=unsetDefaultMail",
|
||||
|
||||
|
||||
/* factory object */
|
||||
factory: {
|
||||
// createInstance: Return a new nsUnsetDefaultMail object.
|
||||
createInstance: function (outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
|
||||
return (new nsUnsetDefaultMail()).QueryInterface(iid);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// canUnload: n/a (returns true)
|
||||
canUnload: function(compMgr) {
|
||||
return true;
|
||||
|
@ -111,16 +111,17 @@ var progressHooks =
|
||||
|
||||
QueryInterface: function( iid )
|
||||
{
|
||||
if (!iid.equals(Components.interfaces.nsISupports) &&
|
||||
!iid.equals(Components.interfaces.nsIXPIProgressDialog))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
if (iid.equals(Components.interfaces.nsISupports) ||
|
||||
iid.equals(Components.interfaces.nsIXPIProgressDialog))
|
||||
return this;
|
||||
|
||||
return this;
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function onLoad()
|
||||
function onLoad()
|
||||
{
|
||||
document.documentElement.getButton("accept").disabled = true;
|
||||
document.documentElement.getButton("cancel").focus();
|
||||
|
@ -69,13 +69,13 @@ testXPIDialogService.prototype =
|
||||
{
|
||||
QueryInterface: function( iid )
|
||||
{
|
||||
if (!iid.equals(Components.interfaces.nsIXPIDialogService) &&
|
||||
!iid.equals(Components.interfaces.nsIXPIProgressDialog) &&
|
||||
!iid.equals(Components.interfaces.nsISupports))
|
||||
{
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
if (iid.equals(Components.interfaces.nsIXPIDialogService) ||
|
||||
iid.equals(Components.interfaces.nsIXPIProgressDialog) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
|
||||
confirmInstall: function( parent, packages, count )
|
||||
|
Loading…
Reference in New Issue
Block a user