Hg: user: Uri Bernstein <uriber@gmail.com>
This commit is contained in:
Uri Bernstein 2008-10-21 09:20:56 +02:00
Родитель 88015e5c46 8b05c605f7
Коммит 87a456a2ee
52 изменённых файлов: 1156 добавлений и 323 удалений

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

@ -96,3 +96,11 @@ done
if test -z "$LIBXUL_SDK"; then
. "${srcdir}/toolkit/toolkit-makefiles.sh"
fi
if test -n "$MOZ_BRANDING_DIRECTORY"; then
add_makefiles "
$MOZ_BRANDING_DIRECTORY/Makefile
$MOZ_BRANDING_DIRECTORY/content/Makefile
$MOZ_BRANDING_DIRECTORY/locales/Makefile
"
fi

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

@ -60,6 +60,12 @@ package:
install::
@$(MAKE) -C browser/installer install
clean::
@$(MAKE) -C browser/installer clean
distclean::
@$(MAKE) -C browser/installer distclean
ifdef ENABLE_TESTS
# Implemented in testing/testsuite-targets.mk

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

@ -58,9 +58,12 @@
#include "nsDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#include <stdlib.h>
#include <limits.h>
#ifndef MAXPATHLEN
#ifdef _MAX_PATH
#ifdef PATH_MAX
#define MAXPATHLEN PATH_MAX
#elif defined(_MAX_PATH)
#define MAXPATHLEN _MAX_PATH
#elif defined(CCHMAXPATH)
#define MAXPATHLEN CCHMAXPATH

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

@ -63,12 +63,16 @@
#include <windows.h>
#include "nsIWindowsRegKey.h"
#include "nsILocalFileWin.h"
#else
#include <limits.h>
#endif
#include "nsAutoPtr.h"
#ifndef MAXPATHLEN
#ifdef _MAX_PATH
#ifdef PATH_MAX
#define MAXPATHLEN PATH_MAX
#elif defined(_MAX_PATH)
#define MAXPATHLEN _MAX_PATH
#elif defined(CCHMAXPATH)
#define MAXPATHLEN CCHMAXPATH

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

@ -88,6 +88,8 @@ MOZ_PKG_MANIFEST = packages-static
$(MOZ_PKG_MANIFEST): $(MOZ_PKG_MANIFEST_P)
$(PERL) $(topsrcdir)/config/preprocessor.pl $(DEFINES) $(ACDEFINES) $< > $@
GARBAGE += $(MOZ_PKG_MANIFEST)
endif
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))

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

@ -93,10 +93,6 @@ endif
# MacOS X 10.4 sends "no autoconf*" errors to stdout, discard those via grep
AUTOCONF ?= $(shell which autoconf-2.13 autoconf2.13 autoconf213 2>/dev/null | grep -v '^no autoconf' | head -1)
ifeq (,$(strip $(AUTOCONF)))
$(error Couldn't find autoconf 2.13)
endif
MKDIR := mkdir
SH := /bin/sh
ifndef MAKE

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

@ -266,6 +266,8 @@ MOZ_NATIVE_NSS = @MOZ_NATIVE_NSS@
CROSS_COMPILE = @CROSS_COMPILE@
WCHAR_CFLAGS = @WCHAR_CFLAGS@
OS_CPPFLAGS = @CPPFLAGS@
OS_CFLAGS = $(OS_CPPFLAGS) @CFLAGS@
OS_CXXFLAGS = $(OS_CPPFLAGS) @CXXFLAGS@

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

@ -1148,7 +1148,7 @@ CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
;;
AIX)
OS_RELEASE=`uname -v`.`uname -r`
OS_TEST=`uname -p`
OS_TEST=${target_cpu}
;;
BSD_386)
OS_ARCH=BSD
@ -1250,7 +1250,7 @@ case "$OS_TEST" in
CPU_ARCH=x86
;;
powerpc* | ppc)
powerpc* | ppc | rs6000)
CPU_ARCH=ppc
;;
@ -1621,15 +1621,15 @@ case "$target" in
if test "$COMPILE_ENVIRONMENT"; then
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_MSG_CHECKING([for VisualAge C++ compiler version >= 5.0.2.0])
AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
AC_TRY_COMPILE([],
[#if (__IBMCPP__ < 502)
[#if (__IBMCPP__ < 600)
#error "Bad compiler"
#endif],
_BAD_COMPILER=,_BAD_COMPILER=1)
if test -n "$_BAD_COMPILER"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([VisualAge C++ version 5.0.2.0 or higher is required to build.])
AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
else
AC_MSG_RESULT([yes])
fi
@ -1854,8 +1854,7 @@ case "$target" in
MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
;;
mips*)
CFLAGS="$CFLAGS -Wa,-xgot"
CXXFLAGS="$CXXFLAGS -Wa,-xgot"
MOZ_DEBUG_FLAGS="-g" # We want inlining
;;
esac
;;
@ -2783,6 +2782,7 @@ dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
HAVE_CPP_2BYTE_WCHAR_T=1
WCHAR_CFLAGS="-fshort-wchar"
else
CXXFLAGS=$_SAVE_CXXFLAGS
fi
@ -7938,6 +7938,7 @@ AC_SUBST(COMPILE_CXXFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(LIBS)
AC_SUBST(CROSS_COMPILE)
AC_SUBST(WCHAR_CFLAGS)
AC_SUBST(HOST_CC)
AC_SUBST(HOST_CXX)

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

@ -806,7 +806,7 @@ nsExternalResourceEnumArgs
void *data;
};
PR_STATIC_CALLBACK(PLDHashOperator)
static PLDHashOperator
ExternalResourceEnumerator(nsIURI* aKey,
nsExternalResourceMap::ExternalResource* aData,
void* aClosure)
@ -826,7 +826,7 @@ nsExternalResourceMap::EnumerateResources(nsIDocument::nsSubDocEnumFunc aCallbac
mMap.EnumerateRead(ExternalResourceEnumerator, &args);
}
PR_STATIC_CALLBACK(PLDHashOperator)
static PLDHashOperator
ExternalResourceTraverser(nsIURI* aKey,
nsExternalResourceMap::ExternalResource* aData,
void* aClosure)

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

@ -974,7 +974,7 @@ nsAccessControlLRUCache::Clear()
mTable.Clear();
}
/* static */ PR_CALLBACK PLDHashOperator
/* static */ PLDHashOperator
nsAccessControlLRUCache::RemoveExpiredEntries(const nsACString& aKey,
nsAutoPtr<CacheEntry>& aValue,
void* aUserData)

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

@ -130,7 +130,7 @@ public:
void Clear();
private:
PR_STATIC_CALLBACK(PLDHashOperator)
static PLDHashOperator
RemoveExpiredEntries(const nsACString& aKey, nsAutoPtr<CacheEntry>& aValue,
void* aUserData);

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

@ -37,8 +37,9 @@
#include "domstubs.idl"
[scriptable, uuid(03723BAE-E1EC-4F35-965F-0A9FDF573D86)]
[scriptable, uuid(74FA3BE6-4CBF-47C7-9BE1-FB9F17DD0D5D)]
interface nsIDOMGeoPositionOptions : nsISupports
{
attribute boolean enableHiqhAccuracy;
attribute boolean enableHighAccuracy;
attribute unsigned long timeout;
};

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

