diff --git a/MozillaThunderbird.changes b/MozillaThunderbird.changes index 31c6f9e..8d375a0 100644 --- a/MozillaThunderbird.changes +++ b/MozillaThunderbird.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri May 30 17:27:50 CEST 2008 - maw@suse.de + +- Add thunderbird-2.0.0.14-backports.patch (bnc390992). + ------------------------------------------------------------------- Fri May 16 16:59:40 CEST 2008 - schwab@suse.de diff --git a/MozillaThunderbird.spec b/MozillaThunderbird.spec index fa3906c..26346e6 100644 --- a/MozillaThunderbird.spec +++ b/MozillaThunderbird.spec @@ -14,7 +14,7 @@ Name: MozillaThunderbird BuildRequires: fdupes gcc-c++ libgnomeui-devel libidl-devel mozilla-nss-devel orbit-devel unzip update-desktop-files zip License: GPL v2 or later; LGPL v2.1 or later; MOZILLA PUBLIC LICENSE (MPL/NPL) Version: 2.0.0.12 -Release: 28 +Release: 32 Summary: The Stand-Alone Mozilla Mail Component Url: http://www.mozilla.org/products/thunderbird/ Group: Productivity/Networking/Email/Clients @@ -52,6 +52,7 @@ Patch27: thunderbird-1.5.0.8-uninitalized-vars-232305.patch Patch29: visibility.patch Patch30: mozilla-missing-decl.patch Patch31: unused-includes.patch +Patch32: thunderbird-2.0.0.14-backports.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build PreReq: libstdc++ fileutils textutils /bin/sh %if %suse_version > 1000 @@ -186,6 +187,7 @@ cd $RPM_BUILD_DIR/mozilla # %patch28 -p1 %patch30 -p1 %patch31 +%patch32 %build export MOZ_BUILD_DATE=%{releasedate} @@ -674,6 +676,8 @@ exit 0 %{_bindir}/thunderbird-config %changelog +* Fri May 30 2008 maw@suse.de +- Add thunderbird-2.0.0.14-backports.patch (bnc390992). * Fri May 16 2008 schwab@suse.de - Remove unused includes. * Mon Mar 24 2008 maw@suse.de diff --git a/thunderbird-2.0.0.14-backports.patch b/thunderbird-2.0.0.14-backports.patch new file mode 100644 index 0000000..edae717 --- /dev/null +++ b/thunderbird-2.0.0.14-backports.patch @@ -0,0 +1,3215 @@ +=== modified file 'content/base/src/nsDOMParser.cpp' +--- content/base/src/nsDOMParser.cpp 2008-05-29 16:56:50 +0000 ++++ content/base/src/nsDOMParser.cpp 2008-05-30 15:07:38 +0000 +@@ -66,6 +66,7 @@ + #include "nsStreamUtils.h" + #include "nsNetCID.h" + #include "nsContentUtils.h" ++#include "nsPIDOMWindow.h" + + static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); + +@@ -348,6 +349,7 @@ + NS_INTERFACE_MAP_ENTRY(nsIDOMParser) + NS_INTERFACE_MAP_ENTRY(nsIDOMLoadListener) + NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) ++ NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer_MOZILLA_1_8_BRANCH) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(DOMParser) + NS_INTERFACE_MAP_END + +@@ -503,35 +505,45 @@ + + // Try to find a base URI for the document we're creating. + nsCOMPtr baseURI; +- +- nsCOMPtr cc; +- nsCOMPtr xpc(do_GetService(nsIXPConnect::GetCID(), &rv)); +- if(NS_SUCCEEDED(rv)) { +- rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc)); +- } +- + nsCOMPtr contextDoc; +- if (NS_SUCCEEDED(rv) && cc) { +- JSContext* cx; +- rv = cc->GetJSContext(&cx); +- if (NS_FAILED(rv)) return NS_ERROR_FAILURE; +- +- nsIScriptContext *scriptContext = GetScriptContextFromJSContext(cx); +- if (scriptContext) { +- nsCOMPtr window = +- do_QueryInterface(scriptContext->GetGlobalObject()); +- +- if (window) { +- window->GetDocument(getter_AddRefs(contextDoc)); +- +- nsCOMPtr doc = do_QueryInterface(contextDoc); +- if (doc) { +- baseURI = doc->GetBaseURI(); ++ if (mOwner) { ++ nsCOMPtr win = do_QueryReferent(mOwner); ++ NS_ENSURE_STATE(win); ++ nsPIDOMWindow* outer = win->GetOuterWindow(); ++ NS_ENSURE_STATE(outer && outer->GetCurrentInnerWindow() == win); ++ nsCOMPtr window = do_QueryInterface(win); ++ if (window) { ++ window->GetDocument(getter_AddRefs(contextDoc)); ++ } ++ } else { ++ nsCOMPtr cc; ++ nsCOMPtr xpc(do_GetService(nsIXPConnect::GetCID(), &rv)); ++ if(NS_SUCCEEDED(rv)) { ++ rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc)); ++ } ++ ++ if (NS_SUCCEEDED(rv) && cc) { ++ JSContext* cx; ++ rv = cc->GetJSContext(&cx); ++ if (NS_FAILED(rv)) return NS_ERROR_FAILURE; ++ ++ nsIScriptContext *scriptContext = GetScriptContextFromJSContext(cx); ++ if (scriptContext) { ++ nsCOMPtr window = ++ do_QueryInterface(scriptContext->GetGlobalObject()); ++ ++ if (window) { ++ window->GetDocument(getter_AddRefs(contextDoc)); + } + } + } + } + ++ nsCOMPtr doc = do_QueryInterface(contextDoc); ++ if (doc) { ++ baseURI = doc->GetBaseURI(); ++ } ++ + if (!baseURI) { + // No URI from script environment (we are running from command line, for example). + // Create a dummy one. +@@ -688,3 +700,11 @@ + + return NS_OK; + } ++ ++NS_IMETHODIMP ++nsDOMParser::Initialize(nsISupports* aOwner, JSContext* cx, JSObject* obj, ++ PRUint32 argc, jsval *argv) ++{ ++ mOwner = do_GetWeakReference(aOwner); ++ return NS_OK; ++} + +=== modified file 'content/base/src/nsDOMParser.h' +--- content/base/src/nsDOMParser.h 2008-05-29 16:56:50 +0000 ++++ content/base/src/nsDOMParser.h 2008-05-30 15:07:38 +0000 +@@ -44,10 +44,13 @@ + #include "nsIEventQueueService.h" + #include "nsIDOMLoadListener.h" + #include "nsWeakReference.h" ++#include "nsWeakPtr.h" ++#include "nsIJSNativeInitializer.h" + + class nsDOMParser : public nsIDOMParser, + public nsIDOMLoadListener, +- public nsSupportsWeakReference ++ public nsSupportsWeakReference, ++ public nsIJSNativeInitializer_MOZILLA_1_8_BRANCH + { + public: + nsDOMParser(); +@@ -68,10 +71,14 @@ + NS_IMETHOD Abort(nsIDOMEvent* aEvent); + NS_IMETHOD Error(nsIDOMEvent* aEvent); + ++ // nsIJSNativeInitializer_MOZILLA_1_8_BRANCH ++ NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* cx, JSObject* obj, ++ PRUint32 argc, jsval* argv); + private: + nsCOMPtr mBaseURI; + nsCOMPtr mEventQService; + PRBool mLoopingForSyncLoad; ++ nsWeakPtr mOwner; + }; + + #endif + +=== modified file 'content/base/src/nsXMLHttpRequest.cpp' +--- content/base/src/nsXMLHttpRequest.cpp 2008-05-29 16:56:50 +0000 ++++ content/base/src/nsXMLHttpRequest.cpp 2008-05-30 15:07:38 +0000 +@@ -83,6 +83,7 @@ + #include "nsContentPolicyUtils.h" + #include "nsContentErrors.h" + #include "nsLayoutStatics.h" ++#include "nsIScriptObjectPrincipal.h" + + static const char* kLoadAsData = "loadAsData"; + #define LOADSTR NS_LITERAL_STRING("load") +@@ -222,25 +223,66 @@ + count); + } + +- +-static nsIScriptContext * +-GetCurrentContext() ++nsresult ++nsXMLHttpRequest::Init() + { ++ // Set the original mScriptContext and mPrincipal, if available. + // Get JSContext from stack. + nsCOMPtr stack = + do_GetService("@mozilla.org/js/xpc/ContextStack;1"); + + if (!stack) { +- return nsnull; ++ return NS_OK; + } + + JSContext *cx; + + if (NS_FAILED(stack->Peek(&cx)) || !cx) { +- return nsnull; +- } +- +- return GetScriptContextFromJSContext(cx); ++ return NS_OK; ++ } ++ ++ nsIScriptContext* context = GetScriptContextFromJSContext(cx); ++ if (!context) { ++ return NS_OK; ++ } ++ nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager(); ++ nsCOMPtr subjectPrincipal; ++ if (secMan) { ++ secMan->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal)); ++ } ++ NS_ENSURE_STATE(subjectPrincipal); ++ ++ mScriptContext = context; ++ mPrincipal = subjectPrincipal; ++ nsCOMPtr window = ++ do_QueryInterface(context->GetGlobalObject()); ++ if (window) { ++ mOwner = do_GetWeakReference(window->GetCurrentInnerWindow()); ++ } ++ ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++nsXMLHttpRequest::Initialize(nsISupports* aOwner, JSContext* cx, JSObject* obj, ++ PRUint32 argc, jsval *argv) ++{ ++ mOwner = do_GetWeakReference(aOwner); ++ if (!mOwner) { ++ NS_WARNING("Unexpected nsIJSNativeInitializer owner"); ++ return NS_OK; ++ } ++ ++ // This XHR object is bound to a |window|, ++ // so re-set principal and script context. ++ nsCOMPtr scriptPrincipal = do_QueryInterface(aOwner); ++ NS_ENSURE_STATE(scriptPrincipal); ++ mPrincipal = scriptPrincipal->GetPrincipal(); ++ nsCOMPtr sgo = do_QueryInterface(aOwner); ++ NS_ENSURE_STATE(sgo); ++ mScriptContext = sgo->GetContext(); ++ NS_ENSURE_STATE(mScriptContext); ++ return NS_OK; + } + + /** +@@ -311,6 +353,7 @@ + NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor) + NS_INTERFACE_MAP_ENTRY(nsIDOMGCParticipant) + NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) ++ NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer_MOZILLA_1_8_BRANCH) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XMLHttpRequest) + NS_INTERFACE_MAP_END + +@@ -344,8 +387,6 @@ + holder->Set(listener, this); + array->AppendElement(holder); + +- mScriptContext = GetCurrentContext(); +- + return NS_OK; + } + +@@ -407,8 +448,6 @@ + { + mOnReadystatechangeListener.Set(aOnreadystatechange, this); + +- mScriptContext = GetCurrentContext(); +- + return NS_OK; + } + +@@ -429,8 +468,6 @@ + { + mOnLoadListener.Set(aOnLoad, this); + +- mScriptContext = GetCurrentContext(); +- + return NS_OK; + } + +@@ -450,8 +487,6 @@ + { + mOnErrorListener.Set(aOnerror, this); + +- mScriptContext = GetCurrentContext(); +- + return NS_OK; + } + +@@ -471,8 +506,6 @@ + { + mOnProgressListener.Set(aOnprogress, this); + +- mScriptContext = GetCurrentContext(); +- + return NS_OK; + } + +@@ -745,10 +778,6 @@ + NS_ENSURE_ARG_POINTER(aLoadGroup); + *aLoadGroup = nsnull; + +- if (!mScriptContext) { +- mScriptContext = GetCurrentContext(); +- } +- + nsCOMPtr doc = GetDocumentFromScriptContext(mScriptContext); + if (doc) { + *aLoadGroup = doc->GetDocumentLoadGroup().get(); // already_AddRefed +@@ -761,10 +790,7 @@ + nsXMLHttpRequest::GetBaseURI() + { + if (!mScriptContext) { +- mScriptContext = GetCurrentContext(); +- if (!mScriptContext) { +- return nsnull; +- } ++ return nsnull; + } + + nsCOMPtr doc = GetDocumentFromScriptContext(mScriptContext); +@@ -828,6 +854,10 @@ + nsCOMPtr stack; + JSContext *cx = nsnull; + ++ if (NS_FAILED(CheckInnerWindowCorrectness())) { ++ return; ++ } ++ + if (mScriptContext) { + stack = do_GetService("@mozilla.org/js/xpc/ContextStack;1"); + +@@ -956,8 +986,10 @@ + rv = NS_NewURI(getter_AddRefs(uri), url, nsnull, GetBaseURI()); + if (NS_FAILED(rv)) return rv; + +- // mScriptContext should be initialized because of GetBaseURI() above. ++ // mScriptContext should be initialized because of Init()/Initialize(). + // Still need to consider the case that doc is nsnull however. ++ rv = CheckInnerWindowCorrectness(); ++ NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr doc = GetDocumentFromScriptContext(mScriptContext); + PRInt16 shouldLoad = nsIContentPolicy::ACCEPT; + rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_OTHER, +@@ -1478,7 +1510,8 @@ + NS_IMETHODIMP + nsXMLHttpRequest::Send(nsIVariant *aBody) + { +- nsresult rv; ++ nsresult rv = CheckInnerWindowCorrectness(); ++ NS_ENSURE_SUCCESS(rv, rv); + + // Return error if we're already processing a request + if (XML_HTTP_REQUEST_SENT & mState) { +@@ -1502,18 +1535,11 @@ + if (httpChannel) { + httpChannel->GetRequestMethod(method); // If GET, method name will be uppercase + +- nsCOMPtr doc = +- do_QueryInterface(nsContentUtils::GetDocumentFromCaller()); +- +- if (doc) { +- nsIPrincipal *principal = doc->GetPrincipal(); +- +- if (principal) { +- nsCOMPtr codebase; +- principal->GetURI(getter_AddRefs(codebase)); +- +- httpChannel->SetReferrer(codebase); +- } ++ if (mPrincipal) { ++ nsCOMPtr codebase; ++ mPrincipal->GetURI(getter_AddRefs(codebase)); ++ ++ httpChannel->SetReferrer(codebase); + } + } + +@@ -1631,11 +1657,6 @@ + } + } + +- if (!mScriptContext) { +- // We need a context to check if redirect (if any) is allowed +- mScriptContext = GetCurrentContext(); +- } +- + // Hook us up to listen to redirects and the like + mChannel->GetNotificationCallbacks(getter_AddRefs(mNotificationCallbacks)); + mChannel->SetNotificationCallbacks(this); + +=== modified file 'content/base/src/nsXMLHttpRequest.h' +--- content/base/src/nsXMLHttpRequest.h 2008-05-29 16:56:50 +0000 ++++ content/base/src/nsXMLHttpRequest.h 2008-05-30 15:07:38 +0000 +@@ -51,6 +51,7 @@ + #include "nsIStreamListener.h" + #include "nsIEventQueueService.h" + #include "nsWeakReference.h" ++#include "nsWeakPtr.h" + #include "jsapi.h" + #include "nsIScriptContext.h" + #include "nsIChannelEventSink.h" +@@ -60,7 +61,8 @@ + #include "nsJSUtils.h" + #include "nsTArray.h" + #include "nsIDOMGCParticipant.h" +- ++#include "nsIJSNativeInitializer.h" ++#include "nsPIDOMWindow.h" + #include "nsIDOMLSProgressEvent.h" + + class nsILoadGroup; +@@ -74,7 +76,8 @@ + public nsIProgressEventSink, + public nsIInterfaceRequestor, + public nsIDOMGCParticipant, +- public nsSupportsWeakReference ++ public nsSupportsWeakReference, ++ public nsIJSNativeInitializer_MOZILLA_1_8_BRANCH + { + public: + nsXMLHttpRequest(); +@@ -116,6 +119,13 @@ + // nsIInterfaceRequestor + NS_DECL_NSIINTERFACEREQUESTOR + ++ // nsIJSNativeInitializer ++ NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* cx, JSObject* obj, ++ PRUint32 argc, jsval* argv); ++ ++ // This is called by the factory constructor. ++ nsresult Init(); ++ + // nsIDOMGCParticipant + virtual nsIDOMGCParticipant* GetSCCIndex(); + virtual void AppendReachableList(nsCOMArray& aArray); +@@ -152,7 +162,22 @@ + void ClearEventListeners(); + already_AddRefed GetCurrentHttpChannel(); + ++ nsresult CheckInnerWindowCorrectness() ++ { ++ if (mOwner) { ++ nsCOMPtr win = do_QueryReferent(mOwner); ++ NS_ENSURE_STATE(win); ++ NS_ASSERTION(win->IsInnerWindow(), "Should have inner window here!\n"); ++ nsPIDOMWindow* outer = win->GetOuterWindow(); ++ if (!outer || outer->GetCurrentInnerWindow() != win) { ++ return NS_ERROR_FAILURE; ++ } ++ } ++ return NS_OK; ++ } ++ + nsCOMPtr mContext; ++ nsCOMPtr mPrincipal; + nsCOMPtr mChannel; + nsCOMPtr mReadRequest; + nsCOMPtr mDocument; +@@ -160,6 +185,7 @@ + nsTArray mLoadEventListeners; + nsTArray mErrorEventListeners; + nsCOMPtr mScriptContext; ++ nsWeakPtr mOwner; // Inner window. + + nsMarkedJSFunctionHolder mOnLoadListener; + nsMarkedJSFunctionHolder mOnErrorListener; + +=== modified file 'content/xul/document/src/nsXULDocument.cpp' +--- content/xul/document/src/nsXULDocument.cpp 2008-05-29 16:56:50 +0000 ++++ content/xul/document/src/nsXULDocument.cpp 2008-05-30 15:07:40 +0000 +@@ -2883,12 +2883,10 @@ + mResolutionPhase = nsForwardReference::eStart; + + // Chrome documents are allowed to load overlays from anywhere. +- // Also, any document may load a chrome:// overlay. + // In all other cases, the overlay is only allowed to load if + // the master document and prototype document have the same origin. + +- PRBool overlayIsChrome = IsChromeURI(aURI); +- if (!IsChromeURI(mDocumentURI) && !overlayIsChrome) { ++ if (!IsChromeURI(mDocumentURI)) { + // Make sure we're allowed to load this overlay. + rv = secMan->CheckSameOriginURI(mDocumentURI, aURI); + if (NS_FAILED(rv)) return rv; +@@ -2896,6 +2894,7 @@ + + // Look in the prototype cache for the prototype document with + // the specified overlay URI. ++ PRBool overlayIsChrome = IsChromeURI(aURI); + if (overlayIsChrome) + gXULCache->GetPrototype(aURI, getter_AddRefs(mCurrentPrototype)); + else +@@ -3218,12 +3217,10 @@ + #endif + + // Chrome documents are allowed to load overlays from anywhere. +- // Also, any document may load a chrome:// overlay. + // In all other cases, the overlay is only allowed to load if + // the master document and prototype document have the same origin. + +- PRBool overlayIsChrome = IsChromeURI(uri); +- if (!IsChromeURI(mDocumentURI) && !overlayIsChrome) { ++ if (!IsChromeURI(mDocumentURI)) { + // Make sure we're allowed to load this overlay. + rv = secMan->CheckSameOriginURI(mDocumentURI, uri); + if (NS_FAILED(rv)) { +@@ -3234,6 +3231,7 @@ + + // Look in the prototype cache for the prototype document with + // the specified overlay URI. ++ PRBool overlayIsChrome = IsChromeURI(uri); + if (overlayIsChrome) + gXULCache->GetPrototype(uri, getter_AddRefs(mCurrentPrototype)); + else + +=== modified file 'directory/c-sdk/config/Makefile' +--- directory/c-sdk/config/Makefile 2008-05-29 16:56:50 +0000 ++++ directory/c-sdk/config/Makefile 2008-05-30 15:10:53 +0000 +@@ -1,37 +1,41 @@ + # Generated automatically from Makefile.in by configure. + #! gmake + # +-# 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. +-# ++# ***** BEGIN LICENSE BLOCK ***** ++# Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++# ++# The contents of this file are subject to the Mozilla Public License Version ++# 1.1 (the "License"); you may not use this file except in compliance with ++# the License. You may obtain a copy of the License at ++# http://www.mozilla.org/MPL/ ++# ++# Software distributed under the License is distributed on an "AS IS" basis, ++# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++# for the specific language governing rights and limitations under the ++# License. ++# + # The Original Code is the Netscape Portable Runtime (NSPR). +-# +-# The Initial Developer of the Original Code is Netscape +-# Communications Corporation. Portions created by Netscape are +-# Copyright (C) 1998-2000 Netscape Communications Corporation. All +-# Rights Reserved. +-# ++# ++# The Initial Developer of the Original Code is ++# Netscape Communications Corporation. ++# Portions created by the Initial Developer are Copyright (C) 1998-2000 ++# the Initial Developer. All Rights Reserved. ++# + # Contributor(s): +-# +-# Alternatively, the contents of this file may be used under the +-# terms of the GNU General Public License Version 2 or later (the +-# "GPL"), in which case the provisions of the GPL are applicable +-# instead of those above. If you wish to allow use of your +-# version of this file only under the terms of the GPL and not to +-# allow others to use your version of this file under the MPL, +-# indicate your decision by deleting the provisions above and +-# replace them with the notice and other provisions required by +-# the GPL. If you do not delete the provisions above, a recipient +-# may use your version of this file under either the MPL or the +-# GPL. +-# ++# ++# Alternatively, the contents of this file may be used under the terms of ++# either the GNU General Public License Version 2 or later (the "GPL"), or ++# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++# in which case the provisions of the GPL or the LGPL are applicable instead ++# of those above. If you wish to allow use of your version of this file only ++# under the terms of either the GPL or the LGPL, and not to allow others to ++# use your version of this file under the terms of the MPL, indicate your ++# decision by deleting the provisions above and replace them with the notice ++# and other provisions required by the GPL or the LGPL. If you do not delete ++# the provisions above, a recipient may use your version of this file under ++# the terms of any one of the MPL, the GPL or the LGPL. ++# ++# ***** END LICENSE BLOCK ***** + + MOD_DEPTH = .. + topsrcdir = .. +@@ -98,7 +102,7 @@ + + ifeq ($(MOZ_OS2_TOOLS),EMX) + XCFLAGS = $(OS_EXE_CFLAGS) +-XLDOPTS = -Zomf -Zlinker /PM:VIO ++XLDOPTS = -Zomf -Zlinker -PM:VIO + endif + + ifeq ($(MOZ_OS2_TOOLS),VACPP) +@@ -119,7 +123,7 @@ + OUTOPTION = -o # end of the line + ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) + ifndef NS_USE_GCC +-OUTOPTION = /Fe ++OUTOPTION = -Fe + endif + endif + + +=== modified file 'directory/c-sdk/ldap/clients/tools/Makefile' +--- directory/c-sdk/ldap/clients/tools/Makefile 2008-05-29 16:56:50 +0000 ++++ directory/c-sdk/ldap/clients/tools/Makefile 2008-05-30 15:10:53 +0000 +@@ -1,25 +1,41 @@ + # Generated automatically from Makefile.in by configure. + # +-# The contents of this file are subject to the Netscape 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/NPL/ +-# +-# 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. +-# ++# ***** BEGIN LICENSE BLOCK ***** ++# Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++# ++# The contents of this file are subject to the Mozilla Public License Version ++# 1.1 (the "License"); you may not use this file except in compliance with ++# the License. You may obtain a copy of the License at ++# http://www.mozilla.org/MPL/ ++# ++# Software distributed under the License is distributed on an "AS IS" basis, ++# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++# for the specific language governing rights and limitations under the ++# License. ++# + # The Original Code is Mozilla Communicator client code, released + # March 31, 1998. +-# +-# The Initial Developer of the Original Code is Netscape +-# Communications Corporation. Portions created by Netscape are +-# Copyright (C) 1998-1999 Netscape Communications Corporation. All +-# Rights Reserved. +-# +-# Contributor(s): +-# ++# ++# The Initial Developer of the Original Code is ++# Netscape Communications Corporation. ++# Portions created by the Initial Developer are Copyright (C) 1998-1999 ++# the Initial Developer. All Rights Reserved. ++# ++# Contributor(s): ++# ++# Alternatively, the contents of this file may be used under the terms of ++# either the GNU General Public License Version 2 or later (the "GPL"), or ++# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++# in which case the provisions of the GPL or the LGPL are applicable instead ++# of those above. If you wish to allow use of your version of this file only ++# under the terms of either the GPL or the LGPL, and not to allow others to ++# use your version of this file under the terms of the MPL, indicate your ++# decision by deleting the provisions above and replace them with the notice ++# and other provisions required by the GPL or the LGPL. If you do not delete ++# the provisions above, a recipient may use your version of this file under ++# the terms of any one of the MPL, the GPL or the LGPL. ++# ++# ***** END LICENSE BLOCK ***** + + MOD_DEPTH = ../../.. + srcdir = . + +=== modified file 'directory/c-sdk/ldap/libraries/libiutil/Makefile' +--- directory/c-sdk/ldap/libraries/libiutil/Makefile 2008-05-29 16:56:50 +0000 ++++ directory/c-sdk/ldap/libraries/libiutil/Makefile 2008-05-30 15:10:54 +0000 +@@ -1,25 +1,41 @@ + # Generated automatically from Makefile.in by configure. + # +-# The contents of this file are subject to the Netscape 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/NPL/ +-# +-# 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. +-# ++# ***** BEGIN LICENSE BLOCK ***** ++# Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++# ++# The contents of this file are subject to the Mozilla Public License Version ++# 1.1 (the "License"); you may not use this file except in compliance with ++# the License. You may obtain a copy of the License at ++# http://www.mozilla.org/MPL/ ++# ++# Software distributed under the License is distributed on an "AS IS" basis, ++# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++# for the specific language governing rights and limitations under the ++# License. ++# + # The Original Code is Mozilla Communicator client code, released + # March 31, 1998. +-# +-# The Initial Developer of the Original Code is Netscape +-# Communications Corporation. Portions created by Netscape are +-# Copyright (C) 1998-1999 Netscape Communications Corporation. All +-# Rights Reserved. +-# +-# Contributor(s): +-# ++# ++# The Initial Developer of the Original Code is ++# Netscape Communications Corporation. ++# Portions created by the Initial Developer are Copyright (C) 1998-1999 ++# the Initial Developer. All Rights Reserved. ++# ++# Contributor(s): ++# ++# Alternatively, the contents of this file may be used under the terms of ++# either the GNU General Public License Version 2 or later (the "GPL"), or ++# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++# in which case the provisions of the GPL or the LGPL are applicable instead ++# of those above. If you wish to allow use of your version of this file only ++# under the terms of either the GPL or the LGPL, and not to allow others to ++# use your version of this file under the terms of the MPL, indicate your ++# decision by deleting the provisions above and replace them with the notice ++# and other provisions required by the GPL or the LGPL. If you do not delete ++# the provisions above, a recipient may use your version of this file under ++# the terms of any one of the MPL, the GPL or the LGPL. ++# ++# ***** END LICENSE BLOCK ***** + + + MOD_DEPTH = ../../.. + +=== modified file 'directory/c-sdk/ldap/libraries/libldif/Makefile' (properties changed: +x to -x) +--- directory/c-sdk/ldap/libraries/libldif/Makefile 2008-05-29 16:56:50 +0000 ++++ directory/c-sdk/ldap/libraries/libldif/Makefile 2008-05-30 15:10:54 +0000 +@@ -1,25 +1,41 @@ + # Generated automatically from Makefile.in by configure. + # +-# The contents of this file are subject to the Netscape 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/NPL/ +-# +-# 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. +-# ++# ***** BEGIN LICENSE BLOCK ***** ++# Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++# ++# The contents of this file are subject to the Mozilla Public License Version ++# 1.1 (the "License"); you may not use this file except in compliance with ++# the License. You may obtain a copy of the License at ++# http://www.mozilla.org/MPL/ ++# ++# Software distributed under the License is distributed on an "AS IS" basis, ++# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++# for the specific language governing rights and limitations under the ++# License. ++# + # The Original Code is Mozilla Communicator client code, released + # March 31, 1998. +-# +-# The Initial Developer of the Original Code is Netscape +-# Communications Corporation. Portions created by Netscape are +-# Copyright (C) 1998-1999 Netscape Communications Corporation. All +-# Rights Reserved. +-# +-# Contributor(s): +-# ++# ++# The Initial Developer of the Original Code is ++# Netscape Communications Corporation. ++# Portions created by the Initial Developer are Copyright (C) 1998-1999 ++# the Initial Developer. All Rights Reserved. ++# ++# Contributor(s): ++# ++# Alternatively, the contents of this file may be used under the terms of ++# either the GNU General Public License Version 2 or later (the "GPL"), or ++# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++# in which case the provisions of the GPL or the LGPL are applicable instead ++# of those above. If you wish to allow use of your version of this file only ++# under the terms of either the GPL or the LGPL, and not to allow others to ++# use your version of this file under the terms of the MPL, indicate your ++# decision by deleting the provisions above and replace them with the notice ++# and other provisions required by the GPL or the LGPL. If you do not delete ++# the provisions above, a recipient may use your version of this file under ++# the terms of any one of the MPL, the GPL or the LGPL. ++# ++# ***** END LICENSE BLOCK ***** + + MOD_DEPTH = ../../.. + srcdir = . + +=== modified file 'directory/c-sdk/ldap/libraries/libssldap/Makefile' +--- directory/c-sdk/ldap/libraries/libssldap/Makefile 2008-05-29 16:56:50 +0000 ++++ directory/c-sdk/ldap/libraries/libssldap/Makefile 2008-05-30 15:10:54 +0000 +@@ -1,25 +1,41 @@ + # Generated automatically from Makefile.in by configure. + # +-# The contents of this file are subject to the Netscape 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/NPL/ +-# +-# 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. +-# ++# ***** BEGIN LICENSE BLOCK ***** ++# Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++# ++# The contents of this file are subject to the Mozilla Public License Version ++# 1.1 (the "License"); you may not use this file except in compliance with ++# the License. You may obtain a copy of the License at ++# http://www.mozilla.org/MPL/ ++# ++# Software distributed under the License is distributed on an "AS IS" basis, ++# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++# for the specific language governing rights and limitations under the ++# License. ++# + # The Original Code is Mozilla Communicator client code, released + # March 31, 1998. +-# +-# The Initial Developer of the Original Code is Netscape +-# Communications Corporation. Portions created by Netscape are +-# Copyright (C) 1998-1999 Netscape Communications Corporation. All +-# Rights Reserved. +-# +-# Contributor(s): +-# ++# ++# The Initial Developer of the Original Code is ++# Netscape Communications Corporation. ++# Portions created by the Initial Developer are Copyright (C) 1998-1999 ++# the Initial Developer. All Rights Reserved. ++# ++# Contributor(s): ++# ++# Alternatively, the contents of this file may be used under the terms of ++# either the GNU General Public License Version 2 or later (the "GPL"), or ++# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++# in which case the provisions of the GPL or the LGPL are applicable instead ++# of those above. If you wish to allow use of your version of this file only ++# under the terms of either the GPL or the LGPL, and not to allow others to ++# use your version of this file under the terms of the MPL, indicate your ++# decision by deleting the provisions above and replace them with the notice ++# and other provisions required by the GPL or the LGPL. If you do not delete ++# the provisions above, a recipient may use your version of this file under ++# the terms of any one of the MPL, the GPL or the LGPL. ++# ++# ***** END LICENSE BLOCK ***** + + MOD_DEPTH = ../../.. + srcdir = . +@@ -76,7 +92,7 @@ + + # variable definitions for exported symbols + ifeq ($(OS_ARCH), WINNT) +- SSLDAP_EXPORT_DEFS= $(srcdir)/../msdos/winsock/nsldapssl32.def ++ SSLDAP_EXPORT_DEFS= $(win_srcdir)/../msdos/winsock/nsldapssl32.def + else + SSLDAP_EXPORT_DEFS= $(SSLOBJDEST)/libldap_ssl.exp + endif + +=== modified file 'dom/public/nsIJSNativeInitializer.h' +--- dom/public/nsIJSNativeInitializer.h 2008-05-29 16:56:50 +0000 ++++ dom/public/nsIJSNativeInitializer.h 2008-05-30 15:07:43 +0000 +@@ -64,5 +64,23 @@ + PRUint32 argc, jsval *argv) = 0; + }; + ++#define NS_IJSNATIVEINITIALIZER_MOZILLA_1_8_BRANCH_IID \ ++ { 0xa26542c9, 0xc825, 0x45e9, \ ++ { 0xb3, 0xcc, 0x66, 0x87, 0x31, 0x3c, 0xf5, 0x73 } } ++ ++// If an object doesn't implement this interface, but does implement ++// nsIJSNativeInitializer, nsIJSNativeInitializer::Initialize(...) is called. ++class nsIJSNativeInitializer_MOZILLA_1_8_BRANCH : public nsISupports { ++public: ++ NS_DEFINE_STATIC_IID_ACCESSOR(NS_IJSNATIVEINITIALIZER_MOZILLA_1_8_BRANCH_IID) ++ ++ /** ++ * Initialize a newly created native instance using the owner of the ++ * constructor and the parameters passed into the JavaScript constructor. ++ */ ++ NS_IMETHOD Initialize(nsISupports* aOwner, JSContext *cx, JSObject *obj, ++ PRUint32 argc, jsval *argv) = 0; ++}; ++ + + #endif // nsIJSNativeInitializer_h__ + +=== modified file 'dom/src/base/nsDOMClassInfo.cpp' +--- dom/src/base/nsDOMClassInfo.cpp 2008-05-29 16:56:50 +0000 ++++ dom/src/base/nsDOMClassInfo.cpp 2008-05-30 15:07:44 +0000 +@@ -4468,7 +4468,8 @@ + } + + static nsresult +-BaseStubConstructor(const nsGlobalNameStruct *name_struct, JSContext *cx, ++BaseStubConstructor(nsIWeakReference* aWeakOwner, ++ const nsGlobalNameStruct *name_struct, JSContext *cx, + JSObject *obj, uintN argc, jsval *argv, jsval *rval) + { + nsresult rv; +@@ -4489,12 +4490,23 @@ + return rv; + } + +- nsCOMPtr initializer(do_QueryInterface(native)); +- if (initializer) { +- rv = initializer->Initialize(cx, obj, argc, argv); ++ nsCOMPtr initializer18 = ++ do_QueryInterface(native); ++ if (initializer18) { ++ nsCOMPtr owner = do_QueryReferent(aWeakOwner); ++ NS_ENSURE_STATE(owner); ++ rv = initializer18->Initialize(owner, cx, obj, argc, argv); + if (NS_FAILED(rv)) { + return NS_ERROR_NOT_INITIALIZED; + } ++ } else { ++ nsCOMPtr initializer(do_QueryInterface(native)); ++ if (initializer) { ++ rv = initializer->Initialize(cx, obj, argc, argv); ++ if (NS_FAILED(rv)) { ++ return NS_ERROR_NOT_INITIALIZED; ++ } ++ } + } + + nsCOMPtr owner(do_QueryInterface(native)); +@@ -4598,8 +4610,11 @@ + class nsDOMConstructor : public nsIDOMConstructor + { + public: +- nsDOMConstructor(const PRUnichar *aName) +- : mClassName(aName) ++ nsDOMConstructor(const PRUnichar *aName, ++ nsISupports* aOwner) ++ : mClassName(aName), ++ mWeakOwner(do_GetWeakReference(aOwner)) ++ + { + } + +@@ -4635,6 +4650,7 @@ + + private: + const PRUnichar *mClassName; ++ nsWeakPtr mWeakOwner; + }; + + NS_IMPL_ADDREF(nsDOMConstructor) +@@ -4684,7 +4700,7 @@ + return NS_ERROR_DOM_NOT_SUPPORTED_ERR; + } + +- return BaseStubConstructor(name_struct, cx, obj, argc, argv, vp); ++ return BaseStubConstructor(mWeakOwner, name_struct, cx, obj, argc, argv, vp); + } + + nsresult +@@ -5409,7 +5425,8 @@ + + nsRefPtr constructor = + new nsDOMConstructor(NS_REINTERPRET_CAST(PRUnichar *, +- ::JS_GetStringChars(str))); ++ ::JS_GetStringChars(str)), ++ NS_STATIC_CAST(nsPIDOMWindow*, aWin)); + if (!constructor) { + return NS_ERROR_OUT_OF_MEMORY; + } +@@ -5470,7 +5487,8 @@ + + const PRUnichar *name = NS_REINTERPRET_CAST(PRUnichar *, + ::JS_GetStringChars(str)); +- nsRefPtr constructor = new nsDOMConstructor(name); ++ nsRefPtr constructor = ++ new nsDOMConstructor(name, NS_STATIC_CAST(nsPIDOMWindow*, aWin)); + if (!constructor) { + return NS_ERROR_OUT_OF_MEMORY; + } +@@ -5686,7 +5704,8 @@ + } + + if (name_struct->mType == nsGlobalNameStruct::eTypeExternalConstructor) { +- nsRefPtr constructor = new nsDOMConstructor(class_name); ++ nsRefPtr constructor = ++ new nsDOMConstructor(class_name, NS_STATIC_CAST(nsPIDOMWindow*, aWin)); + if (!constructor) { + return NS_ERROR_OUT_OF_MEMORY; + } + +=== modified file 'dom/src/base/nsGlobalWindow.cpp' +--- dom/src/base/nsGlobalWindow.cpp 2008-05-29 16:56:50 +0000 ++++ dom/src/base/nsGlobalWindow.cpp 2008-05-30 15:07:44 +0000 +@@ -6525,8 +6525,21 @@ + } + } + ++ nsCOMPtr ourPrincipal = GetPrincipal(); ++ JSPrincipals *jsprins; ++ rv = ourPrincipal->GetJSPrincipals(cx, &jsprins); ++ if (NS_FAILED(rv)) { ++ timeout->Release(scx); ++ ++ return rv; ++ } ++ ++ // We know that ourPrincipal holds a strong ref to jsprins. ++ JSPRINCIPALS_DROP(cx, jsprins); ++ + const char *filename; +- if (nsJSUtils::GetCallingLocation(cx, &filename, &timeout->mLineNo)) { ++ if (nsJSUtils::GetCallingLocation(cx, &filename, &timeout->mLineNo, ++ jsprins)) { + timeout->mFileName = PL_strdup(filename); + + if (!timeout->mFileName) { +@@ -6552,7 +6565,6 @@ + } + + PRBool subsumes = PR_FALSE; +- nsCOMPtr ourPrincipal = GetPrincipal(); + + // Note the direction of this test: We don't allow chrome setTimeouts on + // content windows, but we do allow content setTimeouts on chrome windows. + +=== modified file 'dom/src/base/nsJSUtils.cpp' +--- dom/src/base/nsJSUtils.cpp 2008-05-29 16:56:50 +0000 ++++ dom/src/base/nsJSUtils.cpp 2008-05-30 15:07:44 +0000 +@@ -1,4 +1,5 @@ + /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ ++/* vim: set ts=2 sw=2 et tw=78: */ + /* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * +@@ -58,11 +59,12 @@ + #include "nsDOMClassInfo.h" + #include "nsIDOMGCParticipant.h" + #include "nsIWeakReference.h" ++#include "nsIScriptSecurityManager.h" + + + JSBool + nsJSUtils::GetCallingLocation(JSContext* aContext, const char* *aFilename, +- PRUint32 *aLineno) ++ PRUint32* aLineno, JSPrincipals* aPrincipals) + { + // Get the current filename and line number + JSStackFrame* frame = nsnull; +@@ -76,6 +78,37 @@ + } while (frame && !script); + + if (script) { ++ // If aPrincipals is non-null then our caller is asking us to ensure ++ // that the filename we return does not have elevated privileges. ++ if (aPrincipals) { ++ // The principals might not be in the script, but we can always ++ // find the right principals in the frame's callee. ++ JSPrincipals* scriptPrins = JS_GetScriptPrincipals(aContext, script); ++ if (!scriptPrins) { ++ JSObject *callee = JS_GetFrameCalleeObject(aContext, frame); ++ nsCOMPtr prin; ++ nsIScriptSecurityManager *ssm = nsContentUtils::GetSecurityManager(); ++ if (NS_FAILED(ssm->GetObjectPrincipal(aContext, callee, ++ getter_AddRefs(prin))) || ++ !prin) { ++ return JS_FALSE; ++ } ++ ++ prin->GetJSPrincipals(aContext, &scriptPrins); ++ ++ // The script has a reference to the principals. ++ JSPRINCIPALS_DROP(aContext, scriptPrins); ++ } ++ ++ // Return the weaker of the two principals if they differ. ++ if (scriptPrins != aPrincipals && ++ scriptPrins->subsume(scriptPrins, aPrincipals)) { ++ *aFilename = aPrincipals->codebase; ++ *aLineno = 0; ++ return JS_TRUE; ++ } ++ } ++ + const char* filename = ::JS_GetScriptFilename(aContext, script); + + if (filename) { + +=== modified file 'dom/src/base/nsJSUtils.h' +--- dom/src/base/nsJSUtils.h 2008-05-29 16:56:50 +0000 ++++ dom/src/base/nsJSUtils.h 2008-05-30 15:07:44 +0000 +@@ -60,7 +60,7 @@ + { + public: + static JSBool GetCallingLocation(JSContext* aContext, const char* *aFilename, +- PRUint32 *aLineno); ++ PRUint32* aLineno, JSPrincipals* aPrincipals); + + static jsval ConvertStringToJSVal(const nsString& aProp, + JSContext* aContext); + +=== modified file 'js/src/jsapi.c' +--- js/src/jsapi.c 2008-05-29 16:56:50 +0000 ++++ js/src/jsapi.c 2008-05-30 15:08:08 +0000 +@@ -1385,6 +1385,7 @@ + {js_InitObjectClass, EAGER_ATOM(toString), NULL}, + {js_InitObjectClass, EAGER_ATOM(toLocaleString), NULL}, + {js_InitObjectClass, EAGER_ATOM(valueOf), NULL}, ++ {js_InitObjectClass, EAGER_ATOM(eval), NULL}, + #if JS_HAS_OBJ_WATCHPOINT + {js_InitObjectClass, LAZY_ATOM(watch), NULL}, + {js_InitObjectClass, LAZY_ATOM(unwatch), NULL}, +@@ -2056,7 +2057,7 @@ + *idp = INT_JSVAL_TO_JSID(v); + } else { + #if JS_HAS_XML_SUPPORT +- if (JSVAL_IS_OBJECT(v)) { ++ if (!JSVAL_IS_PRIMITIVE(v)) { + *idp = OBJECT_JSVAL_TO_JSID(v); + return JS_TRUE; + } +@@ -4062,6 +4063,7 @@ + JSTokenStream *ts; + JSFunction *fun; + JSAtom *funAtom, *argAtom; ++ JSTempValueRooter tvr; + uintN i; + + CHECK_REQUEST(cx); +@@ -4069,7 +4071,7 @@ + ts = js_NewTokenStream(cx, chars, length, filename, lineno, principals); + if (!ts) { + fun = NULL; +- goto out; ++ goto out2; + } + if (!name) { + funAtom = NULL; +@@ -4077,12 +4079,15 @@ + funAtom = js_Atomize(cx, name, strlen(name), 0); + if (!funAtom) { + fun = NULL; +- goto out; ++ goto out2; + } + } + fun = js_NewFunction(cx, NULL, NULL, nargs, 0, obj, funAtom); + if (!fun) + goto out; ++ ++ /* From this point the control must flow through the label out. */ ++ JS_PUSH_TEMP_ROOT_FUNCTION(cx, fun, &tvr); + if (nargs) { + for (i = 0; i < nargs; i++) { + argAtom = js_Atomize(cx, argnames[i], strlen(argnames[i]), 0); +@@ -4112,7 +4117,12 @@ + return NULL; + } + } +-out: ++ ++ out: ++ cx->weakRoots.newborn[GCX_PRIVATE] = (JSGCThing *) fun; ++ JS_POP_TEMP_ROOT(cx, &tvr); ++ ++ out2: + if (ts) + js_CloseTokenStream(cx, ts); + JS_ARENA_RELEASE(&cx->tempPool, mark); + +=== modified file 'js/src/jscntxt.h' +--- js/src/jscntxt.h 2008-05-29 16:56:50 +0000 ++++ js/src/jscntxt.h 2008-05-30 15:08:08 +0000 +@@ -525,132 +525,88 @@ + * a C function across several layers of other functions, use the + * js_LeaveLocalRootScopeWithResult internal API (see further below) instead. + * ++ * The macros also provide a simple way to get a single rooted pointer via ++ * JS_PUSH_TEMP_ROOT_(cx, NULL, &tvr). Then &tvr.u. gives the ++ * necessary pointer. ++ * + * JSTempValueRooter.count defines the type of the rooted value referenced by +- * JSTempValueRooter.u union of type JSTempValueUnion according to the +- * following table: +- * +- * count description +- * JSTVU_SINGLE u.value contains the single value or GC-thing to root. +- * JSTVU_MARKER u.marker holds a hook that GC calls to mark the values. +- * JSTVU_SPROP u.sprop points to the property tree node to mark. +- * JSTVU_WEAK_ROOTS u.weakRoots points to saved weak roots. +- * JSTVU_SCRIPT u.script roots a pointer to JSScript. +- * >= 0 u.array points to a stack-allocated vector of jsvals. ++ * JSTempValueRooter.u union of type JSTempValueUnion. When count is positive ++ * or zero, u.array points to a vector of jsvals. Otherwise it must be one of ++ * the following constants: + */ +-#define JSTVU_SINGLE (-1) +-#define JSTVU_MARKER (-2) +-#define JSTVU_SPROP (-3) +-#define JSTVU_WEAK_ROOTS (-4) +-#define JSTVU_SCRIPT (-5) ++#define JSTVU_SINGLE (-1) /* u.value or u. is single jsval ++ or GC-thing */ ++#define JSTVU_MARKER (-2) /* u.marker is a hook to mark a custom ++ * structure */ ++#define JSTVU_SPROP (-3) /* u.sprop roots property tree node */ ++#define JSTVU_WEAK_ROOTS (-4) /* u.weakRoots points to saved weak roots */ ++#define JSTVU_SCRIPT (-5) /* u.script roots JSScript* */ + + /* +- * To root a single GC-thing pointer, which need not be tagged and stored as a +- * jsval, use JS_PUSH_TEMP_ROOT_GCTHING. The macro reinterprets an arbitrary +- * GC-thing as jsval. It works because a GC-thing is aligned on a 0 mod 8 +- * boundary, and object has the 0 jsval tag. So any GC-thing may be tagged as +- * if it were an object and untagged, if it's then used only as an opaque +- * pointer until discriminated by other means than tag bits (this is how the +- * GC mark function uses its |thing| parameter -- it consults GC-thing flags +- * stored separately from the thing to decide the type of thing). +- * +- * JS_PUSH_TEMP_ROOT_OBJECT and JS_PUSH_TEMP_ROOT_STRING are type-safe +- * alternatives to JS_PUSH_TEMP_ROOT_GCTHING for JSObject and JSString. They +- * also provide a simple way to get a single pointer to rooted JSObject or +- * JSString via JS_PUSH_TEMP_ROOT_(OBJECT|STRTING)(cx, NULL, &tvr). Then +- * &tvr.u.object or tvr.u.string gives the necessary pointer, which puns +- * tvr.u.value safely because JSObject * and JSString * are GC-things and, as +- * such, their tag bits are all zeroes. ++ * Here single JSTVU_SINGLE covers both jsval and pointers to any GC-thing via ++ * reinterpreting the thing as JSVAL_OBJECT. It works because the GC-thing is ++ * aligned on a 0 mod 8 boundary, and object has the 0 jsval tag. So any ++ * GC-thing may be tagged as if it were an object and untagged, if it's then ++ * used only as an opaque pointer until discriminated by other means than tag ++ * bits. This is how, for example, js_GetGCThingTraceKind uses its |thing| ++ * parameter -- it consults GC-thing flags stored separately from the thing to ++ * decide the kind of thing. + * + * The following checks that this type-punning is possible. + */ + JS_STATIC_ASSERT(sizeof(JSTempValueUnion) == sizeof(jsval)); +-JS_STATIC_ASSERT(sizeof(JSTempValueUnion) == sizeof(JSObject *)); ++JS_STATIC_ASSERT(sizeof(JSTempValueUnion) == sizeof(void *)); + +-#define JS_PUSH_TEMP_ROOT_COMMON(cx,tvr) \ ++#define JS_PUSH_TEMP_ROOT_COMMON(cx,x,tvr,cnt,kind) \ + JS_BEGIN_MACRO \ + JS_ASSERT((cx)->tempValueRooters != (tvr)); \ ++ (tvr)->count = (cnt); \ ++ (tvr)->u.kind = (x); \ + (tvr)->down = (cx)->tempValueRooters; \ + (cx)->tempValueRooters = (tvr); \ + JS_END_MACRO + +-#define JS_PUSH_SINGLE_TEMP_ROOT(cx,val,tvr) \ ++#define JS_POP_TEMP_ROOT(cx,tvr) \ + JS_BEGIN_MACRO \ +- (tvr)->count = JSTVU_SINGLE; \ +- (tvr)->u.value = val; \ +- JS_PUSH_TEMP_ROOT_COMMON(cx, tvr); \ ++ JS_ASSERT((cx)->tempValueRooters == (tvr)); \ ++ (cx)->tempValueRooters = (tvr)->down; \ + JS_END_MACRO + + #define JS_PUSH_TEMP_ROOT(cx,cnt,arr,tvr) \ + JS_BEGIN_MACRO \ + JS_ASSERT((ptrdiff_t)(cnt) >= 0); \ +- (tvr)->count = (ptrdiff_t)(cnt); \ +- (tvr)->u.array = (arr); \ +- JS_PUSH_TEMP_ROOT_COMMON(cx, tvr); \ ++ JS_PUSH_TEMP_ROOT_COMMON(cx, arr, tvr, (ptrdiff_t) (cnt), array); \ + JS_END_MACRO + +-#define JS_PUSH_TEMP_ROOT_MARKER(cx,marker_,tvr) \ +- JS_BEGIN_MACRO \ +- (tvr)->count = JSTVU_MARKER; \ +- (tvr)->u.marker = (marker_); \ +- JS_PUSH_TEMP_ROOT_COMMON(cx, tvr); \ +- JS_END_MACRO ++#define JS_PUSH_SINGLE_TEMP_ROOT(cx,val,tvr) \ ++ JS_PUSH_TEMP_ROOT_COMMON(cx, val, tvr, JSTVU_SINGLE, value) + + #define JS_PUSH_TEMP_ROOT_OBJECT(cx,obj,tvr) \ +- JS_BEGIN_MACRO \ +- (tvr)->count = JSTVU_SINGLE; \ +- (tvr)->u.object = (obj); \ +- JS_PUSH_TEMP_ROOT_COMMON(cx, tvr); \ +- JS_END_MACRO ++ JS_PUSH_TEMP_ROOT_COMMON(cx, obj, tvr, JSTVU_SINGLE, object) + + #define JS_PUSH_TEMP_ROOT_STRING(cx,str,tvr) \ +- JS_BEGIN_MACRO \ +- (tvr)->count = JSTVU_SINGLE; \ +- (tvr)->u.string = (str); \ +- JS_PUSH_TEMP_ROOT_COMMON(cx, tvr); \ +- JS_END_MACRO +- +-#define JS_PUSH_TEMP_ROOT_GCTHING(cx,thing,tvr) \ +- JS_BEGIN_MACRO \ +- JS_ASSERT(JSVAL_IS_OBJECT((jsval)thing)); \ +- (tvr)->count = JSTVU_SINGLE; \ +- (tvr)->u.gcthing = (thing); \ +- JS_PUSH_TEMP_ROOT_COMMON(cx, tvr); \ +- JS_END_MACRO +- +-#define JS_POP_TEMP_ROOT(cx,tvr) \ +- JS_BEGIN_MACRO \ +- JS_ASSERT((cx)->tempValueRooters == (tvr)); \ +- (cx)->tempValueRooters = (tvr)->down; \ +- JS_END_MACRO +- +-#define JS_TEMP_ROOT_EVAL(cx,cnt,val,expr) \ +- JS_BEGIN_MACRO \ +- JSTempValueRooter tvr; \ +- JS_PUSH_TEMP_ROOT(cx, cnt, val, &tvr); \ +- (expr); \ +- JS_POP_TEMP_ROOT(cx, &tvr); \ +- JS_END_MACRO ++ JS_PUSH_TEMP_ROOT_COMMON(cx, str, tvr, JSTVU_SINGLE, string) ++ ++#define JS_PUSH_TEMP_ROOT_FUNCTION(cx,fun,tvr) \ ++ JS_PUSH_TEMP_ROOT_COMMON(cx, fun, tvr, JSTVU_SINGLE, function) ++ ++#define JS_PUSH_TEMP_ROOT_QNAME(cx,qn,tvr) \ ++ JS_PUSH_TEMP_ROOT_COMMON(cx, qn, tvr, JSTVU_SINGLE, qname) ++ ++#define JS_PUSH_TEMP_ROOT_XML(cx,xml_,tvr) \ ++ JS_PUSH_TEMP_ROOT_COMMON(cx, xml_, tvr, JSTVU_SINGLE, xml) ++ ++#define JS_PUSH_TEMP_ROOT_MARKER(cx,marker_,tvr) \ ++ JS_PUSH_TEMP_ROOT_COMMON(cx, marker_, tvr, JSTVU_MARKER, marker) + + #define JS_PUSH_TEMP_ROOT_SPROP(cx,sprop_,tvr) \ +- JS_BEGIN_MACRO \ +- (tvr)->count = JSTVU_SPROP; \ +- (tvr)->u.sprop = (sprop_); \ +- JS_PUSH_TEMP_ROOT_COMMON(cx, tvr); \ +- JS_END_MACRO ++ JS_PUSH_TEMP_ROOT_COMMON(cx, sprop_, tvr, JSTVU_SPROP, sprop) + + #define JS_PUSH_TEMP_ROOT_WEAK_COPY(cx,weakRoots_,tvr) \ +- JS_BEGIN_MACRO \ +- (tvr)->count = JSTVU_WEAK_ROOTS; \ +- (tvr)->u.weakRoots = (weakRoots_); \ +- JS_PUSH_TEMP_ROOT_COMMON(cx, tvr); \ +- JS_END_MACRO ++ JS_PUSH_TEMP_ROOT_COMMON(cx, weakRoots_, tvr, JSTVU_WEAK_ROOTS, weakRoots) + + #define JS_PUSH_TEMP_ROOT_SCRIPT(cx,script_,tvr) \ +- JS_BEGIN_MACRO \ +- (tvr)->count = JSTVU_SCRIPT; \ +- (tvr)->u.script = (script_); \ +- JS_PUSH_TEMP_ROOT_COMMON(cx, tvr); \ +- JS_END_MACRO ++ JS_PUSH_TEMP_ROOT_COMMON(cx, script_, tvr, JSTVU_SCRIPT, script) + + struct JSContext { + /* JSRuntime contextList linkage. */ + +=== modified file 'js/src/jsfun.c' +--- js/src/jsfun.c 2008-05-29 16:56:50 +0000 ++++ js/src/jsfun.c 2008-05-30 15:08:08 +0000 +@@ -1855,9 +1855,14 @@ + JS_ASSERT(!fp->script && fp->fun && fp->fun->u.n.native == Function); + caller = JS_GetScriptedCaller(cx, fp); + if (caller) { +- filename = caller->script->filename; +- lineno = js_PCToLineNumber(cx, caller->script, caller->pc); + principals = JS_EvalFramePrincipals(cx, fp, caller); ++ if (principals == caller->script->principals) { ++ filename = caller->script->filename; ++ lineno = js_PCToLineNumber(cx, caller->script, caller->pc); ++ } else { ++ filename = principals->codebase; ++ lineno = 0; ++ } + } else { + filename = NULL; + lineno = 0; +@@ -2262,7 +2267,7 @@ + + caller = JS_GetScriptedCaller(cx, cx->fp); + if (caller) { +- principals = caller->script->principals; ++ principals = JS_StackFramePrincipals(cx, caller); + } else { + /* No scripted caller, don't allow access. */ + principals = NULL; + +=== modified file 'js/src/jsinterp.c' +--- js/src/jsinterp.c 2008-05-29 16:56:50 +0000 ++++ js/src/jsinterp.c 2008-05-30 15:08:08 +0000 +@@ -144,9 +144,11 @@ + * homes in fp, when calling out of the interpreter loop or threaded code. + * RESTORE_SP_AND_PC copies the other way, to update registers after a call + * to a subroutine that interprets a piece of the current script. ++ * ASSERT_SAVED_SP_AND_PC checks that SAVE_SP_AND_PC was called. + */ + #define SAVE_SP_AND_PC(fp) (SAVE_SP(fp), (fp)->pc = pc) + #define RESTORE_SP_AND_PC(fp) (RESTORE_SP(fp), pc = (fp)->pc) ++#define ASSERT_SAVED_SP_AND_PC(fp) JS_ASSERT((fp)->sp == sp && (fp)->pc == pc); + + /* + * Push the generating bytecode's pc onto the parallel pc stack that runs +@@ -173,6 +175,7 @@ + if (JSDOUBLE_IS_INT(d, i_) && INT_FITS_IN_JSVAL(i_)) { \ + v_ = INT_TO_JSVAL(i_); \ + } else { \ ++ SAVE_SP_AND_PC(fp); \ + ok = js_NewDoubleValue(cx, d, &v_); \ + if (!ok) \ + goto out; \ +@@ -187,6 +190,7 @@ + if (INT_FITS_IN_JSVAL(i)) { \ + v_ = INT_TO_JSVAL(i); \ + } else { \ ++ SAVE_SP_AND_PC(fp); \ + ok = js_NewDoubleValue(cx, (jsdouble)(i), &v_); \ + if (!ok) \ + goto out; \ +@@ -201,6 +205,7 @@ + if ((u) <= JSVAL_INT_MAX) { \ + v_ = INT_TO_JSVAL(u); \ + } else { \ ++ SAVE_SP_AND_PC(fp); \ + ok = js_NewDoubleValue(cx, (jsdouble)(u), &v_); \ + if (!ok) \ + goto out; \ +@@ -3348,10 +3353,10 @@ + JS_ASSERT(INT_FITS_IN_JSVAL(i)); + rval = INT_TO_JSVAL(i); + } else { ++ SAVE_SP_AND_PC(fp); + if (JSVAL_IS_DOUBLE(rval)) { + d = *JSVAL_TO_DOUBLE(rval); + } else { +- SAVE_SP_AND_PC(fp); + ok = js_ValueToNumber(cx, rval, &d); + if (!ok) + goto out; +@@ -5123,7 +5128,8 @@ + id = ATOM_TO_JSID(atom); + goto gs_get_lval; + +- case JSOP_INITELEM: ++ default: ++ JS_ASSERT(op2 == JSOP_INITELEM); + JS_ASSERT(sp - fp->spbase >= 3); + rval = FETCH_OPND(-1); + FETCH_ELEMENT_ID(-2, id); +@@ -5133,9 +5139,6 @@ + JS_ASSERT(JSVAL_IS_OBJECT(lval)); + obj = JSVAL_TO_OBJECT(lval); + break; +- +- default: +- JS_ASSERT(0); + } + + /* Ensure that id has a type suitable for use with obj. */ +@@ -5978,6 +5981,7 @@ + ASSERT_NOT_THROWING(cx); + if (fp->flags & JSFRAME_FILTERING) { + /* FIXME: bug 309894 -- fix to eliminate this error. */ ++ SAVE_SP_AND_PC(fp); + JS_ReportErrorNumberUC(cx, js_GetErrorMessage, NULL, + JSMSG_YIELD_FROM_FILTER); + ok = JS_FALSE; +@@ -6201,7 +6205,10 @@ + + atom_not_defined: + { +- const char *printable = js_AtomToPrintableString(cx, atom); ++ const char *printable; ++ ++ ASSERT_SAVED_SP_AND_PC(fp); ++ printable = js_AtomToPrintableString(cx, atom); + if (printable) + js_ReportIsNotDefined(cx, printable); + ok = JS_FALSE; + +=== modified file 'js/src/jsobj.c' +--- js/src/jsobj.c 2008-05-29 16:56:50 +0000 ++++ js/src/jsobj.c 2008-05-30 15:08:08 +0000 +@@ -1260,13 +1260,19 @@ + JS_ASSERT(!caller || caller->pc); + indirectCall = (caller && *caller->pc != JSOP_EVAL); + +- if (indirectCall && +- !JS_ReportErrorFlagsAndNumber(cx, +- JSREPORT_WARNING | JSREPORT_STRICT, +- js_GetErrorMessage, NULL, +- JSMSG_BAD_INDIRECT_CALL, +- js_eval_str)) { +- return JS_FALSE; ++ /* ++ * Note: This restriction allows for Array.map(array, eval), but does not ++ * allow the user to pass a this parameter that isn't a global object. ++ */ ++ if (indirectCall || OBJ_GET_PARENT(cx, obj)) { ++ uintN flags = (OBJ_GET_PARENT(cx, obj) != NULL) ++ ? JSREPORT_ERROR ++ : JSREPORT_WARNING | JSREPORT_STRICT; ++ if (!JS_ReportErrorFlagsAndNumber(cx, flags, js_GetErrorMessage, NULL, ++ JSMSG_BAD_INDIRECT_CALL, ++ js_eval_str)) { ++ return JS_FALSE; ++ } + } + + if (!JSVAL_IS_STRING(argv[0])) { +@@ -1776,7 +1782,6 @@ + {js_toString_str, js_obj_toString, 0, 0, OBJ_TOSTRING_EXTRA}, + {js_toLocaleString_str, js_obj_toLocaleString, 0, 0, OBJ_TOSTRING_EXTRA}, + {js_valueOf_str, obj_valueOf, 0,0,0}, +- {js_eval_str, obj_eval, 1,0,0}, + #if JS_HAS_OBJ_WATCHPOINT + {js_watch_str, obj_watch, 2,0,0}, + {js_unwatch_str, obj_unwatch, 1,0,0}, +@@ -2230,22 +2235,15 @@ + js_InitObjectClass(JSContext *cx, JSObject *obj) + { + JSObject *proto; +- jsval eval; + + proto = JS_InitClass(cx, obj, NULL, &js_ObjectClass, Object, 1, + object_props, object_methods, NULL, NULL); + if (!proto) + return NULL; + +- /* ECMA (15.1.2.1) says 'eval' is also a property of the global object. */ +- if (!OBJ_GET_PROPERTY(cx, proto, +- ATOM_TO_JSID(cx->runtime->atomState.evalAtom), +- &eval)) { +- return NULL; +- } +- if (!OBJ_DEFINE_PROPERTY(cx, obj, +- ATOM_TO_JSID(cx->runtime->atomState.evalAtom), +- eval, NULL, NULL, 0, NULL)) { ++ /* ECMA (15.1.2.1) says 'eval' is a property of the global object. */ ++ if (!js_DefineFunction(cx, obj, cx->runtime->atomState.evalAtom, ++ obj_eval, 1, 0)) { + return NULL; + } + + +=== modified file 'js/src/jsparse.c' +--- js/src/jsparse.c 2008-05-29 16:56:50 +0000 ++++ js/src/jsparse.c 2008-05-30 15:08:08 +0000 +@@ -4431,7 +4431,7 @@ + + /* Pick JSOP_EVAL and flag tc as heavyweight if eval(...). */ + pn2->pn_op = JSOP_CALL; +- if (pn->pn_op == JSOP_NAME && ++ if (pn->pn_arity == PN_NAME && + pn->pn_atom == cx->runtime->atomState.evalAtom) { + pn2->pn_op = JSOP_EVAL; + tc->flags |= TCF_FUN_HEAVYWEIGHT; + +=== modified file 'js/src/jsprvtd.h' +--- js/src/jsprvtd.h 2008-05-29 16:56:50 +0000 ++++ js/src/jsprvtd.h 2008-05-30 15:08:08 +0000 +@@ -212,7 +212,9 @@ + jsval value; + JSObject *object; + JSString *string; +- void *gcthing; ++ JSFunction *function; ++ JSXML *xml; ++ JSXMLQName *qname; + JSTempValueMarker marker; + JSScopeProperty *sprop; + JSWeakRoots *weakRoots; + +=== modified file 'js/src/jsxml.c' +--- js/src/jsxml.c 2008-05-29 16:56:50 +0000 ++++ js/src/jsxml.c 2008-05-30 15:08:08 +0000 +@@ -3108,7 +3108,7 @@ + if (!qn) + return NULL; + +- JS_PUSH_TEMP_ROOT_GCTHING(cx, qn, &tvr); ++ JS_PUSH_TEMP_ROOT_QNAME(cx, qn, &tvr); + obj = js_GetAttributeNameObject(cx, qn); + JS_POP_TEMP_ROOT(cx, &tvr); + if (!obj) +@@ -7574,7 +7574,7 @@ + xml = js_NewXML(cx, xml_class); + if (!xml) + return NULL; +- JS_PUSH_TEMP_ROOT_GCTHING(cx, xml, &tvr); ++ JS_PUSH_TEMP_ROOT_XML(cx, xml, &tvr); + obj = js_GetXMLObject(cx, xml); + JS_POP_TEMP_ROOT(cx, &tvr); + return obj; +@@ -8194,7 +8194,7 @@ + JSBool ok, match; + JSStackFrame *fp; + uint32 flags; +- JSObject *scobj, *listobj, *resobj, *withobj, *kidobj; ++ JSObject *scobj, *listobj, *resobj, *withobj, *kidobj, *obj2; + JSXML *xml, *list, *result, *kid; + JSXMLArrayCursor cursor; + +@@ -8245,6 +8245,15 @@ + break; + OBJ_SET_PROTO(cx, withobj, kidobj); + ok = js_Interpret(cx, pc, vp) && js_ValueToBoolean(cx, *vp, &match); ++ for (obj2 = fp->scopeChain; ++ obj2 != withobj; ++ obj2 = OBJ_GET_PARENT(cx, obj2)) { ++ if (OBJ_GET_CLASS(cx, obj2) == &js_BlockClass) { ++ if (JS_GetPrivate(cx, obj2) != fp) ++ break; ++ ok &= js_PutBlockObject(cx, obj2); ++ } ++ } + if (ok && match) + ok = Append(cx, result, kid); + if (!ok) + +=== modified file 'js/src/xpconnect/src/XPCNativeWrapper.cpp' +--- js/src/xpconnect/src/XPCNativeWrapper.cpp 2008-05-29 16:56:50 +0000 ++++ js/src/xpconnect/src/XPCNativeWrapper.cpp 2008-05-30 15:08:09 +0000 +@@ -223,6 +223,32 @@ + return ID_TO_VALUE(rt->GetStringID(index)); + } + ++static inline ++JSBool ++EnsureLegalActivity(JSContext *cx, JSObject *obj) ++{ ++ jsval flags; ++ ++ ::JS_GetReservedSlot(cx, obj, 0, &flags); ++ if (HAS_FLAGS(flags, FLAG_EXPLICIT)) { ++ // Can't make any assertions about the owner of this wrapper. ++ return JS_TRUE; ++ } ++ ++ JSStackFrame *frame = nsnull; ++ uint32 fileFlags = JS_GetTopScriptFilenameFlags(cx, NULL); ++ if (!JS_FrameIterator(cx, &frame) || ++ fileFlags == JSFILENAME_NULL || ++ (fileFlags & JSFILENAME_SYSTEM)) { ++ // We expect implicit native wrappers in system files. ++ return JS_TRUE; ++ } ++ ++ // Otherwise, we're looking at a non-system file with a handle on an ++ // implcit wrapper. This is a bug! Deny access. ++ return ThrowException(NS_ERROR_XPC_SECURITY_MANAGER_VETO, cx); ++} ++ + static JSBool + WrapFunction(JSContext* cx, JSObject* funobj, jsval *rval) + { +@@ -264,6 +290,25 @@ + JS_STATIC_DLL_CALLBACK(JSBool) + XPC_NW_AddProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) + { ++ JSProperty *prop; ++ JSObject *objp; ++ jsid idAsId; ++ ++ if (!::JS_ValueToId(cx, id, &idAsId) || ++ !OBJ_LOOKUP_PROPERTY(cx, obj, idAsId, &objp, &prop)) { ++ return JS_FALSE; ++ } ++ ++ // Do not allow scripted getters or setters on XPCNativeWrappers. ++ NS_ASSERTION(prop && objp == obj, "Wasn't this property just added?"); ++ JSScopeProperty *sprop = (JSScopeProperty *) prop; ++ if (sprop->attrs & (JSPROP_GETTER | JSPROP_SETTER)) { ++ OBJ_DROP_PROPERTY(cx, objp, prop); ++ return ThrowException(NS_ERROR_ILLEGAL_VALUE, cx); ++ } ++ ++ OBJ_DROP_PROPERTY(cx, objp, prop); ++ + jsval flags; + ::JS_GetReservedSlot(cx, obj, 0, &flags); + if (!HAS_FLAGS(flags, FLAG_RESOLVING)) { +@@ -272,12 +317,17 @@ + + // Note: no need to protect *vp from GC here, since it's already in the slot + // on |obj|. +- return RewrapIfDeepWrapper(cx, obj, *vp, vp); ++ return EnsureLegalActivity(cx, obj) && ++ RewrapIfDeepWrapper(cx, obj, *vp, vp); + } + + JS_STATIC_DLL_CALLBACK(JSBool) + XPC_NW_DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) + { ++ if (!EnsureLegalActivity(cx, obj)) { ++ return JS_FALSE; ++ } ++ + XPC_NW_BYPASS_BASE(cx, obj, + // We're being notified of a delete operation on id in this + // XPCNativeWrapper, so forward to the right high-level hook, +@@ -421,6 +471,10 @@ + } + } + ++ if (!EnsureLegalActivity(cx, obj)) { ++ return JS_FALSE; ++ } ++ + XPCWrappedNative *wrappedNative = + XPCNativeWrapper::GetWrappedNative(cx, obj); + +@@ -630,6 +684,10 @@ + // JS_Enumerate API. Then reflect properties named by the enumerated + // identifiers from the wrapped native to the native wrapper. + ++ if (!EnsureLegalActivity(cx, obj)) { ++ return JS_FALSE; ++ } ++ + XPCWrappedNative *wn = XPCNativeWrapper::GetWrappedNative(cx, obj); + if (!wn) { + return JS_TRUE; +@@ -688,6 +746,10 @@ + return JS_TRUE; + } + ++ if (!EnsureLegalActivity(cx, obj)) { ++ return JS_FALSE; ++ } ++ + if (id == GetStringByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) { + *objp = obj; + return JS_DefineFunction(cx, obj, "toString", +@@ -903,8 +965,11 @@ + JS_STATIC_DLL_CALLBACK(JSBool) + XPC_NW_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp) + { ++ if (!EnsureLegalActivity(cx, obj)) { ++ return JS_FALSE; ++ } ++ + XPC_NW_BYPASS(cx, obj, convert, (cx, obj, type, vp)); +- + return JS_TRUE; + } + +@@ -1261,6 +1326,10 @@ + } + } + ++ if (!EnsureLegalActivity(cx, obj)) { ++ return JS_FALSE; ++ } ++ + // Check whether toString was overridden in any object along + // the wrapped native's object's prototype chain. + XPCJSRuntime *rt = nsXPConnect::GetRuntime(); + +=== modified file 'js/src/xpconnect/src/nsXPConnect.cpp' +--- js/src/xpconnect/src/nsXPConnect.cpp 2008-05-29 16:56:50 +0000 ++++ js/src/xpconnect/src/nsXPConnect.cpp 2008-05-30 15:08:09 +0000 +@@ -420,6 +420,23 @@ + return rv; + } + ++class SaveFrame ++{ ++public: ++ SaveFrame(JSContext *cx) ++ : mJSContext(cx) { ++ mFrame = JS_SaveFrameChain(mJSContext); ++ } ++ ++ ~SaveFrame() { ++ JS_RestoreFrameChain(mJSContext, mFrame); ++ } ++ ++private: ++ JSContext *mJSContext; ++ JSStackFrame *mFrame; ++}; ++ + /* void initClasses (in JSContextPtr aJSContext, in JSObjectPtr aGlobalJSObj); */ + NS_IMETHODIMP + nsXPConnect::InitClasses(JSContext * aJSContext, JSObject * aGlobalJSObj) +@@ -427,6 +444,7 @@ + NS_ASSERTION(aJSContext, "bad param"); + NS_ASSERTION(aGlobalJSObj, "bad param"); + ++ SaveFrame sf(aJSContext); + XPCCallContext ccx(NATIVE_CALLER, aJSContext); + if(!ccx.IsValid()) + return UnexpectedFailure(NS_ERROR_FAILURE); +@@ -561,6 +579,7 @@ + JS_SetPrototype(aJSContext, protoJSObject, scope->GetPrototypeJSObject()); + } + ++ SaveFrame sf(ccx); + if(!nsXPCComponents::AttachNewComponentsObject(ccx, scope, globalJSObj)) + return UnexpectedFailure(NS_ERROR_FAILURE); + + +=== modified file 'layout/base/nsCSSFrameConstructor.cpp' +--- layout/base/nsCSSFrameConstructor.cpp 2008-05-29 16:56:50 +0000 ++++ layout/base/nsCSSFrameConstructor.cpp 2008-05-30 15:08:09 +0000 +@@ -12659,7 +12659,10 @@ + NS_ASSERTION(letterContent->GetBindingParent() != letterContent, + "Reframes of this letter frame will mess with the root of a " + "native anonymous content subtree!"); +- InitAndRestoreFrame(aState, letterContent, aParentFrame, aStyleContext, ++ InitAndRestoreFrame(aState, letterContent, ++ aState.GetGeometricParent(aStyleContext->GetStyleDisplay(), ++ aParentFrame), ++ aStyleContext, + nsnull, letterFrame); + + // Init the text frame to refer to the letter frame. Make sure we + +=== modified file 'layout/base/nsLayoutAtomList.h' +--- layout/base/nsLayoutAtomList.h 2008-05-29 16:56:50 +0000 ++++ layout/base/nsLayoutAtomList.h 2008-05-30 15:08:09 +0000 +@@ -111,6 +111,7 @@ + LAYOUT_ATOM(letterFrame, "LetterFrame") + LAYOUT_ATOM(lineFrame, "LineFrame") + LAYOUT_ATOM(listControlFrame,"ListControlFrame") ++LAYOUT_ATOM(menuPopupFrame, "MenuPopupFrame") + LAYOUT_ATOM(objectFrame, "ObjectFrame") + LAYOUT_ATOM(pageFrame, "PageFrame") + LAYOUT_ATOM(pageBreakFrame, "PageBreakFrame") + +=== modified file 'layout/build/nsLayoutModule.cpp' +--- layout/build/nsLayoutModule.cpp 2008-05-29 16:56:50 +0000 ++++ layout/build/nsLayoutModule.cpp 2008-05-30 15:08:10 +0000 +@@ -196,7 +196,7 @@ + #endif // MOZ_SVG + + NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMSerializer) +-NS_GENERIC_FACTORY_CONSTRUCTOR(nsXMLHttpRequest) ++NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsXMLHttpRequest, Init) + NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMParser) + + //----------------------------------------------------------------------------- + +=== modified file 'layout/generic/nsFrame.cpp' +--- layout/generic/nsFrame.cpp 2008-05-29 17:00:54 +0000 ++++ layout/generic/nsFrame.cpp 2008-05-30 15:08:10 +0000 +@@ -1752,6 +1752,10 @@ + return NS_OK; + + frameselection->StopAutoScrollTimer(); ++ // If we have capturing view, it must be ensured that |this| doesn't ++ // get deleted during HandleDrag. ++ nsWeakFrame weakFrame = GetNearestCapturingView(this) ? this : nsnull; ++ + // Check if we are dragging in a table cell + nsCOMPtr parentContent; + PRInt32 contentOffset; +@@ -1766,14 +1770,16 @@ + else + frameselection->HandleDrag(aPresContext, this, aEvent->point); + +- nsIView* captureView = GetNearestCapturingView(this); +- if (captureView) { +- // Get the view that aEvent->point is relative to. This is disgusting. +- nsPoint dummyPoint; +- nsIView* eventView; +- GetOffsetFromView(dummyPoint, &eventView); +- nsPoint pt = aEvent->point + eventView->GetOffsetTo(captureView); +- frameselection->StartAutoScrollTimer(aPresContext, captureView, pt, 30); ++ if (weakFrame) { ++ nsIView* captureView = GetNearestCapturingView(this); ++ if (captureView) { ++ // Get the view that aEvent->point is relative to. This is disgusting. ++ nsPoint dummyPoint; ++ nsIView* eventView; ++ GetOffsetFromView(dummyPoint, &eventView); ++ nsPoint pt = aEvent->point + eventView->GetOffsetTo(captureView); ++ frameselection->StartAutoScrollTimer(aPresContext, captureView, pt, 30); ++ } + } + + return NS_OK; + +=== modified file 'layout/generic/nsInlineFrame.cpp' +--- layout/generic/nsInlineFrame.cpp 2008-05-29 16:56:50 +0000 ++++ layout/generic/nsInlineFrame.cpp 2008-05-30 15:08:10 +0000 +@@ -339,6 +339,11 @@ + aOurLineContainer->GetPrevInFlow(), + "Don't call this when we have no continuation, it's a waste"); + ++ if (!aFrame) { ++ NS_ASSERTION(aReparentSiblings, "Why did we get called?"); ++ return; ++ } ++ + nsIFrame* ancestor = aFrame; + nsIFrame* ancestorBlockChild; + do { + +=== modified file 'layout/generic/nsSelection.cpp' +--- layout/generic/nsSelection.cpp 2008-05-29 16:56:50 +0000 ++++ layout/generic/nsSelection.cpp 2008-05-30 15:08:10 +0000 +@@ -7996,6 +7996,7 @@ + return NS_OK; + } + PRInt32 cnt = mSelectionListeners.Count(); ++ nsCOMArray selectionListeners(mSelectionListeners); + + nsCOMPtr domdoc; + nsCOMPtr shell; +@@ -8005,7 +8006,7 @@ + short reason = mFrameSelection->PopReason(); + for (PRInt32 i = 0; i < cnt; i++) + { +- nsISelectionListener* thisListener = mSelectionListeners[i]; ++ nsISelectionListener* thisListener = selectionListeners[i]; + if (thisListener) + thisListener->NotifySelectionChanged(domdoc, this, reason); + } + +=== modified file 'layout/xul/base/src/nsMenuPopupFrame.h' +--- layout/xul/base/src/nsMenuPopupFrame.h 2008-05-29 16:56:50 +0000 ++++ layout/xul/base/src/nsMenuPopupFrame.h 2008-05-30 15:08:18 +0000 +@@ -54,6 +54,7 @@ + #include "nsBoxFrame.h" + #include "nsIMenuParent.h" + #include "nsIWidget.h" ++#include "nsLayoutAtoms.h" + + #include "nsITimer.h" + +@@ -188,6 +189,8 @@ + + NS_IMETHOD KillCloseTimer(); + ++ virtual nsIAtom* GetType() const { return nsLayoutAtoms::menuPopupFrame; } ++ + #ifdef DEBUG + NS_IMETHOD GetFrameName(nsAString& aResult) const + { + +=== modified file 'layout/xul/base/src/nsPopupBoxObject.cpp' +--- layout/xul/base/src/nsPopupBoxObject.cpp 2008-05-29 16:56:50 +0000 ++++ layout/xul/base/src/nsPopupBoxObject.cpp 2008-05-30 15:08:18 +0000 +@@ -65,6 +65,13 @@ + nsPopupBoxObject(); + virtual ~nsPopupBoxObject(); + ++ nsMenuPopupFrame* GetMenuPopupFrame() ++ { ++ nsIFrame* frame = GetFrame(); ++ if (frame && frame->GetType() == nsLayoutAtoms::menuPopupFrame) ++ return NS_STATIC_CAST(nsMenuPopupFrame*, frame); ++ return nsnull; ++ } + }; + + /* Implementation file */ +@@ -209,10 +216,7 @@ + NS_IMETHODIMP + nsPopupBoxObject::MoveTo(PRInt32 aLeft, PRInt32 aTop) + { +- nsIFrame* frame = GetFrame(); +- if (!frame) return NS_OK; +- +- nsMenuPopupFrame* menuPopupFrame = NS_STATIC_CAST(nsMenuPopupFrame*, frame); ++ nsMenuPopupFrame* menuPopupFrame = GetMenuPopupFrame(); + if (!menuPopupFrame) return NS_OK; + + menuPopupFrame->MoveTo(aLeft, aTop); +@@ -237,10 +241,7 @@ + NS_IMETHODIMP + nsPopupBoxObject::GetAutoPosition(PRBool* aShouldAutoPosition) + { +- nsIFrame* frame = GetFrame(); +- if (!frame) return NS_OK; +- +- nsMenuPopupFrame* menuPopupFrame = NS_STATIC_CAST(nsMenuPopupFrame*, frame); ++ nsMenuPopupFrame* menuPopupFrame = GetMenuPopupFrame(); + if (!menuPopupFrame) return NS_OK; + + menuPopupFrame->GetAutoPosition(aShouldAutoPosition); +@@ -251,10 +252,7 @@ + NS_IMETHODIMP + nsPopupBoxObject::SetAutoPosition(PRBool aShouldAutoPosition) + { +- nsIFrame* frame = GetFrame(); +- if (!frame) return NS_OK; +- +- nsMenuPopupFrame* menuPopupFrame = NS_STATIC_CAST(nsMenuPopupFrame*, frame); ++ nsMenuPopupFrame* menuPopupFrame = GetMenuPopupFrame(); + if (!menuPopupFrame) return NS_OK; + + menuPopupFrame->SetAutoPosition(aShouldAutoPosition); +@@ -265,10 +263,7 @@ + NS_IMETHODIMP + nsPopupBoxObject::EnableRollup(PRBool aShouldRollup) + { +- nsIFrame* frame = GetFrame(); +- if (!frame) return NS_OK; +- +- nsMenuPopupFrame* menuPopupFrame = NS_STATIC_CAST(nsMenuPopupFrame*, frame); ++ nsMenuPopupFrame* menuPopupFrame = GetMenuPopupFrame(); + if (!menuPopupFrame) return NS_OK; + + menuPopupFrame->EnableRollup(aShouldRollup); +@@ -279,10 +274,7 @@ + NS_IMETHODIMP + nsPopupBoxObject::EnableKeyboardNavigator(PRBool aEnableKeyboardNavigator) + { +- nsIFrame* frame = GetFrame(); +- if (!frame) return NS_OK; +- +- nsMenuPopupFrame* menuPopupFrame = NS_STATIC_CAST(nsMenuPopupFrame*, frame); ++ nsMenuPopupFrame* menuPopupFrame = GetMenuPopupFrame(); + if (!menuPopupFrame) return NS_OK; + + if (aEnableKeyboardNavigator) + +=== modified file 'mail/app/icons/gtk/messengerWindow.xpm' +--- mail/app/icons/gtk/messengerWindow.xpm 2008-05-29 16:56:50 +0000 ++++ mail/app/icons/gtk/messengerWindow.xpm 2008-05-30 15:15:15 +0000 +@@ -1,295 +1,278 @@ +-/* XPM */ +-static char *messengerWindow.xpm[] = { +-/* columns rows colors chars-per-pixel */ +-"32 32 257 2", +-" c #000000", +-". c #080704", +-"X c #0b0a03", +-"o c #010912", +-"O c #15130d", +-"+ c #1e1810", +-"@ c #021326", +-"# c #021a33", +-"$ c #282117", +-"% c #2b241b", +-"& c #342b1c", +-"* c #3e311d", +-"= c #38381c", +-"- c #3a3628", +-"; c #3a3122", +-": c #3d3e3b", +-"> c #06175e", +-", c #04284e", +-"< c #04264b", +-"1 c #05255e", +-"2 c #08227d", +-"3 c #053464", +-"4 c #0f3c75", +-"5 c #1a257a", +-"6 c #323641", +-"7 c #313940", +-"8 c #393848", +-"9 c #26394a", +-"0 c #273b62", +-"q c #06407f", +-"w c #16406c", +-"e c #1a4571", +-"r c #3c4449", +-"t c #24476c", +-"y c #40321e", +-"u c #423624", +-"i c #473925", +-"p c #403d2e", +-"a c #4b3d29", +-"s c #4e412d", +-"d c #4b4538", +-"f c #50422c", +-"g c #524632", +-"h c #564932", +-"j c #5c4e39", +-"k c #564b37", +-"l c #5d503b", +-"z c #62543d", +-"x c #7f7f3f", +-"c c #404a4d", +-"v c #4a4647", +-"b c #4a4d4d", +-"n c #484754", +-"m c #424e59", +-"M c #5b5548", +-"N c #4d546e", +-"B c #5a6368", +-"V c #665842", +-"C c #6c5f49", +-"Z c #685b45", +-"A c #6c614e", +-"S c #72644c", +-"D c #756953", +-"F c #7a6c54", +-"G c #7b6e58", +-"H c #746c5e", +-"J c #7e725a", +-"K c #63646b", +-"L c #6c6f7d", +-"P c #7f7766", +-"I c #787974", +-"U c #787d7f", +-"Y c #092a8c", +-"T c #0e219e", +-"R c #0a289c", +-"E c #093c9c", +-"W c #0c21ab", +-"Q c #0b2aab", +-"! c #0d23bb", +-"~ c #1022a0", +-"^ c #253293", +-"/ c #0f2ada", +-"( c #102ce9", +-") c #1130f9", +-"_ c #08469d", +-"` c #0f5096", +-"' c #08519d", +-"] c #195594", +-"[ c #0948ac", +-"{ c #0851a0", +-"} c #0958ad", +-"| c #0e5db1", +-" . c #1158a4", +-".. c #165eaa", +-"X. c #0960bc", +-"o. c #2b5d91", +-"O. c #33409e", +-"+. c #0a68cc", +-"@. c #0b71dc", +-"#. c #0b77eb", +-"$. c #424d85", +-"%. c #44578d", +-"&. c #4f5c84", +-"*. c #616d91", +-"=. c #68708b", +-"-. c #6f7996", +-";. c #7e7d81", +-":. c #6d7caa", +-">. c #717ea7", +-",. c #0c80fb", +-"<. c #7e898f", +-"1. c #7d8497", +-"2. c #7481a7", +-"3. c #7280ab", +-"4. c #7a87ac", +-"5. c #7685b1", +-"6. c #82745b", +-"7. c #897a5e", +-"8. c #877860", +-"9. c #8c7e66", +-"0. c #857a69", +-"q. c #8f8064", +-"w. c #8e836f", +-"e. c #8c8271", +-"r. c #94856a", +-"t. c #96886e", +-"y. c #9b8c6f", +-"u. c #918165", +-"i. c #918672", +-"p. c #918978", +-"a. c #9b8d73", +-"s. c #998e7a", +-"d. c #9e9175", +-"f. c #9d917b", +-"g. c #a19274", +-"h. c #a4957a", +-"j. c #a7997e", +-"k. c #ab9b7c", +-"l. c #838389", +-"z. c #868886", +-"x. c #898787", +-"c. c #878992", +-"v. c #848999", +-"b. c #859097", +-"n. c #8e9098", +-"m. c #908a83", +-"M. c #94918e", +-"N. c #999387", +-"B. c #969290", +-"V. c #9a9691", +-"C. c #9f9b93", +-"Z. c #9d9b9b", +-"A. c #858da5", +-"S. c #808db4", +-"D. c #8190bd", +-"F. c #8e98b1", +-"G. c #9195a3", +-"H. c #9c9ea6", +-"J. c #a49981", +-"K. c #a39c8d", +-"L. c #a99c84", +-"P. c #a19682", +-"I. c #a39d93", +-"U. c #aea083", +-"Y. c #ada189", +-"T. c #a6a196", +-"R. c #a7a299", +-"E. c #aca79c", +-"W. c #aca495", +-"Q. c #b3a484", +-"!. c #b1a68b", +-"~. c #b6aa8f", +-"^. c #b1aa9c", +-"/. c #b8ac92", +-"(. c #bdb090", +-"). c #bbb099", +-"_. c #a4a4aa", +-"`. c #b6afa0", +-"'. c #b6b0a5", +-"]. c #bab3a5", +-"[. c #bcb6a9", +-"{. c #beb8aa", +-"}. c #8796c1", +-"|. c #8d9cca", +-" X c #9fa8c4", +-".X c #9da8c6", +-"XX c #97a6d1", +-"oX c #98a9da", +-"OX c #a3adcb", +-"+X c #adb3c3", +-"@X c #abb6d3", +-"#X c #b0b6c1", +-"$X c #b1bcdb", +-"%X c #a8b8e1", +-"&X c #b5c0de", +-"*X c #b8c2d8", +-"=X c #bac5e4", +-"-X c #bbc7e8", +-";X c #c0af87", +-":X c #c4b38d", +-">X c #c3b493", +-",X c #c6b89d", +-".N ;.I.^.].4X4X5X5X8X8X8X4X0.V O YXYXYXYXYXYX", +-"YXYXYXYXYXYX%.pXUXzXOX3.-.c.C.E.].4X5X8X8X9X9Xs.S % YXYXYXYXYX", +-"YXYXYXYXYXg &.PXIXUXIXIXvX$X}.>.1.n.C.E.'.{.5X8XP.J - YXYXYXYX", +-"YXYXYXYXS M 4.UXUXUXIXIXIXIXIXIXzX&XXXD.4.A.G.Z.R.p.D - YXYX", +-"YXYXx 7.J L *XUXIXIXPXIXIXIXIXUXIXUXUXIXDXkX=X$XoX|.3.=.d . YX", +-"YXF 6.f.T.*.DXIXIXPXJXIXJXJXJXJXJXIXIXPXJXIXJXJXJXvX[.l.U. YX", +-"YXk.t.w.H 5.JXJXPXJXJXJXJXJXJXFXJXJXPXJXJXJXJXJXvX+Xn.!.k. YX", +-"YXk.Q.a.K .XMXFXHXHXFXJXJXFXFXFXMXHXFXHXFXJXJXlX[.V.k.;Xk. YX", +-"YXg.qX>Xf._.gXDXFXMXFXFXHXMXbXmXMXFXFXMXFXMXzX+Xn.h.:X:Xg. YX", +-"YXy.wXeX6Xh.I.*XxXbXMXMXMXMXMXbXmXMXmXbXmXlX+XB.h.>X ' ,.,.,.,.#.Y +.,.,.` ", +-"YXf 6X0XqXh.q.uXiXNXiXiXiXuXB } ,.R ! +.X.,.,.,.#.#.,.,.#., ", +-"YXa 1X0Xf.8.tXNXiXiXiXtXtXtX!. .,.[ / X.,.,.,.,.,.,.,.,.,.# ", +-"YXy 1Xa.6.rXuXyXtXtXtXeXqX/.g.d } ,.{ 1 #.,.,.,.,.,.,.#.3 ", +-"YX* g.F qXeXeX,XQ.a.6.Z k a u % X 3 } #.#.,.#.,.,.@.' @ ", +-"YXa V t.9.D z h a ; $ O ", +-"YXh f u & + . YXYX" +-}; ++/* XPM */ ++static char * thunderbird3_xpm[] = { ++"48 48 227 2", ++" c None", ++"! c black", ++"# c #7693BC", ++"$ c #C4DAE4", ++"% c #7186B1", ++"& c #90C7D9", ++"' c #D1E7EE", ++"( c #7396C1", ++") c #9ED5E1", ++"* c #B3D6E3", ++"+ c #98BAD3", ++", c #6381AA", ++"- c #9DAED1", ++". c #6FABCA", ++"0 c #5695BD", ++"1 c #4E91BB", ++"2 c #3C82B2", ++"3 c #2B73AA", ++"4 c #1A65A2", ++"5 c #0E5196", ++"6 c #3277AC", ++"7 c #6A71A6", ++"8 c #85BAD1", ++"9 c #256AA5", ++": c #15609F", ++"; c #282E7C", ++"< c #0D1368", ++"= c #5B9CC1", ++"> c #4387B5", ++"? c #44609C", ++"@ c #27438B", ++"A c #566BA3", ++"B c #5886B7", ++"C c #0B3F90", ++"D c #314D92", ++"E c #233B86", ++"F c #45498D", ++"G c #6889B9", ++"H c #387CB0", ++"I c #305DA0", ++"J c #254995", ++"K c #535997", ++"L c #E1F1F5", ++"M c #6592BD", ++"N c #1C5FA0", ++"O c #EAEEEF", ++"P c #547CB2", ++"Q c #4871AC", ++"R c #497AB0", ++"S c #0D2478", ++"T c #889AC3", ++"U c #436CA9", ++"V c #3965A4", ++"W c #27599C", ++"X c #10093A", ++"Y c #AFCBDC", ++"Z c #093479", ++"[ c #09316E", ++"] c #15417B", ++"^ c #537AAE", ++"_ c #0C3589", ++"` c #231939", ++"a c #090136", ++"b c #172779", ++"c c #0A1457", ++"d c #0D2981", ++"e c #191446", ++"f c #8A5A1C", ++"g c #8B601D", ++"h c #B8C0B9", ++"i c #755657", ++"j c #7C4C22", ++"k c #8EA1C9", ++"l c #5D3A23", ++"m c #A5A797", ++"n c #2D2364", ++"o c #583A31", ++"p c #987559", ++"q c #0B0A47", ++"r c #2B5385", ++"s c #131C72", ++"t c #352C44", ++"u c #9A7E49", ++"v c #7D4A1C", ++"w c #916A2B", ++"x c #989387", ++"y c #9895AC", ++"z c #2F334D", ++"{ c #684627", ++"| c #5C4A43", ++"} c #4A3350", ++"~ c #0C124D", ++" ! c #130C40", ++"!! c #0A2569", ++"#! c #715D44", ++"$! c #AC9150", ++"%! c #865D44", ++"&! c #8E7643", ++"'! c #D8C7A8", ++"(! c #79A2BD", ++")! c #273559", ++"*! c #A66419", ++"+! c #AE732E", ++",! c #C78D46", ++"-! c #D8A866", ++".! c #C6A35A", ++"0! c #A9823E", ++"1! c #76582C", ++"2! c #644836", ++"3! c #473638", ++"4! c #373035", ++"5! c #0D2055", ++"6! c #32589C", ++"7! c #0E1B73", ++"8! c #143589", ++"9! c #BA9B57", ++":! c #74563B", ++";! c #F6F7F9", ++"! c #F3BD7B", ++"?! c #F5C27F", ++"@! c #F8C685", ++"A! c #795A16", ++"B! c #33232B", ++"C! c #193E90", ++"D! c #1D1438", ++"E! c #B68E62", ++"F! c #D7C398", ++"G! c #E6D1A8", ++"H! c #C7B07F", ++"I! c #454151", ++"J! c #928278", ++"K! c #BA874B", ++"L! c #AA7D43", ++"M! c #F9CD92", ++"N! c #B4964B", ++"O! c #5C421C", ++"P! c #162D81", ++"Q! c #32233B", ++"R! c #C9A867", ++"S! c #FBF6D8", ++"T! c #FEFDE5", ++"U! c #93999A", ++"V! c #7B787B", ++"W! c #EBE2C5", ++"X! c #E6D8B7", ++"Y! c #C39966", ++"Z! c #BA8C57", ++"[! c #DDB978", ++"]! c #FBE2B6", ++"^! c #F9D9A6", ++"_! c #F9D39A", ++"`! c #211B4C", ++"a! c #0E0E5A", ++"b! c #95A6CA", ++"c! c #8E7768", ++"d! c #F9EBC6", ++"e! c #D0A376", ++"f! c #C69E76", ++"g! c #111A59", ++"h! c #A88758", ++"i! c #BEBDAF", ++"j! c #CDB48D", ++"k! c #FCF0CC", ++"l! c #4E3621", ++"m! c #F2E6D6", ++"n! c #E7C998", ++"o! c #936847", ++"p! c #8B6347", ++"q! c #9D8450", ++"r! c #42548A", ++"s! c #92A7AE", ++"t! c #AB968A", ++"u! c #E9D9C5", ++"v! c #B8997B", ++"w! c #C7A778", ++"x! c #152467", ++"y! c #4A4F91", ++"z! c #868799", ++"{! c #B3966C", ++"|! c #223479", ++"}! c #193077", ++"~! c #686485", ++" # c #F1DCB1", ++"!# c #A7866B", ++"## c #B8A792", ++"$# c #A4A6A4", ++"%# c #455B92", ++"&# c #4C4A76", ++"'# c #8F6A54", ++"(# c #5E84AB", ++")# c #27224B", ++"*# c #4D5F7C", ++"+# c #553D1E", ++",# c #5B4F6C", ++"-# c #E8C387", ++".# c #161969", ++"0# c #D3B069", ++"1# c #E0AF6C", ++"2# c #848DB3", ++"3# c #292452", ++"4# c #675441", ++"5# c #55453D", ++"6# c #352C57", ++"7# c #E5B978", ++"8# c #373058", ++"9# c #645654", ++":# c #7B6644", ++";# c #EAC27E", ++"<# c #7D6568", ++"=# c #3C3663", ++"># c #7B7895", ++"?# c #AC904D", ++"@# c #595579", ++"A# c #625E80", ++"B# c #76728E", ++"C# c #695B61", ++"D# c #544758", ++"E# c #6B6378", ++"F# c #454169", ++"G# c #403B65", ++"H# c #A7A8BC", ++"I# c #716D8D", ++"J# c #B6B4C4", ++"K# c #827E9A", ++"L# c #C4CAD4", ++" ", ++" # $ ", ++" % & ' ", ++" ( ) ' * * ) + & & ", ++" , ) & - ) & . . 0 1 2 3 4 4 5 5 6 ( ", ++" 7 ) ) 8 8 ) & & . 1 2 6 9 : 5 : 4 4 3 9 9 ", ++" ; < 8 ) ) ) ) 8 . = 1 2 6 4 4 6 2 2 2 > > 1 1 2 1 ", ++" ? @ ; A ) ) & & . . = 1 2 6 3 6 2 2 2 1 1 > > 1 = 2 2 = 8 ", ++" B C D E F & ) & & . . = G B 3 3 6 H 2 2 1 2 2 1 1 = . 8 = = . 3 ", ++" 9 I J E K L ' & & . M B G B 6 3 3 6 H 2 2 1 > 2 2 = . 2 H 3 . 4 : 3 ", ++" > N I E E ' O $ 8 = P Q G G 6 9 3 3 6 > 0 > 2 1 = 2 . 1 3 8 . & . H 1 H ", ++" = 1 R Q S T L L 8 P U U G # 6 4 : 5 : : 9 6 2 1 9 = . ) 8 & ) = 4 : 4 3 9 V ", ++" . . 1 W S X $ L Y V I V P T 2 4 : 5 5 C Z [ ] 3 6 9 4 1 2 3 6 H 3 3 6 > 1 : 5 P ", ++" * 0 3 ^ _ ` a $ L B J b ; T M 4 : 5 5 5 5 C C S c ] 2 . 8 = 1 1 0 1 1 > : 6 : d V ", ++" 8 . . 5 e f g h * V F i j k 9 : 5 5 5 5 C C C _ _ c Z 9 9 9 : 3 2 : 9 > N 5 5 d D J ", ++" * 8 . 9 < l g g m + I n o p B : 5 5 5 C C C C _ _ d [ q r > 1 9 : 5 : 5 : V N 5 S E s ", ++" . > 3 C t u v w x = I A y - N _ z l v j { | } t ~ !a a a 6 . B 5 5 5 5 5 V N 5 < s < 7 ", ++" . > 6 !!#!$!%!&!'!1 Q (!B : )!j *!*!*!*!+!,!-!.!0!1!2!3!4!5!3 B : N 6!N V V D 7!< < 7!8! ", ++" * 0 2 W ~ $!9!9!:!;!$ !?!@!@!>!-!+!A!A!B!5 9 N 5 N 5 U Q E 7!< < d C! ", ++" 8 2 9 C D!E!F!G!H!L !N!f O![ 5 N 5 N b Q U S < d 7!d 8! ", ++" = P!5 _ Q!R!S!T!F!U!V!W!X!Y!Y!Z!Z!Z![!]!^!^!_!M!M!M!@!@!@!K!A!`!: 9 I @ a!9 C!d d _ d P!J b! ", ++" H _ S _ t F!T!T!S!c!p T!d!e!f!Y!f!e!]!]!]!]!]!]!_!_!_!M!M!?!0!4!Q Q U 7!q C!_ 8!s 8!C!b 6!- ", ++" 9 C s 8!g!'!T!T!T!d!h!i!S!'!H!j!e!X!k!d!d!]!]!]!]!]!^!^!_!_!Z!l!I Q 6!d a C!C!C!P!C!8!b U P ", ++" 5 C S C!@ j!T!T!T!T!X!&!S!W!F!F!F!m!T!T!S!k!k!d!]!]!]!n!o!p!q!:!6!6!C!8!c 6!C!J E J s P!Q Q ", ++" @ C s r!V s!T!T!T!T!T!F!t!S!X!'!u!T!T!T!T!T!S!S!W!v!p!o!w!H!n!9!I 6!6!C!x!6!6!@ J C!d E R Q ", ++" y!d d J!z!M S!T!T!T!T!S!v!'!m!u!W!T!T!T!T!T!X!p p!{!F!n!^!^!_!j!U U V @ |!V V P!s _ 8!J D ( ", ++" 7 < < J!F!H!X!T!T!T!T!T!d!p S!T!T!T!T!W!t!p!p F!n!^!]!^!^!^!^!F!B R ^ }!6!U V d P!8!C!6!< T ", ++" < < ~!m!X!'!T!T!T!T!T!T! #!#T!S!##p!p j! # #]!]!]!^!^!^!_!_!$#( M %#!!B Q J C!8!J J < < T ", ++" s d &#X!T!T!T!T!T!T!T!S!S!F!'#p!H!W!]!]!]!]!]!^!^!^!^!_!_!_!(!. (#)#@ P I 6!J C!6!8!< < ", ++" E C!E '!S!T!T!T!T!T!S!S!S!k!]!d!d!]!]!]!]!]!]!^!^!^!_!_!_!i!(!*#+#l!C 8!U V @ 6!6!S S S ", ++" % b @ ##u!T!T!T!T!S!S!S!k!k!d!d!]!d!]!]!]!^!^!^!^!_!_!M!M!M!?!w A!B!_ J P Q 8!I P!d d S ", ++" < < ,#-#X!T!T!S!S!S!k!k!d!d!d!]!]!]!]!]!^!^!^!_!_!_!M!M!@!>!g f a d P B E _ d d _ 8!%# ", ++" F < .#$!.!0#-# #k!k!k!d!d!d!]!]!]!]!^!^!^!^!_!_!M!M!M!@!@!1#w h!X S I c C!8!x!C!C!S 2# ", ++" < < 3#4#u N!.!0#[!^!]!d!]!]!]!]!^!^!^!^!_!_!_!M!M!@!@!@!1#1#p q a!d g!J C!g!J @ ~ ", ++" 7 7!7!a a `!5#&!9!.!0#[!M!^!]!]!^!^!^!_!_!M!M!M!@!@!@!@!?!?!6#q q < ] J < ] J ~ `! ", ++" b 8!a!a a a a e 3!&!9!.!0#7#-#_!^!_!_!_!M!M!@!@!@!?!?!?!e!3#X a a 8!S a S < a ", ++" b @ X a a e a a a 8#9#:#N!.!0#7#;#M!M!M!@!@!@!@!@!@!?!<#3#X a a 7!q q < a e ", ++" s < a a a =#a ! >#9#:#?#.!0#7#;#@!@!?!?!?!?![!=#e a a X a a a a a ", ++" 7!s X a ># @#A# B##@# !a a X G# !a a ", ++" H#I#e a a a &#`!a a ", ++" J#>#e a a a F#G#a K# ", ++" H#I# !a a X @#8#a ", ++" L#K#3#a a 3#6#A#`!A# ", ++" y @#F#B# z!B#># ", ++" "}; +\ No newline at end of file + +=== modified file 'mail/app/icons/gtk/messengerWindow16.xpm' +--- mail/app/icons/gtk/messengerWindow16.xpm 2008-05-29 16:56:50 +0000 ++++ mail/app/icons/gtk/messengerWindow16.xpm 2008-05-30 15:15:15 +0000 +@@ -1,143 +1,186 @@ + /* XPM */ +-static char *messengerWindow.xpm[] = { +-/* columns rows colors chars-per-pixel */ +-"16 16 121 2", +-" c #000000", +-". c #090704", +-"X c #0a0906", +-"o c #19150f", +-"O c #1c1810", +-"+ c #2a251b", +-"@ c #2f281e", +-"# c #2f2920", +-"$ c #332d23", +-"% c #373126", +-"& c #3d3629", +-"* c #41371f", +-"= c #473c26", +-"- c #483e28", +-"; c #423c30", +-": c #544837", +-"> c #514838", +-", c #61523b", +-"< c #57585e", +-"1 c #5f5c5c", +-"2 c #515361", +-"3 c #655944", +-"4 c #645b4a", +-"5 c #695f4d", +-"6 c #7a6d4f", +-"7 c #736856", +-"8 c #7e6e53", +-"9 c #7a6e58", +-"0 c #424e88", +-"q c #52618b", +-"w c #897a5e", +-"e c #817764", +-"r c #817a6f", +-"t c #8c7f67", +-"y c #8e8063", +-"u c #918369", +-"i c #948974", +-"p c #988b71", +-"a c #988e7d", +-"s c #a2947b", +-"d c #af9e7a", +-"f c #858995", +-"g c #958d83", +-"h c #9b9da6", +-"j c #9ea3b2", +-"k c #99a0b8", +-"l c #a09682", +-"z c #aa9c81", +-"x c #a09a90", +-"c c #afa285", +-"v c #afa288", +-"b c #a8a090", +-"n c #b4a586", +-"m c #b3a689", +-"M c #b8aa8c", +-"N c #b8ad96", +-"B c #bcb199", +-"V c #a1a0a2", +-"C c #a8a6a4", +-"Z c #aca9a5", +-"A c #a7aab6", +-"S c #a6a9b8", +-"D c #aab0bd", +-"F c #b6afa1", +-"G c #b5b1aa", +-"H c #bbb4a4", +-"J c #b1b3be", +-"K c #adb6cc", +-"L c #adb7d1", +-"P c #b1b9cd", +-"I c #b7c0d6", +-"U c #b8c4e3", +-"Y c #c4b188", +-"T c #c3b496", +-"R c #c3b69b", +-"E c #cebd96", +-"W c #c9bb99", +-"Q c #c6b9a1", +-"! c #c3bcac", +-"~ c #c8bca6", +-"^ c #c4bfb2", +-"/ c #d2c097", +-"( c #d0c19d", +-") c #cfc2a3", +-"_ c #cfc4af", +-"` c #c7c0b2", +-"' c #ccc5b5", +-"] c #d5c7a5", +-"[ c #d7c9ad", +-"{ c #dbcdae", +-"} c #d7ceba", +-"| c #daceb5", +-" . c #ddd0b3", +-".. c #dbd1ba", +-"X. c #e3d7ba", +-"o. c #e3d8be", +-"O. c #dfd9c8", +-"+. c #cdd4e5", +-"@. c #cfd8ec", +-"#. c #d3defc", +-"$. c #dee2ef", +-"%. c #d7e3ff", +-"&. c #dfe4f3", +-"*. c #dbe7ff", +-"=. c #dde8fe", +-"-. c #e5dbc4", +-";. c #eadec4", +-":. c #e8dfc8", +-">. c #ece3cd", +-",. c #ece4d1", +-"<. c #efe8d5", +-"1. c #e5eaf5", +-"2. c #e3edfe", +-"3. c #e7f1fe", +-"4. c #eef4fe", +-"5. c #f9f3e3", +-"6. c #fbf6e8", +-"7. c #f1f6ff", +-"8. c #f4faff", +-"9. c #fefeff", +-"0. c None", +-/* pixels */ +-"0.0.0.0.0.0.* > 7 : . 0.0.0.", +-"0.0.0.0.0.= 3 x ! B 5 . 0.0.", +-"0.0.0.0 q 1 x ! ! ' ' e . 0.", +-"0.0.0.2 &.$.P j h C G ` 4 ", +-"0.0.6 f 9.9.9.4.1.+.I K S < . ", +-"0.t r K 9.4.4.4.4.9.8.8.@.Z ; ", +-"0.n a P 3.2.3.2.*.2.2.2.Z Y ; ", +-"0.M .N D %.2.*.%.*.#.D M E & ", +-"0.v X.-.R V U K A P k l ( E $ ", +-"0.z X.-.<...g F O.! i ) ] E $ ", +-"0.s X.-.,.} ~ 5.6.5.} v W E @ ", +-"0.p X...B ' <.>.:.:.:.| m d + ", +-"0.u .z ~ >.:.o.o.o. .{ T w o ", +-"0.w n Q ;...[ T d t 3 & O X ", +-"0., p s 9 > @ o X ", +-"0. " +-}; ++static char * messengerWindow16_xpm[] = { ++"16 16 167 2", ++" c None", ++". c #8CBDD3", ++"+ c #9ECADC", ++"@ c #7DB3CF", ++"# c #5795BD", ++"$ c #266CA6", ++"% c #2E6FA8", ++"& c #284890", ++"* c #5D7AAA", ++"= c #93CADB", ++"- c #71AAC9", ++"; c #4284B4", ++"> c #2F76AB", ++", c #3F84B3", ++"' c #4589B6", ++") c #5798BE", ++"! c #5E9DC2", ++"~ c #3871AA", ++"{ c #5A6FA7", ++"] c #B0CFDF", ++"^ c #5D8CBA", ++"/ c #5181B3", ++"( c #236AA5", ++"_ c #357AAE", ++": c #4185B4", ++"< c #5D9DC2", ++"[ c #66A3C5", ++"} c #4C8EB9", ++"| c #2D74AB", ++"1 c #6FA8C8", ++"2 c #314978", ++"3 c #989FA7", ++"4 c #4B649A", ++"5 c #5F77A1", ++"6 c #18609F", ++"7 c #0D4D95", ++"8 c #0C3884", ++"9 c #1C4C8A", ++"0 c #4486B5", ++"a c #397EB0", ++"b c #367BAF", ++"c c #2369A4", ++"d c #264D95", ++"e c #3B77AA", ++"f c #6F533D", ++"g c #8E9384", ++"h c #536996", ++"i c #476387", ++"j c #59514A", ++"k c #63554F", ++"l c #545364", ++"m c #282447", ++"n c #345E89", ++"o c #2464A2", ++"p c #1A599B", ++"q c #235499", ++"r c #111C71", ++"s c #5F93BB", ++"t c #1D427D", ++"u c #D1B988", ++"v c #ADA99E", ++"w c #878078", ++"x c #AF7F48", ++"y c #C39356", ++"z c #F2C68A", ++"A c #F8C788", ++"B c #D6A764", ++"C c #554A3E", ++"D c #1B5D9E", ++"E c #245093", ++"F c #1D3887", ++"G c #0E247B", ++"H c #185299", ++"I c #172D77", ++"J c #F0E8CC", ++"K c #D9CBAE", ++"L c #DED0B0", ++"M c #CDAF83", ++"N c #F3E3C1", ++"O c #FBE8C0", ++"P c #FAE0B2", ++"Q c #ECC895", ++"R c #9B7A51", ++"S c #3860A2", ++"T c #142873", ++"U c #183789", ++"V c #183285", ++"W c #5478B0", ++"X c #2B408A", ++"Y c #5A6085", ++"Z c #D8DAC9", ++"` c #FEFDE5", ++" . c #D8C7AA", ++".. c #EFE5CB", ++"+. c #FCFAE1", ++"@. c #DACCB3", ++"#. c #CCB28E", ++"$. c #D6B78A", ++"%. c #E2C592", ++"&. c #416BA7", ++"*. c #29488D", ++"=. c #23418D", ++"-. c #1A3C8D", ++";. c #4C6AA4", ++">. c #6A6F93", ++",. c #F7F2D8", ++"'. c #FBF5D8", ++"). c #D5C1A0", ++"!. c #D4BD99", ++"~. c #F4DCB0", ++"{. c #FADEAF", ++"]. c #F9D7A2", ++"^. c #CDC1A5", ++"/. c #556881", ++"(. c #31589A", ++"_. c #264A95", ++":. c #1B3685", ++"<. c #343877", ++"[. c #E2D0A4", ++"}. c #F9EFCE", ++"|. c #FBF1CF", ++"1. c #FAEBC5", ++"2. c #FBE3B8", ++"3. c #FADDAD", ++"4. c #F9D096", ++"5. c #F5C485", ++"6. c #684A2D", ++"7. c #2B4E93", ++"8. c #1E3F8B", ++"9. c #113085", ++"0. c #222B7A", ++"a. c #292650", ++"b. c #614E47", ++"c. c #AD9269", ++"d. c #E5C78E", ++"e. c #F6D6A3", ++"f. c #F8C889", ++"g. c #F4C280", ++"h. c #6B545A", ++"i. c #0E1A5F", ++"j. c #152B75", ++"k. c #182567", ++"l. c #151F6C", ++"m. c #0D073F", ++"n. c #241E4D", ++"o. c #51475C", ++"p. c #9C855F", ++"q. c #B3976A", ++"r. c #E2B978", ++"s. c #F4C381", ++"t. c #E8BA7E", ++"u. c #271F4B", ++"v. c #0D083F", ++"w. c #0A053F", ++"x. c #2A387E", ++"y. c #977D56", ++"z. c #776970", ++"A. c #0D063A", ++"B. c #1A1345", ++"C. c #0C0439", ++"D. c #807E9A", ++"E. c #191244", ++"F. c #2B2553", ++"G. c #261F4E", ++"H. c #7F7D99", ++"I. c #3E3961", ++"J. c #575276", ++" ", ++" . + @ # $ % ", ++" & * = - ; > , ' ) ! ", ++" ~ { ] ^ / ( _ : < [ } | ", ++" 1 2 3 4 5 6 7 8 9 0 a b c d ", ++" e f g h i j k l m n o p q r ", ++"s t u v w x y z A B C D E F G ", ++"H I J K L M N O P Q R S T U V W ", ++"X Y Z ` ...+.@.#.$.%.&.*.=.-.;.", ++" >.,.` '.).!.~.{.].^./.(._.:. ", ++" <.[.}.|.1.2.3.].4.5.6.7.8.9. ", ++" 0.a.b.c.d.e.].4.f.g.h.i.j.k. ", ++" l.m.n.o.p.q.r.s.t.u.v.w. ", ++" x. y.z.A.B.C. ", ++" D.E.F.G. ", ++" H.I.J. "}; + +=== modified file 'mail/app/icons/os2/messengerWindow.ico' +Binary files mail/app/icons/os2/messengerWindow.ico 2008-05-29 16:56:50 +0000 and mail/app/icons/os2/messengerWindow.ico 2008-05-30 15:15:15 +0000 differ +=== modified file 'mail/app/icons/windows/messengerWindow.ico' +Binary files mail/app/icons/windows/messengerWindow.ico 2008-05-29 16:56:50 +0000 and mail/app/icons/windows/messengerWindow.ico 2008-05-30 15:15:15 +0000 differ +=== modified file 'modules/libpref/Makefile.in' +--- modules/libpref/Makefile.in 2008-05-29 16:56:50 +0000 ++++ modules/libpref/Makefile.in 2008-05-30 15:08:27 +0000 +@@ -42,6 +42,10 @@ + + include $(DEPTH)/config/autoconf.mk + ++ifdef ENABLE_TESTS ++TOOL_DIRS += test ++endif ++ + MODULE = pref + DIRS = public src + + +=== modified file 'modules/libpref/public/nsIPrefBranch2.idl' +--- modules/libpref/public/nsIPrefBranch2.idl 2008-05-29 16:56:50 +0000 ++++ modules/libpref/public/nsIPrefBranch2.idl 2008-05-30 15:08:27 +0000 +@@ -86,6 +86,21 @@ + * registered. This insures that shorter lived objects (say one tied to an + * open window) will not fall into the cyclical reference trap. + * ++ * @note ++ * The list of registered observers may be changed during the dispatch of ++ * nsPref:changed notification. However, the observers are not guaranteed ++ * to be notified in any particular order, so you can't be sure whether the ++ * added/removed observer will be called during the notification when it ++ * is added/removed. ++ * ++ * @note ++ * It is possible to change preferences during the notification. ++ * ++ * @note ++ * It is not safe to change observers during this callback in Gecko ++ * releases before 1.9. If you want a safe way to remove a pref observer, ++ * please use an nsITimer. ++ * + * @see nsIObserver + * @see removeObserver + */ + +=== modified file 'modules/libpref/src/prefapi.cpp' +--- modules/libpref/src/prefapi.cpp 2008-05-29 16:56:50 +0000 ++++ modules/libpref/src/prefapi.cpp 2008-05-30 15:08:27 +0000 +@@ -122,6 +122,9 @@ + static struct CallbackNode* gCallbacks = NULL; + static PRBool gCallbacksEnabled = PR_TRUE; + static PRBool gIsAnyPrefLocked = PR_FALSE; ++// These are only used during the call to pref_DoCallback ++static PRBool gCallbacksInProgress = PR_FALSE; ++static PRBool gShouldCleanupDeadNodes = PR_FALSE; + + + static PLDHashTableOps pref_HashTableOps = { +@@ -175,6 +178,9 @@ + /* -- Privates */ + struct CallbackNode { + char* domain; ++ // If someone attempts to remove the node from the callback list while ++ // pref_DoCallback is running, |func| is set to nsnull. Such nodes will ++ // be removed at the end of pref_DoCallback. + PrefChangedFunc func; + void* data; + struct CallbackNode* next; +@@ -206,6 +212,8 @@ + /* Frees the callback list. */ + void PREF_Cleanup() + { ++ NS_ASSERTION(!gCallbacksInProgress, ++ "PREF_Cleanup was called while gCallbacksInProgress is PR_TRUE!"); + struct CallbackNode* node = gCallbacks; + struct CallbackNode* next_node; + +@@ -806,6 +814,9 @@ + PrefChangedFunc callback, + void * instance_data) + { ++ NS_PRECONDITION(pref_node, "pref_node must not be nsnull"); ++ NS_PRECONDITION(callback, "callback must not be nsnull"); ++ + struct CallbackNode* node = (struct CallbackNode*) malloc(sizeof(struct CallbackNode)); + if (node) + { +@@ -818,7 +829,29 @@ + return; + } + +-/* Deletes a node from the callback list. */ ++/* Removes |node| from gCallbacks list. ++ Returns the node after the deleted one. */ ++struct CallbackNode* ++pref_RemoveCallbackNode(struct CallbackNode* node, ++ struct CallbackNode* prev_node) ++{ ++ NS_PRECONDITION(!prev_node || prev_node->next == node, "invalid params"); ++ NS_PRECONDITION(prev_node || gCallbacks == node, "invalid params"); ++ ++ NS_ASSERTION(!gCallbacksInProgress, ++ "modifying the callback list while gCallbacksInProgress is PR_TRUE"); ++ ++ struct CallbackNode* next_node = node->next; ++ if (prev_node) ++ prev_node->next = next_node; ++ else ++ gCallbacks = next_node; ++ PR_Free(node->domain); ++ PR_Free(node); ++ return next_node; ++} ++ ++/* Deletes a node from the callback list or marks it for deletion. */ + nsresult + PREF_UnregisterCallback(const char *pref_node, + PrefChangedFunc callback, +@@ -832,16 +865,21 @@ + { + if ( strcmp(node->domain, pref_node) == 0 && + node->func == callback && +- node->data == instance_data ) ++ node->data == instance_data) + { +- struct CallbackNode* next_node = node->next; +- if (prev_node) +- prev_node->next = next_node; ++ if (gCallbacksInProgress) ++ { ++ // postpone the node removal until after ++ // gCallbacks enumeration is finished. ++ node->func = nsnull; ++ gShouldCleanupDeadNodes = PR_TRUE; ++ prev_node = node; ++ node = node->next; ++ } + else +- gCallbacks = next_node; +- PR_Free(node->domain); +- PR_Free(node); +- node = next_node; ++ { ++ node = pref_RemoveCallbackNode(node, prev_node); ++ } + rv = NS_OK; + } + else +@@ -857,15 +895,49 @@ + { + nsresult rv = NS_OK; + struct CallbackNode* node; ++ ++ PRBool reentered = gCallbacksInProgress; ++ gCallbacksInProgress = PR_TRUE; ++ // Nodes must not be deleted while gCallbacksInProgress is PR_TRUE. ++ // Nodes that need to be deleted are marked for deletion by nulling ++ // out the |func| pointer. We release them at the end of this function ++ // if we haven't reentered. ++ + for (node = gCallbacks; node != NULL; node = node->next) + { +- if ( PL_strncmp(changed_pref, node->domain, PL_strlen(node->domain)) == 0 ) ++ if ( node->func && ++ PL_strncmp(changed_pref, ++ node->domain, ++ PL_strlen(node->domain)) == 0 ) + { + nsresult rv2 = (*node->func) (changed_pref, node->data); + if (NS_FAILED(rv2)) + rv = rv2; + } + } ++ ++ gCallbacksInProgress = reentered; ++ ++ if (gShouldCleanupDeadNodes && !gCallbacksInProgress) ++ { ++ struct CallbackNode* prev_node = NULL; ++ node = gCallbacks; ++ ++ while (node != NULL) ++ { ++ if (!node->func) ++ { ++ node = pref_RemoveCallbackNode(node, prev_node); ++ } ++ else ++ { ++ prev_node = node; ++ node = node->next; ++ } ++ } ++ gShouldCleanupDeadNodes = PR_FALSE; ++ } ++ + return rv; + } + + +=== added directory 'modules/libpref/test' +=== added file 'modules/libpref/test/Makefile.in' +--- modules/libpref/test/Makefile.in 1970-01-01 00:00:00 +0000 ++++ modules/libpref/test/Makefile.in 2008-05-30 15:08:27 +0000 +@@ -0,0 +1,50 @@ ++# ++# ***** BEGIN LICENSE BLOCK ***** ++# Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++# ++# The contents of this file are subject to the Mozilla Public License Version ++# 1.1 (the "License"); you may not use this file except in compliance with ++# the License. You may obtain a copy of the License at ++# http://www.mozilla.org/MPL/ ++# ++# Software distributed under the License is distributed on an "AS IS" basis, ++# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++# for the specific language governing rights and limitations under the ++# License. ++# ++# The Original Code is mozilla.org code. ++# ++# The Initial Developer of the Original Code is ++# Mozilla.org. ++# Portions created by the Initial Developer are Copyright (C) 2005 ++# the Initial Developer. All Rights Reserved. ++# ++# Contributor(s): ++# Boris Zbarsky (Original author) ++# ++# 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"), ++# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++# in which case the provisions of the GPL or the LGPL are applicable instead ++# of those above. If you wish to allow use of your version of this file only ++# under the terms of either the GPL or the LGPL, and not to allow others to ++# use your version of this file under the terms of the MPL, indicate your ++# decision by deleting the provisions above and replace them with the notice ++# and other provisions required by the GPL or the LGPL. If you do not delete ++# the provisions above, a recipient may use your version of this file under ++# the terms of any one of the MPL, the GPL or the LGPL. ++# ++# ***** END LICENSE BLOCK ***** ++ ++DEPTH = ../../.. ++topsrcdir = @top_srcdir@ ++srcdir = @srcdir@ ++VPATH = @srcdir@ ++ ++include $(DEPTH)/config/autoconf.mk ++ ++MODULE = test_libpref ++ ++XPCSHELL_TESTS = unit ++ ++include $(topsrcdir)/config/rules.mk + +=== added directory 'modules/libpref/test/unit' +=== added file 'modules/libpref/test/unit/test_bug345529.js' +--- modules/libpref/test/unit/test_bug345529.js 1970-01-01 00:00:00 +0000 ++++ modules/libpref/test/unit/test_bug345529.js 2008-05-30 15:08:27 +0000 +@@ -0,0 +1,34 @@ ++/* Any copyright is dedicated to the Public Domain. ++ * http://creativecommons.org/licenses/publicdomain/ */ ++ ++// Regression test for bug 345529 - crash removing an observer during an ++// nsPref:changed notification. ++function run_test() { ++ const Cc = Components.classes; ++ const Ci = Components.interfaces; ++ const PREF_NAME = "testPref"; ++ ++ var prefs = Cc["@mozilla.org/preferences-service;1"] ++ .getService(Ci.nsIPrefBranch2); ++ var observer = { ++ QueryInterface: function QueryInterface(aIID) { ++ if (aIID.equals(Ci.nsIObserver) || ++ aIID.equals(Ci.nsISupports)) ++ return this; ++ throw Components.results.NS_NOINTERFACE; ++ }, ++ ++ observe: function observe(aSubject, aTopic, aState) { ++ prefs.removeObserver(PREF_NAME, observer); ++ } ++ } ++ prefs.addObserver(PREF_NAME, observer, false); ++ ++ prefs.setCharPref(PREF_NAME, "test0") ++ // This second call isn't needed on a clean profile: it makes sure ++ // the observer gets called even if the pref already had the value ++ // "test0" before this test. ++ prefs.setCharPref(PREF_NAME, "test1") ++ ++ do_check_true(true); ++} +