@ -47,7 +47,6 @@
#include "nsIObserverService.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsIProxyObjectManager.h"
#include "nsIJSContextStack.h"
#include <math.h>
@ -69,13 +68,12 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMGEOPOSITIONERROR
nsDOMGeoPositionError(PRInt16 aCode, const nsAString& aMessage);
nsDOMGeoPositionError(PRInt16 aCode);
void NotifyCallback(nsIDOMGeoPositionErrorCallback* callback);
private:
~nsDOMGeoPositionError();
PRInt16 mCode;
nsString mMessage;
};
NS_INTERFACE_MAP_BEGIN(nsDOMGeoPositionError)
@ -87,8 +85,8 @@ NS_INTERFACE_MAP_END
NS_IMPL_THREADSAFE_ADDREF(nsDOMGeoPositionError)
NS_IMPL_THREADSAFE_RELEASE(nsDOMGeoPositionError)
nsDOMGeoPositionError::nsDOMGeoPositionError(PRInt16 aCode, const nsAString& aMessage)
: mCode(aCode), mMessage(aMessage)
nsDOMGeoPositionError::nsDOMGeoPositionError(PRInt16 aCode)
: mCode(aCode)
{
}
@ -106,16 +104,43 @@ nsDOMGeoPositionError::GetCode(PRInt16 *aCode)
NS_IMETHODIMP
nsDOMGeoPositionError::GetMessage(nsAString & aMessage)
{
aMessage = mMessage;
aMessage.Truncate();
return NS_OK;
}
void
nsDOMGeoPositionError::NotifyCallback(nsIDOMGeoPositionErrorCallback* aCallback)
{
if (!aCallback)
return;
// Ensure that the proper context is on the stack (bug 452762)
nsCOMPtr<nsIJSContextStack> stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1"));
if (!stack || NS_FAILED(stack->Push(nsnull)))
return;
aCallback->HandleEvent(this);
// remove the stack
JSContext* cx;
stack->Pop(&cx);
}
////////////////////////////////////////////////////
// nsGeolocationRequest
////////////////////////////////////////////////////
nsGeolocationRequest::nsGeolocationRequest(nsGeolocation* locator, nsIDOMGeoPositionCallback* callback, nsIDOMGeoPositionErrorCallback* errorCallback)
: mAllowed(PR_FALSE), mCleared(PR_FALSE), mFuzzLocation(PR_FALSE), mCallback(callback), mErrorCallback(errorCallback), mLocator(locator)
nsGeolocationRequest::nsGeolocationRequest(nsGeolocation* aLocator,
nsIDOMGeoPositionCallback* aCallback,
nsIDOMGeoPositionErrorCallback* aErrorCallback,
nsIDOMGeoPositionOptions* aOptions)
: mAllowed(PR_FALSE),
mCleared(PR_FALSE),
mFuzzLocation(PR_FALSE),
mHasSentData(PR_FALSE),
mCallback(aCallback),
mErrorCallback(aErrorCallback),
mOptions(aOptions),
mLocator(aLocator)
{
}
@ -126,11 +151,41 @@ nsGeolocationRequest::~nsGeolocationRequest()
NS_INTERFACE_MAP_BEGIN(nsGeolocationRequest)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIGeolocationRequest)
NS_INTERFACE_MAP_ENTRY(nsIGeolocationRequest)
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(nsGeolocationRequest)
NS_IMPL_RELEASE(nsGeolocationRequest)
void
nsGeolocationRequest::NotifyError(PRInt16 errorCode)
{
nsRefPtr<nsDOMGeoPositionError> positionError = new nsDOMGeoPositionError(errorCode);
if (!positionError)
return;
positionError->NotifyCallback(mErrorCallback);
}
NS_IMETHODIMP
nsGeolocationRequest::Notify(nsITimer* aTimer)
{
// If we haven't gotten an answer from the geolocation
// provider yet, cancel the request. Same logic as
// ::Cancel, just a different error
if (!mHasSentData) {
NotifyError(NS_GEO_ERROR_CODE_TIMEOUT);
// remove ourselves from the locator's callback lists.
mLocator->RemoveRequest(this);
}
mTimeoutTimer = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsGeolocationRequest::GetRequestingURI(nsIURI * *aRequestingURI)
{
@ -152,6 +207,8 @@ nsGeolocationRequest::GetRequestingWindow(nsIDOMWindow * *aRequestingWindow)
NS_IMETHODIMP
nsGeolocationRequest::Cancel()
{
NotifyError(NS_GEO_ERROR_CODE_PERMISSION_ERROR);
// remove ourselves from the locators callback lists.
mLocator->RemoveRequest(this);
return NS_OK;
@ -165,35 +222,15 @@ nsGeolocationRequest::Allow()
nsresult rv = geoService->StartDevice();
if (NS_FAILED(rv)) {
// Location provider error
NotifyError(NS_GEO_ERROR_CODE_LOCATION_PROVIDER_ERROR);
return NS_OK;
}
if (!mErrorCallback)
return NS_OK; // If no one is listening for errors, fail silently.
// TODO what are the real error values here!!
nsRefPtr<nsDOMGeoPositionError> positionError = new nsDOMGeoPositionError(1, NS_LITERAL_STRING(""));
nsCOMPtr<nsIDOMGeoPositionErrorCallback> callbackProxy;
nsCOMPtr<nsIProxyObjectManager> proxyObjMgr = do_GetService("@mozilla.org/xpcomproxy;1");
proxyObjMgr->GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
NS_GET_IID(nsIDOMGeoPositionErrorCallback),
mErrorCallback,
NS_PROXY_ASYNC | NS_PROXY_ALWAYS,
getter_AddRefs(callbackProxy));
// Ensure that the proper context is on the stack (bug 452762)
nsCOMPtr<nsIJSContextStack> stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1"));
if (!stack || NS_FAILED(stack->Push(nsnull)))
return NS_OK; // silently fail
callbackProxy->HandleEvent(positionError);
// remove the stack
JSContext* cx;
stack->Pop(&cx);
return NS_OK; // silently fail
PRUint32 timeout;
if (mOptions && NS_SUCCEEDED(mOptions->GetTimeout(&timeout)) && timeout > 0) {
mTimeoutTimer = do_CreateInstance("@mozilla.org/timer;1");
mTimeoutTimer->InitWithCallback(this, timeout, nsITimer::TYPE_ONE_SHOT);
}
mAllowed = PR_TRUE;
@ -214,7 +251,7 @@ nsGeolocationRequest::MarkCleared()
}
void
nsGeolocationRequest::SendLocation(nsIDOMGeoPosition* position)
nsGeolocationRequest::SendLocation(nsIDOMGeoPosition* aPosition)
{
if (mCleared || !mAllowed)
return;
@ -232,14 +269,14 @@ nsGeolocationRequest::SendLocation(nsIDOMGeoPosition* position)
double lat, lon, alt, herror, verror, heading, velocity;
DOMTimeStamp time;
position->GetLatitude(&lat);
position->GetLongitude(&lon);
position->GetAltitude(&alt);
position->GetAccuracy(&herror);
position->GetAltitudeAccuracy(&verror);
position->GetHeading(&heading);
position->GetVelocity(&velocity);
position->GetTimestamp(&time);
aPosition->GetLatitude(&lat);
aPosition->GetLongitude(&lon);
aPosition->GetAltitude(&alt);
aPosition->GetAccuracy(&herror);
aPosition->GetAltitudeAccuracy(&verror);
aPosition->GetHeading(&heading);
aPosition->GetVelocity(&velocity);
aPosition->GetTimestamp(&time);
// Truncate ?
// lat = floor(lat*10+.5)/10;
@ -266,12 +303,14 @@ nsGeolocationRequest::SendLocation(nsIDOMGeoPosition* position)
}
else
{
mCallback->HandleEvent(position);
mCallback->HandleEvent(aPosition);
}
// remove the stack
JSContext* cx;
stack->Pop(&cx);
mHasSentData = PR_TRUE;
}
void
@ -378,7 +417,8 @@ nsGeolocationService::~nsGeolocationService()
}
NS_IMETHODIMP
nsGeolocationService::Observe(nsISupports* aSubject, const char* aTopic,
nsGeolocationService::Observe(nsISupports* aSubject,
const char* aTopic,
const PRUnichar* aData)
{
if (!strcmp("quit-application", aTopic))
@ -434,10 +474,10 @@ nsGeolocationService::SetPrompt(nsIGeolocationPrompt * aPrompt)
}
NS_IMETHODIMP
nsGeolocationService::Update(nsIDOMGeoPosition *somewhere)
nsGeolocationService::Update(nsIDOMGeoPosition *aSomewhere)
{
for (PRUint32 i = 0; i< mGeolocators.Length(); i++)
mGeolocators[i]->Update(somewhere);
mGeolocators[i]->Update(aSomewhere);
return NS_OK;
}
@ -532,6 +572,7 @@ nsGeolocationService::GetInstance()
{
if (!nsGeolocationService::gService) {
nsGeolocationService::gService = new nsGeolocationService();
NS_ASSERTION(nsGeolocationService::gService, "null nsGeolocationService.");
}
return nsGeolocationService::gService;
}
@ -545,15 +586,15 @@ nsGeolocationService::GetGeolocationService()
}
void
nsGeolocationService::AddLocator(nsGeolocation* locator)
nsGeolocationService::AddLocator(nsGeolocation* aLocator)
{
mGeolocators.AppendElement(locator);
mGeolocators.AppendElement(aLocator);
}
void
nsGeolocationService::RemoveLocator(nsGeolocation* locator)
nsGeolocationService::RemoveLocator(nsGeolocation* aLocator)
{
mGeolocators.RemoveElement(locator);
mGeolocators.RemoveElement(aLocator);
}
////////////////////////////////////////////////////
@ -569,17 +610,17 @@ NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(nsGeolocation)
NS_IMPL_RELEASE(nsGeolocation)
nsGeolocation::nsGeolocation(nsIDOMWindow* contentDom)
nsGeolocation::nsGeolocation(nsIDOMWindow* aContentDom)
: mUpdateInProgress(PR_FALSE)
{
// Remember the window
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(contentDom);
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aContentDom);
if (window)
mOwner = window->GetCurrentInnerWindow();
// Grab the uri of the document
nsCOMPtr<nsIDOMDocument> domdoc;
contentDom->GetDocument(getter_AddRefs(domdoc));
aContentDom->GetDocument(getter_AddRefs(domdoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domdoc);
if (doc)
doc->NodePrincipal()->GetURI(getter_AddRefs(mURI));
@ -597,11 +638,11 @@ void
nsGeolocation::Shutdown()
{
// Shutdown and release all callbacks
for (PRInt32 i = 0; i< mPendingCallbacks.Count(); i++)
for (PRUint32 i = 0; i< mPendingCallbacks.Length(); i++)
mPendingCallbacks[i]->Shutdown();
mPendingCallbacks.Clear();
for (PRInt32 i = 0; i< mWatchingCallbacks.Count(); i++)
for (PRUint32 i = 0; i< mWatchingCallbacks.Length(); i++)
mWatchingCallbacks[i]->Shutdown();
mWatchingCallbacks.Clear();
@ -616,13 +657,13 @@ nsGeolocation::Shutdown()
PRBool
nsGeolocation::HasActiveCallbacks()
{
return (PRBool) mWatchingCallbacks.Count();
return mWatchingCallbacks.Length() != 0;
}
void
nsGeolocation::RemoveRequest(nsGeolocationRequest* request)
nsGeolocation::RemoveRequest(nsGeolocationRequest* aRequest)
{
mPendingCallbacks.RemoveObject(request);
mPendingCallbacks.RemoveElement(aRequest);
// if it is in the mWatchingCallbacks, we can't do much
// since we passed back the position in the array to who
@ -630,11 +671,11 @@ nsGeolocation::RemoveRequest(nsGeolocationRequest* request)
// around with the ordering of the array. Instead, just
// mark the request as "cleared".
request->MarkCleared();
aRequest->MarkCleared();
}
void
nsGeolocation::Update(nsIDOMGeoPosition *somewhere)
nsGeolocation::Update(nsIDOMGeoPosition *aSomewhere)
{
// This method calls out to objects which may spin and
// event loop which may add new location objects into
@ -653,13 +694,13 @@ nsGeolocation::Update(nsIDOMGeoPosition *somewhere)
}
// notify anyone that has been waiting
for (PRInt32 i = 0; i< mPendingCallbacks.Count(); i++)
mPendingCallbacks[i]->SendLocation(somewhere);
for (PRUint32 i = 0; i< mPendingCallbacks.Length(); i++)
mPendingCallbacks[i]->SendLocation(aSomewhere);
mPendingCallbacks.Clear();
// notify everyone that is watching
for (PRInt32 i = 0; i< mWatchingCallbacks.Count(); i++)
mWatchingCallbacks[i]->SendLocation(somewhere);
for (PRUint32 i = 0; i< mWatchingCallbacks.Length(); i++)
mWatchingCallbacks[i]->SendLocation(aSomewhere);
mUpdateInProgress = PR_FALSE;
}
@ -682,37 +723,43 @@ nsGeolocation::GetCurrentPosition(nsIDOMGeoPositionCallback *callback,
if (prompt == nsnull)
return NS_ERROR_NOT_AVAILABLE;
nsRefPtr<nsGeolocationRequest> request = new nsGeolocationRequest(this, callback, errorCallback);
nsRefPtr<nsGeolocationRequest> request = new nsGeolocationRequest(this, callback, errorCallback, options);
if (!request)
return NS_ERROR_OUT_OF_MEMORY;
prompt->Prompt(request);
// What if you have a location provider that only sends a location once, then stops.? fix.
mPendingCallbacks.AppendObject(request);
mPendingCallbacks.AppendElement(request);
return NS_OK;
}
NS_IMETHODIMP
nsGeolocation::WatchPosition(nsIDOMGeoPositionCallback *callback,
nsIDOMGeoPositionErrorCallback *errorCallback,
nsIDOMGeoPositionOptions *options,
nsGeolocation::WatchPosition(nsIDOMGeoPositionCallback *aCallback,
nsIDOMGeoPositionErrorCallback *aErrorCallback,
nsIDOMGeoPositionOptions *aOptions,
PRUint16 *_retval NS_OUTPARAM)
{
nsIGeolocationPrompt* prompt = mService->GetPrompt();
if (prompt == nsnull)
return NS_ERROR_NOT_AVAILABLE;
nsRefPtr<nsGeolocationRequest> request = new nsGeolocationRequest(this, callback, errorCallback);
nsRefPtr<nsGeolocationRequest> request = new nsGeolocationRequest(this, aCallback, aErrorCallback, aOptions);
if (!request)
return NS_ERROR_OUT_OF_MEMORY;
prompt->Prompt(request);
// need to hand back an index/reference.
mWatchingCallbacks.AppendObject(request);
*_retval = mWatchingCallbacks.Count() - 1;
mWatchingCallbacks.AppendElement(request);
*_retval = mWatchingCallbacks.Length() - 1;
return NS_OK;
}
NS_IMETHODIMP
nsGeolocation::ClearWatch(PRUint16 watchId)
nsGeolocation::ClearWatch(PRUint16 aWatchId)
{
mWatchingCallbacks[watchId]->MarkCleared();
mWatchingCallbacks[aWatchId]->MarkCleared();
return NS_OK;
}

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

@ -55,18 +55,25 @@
#include "nsIGeolocationProvider.h"
#define NS_GEO_ERROR_CODE_PERMISSION_ERROR 1
#define NS_GEO_ERROR_CODE_LOCATION_PROVIDER_ERROR 2
#define NS_GEO_ERROR_CODE_POSITION_NOT_FOUND 3
#define NS_GEO_ERROR_CODE_TIMEOUT 4
class nsGeolocationService;
class nsGeolocation;
class nsGeolocationRequest : public nsIGeolocationRequest
class nsGeolocationRequest : public nsIGeolocationRequest, public nsITimerCallback
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIGEOLOCATIONREQUEST
NS_DECL_NSITIMERCALLBACK
nsGeolocationRequest(nsGeolocation* locator,
nsIDOMGeoPositionCallback* callback,
nsIDOMGeoPositionErrorCallback* errorCallback);
nsIDOMGeoPositionErrorCallback* errorCallback,
nsIDOMGeoPositionOptions* options);
void Shutdown();
void SendLocation(nsIDOMGeoPosition* location);
@ -76,14 +83,20 @@ class nsGeolocationRequest : public nsIGeolocationRequest
~nsGeolocationRequest();
private:
PRBool mAllowed;
PRBool mCleared;
PRBool mFuzzLocation;
void NotifyError(PRInt16 errorCode);
PRPackedBool mAllowed;
PRPackedBool mCleared;
PRPackedBool mFuzzLocation;
PRPackedBool mHasSentData;
nsCOMPtr<nsITimer> mTimeoutTimer;
nsCOMPtr<nsIDOMGeoPositionCallback> mCallback;
nsCOMPtr<nsIDOMGeoPositionErrorCallback> mErrorCallback;
nsCOMPtr<nsIDOMGeoPositionOptions> mOptions;
nsGeolocation* mLocator; // The locator exists longer than this object.
nsGeolocation* mLocator; // The locator exists alonger than this object.
};
/**
@ -212,8 +225,8 @@ private:
// |mWatchingCallbacks| holds objects until the object is explictly removed or
// there is a page change.
nsCOMArray<nsGeolocationRequest> mPendingCallbacks;
nsCOMArray<nsGeolocationRequest> mWatchingCallbacks;
nsTArray<nsRefPtr<nsGeolocationRequest> > mPendingCallbacks;
nsTArray<nsRefPtr<nsGeolocationRequest> > mWatchingCallbacks;
PRBool mUpdateInProgress;

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

@ -53,6 +53,7 @@ _TEST_FILES = \
test_cancelWatch.html \
test_clearWatch.html \
test_geoPrompt.html \
test_timeoutWatch.html \
prompt_common.js \
geolocation_common.js \
geolocation.html \

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

@ -3,15 +3,15 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const Ci = Components.interfaces;
const Cc = Components.classes;
function GeolocationObject() {};
GeolocationObject.prototype = {
function GeopositionObject() {};
GeopositionObject.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeolocation, Ci.nsIClassInfo, Ci.nsIGeolocationPrompt]),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPosition, Ci.nsIClassInfo]),
// Class Info is required to be able to pass objects back into the DOM.
getInterfaces: function(countRef) {
var interfaces = [Ci.nsIDOMGeolocation, Ci.nsIClassInfo, Ci.nsISupports, Ci.nsIGeolocationPrompt];
var interfaces = [Ci.nsIDOMGeoPosition, Ci.nsIClassInfo, Ci.nsISupports];
countRef.value = interfaces.length;
return interfaces;
},
@ -25,11 +25,11 @@ GeolocationObject.prototype = {
latitude: 1,
longitude: 1,
altitude: 1,
horizontalAccuracy: 1,
verticalAccuracy: 1,
accuracy: 1,
altitudeAccuracy: 1,
heading: 1,
velocity: 1,
timestamp: 1,
prompt: function(uri) {return 1;},
};
function dump(msg) {
@ -64,7 +64,7 @@ MyLocation.prototype = {
Ci.nsITimer.TYPE_REPEATING_SLACK);
},
currentLocation: new GeolocationObject(),
currentLocation: new GeopositionObject(),
shutdown: function() {
dump("shutdown");
if(this.timer)

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

@ -0,0 +1,65 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=455327
-->
<head>
<title>Test for timeout option </title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="prompt_common.js"></script>
<script type="text/javascript" src="geolocation_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=455327">Mozilla Bug </a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug **/
SimpleTest.waitForExplicitFinish();
promptOption = ACCEPT;
attachPrompt();
ok(navigator.geolocation, "Ensure that the geolocation object is present");
function successCallback(pos){
ok(0, "success should have never been called.");
removePrompt();
SimpleTest.finish();
}
function errorCallback(err) {
removePrompt();
if (err.code == 2) {
// nothing is hooked up to test against.
SimpleTest.finish();
return;
}
ok(err.code == 4, "ensure error is a timeout.");
removePrompt();
SimpleTest.finish();
}
var options = {
enableHighAccuracy: true,
timeout: 100
};
navigator.geolocation.watchPosition(successCallback,
errorCallback,
options);
</script>
</pre>
</body>
</html>

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

@ -575,7 +575,7 @@ FindFullNameForFace(const ENUMLOGFONTEXW *lpelfe,
// callback called for each family name, based on the assumption that the
// first part of the full name is the family name
static PLDHashOperator PR_CALLBACK
static PLDHashOperator
FindFullName(nsStringHashKey::KeyType aKey,
nsRefPtr<FontFamily>& aFontFamily,
void* userArg)

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

@ -2708,7 +2708,7 @@ SetChildFullZoom(nsIMarkupDocumentViewer* aChild, void* aClosure)
aChild->SetFullZoom(ZoomInfo->mZoom);
}
PR_STATIC_CALLBACK(PRBool)
static PRBool
SetExtResourceTextZoom(nsIDocument* aDocument, void* aClosure)
{
// Would it be better to enumerate external resource viewers instead?
@ -2724,7 +2724,7 @@ SetExtResourceTextZoom(nsIDocument* aDocument, void* aClosure)
return PR_TRUE;
}
PR_STATIC_CALLBACK(PRBool)
static PRBool
SetExtResourceFullZoom(nsIDocument* aDocument, void* aClosure)
{
// Would it be better to enumerate external resource viewers instead?

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

@ -63,7 +63,6 @@ _TEST_FILES = test_bug288789.html \
test_bug416168.html \
test_bug421436.html \
test_bug448860.html \
test_bug460532.html \
test_character_movement.html \
test_word_movement.html \
test_backspace_delete.html \

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

@ -398,7 +398,7 @@ nsSVGEffects::GetFilterProperty(nsIFrame *aFrame)
return static_cast<nsSVGFilterProperty *>(aFrame->GetProperty(nsGkAtoms::filter));
}
static PLDHashOperator PR_CALLBACK
static PLDHashOperator
GatherEnumerator(nsVoidPtrHashKey* aEntry, void* aArg)
{
nsTArray<nsSVGRenderingObserver*>* array =

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

@ -661,7 +661,7 @@ nsCookieService::Observe(nsISupports *aSubject,
if (mPrivateHostTable.IsInitialized() || mPrivateHostTable.Init()) {
mHostTable = &mPrivateHostTable;
mCookieCount = mHostTable->Count();
NotifyChanged(nsnull, NS_LITERAL_STRING("cleared").get());
NotifyChanged(nsnull, NS_LITERAL_STRING("reload").get());
}
// close the connection to the on-disk DB
mStmtInsert = nsnull;

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

@ -19,6 +19,7 @@
*
* Contributor(s):
* Justin Dolske <dolske@mozilla.com> (original author)
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -122,6 +123,31 @@ LoginManager.prototype = {
return this.__storage;
},
// Private Browsing Service
// If the service is not available, null will be returned.
__privateBrowsingService : undefined,
get _privateBrowsingService() {
if (this.__privateBrowsingService == undefined) {
if ("@mozilla.org/privatebrowsing;1" in Cc)
this.__privateBrowsingService = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
else
this.__privateBrowsingService = null;
}
return this.__privateBrowsingService;
},
// Whether we are in private browsing mode
get _inPrivateBrowsing() {
var pbSvc = this._privateBrowsingService;
if (pbSvc)
return pbSvc.privateBrowsingEnabled;
else
return false;
},
_prefBranch : null, // Preferences service
_nsLoginInfo : null, // Constructor for nsILoginInfo implementation
@ -764,6 +790,13 @@ LoginManager.prototype = {
return prompterSvc;
}
if (this._inPrivateBrowsing) {
// We won't do anything in private browsing mode anyway,
// so there's no need to perform further checks.
this.log("(form submission ignored in private browsing mode)");
return;
}
var doc = form.ownerDocument;
var win = doc.defaultView;
@ -953,7 +986,8 @@ LoginManager.prototype = {
this.log("fillDocument processing " + forms.length +
" forms on " + doc.documentURI);
var autofillForm = this._prefBranch.getBoolPref("autofillForms");
var autofillForm = !this._inPrivateBrowsing &&
this._prefBranch.getBoolPref("autofillForms");
var previousActionOrigin = null;
var foundLogins = null;

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

@ -166,6 +166,19 @@ LoginManagerPrompter.prototype = {
},
// Whether we are in private browsing mode
get _inPrivateBrowsing() {
// The Private Browsing service might not be available.
try {
var pbs = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
return pbs.privateBrowsingEnabled;
} catch (e) {
return false;
}
},
/*
* log
*
@ -227,7 +240,11 @@ LoginManagerPrompter.prototype = {
// If hostname is null, we can't save this login.
if (hostname) {
var canRememberLogin = (aSavePassword ==
var canRememberLogin;
if (this._inPrivateBrowsing)
canRememberLogin = false;
else
canRememberLogin = (aSavePassword ==
Ci.nsIAuthPrompt.SAVE_PASSWORD_PERMANENTLY) &&
this._pwmgr.getLoginSavingEnabled(hostname);
@ -323,7 +340,7 @@ LoginManagerPrompter.prototype = {
var [hostname, realm, username] = this._getRealmInfo(aPasswordRealm);
// If hostname is null, we can't save this login.
if (hostname) {
if (hostname && !this._inPrivateBrowsing) {
var canRememberLogin = (aSavePassword ==
Ci.nsIAuthPrompt.SAVE_PASSWORD_PERMANENTLY) &&
this._pwmgr.getLoginSavingEnabled(hostname);
@ -448,6 +465,8 @@ LoginManagerPrompter.prototype = {
}
var canRememberLogin = this._pwmgr.getLoginSavingEnabled(hostname);
if (this._inPrivateBrowsing)
canRememberLogin = false;
// if checkboxLabel is null, the checkbox won't be shown at all.
if (canRememberLogin && !notifyBox)

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

@ -63,6 +63,7 @@ MOCHI_TESTS = \
test_basic_form_pwonly.html \
test_bug_227640.html \
test_bug_242956.html \
test_privbrowsing.html \
test_bug_360493_1.html \
test_bug_360493_2.html \
test_bug_391514.html \
@ -80,6 +81,10 @@ MOCHI_CONTENT = \
notification_common.js \
authenticate.sjs \
formsubmit.sjs \
subtst_privbrowsing_1.html \
subtst_privbrowsing_2.html \
subtst_privbrowsing_3.html \
subtst_privbrowsing_4.html \
subtst_notifications_1.html \
subtst_notifications_2.html \
subtst_notifications_3.html \

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

@ -104,3 +104,26 @@ function checkUnmodifiedForm(formNum) {
ele.name + " in form " + formNum);
}
}
// Mochitest gives us a sendKey(), but it's targeted to a specific element.
// This basically sends an untargeted key event, to whatever's focused.
function doKey(aKey, modifier) {
// Seems we need to enable this again, or sendKeyEvent() complaints.
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var keyName = "DOM_VK_" + aKey.toUpperCase();
var key = Components.interfaces.nsIDOMKeyEvent[keyName];
// undefined --> null
if (!modifier)
modifier = null;
// Window utils for sending fake sey events.
var wutils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
wutils.sendKeyEvent("keydown", key, 0, modifier);
wutils.sendKeyEvent("keypress", key, 0, modifier);
wutils.sendKeyEvent("keyup", key, 0, modifier);
}

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

@ -0,0 +1,31 @@
<html>
<head>
<title>Subtest for Login Manager notifications (private browsing)</title>
</head>
<body>
<h2>Subtest 1</h2>
<!--
Make sure that the password-save notification appears outside of
the private mode, but not inside it.
-->
<form id="form" action="formsubmit.sjs">
<input id="user" name="user" type="text">
<input id="pass" name="pass" type="password">
<button type='submit'>Submit</button>
</form>
<script>
function submitForm() {
userField.value = "notifyu1";
passField.value = "notifyp1";
form.submit();
}
window.onload = submitForm;
var form = document.getElementById("form");
var userField = document.getElementById("user");
var passField = document.getElementById("pass");
</script>
</body>
</html>

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

@ -0,0 +1,31 @@
<html>
<head>
<title>Subtest for Login Manager notifications (private browsing)</title>
</head>
<body>
<h2>Subtest 2</h2>
<!--
Make sure that the password-change notification appears outside of
the private mode, but not inside it.
-->
<form id="form" action="formsubmit.sjs">
<input id="pass" name="pass" type="password">
<input id="newpass" name="newpass" type="password">
<button type='submit'>Submit</button>
</form>
<script>
function submitForm() {
passField.value = "notifyp1";
passField2.value = "notifyp2";
form.submit();
}
window.onload = submitForm;
var form = document.getElementById("form");
var passField = document.getElementById("pass");
var passField2 = document.getElementById("newpass");
</script>
</body>
</html>

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

@ -0,0 +1,27 @@
<html>
<head>
<title>Subtest for Login Manager notifications (private browsing)</title>
</head>
<body>
<h2>Subtest 3</h2>
<!--
Make sure that the user/pass fields are auto-filled outside of
the private mode, but not inside it.
-->
<form id="form" action="formsubmit.sjs">
<input id="user" name="user" type="text">
<input id="pass" name="pass" type="password">
<button type='submit'>Submit</button>
</form>
<script>
function submitForm() {
form.submit();
}
window.onload = submitForm;
var form = document.getElementById("form");
</script>
</body>
</html>

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

@ -0,0 +1,34 @@
<html>
<head>
<title>Subtest for Login Manager notifications (private browsing)</title>
<script type="text/javascript" src="pwmgr_common.js"></script>
</head>
<body>
<h2>Subtest 4</h2>
<!--
Make sure that the user/pass fields have manual filling enabled
in private mode.
-->
<form id="form" action="formsubmit.sjs">
<input id="user" name="user" type="text">
<input id="pass" name="pass" type="password">
<button type='submit'>Submit</button>
</form>
<script>
function submitForm() {
userField.focus();
doKey("down");
doKey("down");
doKey("return");
setTimeout(function(){ form.submit(); }, 100);
}
window.onload = submitForm;
var form = document.getElementById("form");
var userField = document.getElementById("user");
</script>
</body>
</html>

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

@ -73,10 +73,6 @@ var uname = $_(1, "uname");
var pword = $_(1, "pword");
const shiftModifier = Components.interfaces.nsIDOMNSEvent.SHIFT_MASK;
// Window utils for sending fake sey events.
var wutils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
// Get the pwmgr service
var pwmgr = Components.classes["@mozilla.org/login-manager;1"]
.getService(Components.interfaces.nsILoginManager);
@ -147,25 +143,6 @@ function checkACForm(expectedUsername, expectedPassword) {
}
// Mochitest gives us a sendKey(), but it's targeted to a specific element.
// This basically sends an untargeted key event, to whatever's focused.
function doKey(aKey, modifier) {
// Seems we need to enable this again, or sendKeyEvent() complaints.
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var keyName = "DOM_VK_" + aKey.toUpperCase();
var key = Components.interfaces.nsIDOMKeyEvent[keyName];
// undefined --> null
if (!modifier)
modifier = null;
wutils.sendKeyEvent("keydown", key, 0, modifier);
wutils.sendKeyEvent("keypress", key, 0, modifier);
wutils.sendKeyEvent("keyup", key, 0, modifier);
}
/*
* Main section of test...

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

@ -0,0 +1,324 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=248970
-->
<head>
<title>Test for Bug 248970</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="notification_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=248970">Mozilla Bug 248970</a>
<p id="display"></p>
<iframe id="iframe"></iframe>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 248970 **/
// based on test_notifications.html
var testpath = document.location.pathname + "/../";
var prefix = "http://test2.example.com" + testpath;
var subtests = [
"subtst_privbrowsing_1.html", // 1
"subtst_privbrowsing_1.html", // 2
"subtst_privbrowsing_1.html", // 3
"subtst_privbrowsing_2.html", // 4
"subtst_privbrowsing_2.html", // 5
"subtst_privbrowsing_2.html", // 6
"subtst_privbrowsing_3.html", // 7
"subtst_privbrowsing_3.html", // 8
"subtst_privbrowsing_4.html", // 9
"subtst_privbrowsing_3.html" // 10
];
var ignoreLoad = false;
function handleLoad(aEvent) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
// ignore every other load event ... We get one for loading the subtest (which
// we want to ignore), and another when the subtest's form submits itself
// (which we want to handle, to start the next test).
ignoreLoad = !ignoreLoad;
if (ignoreLoad) {
ok(true, "Ignoring load of subtest #" + testNum);
return;
}
ok(true, "Processing submission of subtest #" + testNum);
checkTest();
// Remove any notification bar that might be lingering from a failed test.
notifyBox.removeAllNotifications(true);
if (testNum <= subtests.length) {
loadNextTest();
} else {
ok(true, "private browsing notification tests finished.");
SimpleTest.finish();
}
}
var testNum = 0;
function loadNextTest() {
// run the initialization code for each test
switch (++ testNum) {
case 1:
ok(!pb.privateBrowsingEnabled, "Test #" + testNum + " should be run outside of private mode");
break;
case 2:
pb.privateBrowsingEnabled = true;
ok(pb.privateBrowsingEnabled, "Test #" + testNum + " should be run inside of private mode");
break;
case 3:
pb.privateBrowsingEnabled = false;
ok(!pb.privateBrowsingEnabled, "Test #" + testNum + " should be run outside of private mode");
break;
case 4:
pwmgr.addLogin(login);
ok(!pb.privateBrowsingEnabled, "Test #" + testNum + " should be run outside of private mode");
break;
case 5:
pb.privateBrowsingEnabled = true;
ok(pb.privateBrowsingEnabled, "Test #" + testNum + " should be run inside of private mode");
break;
case 6:
pb.privateBrowsingEnabled = false;
ok(!pb.privateBrowsingEnabled, "Test #" + testNum + " should be run outside of private mode");
break;
case 7:
pwmgr.addLogin(login);
ok(!pb.privateBrowsingEnabled, "Test #" + testNum + " should be run outside of private mode");
break;
case 8:
pb.privateBrowsingEnabled = true;
ok(pb.privateBrowsingEnabled, "Test #" + testNum + " should be run inside of private mode");
break;
case 9:
ok(pb.privateBrowsingEnabled, "Test #" + testNum + " should be run inside of private mode");
break;
case 10:
pb.privateBrowsingEnabled = false;
ok(!pb.privateBrowsingEnabled, "Test #" + testNum + " should be run outside of private mode");
break;
default:
ok(false, "Unexpected call to loadNextTest for test #" + testNum);
}
ok(true, "Starting test #" + testNum);
iframe.src = prefix + subtests[testNum-1];
}
function checkTest() {
var bar;
switch (testNum) {
case 1:
// run outside of private mode, notification bar should appear
bar = getNotificationBar(notifyBox, "password-save");
ok(bar, "got notification bar");
notifyBox.removeAllNotifications(true);
break;
case 2:
// run inside of private mode, notification bar should not appear
bar = getNotificationBar(notifyBox, "password-save");
ok(!bar, "checking for no notification bar");
notifyBox.removeAllNotifications(true);
break;
case 3:
// run outside of private mode, notification bar should appear
bar = getNotificationBar(notifyBox, "password-save");
ok(bar, "got notification bar");
notifyBox.removeAllNotifications(true);
break;
case 4:
// run outside of private mode, notification bar should appear
bar = getNotificationBar(notifyBox, "password-change");
ok(bar, "got notification bar");
notifyBox.removeAllNotifications(true);
break;
case 5:
// run inside of private mode, notification bar should not appear
bar = getNotificationBar(notifyBox, "password-change");
ok(!bar, "checking for no notification bar");
notifyBox.removeAllNotifications(true);
break;
case 6:
// run outside of private mode, notification bar should appear
bar = getNotificationBar(notifyBox, "password-change");
ok(bar, "got notification bar");
notifyBox.removeAllNotifications(true);
pwmgr.removeLogin(login);
break;
case 7:
// verify that the user/pass pair was autofilled
var gotUser = iframe.contentDocument.getElementById("user").textContent;
var gotPass = iframe.contentDocument.getElementById("pass").textContent;
is(gotUser, "notifyu1", "Checking submitted username");
is(gotPass, "notifyp1", "Checking submitted password");
break;
case 8:
// verify that the user/pass pair was not autofilled
var gotUser = iframe.contentDocument.getElementById("user").textContent;
var gotPass = iframe.contentDocument.getElementById("pass").textContent;
is(gotUser, "", "Checking submitted username");
is(gotPass, "", "Checking submitted password");
break;
case 9:
// verify that the user/pass pair was available for autocomplete
var gotUser = iframe.contentDocument.getElementById("user").textContent;
var gotPass = iframe.contentDocument.getElementById("pass").textContent;
is(gotUser, "notifyu1", "Checking submitted username");
is(gotPass, "notifyp1", "Checking submitted password");
break;
case 10:
// verify that the user/pass pair was autofilled
var gotUser = iframe.contentDocument.getElementById("user").textContent;
var gotPass = iframe.contentDocument.getElementById("pass").textContent;
is(gotUser, "notifyu1", "Checking submitted username");
is(gotPass, "notifyp1", "Checking submitted password");
pwmgr.removeLogin(login);
break;
default:
ok(false, "Unexpected call to checkTest for test #" + testNum);
}
}
var _PBSvc = null;
function get_PBSvc() {
if (_PBSvc)
return _PBSvc;
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
try {
_PBSvc = Components.classes["@mozilla.org/privatebrowsing;1"].
getService(Components.interfaces.nsIPrivateBrowsingService);
if (_PBSvc) {
var observer = {
QueryInterface: function (iid) {
const interfaces = [Components.interfaces.nsIObserver,
Components.interfaces.nsISupports];
if (!interfaces.some(function(v) iid.equals(v)))
throw Components.results.NS_ERROR_NO_INTERFACE;
return this;
},
observe: function (subject, topic, data) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
subject.QueryInterface(Components.interfaces.nsISupportsPRUint32);
subject.data = 0;
}
};
var os = Components.classes["@mozilla.org/observer-service;1"].
getService(Components.interfaces.nsIObserverService);
os.addObserver(observer, "private-browsing-enter", false);
}
return _PBSvc;
} catch (e) {}
return null;
}
var ignoreLoad = false;
function handleLoad(aEvent) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
// ignore every other load event ... We get one for loading the subtest (which
// we want to ignore), and another when the subtest's form submits itself
// (which we want to handle, to start the next test).
ignoreLoad = !ignoreLoad;
if (ignoreLoad) {
ok(true, "Ignoring load of subtest #" + testNum);
return;
}
ok(true, "Processing submission of subtest #" + testNum);
checkTest();
// Remove any notification bar that might be lingering from a failed test.
notifyBox.removeAllNotifications(true);
if (testNum < subtests.length) {
loadNextTest();
} else {
ok(true, "notification tests finished.");
SimpleTest.finish();
}
}
var pb = get_PBSvc();
if (!pb) { // Private Browsing might not be available
ok(true, "Private browsing service is not available");
SimpleTest.finish();
} else {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
const Ci = Components.interfaces;
const Cc = Components.classes;
ok(Ci != null, "Access Ci");
ok(Cc != null, "Access Cc");
var pwmgr = Cc["@mozilla.org/login-manager;1"].
getService(Ci.nsILoginManager);
ok(pwmgr != null, "Access pwmgr");
// We need to make sure no logins have been stored by previous tests
// for forms in |url|, otherwise the change password notification
// would turn into a prompt, and the test will fail.
var url = "http://test2.example.com";
is(pwmgr.countLogins(url, "", null), 0, "No logins should be stored for " + url);
var nsLoginInfo = new Components.Constructor("@mozilla.org/login-manager/loginInfo;1",
Ci.nsILoginInfo, "init");
var login = new nsLoginInfo(url, url, null, "notifyu1", "notifyp1", "user", "pass");
var iframe = document.getElementById("iframe");
iframe.onload = handleLoad;
// The notification box (not *bar*) is a constant, per-tab container. So, we
// only need to fetch it once.
var notifyBox = getNotificationBox(window.top);
ok(notifyBox, "Got notification box");
// Remove any notification bars that might be left over from other tests.
notifyBox.removeAllNotifications(true);
SimpleTest.waitForExplicitFinish();
loadNextTest();
}
</script>
</pre>
</body>
</html>

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

@ -271,6 +271,8 @@ MOZ_PKG_REMOVALS_GEN = removed-files
$(MOZ_PKG_REMOVALS_GEN): $(MOZ_PKG_REMOVALS) Makefile Makefile.in
$(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py -Fsubstitution $(DEFINES) $(ACDEFINES) $(MOZ_PKG_REMOVALS) > $(MOZ_PKG_REMOVALS_GEN)
GARBAGE += $(MOZ_PKG_REMOVALS_GEN)
endif
GARBAGE += $(DIST)/$(PACKAGE) $(PACKAGE)

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

@ -118,7 +118,9 @@ void LaunchChild(int argc, char **argv);
#endif
#ifndef MAXPATHLEN
# ifdef MAX_PATH
# ifdef PATH_MAX
# define MAXPATHLEN PATH_MAX
# elif defined(_MAX_PATH)
# define MAXPATHLEN MAX_PATH
# elif defined(_MAX_PATH)
# define MAXPATHLEN _MAX_PATH

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

@ -40,10 +40,14 @@
#ifdef XP_WIN
#include <windows.h>
#else
#include <limits.h>
#endif
#ifndef MAXPATHLEN
#ifdef _MAX_PATH
#ifdef PATH_MAX
#define MAXPATHLEN PATH_MAX
#elif defined(_MAX_PATH)
#define MAXPATHLEN _MAX_PATH
#elif defined(CCHMAXPATH)
#define MAXPATHLEN CCHMAXPATH

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

@ -292,6 +292,7 @@ public:
NS_IMETHOD Show(PRBool aState);
NS_IMETHOD IsVisible(PRBool& outState);
NS_IMETHOD SetParent(nsIWidget* aNewParent);
virtual nsIWidget* GetParent(void);
NS_IMETHOD ModalEventFilter(PRBool aRealEvent, void *aEvent,

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

@ -972,8 +972,38 @@ NS_IMETHODIMP nsChildView::Show(PRBool aState)
}
nsIWidget*
nsChildView::GetParent(void)
//-------------------------------------------------------------------------
//
// Reset the parent of this widget
//
//-------------------------------------------------------------------------
NS_IMETHODIMP nsChildView::SetParent(nsIWidget* aNewParent)
{
NS_ENSURE_ARG(aNewParent);
// make sure we stay alive
nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
// remove us from our existing parent
if (mParentWidget)
mParentWidget->RemoveChild(this);
[mView removeFromSuperview]; // we hold a ref to mView, so this is OK
// add us to the new parent
aNewParent->AddChild(this);
mParentWidget = aNewParent;
mParentView = (NSView*)aNewParent->GetNativeData(NS_NATIVE_WIDGET);
[mParentView addSubview:mView];
return NS_OK;
}
//-------------------------------------------------------------------------
//
// Get this widget's parent
//
//-------------------------------------------------------------------------
nsIWidget* nsChildView::GetParent(void)
{
return mParentWidget;
}

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

@ -231,6 +231,7 @@ NS_GetFrozenFunctions(XPCOMFunctions *entryPoints, const char* libraryPath);
#define XUL_DLL "libxul"MOZ_DLL_SUFFIX
#else // Unix
#include <limits.h> // for PATH_MAX
#define XPCOM_DLL "libxpcom"MOZ_DLL_SUFFIX

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

@ -289,6 +289,23 @@ RegisterGenericFactory(nsIComponentRegistrar* registrar,
static PRBool CheckUpdateFile()
{
nsresult rv;
nsCOMPtr<nsIFile> compregFile;
rv = nsDirectoryService::gService->Get(NS_XPCOM_COMPONENT_REGISTRY_FILE,
NS_GET_IID(nsIFile),
getter_AddRefs(compregFile));
if (NS_FAILED(rv)) {
NS_WARNING("Getting NS_XPCOM_COMPONENT_REGISTRY_FILE failed");
return PR_FALSE;
}
PRBool exists;
if (NS_FAILED(compregFile->Exists(&exists)) || !exists)
return PR_TRUE;
PRInt64 compregModTime;
compregFile->GetLastModifiedTime(&compregModTime);
nsCOMPtr<nsIFile> file;
rv = nsDirectoryService::gService->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
NS_GET_IID(nsIFile),
@ -301,28 +318,39 @@ static PRBool CheckUpdateFile()
file->AppendNative(nsDependentCString(".autoreg"));
PRBool exists;
file->Exists(&exists);
if (!exists)
return PR_FALSE;
goto next;
nsCOMPtr<nsIFile> compregFile;
rv = nsDirectoryService::gService->Get(NS_XPCOM_COMPONENT_REGISTRY_FILE,
PRInt64 autoregModTime;
file->GetLastModifiedTime(&autoregModTime);
if (LL_CMP(autoregModTime, >, compregModTime))
return PR_TRUE;
next:
nsCOMPtr<nsIFile> greFile;
rv = nsDirectoryService::gService->Get(NS_GRE_DIR,
NS_GET_IID(nsIFile),
getter_AddRefs(compregFile));
getter_AddRefs(greFile));
if (NS_FAILED(rv)) {
NS_WARNING("Getting NS_XPCOM_COMPONENT_REGISTRY_FILE failed");
NS_WARNING("Getting NS_GRE_DIR failed");
return PR_FALSE;
}
if (NS_FAILED(compregFile->Exists(&exists)) || !exists)
return PR_TRUE;
greFile->AppendNative(nsDependentCString(".autoreg"));
PRInt64 compregModTime, autoregModTime;
compregFile->GetLastModifiedTime(&compregModTime);
file->GetLastModifiedTime(&autoregModTime);
PRBool equals;
rv = greFile->Equals(file, &equals);
if (NS_SUCCEEDED(rv) && equals)
return PR_FALSE;
greFile->Exists(&exists);
if (!exists)
return PR_FALSE;
greFile->GetLastModifiedTime(&autoregModTime);
return LL_CMP(autoregModTime, >, compregModTime);
}

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

@ -276,11 +276,7 @@ ifeq ($(OS_ARCH),Linux)
ifneq (,$(findstring mips, $(OS_TEST)))
CPPSRCS := xptcinvoke_mips.cpp xptcstubs_mips.cpp
ASFILES := xptcinvoke_asm_mips.s xptcstubs_asm_mips.s
#xptcstubs_mips.cpp
# xptcstubs_asm_mips.s
ifdef GNU_CC
ASFLAGS += $(INCLUDES) -x assembler-with-cpp -D__GNUC__
endif
ASFLAGS += -I$(PUBLIC) -x assembler-with-cpp
endif
endif
@ -466,10 +462,7 @@ LOCAL_INCLUDES += \
ifeq ($(OS_ARCH),Linux)
ifneq (,$(findstring mips, $(OS_TEST)))
xptcstubs_asm_mips.o: xptcstubs_asm_mips.s.m4 $(PUBLIC)/xptcstubsdef.inc
m4 $(INCLUDES) $< > ./xptcstubs_asm_mips.s && \
$(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) ./xptcstubs_asm_mips.s
$(RM) -f ./xptcstubs_asm_mips.s
xptcstubs_asm_mips.o: $(PUBLIC)/xptcstubsdef.inc
endif
endif

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

@ -24,6 +24,7 @@
* Contributor(s):
* Brendan Eich <brendan@mozilla.org>
* Stuart Parmenter <pavlov@netscape.com>
* Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
*
* 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
@ -44,139 +45,123 @@
#include <sys/regdef.h>
#include <sys/asm.h>
# NARGSAVE is the argument space in the callers frame, including extra
# 'shadowed' space for the argument registers. The minimum of 4
# argument slots is sometimes predefined in the header files.
#ifndef NARGSAVE
#define NARGSAVE 4
#endif
#define LOCALSZ 3 /* gp, fp, ra */
#define FRAMESZ ((((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK)
#define RAOFF (FRAMESZ - (1*SZREG))
#define FPOFF (FRAMESZ - (2*SZREG))
#define GPOFF (FRAMESZ - (3*SZREG))
#define A0OFF (FRAMESZ + (0*SZREG))
#define A1OFF (FRAMESZ + (1*SZREG))
#define A2OFF (FRAMESZ + (2*SZREG))
#define A3OFF (FRAMESZ + (3*SZREG))
.text
.globl invoke_count_words
.globl invoke_copy_to_stack
# We need a variable number of words allocated from the stack for copies of
# the params, and this space must come between the high frame (where ra, gp,
# and s0 are saved) and the low frame (where a0-a3 are saved by the callee
# functions we invoke).
LOCALSZ=4 # s0, s1, ra, gp
NARGSAVE=4 # a0, a1, a2, a3
HIFRAMESZ=(LOCALSZ*SZREG)
LOFRAMESZ=(NARGSAVE*SZREG)
FRAMESZ=(HIFRAMESZ+LOFRAMESZ+ALSZ)&ALMASK
# XXX these 2*SZREG, etc. are very magic -- we *know* that ALSZ&ALMASK cause
# FRAMESZ to be 0 mod 8, in this case to be 16 and not 12.
RAOFF=FRAMESZ - (2*SZREG)
GPOFF=FRAMESZ - (3*SZREG)
S0OFF=FRAMESZ - (4*SZREG)
S1OFF=FRAMESZ - (5*SZREG)
# These are not magic -- they are just our argsave slots in the caller frame.
A0OFF=FRAMESZ
A1OFF=FRAMESZ + (1*SZREG)
A2OFF=FRAMESZ + (2*SZREG)
A3OFF=FRAMESZ + (3*SZREG)
#
# _XPTC_InvokeByIndex(that, methodIndex, paramCount, params)
# _NS_InvokeByIndex_P(that, methodIndex, paramCount, params)
# a0 a1 a2 a3
NESTED(_XPTC_InvokeByIndex, FRAMESZ, ra)
.set noreorder
.cpload t9
.set reorder
.globl _NS_InvokeByIndex_P
.align 2
.type _NS_InvokeByIndex_P,@function
.ent _NS_InvokeByIndex_P,0
.frame fp, FRAMESZ, ra
_NS_InvokeByIndex_P:
SETUP_GP
subu sp, FRAMESZ
# specify the save register mask -- XXX do we want the a0-a3 here, given
# our "split" frame where the args are saved below a dynamicly allocated
# region under the high frame?
#
# 10010000000000010000000011110000
.mask 0x900100F0, -((NARGSAVE+LOCALSZ)*SZREG)
# specify the save register mask for gp, fp, ra, a3 - a0
.mask 0xD00000F0, RAOFF-FRAMESZ
# thou shalt not use .cprestore if yer frame has variable size...
# .cprestore GPOFF
sw ra, RAOFF(sp)
sw fp, FPOFF(sp)
REG_S ra, RAOFF(sp)
# we can't use .cprestore in a variable stack frame
sw gp, GPOFF(sp)
# this happens automatically with .cprestore, but we cannot use that op...
REG_S gp, GPOFF(sp)
REG_S s0, S0OFF(sp)
REG_S s1, S1OFF(sp)
sw a0, A0OFF(sp)
sw a1, A1OFF(sp)
sw a2, A2OFF(sp)
sw a3, A3OFF(sp)
REG_S a0, A0OFF(sp)
REG_S a1, A1OFF(sp)
REG_S a2, A2OFF(sp)
REG_S a3, A3OFF(sp)
# save bottom of fixed frame
move fp, sp
# invoke_count_words(paramCount, params)
# extern "C" uint32
# invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s);
la t9, invoke_count_words
move a0, a2
move a1, a3
jalr t9
lw gp, GPOFF(fp)
jal invoke_count_words
lw gp, GPOFF(sp)
# allocate variable stack, with a size of:
# wordsize (of 4 bytes) * result (already aligned to dword)
# but a minimum of 16 byte
sll v0, 2
slt t0, v0, 16
beqz t0, 1f
li v0, 16
1: subu sp, v0
# save the old sp so we can pop the param area and any "low frame"
# needed as an argsave area below the param block for callees that
# we invoke.
move s0, sp
REG_L a1, A2OFF(sp) # a1 = paramCount
REG_L a2, A3OFF(sp) # a2 = params
# we define a word as 4 bytes, period end of story!
sll v0, 2 # 4 bytes * result of invoke_copy_words
subu v0, LOFRAMESZ # but we take back the argsave area built into
# our stack frame -- SWEET!
subu sp, sp, v0 # make room
move a0, sp # a0 = param stack address
move s1, a0 # save it for later -- it should be safe here
# the old sp is still saved in s0, but we now need another argsave
# area ("low frame") for the invoke_copy_to_stack call.
subu sp, sp, LOFRAMESZ
# copy the param into the stack areas
# let a0 point to the bottom of the variable stack, allocate
# another fixed stack for:
# extern "C" void
# invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount,
# nsXPTCVariant* s)
jal invoke_copy_to_stack
lw gp, GPOFF(s0)
# nsXPTCVariant* s);
la t9, invoke_copy_to_stack
move a0, sp
lw a1, A2OFF(fp)
lw a2, A3OFF(fp)
subu sp, 16
jalr t9
lw gp, GPOFF(fp)
move sp, s0 # get orig sp back, popping params and argsave
# back to the variable stack frame
addu sp, 16
REG_L a0, A0OFF(sp) # a0 = set "that" to be "this"
REG_L a1, A1OFF(sp) # a1 = methodIndex
# t1 = methodIndex * 4
# (use shift instead of mult)
sll t1, a1, 2
# calculate the function we need to jump to,
# which must then be saved in t9
# calculate the function we need to jump to, which must then be
# stored in t9
lw a0, A0OFF(fp) # a0 = set "that" to be "this"
lw t0, A1OFF(fp) # a1 = methodIndex
lw t9, 0(a0)
addu t9, t9, t1
lw t9, 8(t9)
# t0 = methodIndex << PTRLOG
sll t0, t0, PTRLOG
addu t9, t0
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
lw t9, (t9)
#else /* not G++ V3 ABI */
lw t9, 2*PTRSIZE(t9)
#endif /* G++ V3 ABI */
# a1..a3 and f13..f14 should now be set to what
# invoke_copy_to_stack told us. skip a0 and f12
# because that is the "this" pointer
# Set a1-a3 to what invoke_copy_to_stack told us. a0 is already
# the "this" pointer. We don't have to care about floating
# point arguments, the non-FP "this" pointer as first argument
# means they'll never be used.
lw a1, 1*SZREG(sp)
lw a2, 2*SZREG(sp)
lw a3, 3*SZREG(sp)
REG_L a1, 1*SZREG(s1)
REG_L a2, 2*SZREG(s1)
REG_L a3, 3*SZREG(s1)
jalr t9
# Micro-optimization: There's no gp usage below this point, so
# we don't reload.
# lw gp, GPOFF(fp)
l.d $f13, 8(s1)
l.d $f14, 16(s1)
# leave variable stack frame
move sp, fp
# Create the stack pointer for the function, which must have 4 words
# of space for callee-saved args. invoke_count_words allocated space
# for a0 starting at s1, so we just move s1 into sp.
move sp, s1
lw ra, RAOFF(sp)
lw fp, FPOFF(sp)
jalr ra, t9
lw gp, GPOFF(s0)
move sp, s0
REG_L ra, RAOFF(sp)
REG_L s0, S0OFF(sp)
addu sp, FRAMESZ
addiu sp, FRAMESZ
j ra
.end _XPTC_InvokeByIndex
END(_NS_InvokeByIndex_P)

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

@ -128,8 +128,8 @@ extern "C" {
}
}
XPTC_PUBLIC_API(nsresult)
XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
EXPORT_XPCOM_API(nsresult)
NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
PRUint32 paramCount, nsXPTCVariant* params)
{
PRUint32 result, n;

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

@ -24,6 +24,7 @@
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
* Brendan Eich <brendan@mozilla.org>
* Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -52,10 +53,8 @@ invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s)
// Count a word for a0 even though it's never stored or loaded
// We do this only for alignment of register pairs.
PRUint32 result = 1;
for (PRUint32 i = 0; i < paramCount; i++, s++)
for (PRUint32 i = 0; i < paramCount; i++, result++, s++)
{
result++;
if (s->IsPtrData())
continue;
@ -68,6 +67,9 @@ invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s)
result++;
result++;
break;
default:
break;
}
}
return (result + 1) & ~(PRUint32)1;
@ -88,8 +90,6 @@ invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount,
continue;
}
*((void**)d) = s->val.p;
switch(s->type)
{
case nsXPTType::T_I64 :
@ -104,19 +104,20 @@ invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount,
if ((PRWord)d & 4) d++;
*((double*) d) = s->val.d; d++;
break;
default:
*((void**)d) = s->val.p;
break;
}
}
}
extern "C" nsresult _XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
extern "C" nsresult _NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
PRUint32 paramCount,
nsXPTCVariant* params);
extern "C"
XPTC_PUBLIC_API(nsresult)
XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
EXPORT_XPCOM_API(nsresult)
NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
PRUint32 paramCount, nsXPTCVariant* params)
{
return _XPTC_InvokeByIndex(that, methodIndex, paramCount, params);
return _NS_InvokeByIndex_P(that, methodIndex, paramCount, params);
}

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

@ -0,0 +1,142 @@
/* -*- Mode: asm; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corp, Inc.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
* Chris Waterson <waterson@netscape.com>
* Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
*/
/* This code is for MIPS using the O32 ABI. */
#include <sys/regdef.h>
#include <sys/asm.h>
# NARGSAVE is the argument space in the callers frame, including extra
# 'shadowed' space for the argument registers. The minimum of 4
# argument slots is sometimes predefined in the header files.
#ifndef NARGSAVE
#define NARGSAVE 4
#endif
#define LOCALSZ 2 /* gp, ra */
#define FRAMESZ ((((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK)
#define RAOFF (FRAMESZ - (1*SZREG))
#define GPOFF (FRAMESZ - (2*SZREG))
#define A0OFF (FRAMESZ + (0*SZREG))
#define A1OFF (FRAMESZ + (1*SZREG))
#define A2OFF (FRAMESZ + (2*SZREG))
#define A3OFF (FRAMESZ + (3*SZREG))
.text
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
#define STUB_ENTRY(x) \
.if x < 10; \
.globl _ZN14nsXPTCStubBase5Stub ##x ##Ev; \
.type _ZN14nsXPTCStubBase5Stub ##x ##Ev,@function; \
.aent _ZN14nsXPTCStubBase5Stub ##x ##Ev,0; \
_ZN14nsXPTCStubBase5Stub ##x ##Ev:; \
SETUP_GP; \
li t0,x; \
b sharedstub; \
.elseif x < 100; \
.globl _ZN14nsXPTCStubBase6Stub ##x ##Ev; \
.type _ZN14nsXPTCStubBase6Stub ##x ##Ev,@function; \
.aent _ZN14nsXPTCStubBase6Stub ##x ##Ev,0; \
_ZN14nsXPTCStubBase6Stub ##x ##Ev:; \
SETUP_GP; \
li t0,x; \
b sharedstub; \
.elseif x < 1000; \
.globl _ZN14nsXPTCStubBase7Stub ##x ##Ev; \
.type _ZN14nsXPTCStubBase7Stub ##x ##Ev,@function; \
.aent _ZN14nsXPTCStubBase7Stub ##x ##Ev,0; \
_ZN14nsXPTCStubBase7Stub ##x ##Ev:; \
SETUP_GP; \
li t0,x; \
b sharedstub; \
.else; \
.err; \
.endif
#else /* not G++ V3 ABI */
#define STUB_ENTRY(x) \
.globl Stub ##x ##__14nsXPTCStubBase; \
.type Stub ##x ##__14nsXPTCStubBase,@function; \
.aent Stub ##x ##__14nsXPTCStubBase,0; \
Stub ##x ##__14nsXPTCStubBase:; \
SETUP_GP; \
li t0,x; \
b sharedstub
#endif /* G++ V3 ABI */
# SENTINEL_ENTRY is handled in the cpp file.
#define SENTINEL_ENTRY(x)
#
# open a dummy frame for the function entries
#
.align 2
.type dummy,@function
.ent dummy, 0
.frame sp, FRAMESZ, ra
dummy:
SETUP_GP
#include "xptcstubsdef.inc"
sharedstub:
subu sp, FRAMESZ
# specify the save register mask for gp, ra, a0-a3
.mask 0x900000F0, RAOFF-FRAMESZ
sw ra, RAOFF(sp)
SAVE_GP(GPOFF)
# Micro-optimization: a0 is already loaded, and its slot gets
# ignored by PrepareAndDispatch, so no need to save it here.
# sw a0, A0OFF(sp)
sw a1, A1OFF(sp)
sw a2, A2OFF(sp)
sw a3, A3OFF(sp)
la t9, PrepareAndDispatch
# t0 is methodIndex
move a1, t0
# have a2 point to the begin of the argument space on stack
addiu a2, sp, FRAMESZ
# PrepareAndDispatch(that, methodIndex, args)
jalr t9
# Micro-optimization: Using jalr explicitly has the side-effect
# of not triggering .cprestore. This is ok because we have no
# gp reference below this point. It also allows better
# instruction sscheduling.
# lw gp, GPOFF(fp)
lw ra, RAOFF(sp)
addiu sp, FRAMESZ
j ra
END(dummy)

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

@ -38,6 +38,7 @@
/* Implement shared vtbl methods. */
#include "xptcprivate.h"
#include "xptiprivate.h"
extern "C" {
nsresult
@ -47,7 +48,6 @@ extern "C" {
nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
nsXPTCMiniVariant* dispatchParams = NULL;
nsIInterfaceInfo* iface_info = NULL;
const nsXPTMethodInfo* info;
PRUint8 paramCount;
PRUint8 i;
@ -55,11 +55,8 @@ extern "C" {
NS_ASSERTION(self,"no self");
self->GetInterfaceInfo(&iface_info);
NS_ASSERTION(iface_info,"no interface info");
iface_info->GetMethodInfo(PRUint16(methodIndex), &info);
NS_ASSERTION(info,"no interface info");
self->mEntry->GetMethodInfo(PRUint16(methodIndex), &info);
NS_ASSERTION(info,"no method info");
paramCount = info->GetParamCount();
@ -107,9 +104,7 @@ extern "C" {
}
}
result = self->CallMethod((PRUint16)methodIndex, info, dispatchParams);
NS_RELEASE(iface_info);
result = self->mOuter->CallMethod((PRUint16)methodIndex, info, dispatchParams);
if(dispatchParams != paramBuffer)
delete [] dispatchParams;

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

@ -39,6 +39,7 @@
* ***** END LICENSE BLOCK ***** */
#include "xptcprivate.h"
#include "xptiprivate.h"
/*
* This is for MIPS O32 ABI
@ -54,7 +55,6 @@ PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, PRUint32* args)
nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
nsXPTCMiniVariant* dispatchParams = NULL;
nsIInterfaceInfo* iface_info = NULL;
const nsXPTMethodInfo* info;
PRUint8 paramCount;
PRUint8 i;
@ -62,11 +62,8 @@ PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, PRUint32* args)
NS_ASSERTION(self,"no self");
self->GetInterfaceInfo(&iface_info);
NS_ASSERTION(iface_info,"no interface info");
iface_info->GetMethodInfo(PRUint16(methodIndex), &info);
NS_ASSERTION(info,"no interface info");
self->mEntry->GetMethodInfo(PRUint16(methodIndex), &info);
NS_ASSERTION(info,"no method info");
paramCount = info->GetParamCount();
@ -109,9 +106,7 @@ PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, PRUint32* args)
}
}
result = self->CallMethod((PRUint16)methodIndex, info, dispatchParams);
NS_RELEASE(iface_info);
result = self->mOuter->CallMethod((PRUint16)methodIndex, info, dispatchParams);
if(dispatchParams != paramBuffer)
delete [] dispatchParams;

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

@ -77,7 +77,7 @@ regdir = /etc/gre.d
install:: $(MOZILLA_VERSION).system.conf
$(NSINSTALL) -D $(DESTDIR)$(regdir)
$(SYSINSTALL) $^ $(DESTDIR)$(regdir)
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(regdir)
endif
# Add pkg-config files to the install:: target
@ -118,6 +118,7 @@ endif
-e "s|%sdkdir%|$(sdkdir)|" \
-e "s|%MOZ_APP_NAME%|$(MOZ_APP_NAME)|" \
-e "s|%MOZILLA_VERSION%|$(MOZ_APP_VERSION)|" \
-e "s|%WCHAR_CFLAGS%|$(WCHAR_CFLAGS)|" \
-e "s|%FULL_NSPR_LIBS%|$(FULL_NSPR_LIBS)|" \
-e "s|%FULL_NSPR_CFLAGS%|$(FULL_NSPR_CFLAGS)|" \
-e "s|%NSPR_NAME%|$(NSPR_NAME)|" \

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

@ -8,4 +8,4 @@ Name: libxul-embedding-unstable
Description: Static library for version-independent embedding of the Mozilla runtime (unstable API)
Version: %MOZILLA_VERSION%
Libs: -L${sdkdir}/lib -lxpcomglue
Cflags: -DXPCOM_GLUE -I${includedir}/${includetype} -fshort-wchar
Cflags: -DXPCOM_GLUE -I${includedir}/${includetype} %WCHAR_CFLAGS%

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

@ -12,4 +12,4 @@ Name: libxul-embedding
Description: Static library for version-independent embedding of the Mozilla runtime
Version: %MOZILLA_VERSION%
Libs: -L${sdkdir}/lib -lxpcomglue
Cflags: -DXPCOM_GLUE -I${includedir}/${includetype} -fshort-wchar
Cflags: -DXPCOM_GLUE -I${includedir}/${includetype} %WCHAR_CFLAGS%

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

@ -9,4 +9,4 @@ Description: The Mozilla Runtime and Embedding Engine (unstable API)
Version: %MOZILLA_VERSION%
Requires: %NSPR_NAME% >= %NSPR_VERSION%
Libs: -L${sdkdir}/lib -lxpcomglue_s -lxul -lxpcom
Cflags: -I${includedir}/${includetype} -fshort-wchar
Cflags: -I${includedir}/${includetype} %WCHAR_CFLAGS%

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

@ -13,4 +13,4 @@ Description: The Mozilla Runtime and Embedding Engine
Version: %MOZILLA_VERSION%
Requires: %NSPR_NAME% >= %NSPR_VERSION%
Libs: -L${sdkdir}/lib -lxpcomglue_s -lxul -lxpcom
Cflags: -I${includedir}/${includetype} -fshort-wchar
Cflags: -I${includedir}/${includetype} %WCHAR_CFLAGS%