diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..944f4cc --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +xulrunner-1.9.2.7.source.tar.bz2 +xulrunner-1.9.3.0b3.source.tar.bz2 +/xulrunner-1.9.3.0b4.source.tar.bz2 +/xulrunner-2.0b6.source.tar.bz2 +/xulrunner-4.0b7.source.tar.bz2 +/xulrunner-2.0b7.source.tar.bz2 +/xulrunner-2.0b8.source.tar.bz2 +/xulrunner-2.0b9.source.tar.bz2 +/xulrunner-2.0b10.source.tar.bz2 +/xulrunner-2.0b11.source.tar.bz2 +/xulrunner-2.0b12.source.tar.bz2 +/xulrunner-2.0rc1.source.tar.bz2 +/xulrunner-2.0rc2.source.tar.bz2 +/xulrunner-2.0.source.tar.bz2 +/xulrunner-2.0.1.source.tar.bz2 +/xulrunner-5.0.source.tar.bz2 +/xulrunner-6.0.source.tar.bz2 +/xulrunner-6.0.2.source.tar.bz2 +/xulrunner-7.0.source.tar.bz2 +/xulrunner-7.0.1.source.tar.bz2 +/xulrunner-8.0.source.tar.bz2 +/xulrunner-9.0.source.tar.bz2 +/xulrunner-9.0.1.source.tar.bz2 +/xulrunner-10.0b6.source.tar.bz2 +/xulrunner-10.0.source.tar.bz2 +/xulrunner-10.0.1.source.tar.bz2 diff --git a/add-gtkmozembed-10.0.patch b/add-gtkmozembed-10.0.patch new file mode 100644 index 0000000..e5816dd --- /dev/null +++ b/add-gtkmozembed-10.0.patch @@ -0,0 +1,8846 @@ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/Makefile.in.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/Makefile.in +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/Makefile.in.gtkmozembed 2012-01-18 16:44:32.465289972 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/Makefile.in 2012-01-18 16:44:32.465289972 +0100 +@@ -0,0 +1,54 @@ ++# ++# ***** 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 Mozilla browser. ++# ++# The Initial Developer of the Original Code is ++# Christopher Blizzard. ++# Portions created by the Initial Developer are Copyright (C) 1999 ++# the Initial Developer. All Rights Reserved. ++# ++# Contributor(s): ++# Christopher Blizzard ++# ++# 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 ***** ++ ++DEPTH = ../../.. ++topsrcdir = @top_srcdir@ ++srcdir = @srcdir@ ++VPATH = @srcdir@ ++ ++include $(DEPTH)/config/autoconf.mk ++ ++MODULE = gtkembedmoz ++ ++DIRS=src ++ ++ifdef ENABLE_TESTS ++TOOL_DIRS += tests ++endif ++ ++include $(topsrcdir)/config/rules.mk +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedCertificates.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedCertificates.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedCertificates.cpp.gtkmozembed 2012-01-18 16:44:32.466289972 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedCertificates.cpp 2012-01-18 16:44:32.466289972 +0100 +@@ -0,0 +1,253 @@ ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ ++/* vim:set ts=2 sw=2 sts=2 tw=80 et cindent: */ ++/* ***** BEGIN LICENSE BLOCK ***** ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla Public License Version ++ * 1.1 (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * http://www.mozilla.org/MPL/ ++ * ++ * Software distributed under the License is distributed on an "AS IS" basis, ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++ * for the specific language governing rights and limitations under the ++ * License. ++ * ++ * The Original Code is mozilla.org code. ++ * ++ * The Initial Developer of the Original Code is ++ * Netscape Communications Corporation. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Terry Hayes ++ * Javier Delgadillo ++ * Oleg Romashin ++ * ++ * 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 ***** */ ++/** ++ * Derived from nsNSSDialogs http://landfill.mozilla.org/mxr-test/seamonkey/source/security/manager/pki/src/nsNSSDialogs.cpp ++ */ ++#include ++#include "nsIURI.h" ++#include "EmbedPrivate.h" ++#include "nsServiceManagerUtils.h" ++#include "nsIWebNavigationInfo.h" ++#include "nsDocShellCID.h" ++#include "nsCOMPtr.h" ++#ifdef MOZILLA_INTERNAL_API ++#include "nsString.h" ++#include "nsXPIDLString.h" ++#include "nsReadableUtils.h" ++#else ++#include "nsStringAPI.h" ++#endif ++#include "nsIPrompt.h" ++#include "nsIDOMWindow.h" ++#include "nsIComponentManager.h" ++#include "nsIServiceManager.h" ++#include "nsIStringBundle.h" ++#include "nsIInterfaceRequestor.h" ++#include "nsIInterfaceRequestorUtils.h" ++#include "nsIX509Cert.h" ++#include "nsIX509CertDB.h" ++#include "nsIDateTimeFormat.h" ++#include "nsDateTimeFormatCID.h" ++#include "EmbedCertificates.h" ++#include "nsIKeygenThread.h" ++#include "nsIX509CertValidity.h" ++#include "nsICRLInfo.h" ++#include "gtkmozembed.h" ++ ++#define PIPSTRING_BUNDLE_URL "chrome://pippki/locale/pippki.properties" ++ ++EmbedCertificates::EmbedCertificates(void) ++{ ++} ++ ++EmbedCertificates::~EmbedCertificates() ++{ ++} ++ ++NS_IMPL_THREADSAFE_ADDREF(EmbedCertificates) ++NS_IMPL_THREADSAFE_RELEASE(EmbedCertificates) ++NS_INTERFACE_MAP_BEGIN(EmbedCertificates) ++NS_INTERFACE_MAP_ENTRY(nsITokenPasswordDialogs) ++NS_INTERFACE_MAP_ENTRY(nsICertificateDialogs) ++NS_INTERFACE_MAP_ENTRY(nsIClientAuthDialogs) ++NS_INTERFACE_MAP_ENTRY(nsICertPickDialogs) ++NS_INTERFACE_MAP_ENTRY(nsITokenDialogs) ++NS_INTERFACE_MAP_ENTRY(nsIGeneratingKeypairInfoDialogs) ++NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCryptoDialogs) ++NS_INTERFACE_MAP_END ++ ++nsresult ++EmbedCertificates::Init(void) ++{ ++ nsresult rv; ++ nsCOMPtr service = ++ do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); ++ if (NS_FAILED(rv)) return NS_OK; ++ rv = service->CreateBundle(PIPSTRING_BUNDLE_URL, ++ getter_AddRefs(mPIPStringBundle)); ++ return NS_OK; ++} ++ ++nsresult ++EmbedCertificates::SetPassword(nsIInterfaceRequestor *ctx, ++ const PRUnichar *tokenName, PRBool* _canceled) ++{ ++ *_canceled = PR_FALSE; ++ return NS_OK; ++} ++ ++nsresult ++EmbedCertificates::GetPassword(nsIInterfaceRequestor *ctx, ++ const PRUnichar *tokenName, ++ PRUnichar **_password, ++ PRBool* _canceled) ++{ ++ *_canceled = PR_FALSE; ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedCertificates::CrlImportStatusDialog(nsIInterfaceRequestor *ctx, nsICRLInfo *crl) ++{ ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedCertificates::ConfirmDownloadCACert(nsIInterfaceRequestor *ctx, ++ nsIX509Cert *cert, ++ PRUint32 *_trust, ++ PRBool *_retval) ++{ ++ // If an implementation chooses not to implement UI for displaying ++ // the cert and asking the user for confirmation, ++ // then this function must return PR_FALSE. ++ *_retval = PR_FALSE; ++ *_trust = nsIX509CertDB::UNTRUSTED; ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedCertificates::NotifyCACertExists(nsIInterfaceRequestor *ctx) ++{ ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedCertificates::ChooseCertificate( ++ nsIInterfaceRequestor *ctx, ++ const PRUnichar *cn, ++ const PRUnichar *organization, ++ const PRUnichar *issuer, ++ const PRUnichar **certNickList, ++ const PRUnichar **certDetailsList, ++ PRUint32 count, ++ PRInt32 *selectedIndex, ++ PRBool *canceled) ++{ ++ *canceled = PR_FALSE; ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedCertificates::PickCertificate( ++ nsIInterfaceRequestor *ctx, ++ const PRUnichar **certNickList, ++ const PRUnichar **certDetailsList, ++ PRUint32 count, ++ PRInt32 *selectedIndex, ++ PRBool *canceled) ++{ ++ *canceled = PR_FALSE; ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedCertificates::SetPKCS12FilePassword( ++ nsIInterfaceRequestor *ctx, ++ nsAString &_password, ++ PRBool *_retval) ++{ ++ /* The person who wrote this method implementation did ++ * not read the contract. ++ */ ++ *_retval = PR_FALSE; ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedCertificates::GetPKCS12FilePassword( ++ nsIInterfaceRequestor *ctx, ++ nsAString &_password, ++ PRBool *_retval) ++{ ++ /* The person who wrote this method implementation did ++ * not read the contract. ++ */ ++ *_retval = PR_FALSE; ++ return NS_OK; ++} ++ ++/* void viewCert (in nsIX509Cert cert); */ ++NS_IMETHODIMP ++EmbedCertificates::ViewCert( ++ nsIInterfaceRequestor *ctx, ++ nsIX509Cert *cert) ++{ ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedCertificates::DisplayGeneratingKeypairInfo(nsIInterfaceRequestor *aCtx, nsIKeygenThread *runnable) ++{ ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedCertificates::ChooseToken( ++ nsIInterfaceRequestor *aCtx, ++ const PRUnichar **aTokenList, ++ PRUint32 aCount, ++ PRUnichar **aTokenChosen, ++ PRBool *aCanceled) ++{ ++ *aCanceled = PR_FALSE; ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedCertificates::DisplayProtectedAuth( ++ nsIInterfaceRequestor *aCtx, ++ nsIProtectedAuthThread *runnable) ++{ ++ return NS_OK; ++} ++ ++/* boolean ConfirmKeyEscrow (in nsIX509Cert escrowAuthority); */ ++NS_IMETHODIMP ++EmbedCertificates::ConfirmKeyEscrow(nsIX509Cert *escrowAuthority, PRBool *_retval) ++{ ++ // If an implementation chooses not to implement UI that asks the user for ++ // confirmation to hand out the private key, ++ // then this function must return PR_FALSE. ++ *_retval = PR_FALSE; ++ return NS_OK; ++} ++ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedCertificates.h.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedCertificates.h +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedCertificates.h.gtkmozembed 2012-01-18 16:44:32.467289972 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedCertificates.h 2012-01-18 16:44:32.467289972 +0100 +@@ -0,0 +1,84 @@ ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ ++/* vim:set ts=2 sw=2 sts=2 et cindent: */ ++/* ***** BEGIN LICENSE BLOCK ***** ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla Public License Version ++ * 1.1 (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * http://www.mozilla.org/MPL/ ++ * ++ * Software distributed under the License is distributed on an "AS IS" basis, ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++ * for the specific language governing rights and limitations under the ++ * License. ++ * ++ * The Original Code is mozilla.org code. ++ * ++ * The Initial Developer of the Original Code is ++ * Netscape Communications Corporation. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Terry Hayes ++ * Javier Delgadillo ++ * Oleg Romashin ++ * ++ * 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 ***** */ ++/** ++ * Derived from nsNSSDialogs http://landfill.mozilla.org/mxr-test/seamonkey/source/security/manager/pki/src/nsNSSDialogs.h ++ */ ++#ifndef __EmbedCertificates_h ++#define __EmbedCertificates_h ++#include "nsITokenPasswordDialogs.h" ++#include "nsICertificateDialogs.h" ++#include "nsIClientAuthDialogs.h" ++#include "nsICertPickDialogs.h" ++#include "nsITokenDialogs.h" ++#include "nsIDOMCryptoDialogs.h" ++#include "nsIGenKeypairInfoDlg.h" ++#include "nsCOMPtr.h" ++#include "nsIStringBundle.h" ++#define EMBED_CERTIFICATES_CID \ ++ { 0x518e071f, 0x1dd2, 0x11b2, \ ++ { 0x93, 0x7e, 0xc4, 0x5f, 0x14, 0xde, 0xf7, 0x78 }} ++#define EMBED_CERTIFICATES_DESCRIPTION "Certificates Listener Impl" ++class EmbedPrivate; ++class EmbedCertificates ++: public nsITokenPasswordDialogs, ++ public nsICertificateDialogs, ++ public nsIClientAuthDialogs, ++ public nsICertPickDialogs, ++ public nsITokenDialogs, ++ public nsIDOMCryptoDialogs, ++ public nsIGeneratingKeypairInfoDialogs ++{ ++ public: ++ NS_DECL_ISUPPORTS ++ NS_DECL_NSITOKENPASSWORDDIALOGS ++ NS_DECL_NSICERTIFICATEDIALOGS ++ NS_DECL_NSICLIENTAUTHDIALOGS ++ NS_DECL_NSICERTPICKDIALOGS ++ NS_DECL_NSITOKENDIALOGS ++ NS_DECL_NSIDOMCRYPTODIALOGS ++ NS_DECL_NSIGENERATINGKEYPAIRINFODIALOGS ++ EmbedCertificates(); ++ virtual ~EmbedCertificates(); ++ nsresult Init(void); ++ protected: ++ nsCOMPtr mPIPStringBundle; ++}; ++#endif /* __EmbedCertificates_h */ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContentListener.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContentListener.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContentListener.cpp.gtkmozembed 2012-01-18 16:44:32.468289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContentListener.cpp 2012-01-19 10:10:40.325459303 +0100 +@@ -0,0 +1,156 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "nsIURI.h" ++ ++#include "EmbedContentListener.h" ++#include "EmbedPrivate.h" ++ ++#include "nsServiceManagerUtils.h" ++#include "nsIWebNavigationInfo.h" ++#include "nsDocShellCID.h" ++ ++EmbedContentListener::EmbedContentListener(void) ++{ ++ mOwner = nsnull; ++} ++ ++EmbedContentListener::~EmbedContentListener() ++{ ++} ++ ++NS_IMPL_ISUPPORTS2(EmbedContentListener, ++ nsIURIContentListener, ++ nsISupportsWeakReference) ++ ++nsresult ++EmbedContentListener::Init(EmbedPrivate *aOwner) ++{ ++ mOwner = aOwner; ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedContentListener::OnStartURIOpen(nsIURI *aURI, ++ bool *aAbortOpen) ++{ ++ nsresult rv; ++ ++ nsCAutoString specString; ++ rv = aURI->GetSpec(specString); ++ ++ if (NS_FAILED(rv)) ++ return rv; ++ ++ gint return_val = FALSE; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[OPEN_URI], 0, ++ specString.get(), &return_val); ++ ++ *aAbortOpen = return_val; ++ ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedContentListener::DoContent(const char *aContentType, ++ bool aIsContentPreferred, ++ nsIRequest *aRequest, ++ nsIStreamListener **aContentHandler, ++ bool *aAbortProcess) ++{ ++ return NS_ERROR_NOT_IMPLEMENTED; ++} ++ ++NS_IMETHODIMP ++EmbedContentListener::IsPreferred(const char *aContentType, ++ char **aDesiredContentType, ++ bool *aCanHandleContent) ++{ ++ return CanHandleContent(aContentType, PR_TRUE, aDesiredContentType, ++ aCanHandleContent); ++} ++ ++NS_IMETHODIMP ++EmbedContentListener::CanHandleContent(const char *aContentType, ++ bool aIsContentPreferred, ++ char **aDesiredContentType, ++ bool *_retval) ++{ ++ *_retval = PR_FALSE; ++ *aDesiredContentType = nsnull; ++ ++ if (aContentType) { ++ nsCOMPtr webNavInfo( ++ do_GetService(NS_WEBNAVIGATION_INFO_CONTRACTID)); ++ if (webNavInfo) { ++ PRUint32 canHandle; ++ nsresult rv = ++ webNavInfo->IsTypeSupported(nsDependentCString(aContentType), ++ mOwner ? mOwner->mNavigation.get() : nsnull, ++ &canHandle); ++ NS_ENSURE_SUCCESS(rv, rv); ++ *_retval = (canHandle != nsIWebNavigationInfo::UNSUPPORTED); ++ } ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedContentListener::GetLoadCookie(nsISupports **aLoadCookie) ++{ ++ return NS_ERROR_NOT_IMPLEMENTED; ++} ++ ++NS_IMETHODIMP ++EmbedContentListener::SetLoadCookie(nsISupports *aLoadCookie) ++{ ++ return NS_ERROR_NOT_IMPLEMENTED; ++} ++ ++NS_IMETHODIMP ++EmbedContentListener::GetParentContentListener(nsIURIContentListener **aParent) ++{ ++ return NS_ERROR_NOT_IMPLEMENTED; ++} ++ ++NS_IMETHODIMP ++EmbedContentListener::SetParentContentListener(nsIURIContentListener *aParent) ++{ ++ return NS_ERROR_NOT_IMPLEMENTED; ++} ++ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContentListener.h.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContentListener.h +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContentListener.h.gtkmozembed 2012-01-18 16:44:32.469289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContentListener.h 2012-01-18 16:44:32.469289973 +0100 +@@ -0,0 +1,66 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#ifndef __EmbedContentListener_h ++#define __EmbedContentListener_h ++ ++#include "nsIURIContentListener.h" ++#include "nsWeakReference.h" ++ ++class EmbedPrivate; ++ ++class EmbedContentListener : public nsIURIContentListener, ++ public nsSupportsWeakReference ++{ ++ public: ++ ++ EmbedContentListener(); ++ virtual ~EmbedContentListener(); ++ ++ nsresult Init (EmbedPrivate *aOwner); ++ ++ NS_DECL_ISUPPORTS ++ ++ NS_DECL_NSIURICONTENTLISTENER ++ ++ private: ++ ++ EmbedPrivate *mOwner; ++ ++}; ++ ++#endif /* __EmbedContentListener_h */ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp.gtkmozembed 2012-01-18 16:44:32.471289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp 2012-01-18 16:44:32.471289973 +0100 +@@ -0,0 +1,618 @@ ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ ++/* vim:set ts=2 sw=2 sts=2 tw=80 et cindent: */ ++/* ***** 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 ++ * Oleg Romashin. ++ * Portions created by the Initial Developer are Copyright (C) 2006 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Oleg Romashin ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++#include "EmbedContextMenuInfo.h" ++#include "nsIImageLoadingContent.h" ++#include "imgILoader.h" ++#include "nsIDOMDocument.h" ++#include "nsIDOMHTMLDocument.h" ++#include "nsIDOMHTMLElement.h" ++#include "nsIDOMHTMLHtmlElement.h" ++#include "nsIDOMHTMLAnchorElement.h" ++#include "nsIDOMHTMLImageElement.h" ++#include "nsIDOMHTMLAreaElement.h" ++#include "nsIDOMHTMLLinkElement.h" ++#include "nsIDOMDocumentView.h" ++#include "nsIDOMAbstractView.h" ++#include "nsIDOMViewCSS.h" ++#include "nsIDOMCSSStyleDeclaration.h" ++#include "nsIDOMCSSValue.h" ++#include "nsIDOMCSSPrimitiveValue.h" ++#include "nsNetUtil.h" ++#include "nsUnicharUtils.h" ++#include "nsIDOMMouseEvent.h" ++#include "nsIDOMNSEvent.h" ++#include "nsIDOMWindow.h" ++#include "nsIDOMWindowCollection.h" ++#include "nsIWebBrowser.h" ++#include "nsIContent.h" ++#include "nsIPresShell.h" ++#include "nsIFormControl.h" ++#include "nsIDOMNSHTMLTextAreaElement.h" ++#include "nsIDOMHTMLInputElement.h" ++#include "nsIDOMHTMLTextAreaElement.h" ++#include "nsIDOMNSHTMLDocument.h" ++#include "nsIDOMNodeList.h" ++#include "nsISelection.h" ++#include "nsIDocument.h" ++#include "EmbedPrivate.h" ++#include ++#include ++#include ++#include ++#if defined(FIXED_BUG347731) || !defined(MOZ_ENABLE_LIBXUL) ++#include "nsIFrame.h" ++#endif ++ ++//***************************************************************************** ++// class EmbedContextMenuInfo ++//***************************************************************************** ++EmbedContextMenuInfo::EmbedContextMenuInfo(EmbedPrivate *aOwner) : mCtxFrameNum(-1), mEmbedCtxType(0) ++{ ++ mOwner = aOwner; ++ mEventNode = nsnull; ++ mCtxDocument = nsnull; ++ mNSHHTMLElement = nsnull; ++ mNSHHTMLElementSc = nsnull; ++ mCtxEvent = nsnull; ++ mEventNode = nsnull; ++ mFormRect = nsIntRect(0,0,0,0); ++} ++ ++EmbedContextMenuInfo::~EmbedContextMenuInfo(void) ++{ ++ mEventNode = nsnull; ++ mCtxDocument = nsnull; ++ mNSHHTMLElement = nsnull; ++ mNSHHTMLElementSc = nsnull; ++ mCtxEvent = nsnull; ++ mEventNode = nsnull; ++} ++ ++NS_IMPL_ADDREF(EmbedContextMenuInfo) ++NS_IMPL_RELEASE(EmbedContextMenuInfo) ++NS_INTERFACE_MAP_BEGIN(EmbedContextMenuInfo) ++NS_INTERFACE_MAP_ENTRY(nsISupports) ++NS_INTERFACE_MAP_END ++ ++nsresult ++EmbedContextMenuInfo::SetFrameIndex() ++{ ++ nsCOMPtr frames; ++ mCtxDomWindow->GetFrames(getter_AddRefs(frames)); ++ nsCOMPtr currentWindow; ++ PRUint32 frameCount = 0; ++ frames->GetLength(&frameCount); ++ for (unsigned int i= 0; i < frameCount; i++) { ++ frames->Item(i, getter_AddRefs(currentWindow)); ++ nsCOMPtr currentDoc; ++ currentWindow->GetDocument(getter_AddRefs(currentDoc)); ++ if (currentDoc == mCtxDocument) { ++ mCtxFrameNum = i; ++ mCtxDomWindow = currentWindow; ++ nsCOMPtr doc = do_QueryInterface(currentDoc); ++ if (doc) ++ doc->GetTitle(mCtxDocTitle); ++ return NS_OK; ++ } ++ } ++ return NS_ERROR_FAILURE; ++} ++ ++nsresult ++EmbedContextMenuInfo::GetFormControlType(nsIDOMEvent* aEvent) ++{ ++ if (!aEvent) ++ return NS_OK; ++ nsCOMPtr nsevent(do_QueryInterface(aEvent)); ++ nsCOMPtr target; ++ nsevent->GetOriginalTarget(getter_AddRefs(target)); ++ // mOrigTarget = target; ++ if (SetFormControlType(target)) { ++ nsCOMPtr eventNode = do_QueryInterface(target); ++ if (!eventNode) ++ return NS_OK; ++ //Frame Stuff ++ nsCOMPtr domDoc; ++ nsresult rv = eventNode->GetOwnerDocument(getter_AddRefs(domDoc)); ++ if (!NS_SUCCEEDED(rv) || !domDoc) { ++ return NS_OK; ++ } ++ mEventNode = eventNode; ++ mCtxDocument = domDoc; ++ nsCOMPtr doc = do_QueryInterface(mCtxDocument); ++ if (!doc) ++ return NS_OK; ++ nsIPresShell *presShell = doc->GetShell(); ++ if (!presShell) ++ return NS_OK; ++ nsCOMPtr tgContent = do_QueryInterface(mEventTarget); ++ nsIFrame* frame = nsnull; ++#if defined(FIXED_BUG347731) || !defined(MOZ_ENABLE_LIBXUL) ++ frame = tgContent->GetDocument() == presShell->GetDocument() ? ++ tgContent->GetPrimaryFrame() : nsnull; ++ if (frame) ++ mFormRect = frame->GetScreenRectExternal(); ++#endif ++ return NS_OK; ++ } ++ return NS_ERROR_FAILURE; ++} ++ ++nsresult ++EmbedContextMenuInfo::SetFormControlType(nsIDOMEventTarget *originalTarget) ++{ ++ nsresult rv = NS_ERROR_FAILURE; ++ nsCOMPtr targetContent = do_QueryInterface(originalTarget); ++ mCtxFormType = 0; ++ if (targetContent && targetContent->IsNodeOfType(nsIContent::eHTML_FORM_CONTROL)) { ++ nsCOMPtr formControl(do_QueryInterface(targetContent)); ++ if (formControl) { ++ mCtxFormType = formControl->GetType(); ++ rv = NS_OK; ++ //#ifdef MOZ_LOGGING ++ switch (mCtxFormType) { ++ case NS_FORM_BUTTON_BUTTON: ++ break; ++ case NS_FORM_BUTTON_RESET: ++ break; ++ case NS_FORM_BUTTON_SUBMIT: ++ break; ++ case NS_FORM_INPUT_BUTTON: ++ break; ++ case NS_FORM_INPUT_CHECKBOX: ++ break; ++ case NS_FORM_INPUT_FILE: ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_INPUT; ++ break; ++ case NS_FORM_INPUT_HIDDEN: ++ break; ++ case NS_FORM_INPUT_RESET: ++ break; ++ case NS_FORM_INPUT_IMAGE: ++ break; ++ case NS_FORM_INPUT_PASSWORD: ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_INPUT; ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_IPASSWORD; ++ break; ++ case NS_FORM_INPUT_RADIO: ++ break; ++ case NS_FORM_INPUT_SUBMIT: ++ break; ++ case NS_FORM_INPUT_EMAIL: ++ case NS_FORM_INPUT_SEARCH: ++ case NS_FORM_INPUT_TEXT: ++ case NS_FORM_INPUT_TEL: ++ case NS_FORM_INPUT_URL: ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_INPUT; ++ break; ++ case NS_FORM_LABEL: ++ break; ++ case NS_FORM_SELECT: ++ break; ++ case NS_FORM_TEXTAREA: ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_INPUT; ++ break; ++ case NS_FORM_OBJECT: ++ break; ++ case NS_FORM_OUTPUT: ++ break; ++ default: ++ break; ++ } ++ if (mEmbedCtxType & GTK_MOZ_EMBED_CTX_INPUT) { ++ PRBool rdonly = PR_FALSE; ++ if (mCtxFormType == NS_FORM_TEXTAREA) { ++ nsCOMPtr input; ++ input = do_QueryInterface(mEventNode, &rv); ++ if (!NS_FAILED(rv) && input) ++ rv = input->GetReadOnly(&rdonly); ++ if (!NS_FAILED(rv) && rdonly) { ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_ROINPUT; ++ } ++ } else { ++ nsCOMPtr input; ++ input = do_QueryInterface(mEventNode, &rv); ++ if (!NS_FAILED(rv) && input) ++ rv = input->GetReadOnly(&rdonly); ++ if (!NS_FAILED(rv) && rdonly) { ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_ROINPUT; ++ } ++ } ++ } ++ //#endif ++ } ++ } ++ return rv; ++} ++ ++const char* ++EmbedContextMenuInfo::GetSelectedText() ++{ ++ nsString cString; ++ nsresult rv = NS_ERROR_FAILURE; ++ if (mCtxFormType != 0 && mEventNode) { ++ PRInt32 TextLength = 0, selStart = 0, selEnd = 0; ++ if (mCtxFormType == NS_FORM_INPUT_TEXT || mCtxFormType == NS_FORM_INPUT_FILE) { ++ nsCOMPtr nsinput = do_QueryInterface(mEventNode, &rv); ++ if (NS_SUCCEEDED(rv) && nsinput) ++ nsinput->GetTextLength(&TextLength); ++ if (TextLength > 0) { ++ nsinput->GetSelectionEnd(&selEnd); ++ nsinput->GetSelectionStart(&selStart); ++ if (selStart < selEnd || mCtxFormType == NS_FORM_INPUT_FILE) { ++ nsCOMPtr input = do_QueryInterface(mEventNode, &rv); ++ rv = input->GetValue(cString); ++ } ++ } ++ } else if (mCtxFormType == NS_FORM_TEXTAREA) { ++ nsCOMPtr nsinput = do_QueryInterface(mEventNode, &rv); ++ if (NS_SUCCEEDED(rv) && nsinput) ++ nsinput->GetTextLength(&TextLength); ++ if (TextLength > 0) { ++ nsinput->GetSelectionStart(&selStart); ++ nsinput->GetSelectionEnd(&selEnd); ++ if (selStart < selEnd) { ++ nsCOMPtr input = do_QueryInterface(mEventNode, &rv); ++ rv = input->GetValue(cString); ++ } ++ } ++ } ++ if (NS_SUCCEEDED(rv) && !cString.IsEmpty()) { ++ if (selStart < selEnd) { ++ cString.Cut(0, selStart); ++ cString.Cut(selEnd-selStart, TextLength); ++ } ++ rv = NS_OK; ++ } ++ } else if (mCtxDocument) { ++ nsCOMPtr htmlDoc = do_QueryInterface(mCtxDocument, &rv); ++ if (NS_FAILED(rv) || !htmlDoc) ++ return nsnull; ++ rv = htmlDoc->GetSelection(cString); ++ if (NS_FAILED(rv) || cString.IsEmpty()) ++ return nsnull; ++ rv = NS_OK; ++ } ++ if (rv == NS_OK) { ++ return NS_ConvertUTF16toUTF8(cString).get(); ++ } ++ return nsnull; ++} ++ ++nsresult ++EmbedContextMenuInfo::CheckDomImageElement(nsIDOMNode *node, nsString& aHref, ++ PRInt32 *aWidth, PRInt32 *aHeight) ++{ ++ nsresult rv = NS_ERROR_FAILURE; ++ nsCOMPtr image = ++ do_QueryInterface(node, &rv); ++ if (image) { ++ rv = image->GetSrc(aHref); ++ if (NS_FAILED(rv)) { ++ return rv; ++ } ++ rv = image->GetWidth(aWidth); ++ rv = image->GetHeight(aHeight); ++ rv = NS_OK; ++ } ++ return rv; ++} ++ ++nsresult ++EmbedContextMenuInfo::GetImageRequest(imgIRequest **aRequest, nsIDOMNode *aDOMNode) ++{ ++ NS_ENSURE_ARG(aDOMNode); ++ NS_ENSURE_ARG_POINTER(aRequest); ++ ++ // Get content ++ nsCOMPtr content(do_QueryInterface(aDOMNode)); ++ NS_ENSURE_TRUE(content, NS_ERROR_FAILURE); ++ ++ return content->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST, ++ aRequest); ++} ++ ++nsresult ++EmbedContextMenuInfo::CheckDomHtmlNode(nsIDOMNode *aNode) ++{ ++ nsresult rv = NS_ERROR_FAILURE; ++ nsString uTag; ++ PRUint16 dnode_type; ++ ++ nsCOMPtr node; ++ if (!aNode && mEventNode) ++ node = mEventNode; ++ nsCOMPtr element = do_QueryInterface(node, &rv); ++ if (!element) { ++ element = do_QueryInterface(mOrigNode, &rv); ++ if (element) { ++ node = mOrigNode; ++ element = do_QueryInterface(node, &rv); ++ } ++ } ++ ++ rv = node->GetNodeType(&dnode_type); ++ if (NS_FAILED(rv)) { ++ return rv; ++ } ++ ++ if (!((nsIDOMNode::ELEMENT_NODE == dnode_type) && element)) { ++ return rv; ++ } ++ nsCOMPtr nodeElement = do_QueryInterface(node, &rv); ++ if (NS_SUCCEEDED(rv) && nodeElement) { ++ mNSHHTMLElement = nodeElement; ++ } else { ++ mNSHHTMLElement = nsnull; ++ } ++ rv = element->GetLocalName(uTag); ++ if (NS_FAILED(rv)) { ++ return rv; ++ } ++ if (uTag.LowerCaseEqualsLiteral("object")) { ++ } ++ else if (uTag.LowerCaseEqualsLiteral("html")) { ++ } ++ else if (uTag.LowerCaseEqualsLiteral("a")) { ++ nsCOMPtr anchor = do_QueryInterface(node); ++ anchor->GetHref(mCtxHref); ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_LINK; ++ if (anchor && !mCtxHref.IsEmpty()) { ++ if (mCtxHref.LowerCaseEqualsLiteral("text/smartbookmark")) { ++ nsCOMPtr childNode; ++ node->GetFirstChild(getter_AddRefs(childNode)); ++ if (childNode) { ++ PRInt32 width, height; ++ rv = CheckDomImageElement(node, mCtxImgHref, &width, &height); ++ if (NS_SUCCEEDED(rv)) ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_IMAGE; ++ } ++ } else if (StringBeginsWith(mCtxHref, NS_LITERAL_STRING("mailto:"))) { ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_EMAIL; ++ } ++ } ++ } ++ else if (uTag.LowerCaseEqualsLiteral("area")) { ++ nsCOMPtr area = do_QueryInterface(node, &rv); ++ if (NS_SUCCEEDED(rv) && area) { ++ PRBool aNoHref = PR_FALSE; ++ rv = area->GetNoHref(&aNoHref); ++ if (!aNoHref) ++ rv = area->GetHref(mCtxHref); ++ else ++ rv = area->GetTarget(mCtxHref); ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_LINK; ++ rv = NS_OK; ++ } ++ } ++ else if (uTag.LowerCaseEqualsLiteral("img")) { ++ PRInt32 width, height; ++ rv = CheckDomImageElement(node, mCtxImgHref, &width, &height); ++ if (NS_SUCCEEDED(rv)) ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_IMAGE; ++ } else { ++ rv = NS_ERROR_FAILURE; ++ } ++ return rv; ++} ++ ++nsresult ++EmbedContextMenuInfo::UpdateContextData(void *aEvent) ++{ ++ NS_ENSURE_ARG_POINTER(aEvent); ++ nsresult rv; ++ nsCOMPtr event = do_QueryInterface((nsISupports*)aEvent, &rv); ++ if (NS_FAILED(rv) || !event) ++ return NS_ERROR_FAILURE; ++ return UpdateContextData(event); ++} ++ ++nsresult ++EmbedContextMenuInfo::GetElementForScroll(nsIDOMEvent *aEvent) ++{ ++ if (!aEvent) return NS_ERROR_UNEXPECTED; ++ nsCOMPtr nsevent(do_QueryInterface(aEvent)); ++ nsCOMPtr target; ++ nsevent->GetOriginalTarget(getter_AddRefs(target)); ++ if (!target) return NS_ERROR_UNEXPECTED; ++ nsCOMPtr targetDOMNode(do_QueryInterface(target)); ++ if (!targetDOMNode) return NS_ERROR_UNEXPECTED; ++ nsCOMPtr targetDOMDocument; ++ targetDOMNode->GetOwnerDocument(getter_AddRefs(targetDOMDocument)); ++ if (!targetDOMDocument) return NS_ERROR_UNEXPECTED; ++ return GetElementForScroll(targetDOMDocument); ++} ++ ++nsresult ++EmbedContextMenuInfo::GetElementForScroll(nsIDOMDocument *targetDOMDocument) ++{ ++ nsCOMPtr targetDOMElement; ++ targetDOMDocument->GetDocumentElement(getter_AddRefs(targetDOMElement)); ++ if (!targetDOMElement) return NS_ERROR_UNEXPECTED; ++ nsString bodyName(NS_LITERAL_STRING("body")); ++ nsCOMPtr bodyList; ++ targetDOMElement->GetElementsByTagName(bodyName, getter_AddRefs(bodyList)); ++ PRUint32 i = 0; ++ bodyList->GetLength(&i); ++ if (i) { ++ nsCOMPtr domBodyNode; ++ bodyList->Item(0, getter_AddRefs(domBodyNode)); ++ if (!domBodyNode) return NS_ERROR_UNEXPECTED; ++ mNSHHTMLElementSc = do_QueryInterface(domBodyNode); ++ if (!mNSHHTMLElementSc) return NS_ERROR_UNEXPECTED; ++ } ++ return NS_OK; ++} ++ ++nsresult ++EmbedContextMenuInfo::UpdateContextData(nsIDOMEvent *aDOMEvent) ++{ ++ if (mCtxEvent == aDOMEvent) ++ return NS_OK; ++ ++ nsresult rv = nsnull; ++ mCtxEvent = aDOMEvent; ++ NS_ENSURE_ARG_POINTER(mCtxEvent); ++ ++ PRUint16 eventphase; ++ mCtxEvent->GetEventPhase(&eventphase); ++ if (!eventphase) { ++ mCtxEvent = nsnull; ++ return NS_ERROR_FAILURE; ++ } ++ ++ nsCOMPtr originalTarget = nsnull; ++ nsCOMPtr originalNode = nsnull; ++ ++ nsCOMPtr aEvent = do_QueryInterface(mCtxEvent, &rv); ++ if (NS_FAILED(rv) || !aEvent) ++ return NS_OK; ++ ++ nsCOMPtr mouseEvent(do_QueryInterface(mCtxEvent, &rv)); ++ if (mouseEvent) { ++ ((nsIDOMMouseEvent*)mouseEvent)->GetClientX(&mX); ++ ((nsIDOMMouseEvent*)mouseEvent)->GetClientY(&mY); ++ } ++ ++ if (aEvent) ++ rv = aEvent->GetOriginalTarget(getter_AddRefs(originalTarget)); ++ originalNode = do_QueryInterface(originalTarget); ++ if (NS_FAILED(rv) || !originalNode) ++ return NS_ERROR_NULL_POINTER; ++ ++ // nsresult SelText = mOwner->ClipBoardAction(GTK_MOZ_EMBED_CAN_COPY); ++ if (originalNode == mOrigNode) ++ return NS_OK; ++ ++ mEmbedCtxType = GTK_MOZ_EMBED_CTX_NONE; ++ mOrigNode = originalNode; ++ if (mOrigNode) { ++ nsString SOrigNode; ++ mOrigNode->GetNodeName(SOrigNode); ++ if (SOrigNode.EqualsLiteral("#document")) ++ return NS_OK; ++ if (SOrigNode.EqualsLiteral("xul:thumb") ++ || SOrigNode.EqualsLiteral("xul:slider") ++ || SOrigNode.EqualsLiteral("xul:scrollbarbutton") ++ || SOrigNode.EqualsLiteral("xul:vbox") ++ || SOrigNode.EqualsLiteral("xul:spacer")) { ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_XUL; ++ return NS_OK; ++ } ++ } ++ if (mCtxEvent) ++ rv = mCtxEvent->GetTarget(getter_AddRefs(mEventTarget)); ++ if (NS_FAILED(rv) || !mEventTarget) { ++ return NS_OK; ++ } ++ nsCOMPtr eventNode = do_QueryInterface(mEventTarget, &rv); ++ mEventNode = eventNode; ++ //Frame Stuff ++ nsCOMPtr domDoc; ++ if (mEventNode) ++ rv = mEventNode->GetOwnerDocument(getter_AddRefs(domDoc)); ++ if (!NS_SUCCEEDED(rv) || !domDoc) { ++ // return NS_OK; ++ } ++ if (NS_SUCCEEDED(rv) && domDoc && mCtxDocument != domDoc) { ++ mCtxDocument = domDoc; ++ mNSHHTMLElementSc = nsnull; ++ mCtxDocument->GetDocumentURI(mCtxURI); ++ NS_ENSURE_ARG_POINTER(mOwner); ++ nsCOMPtr webBrowser; ++ mOwner->mWindow->GetWebBrowser(getter_AddRefs(webBrowser)); ++ webBrowser->GetContentDOMWindow(getter_AddRefs(mCtxDomWindow)); ++ nsCOMPtr mainDocument; ++ mCtxDomWindow->GetDocument(getter_AddRefs(mainDocument)); ++ if (!mainDocument) { ++ return NS_OK; ++ } ++ mCtxFrameNum = -1; ++ if (mainDocument != domDoc) { ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_IFRAME; ++ SetFrameIndex(); ++ } ++ } ++ nsCOMPtr targetDOMElement; ++ mCtxDocument->GetDocumentElement(getter_AddRefs(targetDOMElement)); ++ if (!targetDOMElement) return NS_ERROR_UNEXPECTED; ++ nsCOMPtr htmlDoc = do_QueryInterface(mCtxDocument); ++ if (htmlDoc) { ++ nsString DMode; ++ htmlDoc->GetDesignMode(DMode); ++ if (DMode.EqualsLiteral("on")) { ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_INPUT; ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_RICHEDIT; ++ } ++ } ++ nsCOMPtr doc = do_QueryInterface(mCtxDocument); ++ if (!doc) ++ return NS_OK; ++ nsIPresShell *presShell = doc->GetShell(); ++ if (!presShell) ++ return NS_OK; ++ nsCOMPtr tgContent = do_QueryInterface(mEventTarget); ++ nsIFrame* frame = nsnull; ++#if defined(FIXED_BUG347731) || !defined(MOZ_ENABLE_LIBXUL) ++ if (mEmbedCtxType & GTK_MOZ_EMBED_CTX_RICHEDIT) ++ frame = presShell->GetRootFrame(); ++ else if (tgContent->GetDocument() == presShell->GetDocument()) { ++ frame = tgContent->GetPrimaryFrame(); ++ } ++ if (frame) { ++ mFormRect = frame->GetScreenRectExternal(); ++ } ++#endif ++ if (NS_SUCCEEDED(SetFormControlType(mEventTarget))) { ++ return NS_OK; ++ } ++ CheckDomHtmlNode(); ++ nsCOMPtr node = mEventNode; ++ nsCOMPtr parentNode; ++ node->GetParentNode(getter_AddRefs(parentNode)); ++ node = parentNode; ++ while (node) { ++ if (NS_FAILED(CheckDomHtmlNode())) ++ break; ++ node->GetParentNode(getter_AddRefs(parentNode)); ++ node = parentNode; ++ } ++ mEmbedCtxType |= GTK_MOZ_EMBED_CTX_DOCUMENT; ++ return NS_OK; ++} +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContextMenuInfo.h.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContextMenuInfo.h +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContextMenuInfo.h.gtkmozembed 2012-01-18 16:44:32.472289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedContextMenuInfo.h 2012-01-18 16:44:32.472289973 +0100 +@@ -0,0 +1,101 @@ ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ ++/* vim:set ts=2 sw=2 sts=2 tw=80 et cindent: */ ++/* ++ * ***** 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 Mozilla browser. ++ * ++ * The Original Code is mozilla.org code. ++ * ++ * The Initial Developer of the Original Code is ++ * Oleg Romashin. ++ * Portions created by the Initial Developer are Copyright (C) 2006 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Oleg Romashin ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++#ifndef EmbedContextMenuInfo_h__ ++#define EmbedContextMenuInfo_h__ ++#include "nsCOMPtr.h" ++#include "nsIDOMNode.h" ++#include "nsIDOMEvent.h" ++#include "imgIContainer.h" ++#include "imgIRequest.h" ++#include "nsIDOMEventTarget.h" ++#include "nsRect.h" ++// for strings ++#ifdef MOZILLA_INTERNAL_API ++#include "nsXPIDLString.h" ++#include "nsReadableUtils.h" ++#endif ++#include "EmbedWindow.h" ++#include "nsIDOMNSHTMLElement.h" ++//***************************************************************************** ++// class EmbedContextMenuInfo ++// ++//***************************************************************************** ++class EmbedContextMenuInfo : public nsISupports ++{ ++public: ++ EmbedContextMenuInfo(EmbedPrivate *aOwner); ++ virtual ~EmbedContextMenuInfo(void); ++ NS_DECL_ISUPPORTS ++ nsresult GetFormControlType(nsIDOMEvent *aDOMEvent); ++ nsresult UpdateContextData(nsIDOMEvent *aDOMEvent); ++ nsresult UpdateContextData(void *aEvent); ++ const char* GetSelectedText(); ++ nsresult GetElementForScroll(nsIDOMDocument *targetDOMDocument); ++ nsresult GetElementForScroll(nsIDOMEvent *aEvent); ++ nsresult CheckDomImageElement(nsIDOMNode *node, nsString& aHref, ++ PRInt32 *aWidth, PRInt32 *aHeight); ++ nsresult GetImageRequest(imgIRequest **aRequest, nsIDOMNode *aDOMNode); ++ nsString GetCtxDocTitle(void) { return mCtxDocTitle; } ++ ++ ++ PRInt32 mX, mY, mObjWidth, mObjHeight, mCtxFrameNum; ++ nsString mCtxURI, mCtxHref, mCtxImgHref; ++ PRUint32 mEmbedCtxType; ++ PRInt32 mCtxFormType; ++ nsCOMPtr mEventNode; ++ nsCOMPtr mEventTarget; ++ nsCOMPtrmCtxDocument; ++ nsIntRect mFormRect; ++ nsCOMPtr mCtxDomWindow; ++ nsCOMPtr mCtxEvent; ++ nsCOMPtr mNSHHTMLElement; ++ nsCOMPtr mNSHHTMLElementSc; ++private: ++ nsresult SetFrameIndex(); ++ nsresult SetFormControlType(nsIDOMEventTarget *originalTarget); ++ nsresult CheckDomHtmlNode(nsIDOMNode *aNode = nsnull); ++ ++ EmbedPrivate *mOwner; ++ nsCOMPtr mOrigNode; ++ nsString mCtxDocTitle; ++}; // class EmbedContextMenuInfo ++#endif // EmbedContextMenuInfo_h__ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedEventListener.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedEventListener.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedEventListener.cpp.gtkmozembed 2012-01-18 16:44:32.473289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedEventListener.cpp 2012-01-18 16:44:32.473289973 +0100 +@@ -0,0 +1,280 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "nsCOMPtr.h" ++#include "nsIDOMMouseEvent.h" ++ ++#include "nsIDOMKeyEvent.h" ++#include "nsIDOMUIEvent.h" ++ ++#include "EmbedEventListener.h" ++#include "EmbedPrivate.h" ++ ++EmbedEventListener::EmbedEventListener(void) ++{ ++ mOwner = nsnull; ++} ++ ++EmbedEventListener::~EmbedEventListener() ++{ ++} ++ ++NS_IMPL_ISUPPORTS1(EmbedEventListener, nsIDOMEventListener) ++ ++nsresult ++EmbedEventListener::Init(EmbedPrivate *aOwner) ++{ ++ mOwner = aOwner; ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedEventListener::KeyDown(nsIDOMEvent* aDOMEvent) ++{ ++ // Return FALSE to this function to mark the event as not ++ // consumed... ++ gint return_val = FALSE; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[DOM_KEY_DOWN], 0, ++ (void *)aDOMEvent, &return_val); ++ if (return_val) { ++ aDOMEvent->StopPropagation(); ++ aDOMEvent->PreventDefault(); ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedEventListener::KeyUp(nsIDOMEvent* aDOMEvent) ++{ ++ // return FALSE to this function to mark this event as not ++ // consumed... ++ gint return_val = FALSE; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[DOM_KEY_UP], 0, ++ (void *)aDOMEvent, &return_val); ++ if (return_val) { ++ aDOMEvent->StopPropagation(); ++ aDOMEvent->PreventDefault(); ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedEventListener::KeyPress(nsIDOMEvent* aDOMEvent) ++{ ++ // Return TRUE from your signal handler to mark the event as consumed. ++ gint return_val = FALSE; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[DOM_KEY_PRESS], 0, ++ (void *)aDOMEvent, &return_val); ++ if (return_val) { ++ aDOMEvent->StopPropagation(); ++ aDOMEvent->PreventDefault(); ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedEventListener::MouseDown(nsIDOMEvent* aDOMEvent) ++{ ++ // Return TRUE from your signal handler to mark the event as consumed. ++ gint return_val = FALSE; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[DOM_MOUSE_DOWN], 0, ++ (void *)aDOMEvent, &return_val); ++ if (return_val) { ++ aDOMEvent->StopPropagation(); ++ aDOMEvent->PreventDefault(); ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedEventListener::MouseUp(nsIDOMEvent* aDOMEvent) ++{ ++ // Return TRUE from your signal handler to mark the event as consumed. ++ gint return_val = FALSE; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[DOM_MOUSE_UP], 0, ++ (void *)aDOMEvent, &return_val); ++ if (return_val) { ++ aDOMEvent->StopPropagation(); ++ aDOMEvent->PreventDefault(); ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedEventListener::MouseClick(nsIDOMEvent* aDOMEvent) ++{ ++ // Return TRUE from your signal handler to mark the event as consumed. ++ gint return_val = FALSE; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[DOM_MOUSE_CLICK], 0, ++ (void *)aDOMEvent, &return_val); ++ if (return_val) { ++ aDOMEvent->StopPropagation(); ++ aDOMEvent->PreventDefault(); ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedEventListener::MouseDblClick(nsIDOMEvent* aDOMEvent) ++{ ++ // Return TRUE from your signal handler to mark the event as consumed. ++ gint return_val = FALSE; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[DOM_MOUSE_DBL_CLICK], 0, ++ (void *)aDOMEvent, &return_val); ++ if (return_val) { ++ aDOMEvent->StopPropagation(); ++ aDOMEvent->PreventDefault(); ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedEventListener::MouseOver(nsIDOMEvent* aDOMEvent) ++{ ++ // Return TRUE from your signal handler to mark the event as consumed. ++ gint return_val = FALSE; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[DOM_MOUSE_OVER], 0, ++ (void *)aDOMEvent, &return_val); ++ if (return_val) { ++ aDOMEvent->StopPropagation(); ++ aDOMEvent->PreventDefault(); ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedEventListener::MouseOut(nsIDOMEvent* aDOMEvent) ++{ ++ // Return TRUE from your signal handler to mark the event as consumed. ++ gint return_val = FALSE; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[DOM_MOUSE_OUT], 0, ++ (void *)aDOMEvent, &return_val); ++ if (return_val) { ++ aDOMEvent->StopPropagation(); ++ aDOMEvent->PreventDefault(); ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedEventListener::Activate(nsIDOMEvent* aDOMEvent) ++{ ++ // Return TRUE from your signal handler to mark the event as consumed. ++ gint return_val = FALSE; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[DOM_ACTIVATE], 0, ++ (void *)aDOMEvent, &return_val); ++ if (return_val) { ++ aDOMEvent->StopPropagation(); ++ aDOMEvent->PreventDefault(); ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedEventListener::FocusIn(nsIDOMEvent* aDOMEvent) ++{ ++ // Return TRUE from your signal handler to mark the event as consumed. ++ gint return_val = FALSE; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[DOM_FOCUS_IN], 0, ++ (void *)aDOMEvent, &return_val); ++ if (return_val) { ++ aDOMEvent->StopPropagation(); ++ aDOMEvent->PreventDefault(); ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedEventListener::FocusOut(nsIDOMEvent* aDOMEvent) ++{ ++ // Return TRUE from your signal handler to mark the event as consumed. ++ gint return_val = FALSE; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[DOM_FOCUS_OUT], 0, ++ (void *)aDOMEvent, &return_val); ++ if (return_val) { ++ aDOMEvent->StopPropagation(); ++ aDOMEvent->PreventDefault(); ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedEventListener::HandleEvent(nsIDOMEvent* aDOMEvent) ++{ ++ nsAutoString eventType; ++ aDOMEvent->GetType(eventType); ++ ++ if (eventType.EqualsLiteral("keydown")) ++ return KeyDown(aDOMEvent); ++ else if (eventType.EqualsLiteral("keyup")) ++ return KeyUp(aDOMEvent); ++ else if (eventType.EqualsLiteral("keypress")) ++ return KeyPress(aDOMEvent); ++ else if (eventType.EqualsLiteral("mousedown")) ++ return MouseDown(aDOMEvent); ++ else if (eventType.EqualsLiteral("mouseup")) ++ return MouseUp(aDOMEvent); ++ else if (eventType.EqualsLiteral("click")) ++ return MouseClick(aDOMEvent); ++ else if (eventType.EqualsLiteral("dblclick")) ++ return MouseDblClick(aDOMEvent); ++ else if (eventType.EqualsLiteral("mouseover")) ++ return MouseOver(aDOMEvent); ++ else if (eventType.EqualsLiteral("mouseout")) ++ return MouseOut(aDOMEvent); ++ else if (eventType.EqualsLiteral("DOMActivate")) ++ return Activate(aDOMEvent); ++ else if (eventType.EqualsLiteral("DOMFocusIn")) ++ return FocusIn(aDOMEvent); ++ else if (eventType.EqualsLiteral("DOMFocusOut")) ++ return FocusOut(aDOMEvent); ++ ++ NS_ERROR("Unexpected event type"); ++ return NS_OK; ++} +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedEventListener.h.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedEventListener.h +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedEventListener.h.gtkmozembed 2012-01-18 16:44:32.474289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedEventListener.h 2012-01-18 16:44:32.474289973 +0100 +@@ -0,0 +1,89 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#ifndef __EmbedEventListener_h ++#define __EmbedEventListener_h ++ ++//#include "nsIDOMKeyListener.h" ++//#include "nsIDOMMouseListener.h" ++//#include "nsIDOMUIListener.h" ++#include "nsIDOMEventListener.h" ++ ++class EmbedPrivate; ++ ++class EmbedEventListener : public nsIDOMEventListener ++{ ++ public: ++ ++ EmbedEventListener(); ++ virtual ~EmbedEventListener(); ++ ++ nsresult Init(EmbedPrivate *aOwner); ++ ++ NS_DECL_ISUPPORTS ++ ++ // nsIDOMEventListener ++ ++ NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent); ++ ++ // nsIDOMKeyListener ++ ++ NS_IMETHOD KeyDown(nsIDOMEvent* aDOMEvent); ++ NS_IMETHOD KeyUp(nsIDOMEvent* aDOMEvent); ++ NS_IMETHOD KeyPress(nsIDOMEvent* aDOMEvent); ++ ++ // nsIDOMMouseListener ++ ++ NS_IMETHOD MouseDown(nsIDOMEvent* aDOMEvent); ++ NS_IMETHOD MouseUp(nsIDOMEvent* aDOMEvent); ++ NS_IMETHOD MouseClick(nsIDOMEvent* aDOMEvent); ++ NS_IMETHOD MouseDblClick(nsIDOMEvent* aDOMEvent); ++ NS_IMETHOD MouseOver(nsIDOMEvent* aDOMEvent); ++ NS_IMETHOD MouseOut(nsIDOMEvent* aDOMEvent); ++ ++ // nsIDOMUIListener ++ ++ NS_IMETHOD Activate(nsIDOMEvent* aDOMEvent); ++ NS_IMETHOD FocusIn(nsIDOMEvent* aDOMEvent); ++ NS_IMETHOD FocusOut(nsIDOMEvent* aDOMEvent); ++ ++ private: ++ ++ EmbedPrivate *mOwner; ++}; ++ ++#endif /* __EmbedEventListener_h */ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedGtkTools.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedGtkTools.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedGtkTools.cpp.gtkmozembed 2012-01-18 16:44:32.476289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedGtkTools.cpp 2012-01-18 16:44:32.476289973 +0100 +@@ -0,0 +1,88 @@ ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ ++/* vim:set ts=2 sw=4 sts=2 tw=80 et cindent: */ ++/* ***** 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 ++ * Oleg Romashin. ++ * Portions created by the Initial Developer are Copyright (C) 2006 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Oleg Romashin ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "EmbedGtkTools.h" ++#ifndef MOZILLA_INTERNAL_API ++#include "nsServiceManagerUtils.h" ++#endif ++#include "EmbedPrivate.h" ++ ++GtkWidget * GetGtkWidgetForDOMWindow(nsIDOMWindow* aDOMWindow) ++{ ++ nsCOMPtr wwatch = do_GetService("@mozilla.org/embedcomp/window-watcher;1"); ++ if (!aDOMWindow) ++ return NULL; ++ nsCOMPtr chrome; ++ wwatch->GetChromeForWindow(aDOMWindow, getter_AddRefs(chrome)); ++ if (!chrome) { ++ return GTK_WIDGET(EmbedCommon::GetAnyLiveWidget()); ++ } ++ ++ nsCOMPtr siteWindow = nsnull; ++ siteWindow = do_QueryInterface(chrome); ++ ++ if (!siteWindow) { ++ return GTK_WIDGET(EmbedCommon::GetAnyLiveWidget()); ++ } ++ ++ GtkWidget* parentWidget; ++ siteWindow->GetSiteWindow((void**)&parentWidget); ++ if (GTK_IS_WIDGET(parentWidget)) ++ return parentWidget; ++ return NULL; ++} ++ ++GtkWindow * GetGtkWindowForDOMWindow(nsIDOMWindow* aDOMWindow) ++{ ++ GtkWidget* parentWidget = GetGtkWidgetForDOMWindow(aDOMWindow); ++ if (!parentWidget) ++ return NULL; ++ GtkWidget* gtkWin = gtk_widget_get_toplevel(parentWidget); ++ if (GTK_WIDGET_TOPLEVEL(gtkWin)) ++ return GTK_WINDOW(gtkWin); ++ return NULL; ++} ++ ++nsresult GetContentViewer(nsIWebBrowser *webBrowser, nsIContentViewer **aViewer) ++{ ++ g_return_val_if_fail(webBrowser, NS_ERROR_FAILURE); ++ nsCOMPtr docShell(do_GetInterface((nsISupports*)webBrowser)); ++ NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE); ++ return docShell->GetContentViewer(aViewer); ++} +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedGtkTools.h.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedGtkTools.h +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedGtkTools.h.gtkmozembed 2012-01-18 16:44:32.476289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedGtkTools.h 2012-01-18 16:44:32.477289973 +0100 +@@ -0,0 +1,67 @@ ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ ++/* vim:set ts=2 sw=2 sts=2 et cindent: */ ++/* ***** 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 ++ * Oleg Romashin. ++ * Portions created by the Initial Developer are Copyright (C) 2006 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Oleg Romashin ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++#ifndef __EmbedTools_h ++#define __EmbedTools_h ++ ++#include "nsCOMPtr.h" ++#ifdef MOZILLA_INTERNAL_API ++#include "nsString.h" ++#else ++#include "nsStringAPI.h" ++#endif ++#include "nsIDOMWindow.h" ++#include "nsIWindowWatcher.h" ++#include "nsIWebBrowserChrome.h" ++#include "nsIEmbeddingSiteWindow.h" ++#include "nsIServiceManager.h" ++#include "nsIContentViewer.h" ++#include "nsIDocShell.h" ++#include "nsIInterfaceRequestorUtils.h" ++#include ++ ++GtkWidget* ++GetGtkWidgetForDOMWindow(nsIDOMWindow* aDOMWindow); ++ ++GtkWindow* ++GetGtkWindowForDOMWindow(nsIDOMWindow* aDOMWindow); ++ ++nsresult ++GetContentViewer(nsIWebBrowser *webBrowser, nsIContentViewer **aViewer); ++ ++#endif /* __EmbedTools_h */ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrivate.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrivate.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrivate.cpp.gtkmozembed 2012-01-18 16:44:32.478289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrivate.cpp 2012-01-19 10:08:33.847456417 +0100 +@@ -0,0 +1,1016 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "nsIDocShell.h" ++#include "nsIWebProgress.h" ++#include "nsIWidget.h" ++#include "nsCRT.h" ++#include "nsNetUtil.h" ++#include "nsIWebBrowserStream.h" ++#include "nsIWebBrowserFocus.h" ++#include "nsIDirectoryService.h" ++#include "nsAppDirectoryServiceDefs.h" ++ ++// for do_GetInterface ++#include "nsIInterfaceRequestor.h" ++// for do_CreateInstance ++#include "nsIComponentManager.h" ++#include "nsComponentManagerUtils.h" ++ ++// for initializing our window watcher service ++#include "nsIWindowWatcher.h" ++ ++#include "nsILocalFile.h" ++ ++#include "nsXULAppAPI.h" ++ ++// all of the crap that we need for event listeners ++// and when chrome windows finish loading ++#include "nsIDOMWindow.h" ++#include "nsPIDOMWindow.h" ++ ++ ++// For seting scrollbar visibilty ++#include "nsIDOMBarProp.h" ++ ++// all of our local includes ++#include "EmbedPrivate.h" ++#include "EmbedWindow.h" ++#include "EmbedProgress.h" ++#include "EmbedContentListener.h" ++#include "EmbedEventListener.h" ++#include "EmbedWindowCreator.h" ++#include "GtkPromptService.h" ++ ++#include "mozilla/ModuleUtils.h" ++ ++#ifdef MOZ_ACCESSIBILITY_ATK ++#include "nsIAccessibilityService.h" ++#include "nsIAccessible.h" ++#include "nsIDOMDocument.h" ++#endif ++ ++PRUint32 EmbedPrivate::sWidgetCount = 0; ++ ++char *EmbedPrivate::sPath = nsnull; ++char *EmbedPrivate::sCompPath = nsnull; ++nsTArray *EmbedPrivate::sWindowList = nsnull; ++nsILocalFile *EmbedPrivate::sProfileDir = nsnull; ++nsISupports *EmbedPrivate::sProfileLock = nsnull; ++GtkWidget *EmbedPrivate::sOffscreenWindow = 0; ++GtkWidget *EmbedPrivate::sOffscreenFixed = 0; ++ ++nsIDirectoryServiceProvider *EmbedPrivate::sAppFileLocProvider = nsnull; ++ ++class GTKEmbedDirectoryProvider : public nsIDirectoryServiceProvider2 ++{ ++public: ++ NS_DECL_ISUPPORTS_INHERITED ++ NS_DECL_NSIDIRECTORYSERVICEPROVIDER ++ NS_DECL_NSIDIRECTORYSERVICEPROVIDER2 ++}; ++ ++static const GTKEmbedDirectoryProvider kDirectoryProvider; ++ ++NS_IMPL_QUERY_INTERFACE2(GTKEmbedDirectoryProvider, ++ nsIDirectoryServiceProvider, ++ nsIDirectoryServiceProvider2) ++ ++NS_IMETHODIMP_(nsrefcnt) ++GTKEmbedDirectoryProvider::AddRef() ++{ ++ return 1; ++} ++ ++NS_IMETHODIMP_(nsrefcnt) ++GTKEmbedDirectoryProvider::Release() ++{ ++ return 1; ++} ++ ++NS_IMETHODIMP ++GTKEmbedDirectoryProvider::GetFile(const char *aKey, bool *aPersist, ++ nsIFile* *aResult) ++{ ++ if (EmbedPrivate::sAppFileLocProvider) { ++ nsresult rv = EmbedPrivate::sAppFileLocProvider->GetFile(aKey, aPersist, ++ aResult); ++ if (NS_SUCCEEDED(rv)) ++ return rv; ++ } ++ ++ if (EmbedPrivate::sProfileDir && (!strcmp(aKey, NS_APP_USER_PROFILE_50_DIR) ++ || !strcmp(aKey, NS_APP_PROFILE_DIR_STARTUP))) { ++ *aPersist = PR_TRUE; ++ return EmbedPrivate::sProfileDir->Clone(aResult); ++ } ++ ++ return NS_ERROR_FAILURE; ++} ++ ++NS_IMETHODIMP ++GTKEmbedDirectoryProvider::GetFiles(const char *aKey, ++ nsISimpleEnumerator* *aResult) ++{ ++ nsCOMPtr ++ dp2(do_QueryInterface(EmbedPrivate::sAppFileLocProvider)); ++ ++ if (!dp2) ++ return NS_ERROR_FAILURE; ++ ++ return dp2->GetFiles(aKey, aResult); ++} ++ ++#define NS_PROMPTSERVICE_CID \ ++ {0x95611356, 0xf583, 0x46f5, {0x81, 0xff, 0x4b, 0x3e, 0x01, 0x62, 0xc6, 0x19}} ++ ++NS_GENERIC_FACTORY_CONSTRUCTOR(GtkPromptService) ++NS_DEFINE_NAMED_CID(NS_PROMPTSERVICE_CID); ++ ++static const mozilla::Module::CIDEntry kDefaultPromptCIDs[] = { ++ { &kNS_PROMPTSERVICE_CID, false, NULL, GtkPromptServiceConstructor }, ++ { NULL } ++}; ++ ++static const mozilla::Module::ContractIDEntry kDefaultPromptContracts[] = { ++ { "@mozilla.org/embedcomp/prompt-service;1", &kNS_PROMPTSERVICE_CID }, ++ { NULL } ++}; ++ ++static const mozilla::Module kDefaultPromptModule = { ++ mozilla::Module::kVersion, ++ kDefaultPromptCIDs, ++ kDefaultPromptContracts ++}; ++ ++EmbedPrivate::EmbedPrivate(void) ++{ ++ mOwningWidget = nsnull; ++ mWindow = nsnull; ++ mProgress = nsnull; ++ mContentListener = nsnull; ++ mEventListener = nsnull; ++ mChromeMask = nsIWebBrowserChrome::CHROME_ALL; ++ mIsChrome = PR_FALSE; ++ mChromeLoaded = PR_FALSE; ++ mListenersAttached = PR_FALSE; ++ mMozWindowWidget = 0; ++ mIsDestroyed = PR_FALSE; ++ ++ PushStartup(); ++ if (!sWindowList) { ++ sWindowList = new nsTArray(); ++ } ++ sWindowList->AppendElement(this); ++} ++ ++EmbedPrivate::~EmbedPrivate() ++{ ++ sWindowList->RemoveElement(this); ++ PopStartup(); ++} ++ ++nsresult ++EmbedPrivate::Init(GtkMozEmbed *aOwningWidget) ++{ ++ // are we being re-initialized? ++ if (mOwningWidget) ++ return NS_OK; ++ ++ // hang on with a reference to the owning widget ++ mOwningWidget = aOwningWidget; ++ ++ // Create our embed window, and create an owning reference to it and ++ // initialize it. It is assumed that this window will be destroyed ++ // when we go out of scope. ++ mWindow = new EmbedWindow(); ++ mWindowGuard = static_cast(mWindow); ++ mWindow->Init(this); ++ ++ // Create our progress listener object, make an owning reference, ++ // and initialize it. It is assumed that this progress listener ++ // will be destroyed when we go out of scope. ++ mProgress = new EmbedProgress(); ++ mProgressGuard = static_cast ++ (mProgress); ++ mProgress->Init(this); ++ ++ // Create our content listener object, initialize it and attach it. ++ // It is assumed that this will be destroyed when we go out of ++ // scope. ++ mContentListener = new EmbedContentListener(); ++ mContentListenerGuard = static_cast(static_cast(mContentListener)); ++ mContentListener->Init(this); ++ ++ // Create our key listener object and initialize it. It is assumed ++ // that this will be destroyed before we go out of scope. ++ mEventListener = new EmbedEventListener(); ++ mEventListenerGuard = ++ static_cast(static_cast(mEventListener)); ++ mEventListener->Init(this); ++ ++ // has the window creator service been set up? ++ static int initialized = PR_FALSE; ++ // Set up our window creator ( only once ) ++ if (!initialized) { ++ // We set this flag here instead of on success. If it failed we ++ // don't want to keep trying and leaking window creator objects. ++ initialized = PR_TRUE; ++ ++ // create our local object ++ EmbedWindowCreator *creator = new EmbedWindowCreator(); ++ nsCOMPtr windowCreator; ++ windowCreator = static_cast(creator); ++ ++ // Attach it via the watcher service ++ nsCOMPtr watcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID); ++ if (watcher) ++ watcher->SetWindowCreator(windowCreator); ++ } ++ return NS_OK; ++} ++ ++nsresult ++EmbedPrivate::Realize(PRBool *aAlreadyRealized) ++{ ++ ++ *aAlreadyRealized = PR_FALSE; ++ ++ // create the offscreen window if we have to ++ EnsureOffscreenWindow(); ++ ++ // Have we ever been initialized before? If so then just reparent ++ // from the offscreen window. ++ if (mMozWindowWidget) { ++ gtk_widget_reparent(mMozWindowWidget, GTK_WIDGET(mOwningWidget)); ++ *aAlreadyRealized = PR_TRUE; ++ return NS_OK; ++ } ++ ++ // Get the nsIWebBrowser object for our embedded window. ++ nsCOMPtr webBrowser; ++ mWindow->GetWebBrowser(getter_AddRefs(webBrowser)); ++ ++ // get a handle on the navigation object ++ mNavigation = do_QueryInterface(webBrowser); ++ ++ // Create our session history object and tell the navigation object ++ // to use it. We need to do this before we create the web browser ++ // window. ++ mSessionHistory = do_CreateInstance(NS_SHISTORY_CONTRACTID); ++ mNavigation->SetSessionHistory(mSessionHistory); ++ ++ // create the window ++ mWindow->CreateWindow(); ++ ++ // bind the progress listener to the browser object ++ nsCOMPtr supportsWeak; ++ supportsWeak = do_QueryInterface(mProgressGuard); ++ nsCOMPtr weakRef; ++ supportsWeak->GetWeakReference(getter_AddRefs(weakRef)); ++ webBrowser->AddWebBrowserListener(weakRef, ++ NS_GET_IID(nsIWebProgressListener)); ++ ++ // set ourselves as the parent uri content listener ++ nsCOMPtr uriListener; ++ uriListener = do_QueryInterface(mContentListenerGuard); ++ webBrowser->SetParentURIContentListener(uriListener); ++ ++ // save the window id of the newly created window ++ nsCOMPtr mozWidget; ++ mWindow->mBaseWindow->GetMainWidget(getter_AddRefs(mozWidget)); ++ // get the native drawing area ++ GdkWindow *tmp_window = ++ static_cast( ++ mozWidget->GetNativeData(NS_NATIVE_WINDOW)); ++ // and, thanks to superwin we actually need the parent of that. ++ tmp_window = gdk_window_get_parent(tmp_window); ++ // save the widget ID - it should be the mozarea of the window. ++ gpointer data = nsnull; ++ gdk_window_get_user_data(tmp_window, &data); ++ mMozWindowWidget = static_cast(data); ++ ++ // Apply the current chrome mask ++ ApplyChromeMask(); ++ ++ return NS_OK; ++} ++ ++void ++EmbedPrivate::Unrealize(void) ++{ ++ // reparent to our offscreen window ++ gtk_widget_reparent(mMozWindowWidget, sOffscreenFixed); ++} ++ ++void ++EmbedPrivate::Show(void) ++{ ++ // Get the nsIWebBrowser object for our embedded window. ++ nsCOMPtr webBrowser; ++ mWindow->GetWebBrowser(getter_AddRefs(webBrowser)); ++ ++ // and set the visibility on the thing ++ nsCOMPtr baseWindow = do_QueryInterface(webBrowser); ++ baseWindow->SetVisibility(PR_TRUE); ++} ++ ++void ++EmbedPrivate::Hide(void) ++{ ++ // Get the nsIWebBrowser object for our embedded window. ++ nsCOMPtr webBrowser; ++ mWindow->GetWebBrowser(getter_AddRefs(webBrowser)); ++ ++ // and set the visibility on the thing ++ nsCOMPtr baseWindow = do_QueryInterface(webBrowser); ++ baseWindow->SetVisibility(PR_FALSE); ++} ++ ++void ++EmbedPrivate::Resize(PRUint32 aWidth, PRUint32 aHeight) ++{ ++ mWindow->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION | ++ nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER, ++ 0, 0, aWidth, aHeight); ++} ++ ++void ++EmbedPrivate::Destroy(void) ++{ ++ // This flag might have been set from ++ // EmbedWindow::DestroyBrowserWindow() as well if someone used a ++ // window.close() or something or some other script action to close ++ // the window. No harm setting it again. ++ mIsDestroyed = PR_TRUE; ++ ++ // Get the nsIWebBrowser object for our embedded window. ++ nsCOMPtr webBrowser; ++ mWindow->GetWebBrowser(getter_AddRefs(webBrowser)); ++ ++ // Release our progress listener ++ nsCOMPtr supportsWeak; ++ supportsWeak = do_QueryInterface(mProgressGuard); ++ nsCOMPtr weakRef; ++ supportsWeak->GetWeakReference(getter_AddRefs(weakRef)); ++ webBrowser->RemoveWebBrowserListener(weakRef, ++ NS_GET_IID(nsIWebProgressListener)); ++ weakRef = nsnull; ++ supportsWeak = nsnull; ++ ++ // Release our content listener ++ webBrowser->SetParentURIContentListener(nsnull); ++ mContentListenerGuard = nsnull; ++ mContentListener = nsnull; ++ ++ // Now that we have removed the listener, release our progress ++ // object ++ mProgressGuard = nsnull; ++ mProgress = nsnull; ++ ++ // detach our event listeners and release the event receiver ++ DetachListeners(); ++ if (mEventTarget) ++ mEventTarget = nsnull; ++ ++ // destroy our child window ++ mWindow->ReleaseChildren(); ++ ++ // release navigation ++ mNavigation = nsnull; ++ ++ // release session history ++ mSessionHistory = nsnull; ++ ++ mOwningWidget = nsnull; ++ ++ mMozWindowWidget = 0; ++} ++ ++void ++EmbedPrivate::SetURI(const char *aURI) ++{ ++ mURI.Assign(aURI); ++} ++ ++void ++EmbedPrivate::LoadCurrentURI(void) ++{ ++ if (mURI.Length()) { ++ nsCOMPtr piWin; ++ GetPIDOMWindow(getter_AddRefs(piWin)); ++ ++ nsAutoPopupStatePusher popupStatePusher(piWin, openAllowed); ++ ++ mNavigation->LoadURI(NS_ConvertUTF8toUTF16(mURI).get(), // URI string ++ nsIWebNavigation::LOAD_FLAGS_NONE | // Load flags ++ nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP, // Allow keyword.URL.. functionality ++ nsnull, // Referring URI ++ nsnull, // Post data ++ nsnull); // extra headers ++ } ++} ++ ++void ++EmbedPrivate::Reload(PRUint32 reloadFlags) ++{ ++ /* Use the session history if it is available, this ++ * allows framesets to reload correctly */ ++ nsCOMPtr wn; ++ ++ if (mSessionHistory) { ++ wn = do_QueryInterface(mSessionHistory); ++ } ++ if (!wn) ++ wn = mNavigation; ++ ++ if (wn) ++ wn->Reload(reloadFlags); ++} ++ ++ ++void ++EmbedPrivate::ApplyChromeMask() ++{ ++ if (mWindow) { ++ nsCOMPtr webBrowser; ++ mWindow->GetWebBrowser(getter_AddRefs(webBrowser)); ++ ++ nsCOMPtr domWindow; ++ webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow)); ++ if (domWindow) { ++ ++ nsCOMPtr scrollbars; ++ domWindow->GetScrollbars(getter_AddRefs(scrollbars)); ++ if (scrollbars) { ++ ++ scrollbars->SetVisible ++ (mChromeMask & nsIWebBrowserChrome::CHROME_SCROLLBARS ? ++ PR_TRUE : PR_FALSE); ++ } ++ } ++ } ++} ++ ++ ++void ++EmbedPrivate::SetChromeMask(PRUint32 aChromeMask) ++{ ++ mChromeMask = aChromeMask; ++ ++ ApplyChromeMask(); ++} ++ ++ ++/* static */ ++void ++EmbedPrivate::PushStartup(void) ++{ ++ // increment the number of widgets ++ sWidgetCount++; ++ ++ // if this is the first widget, fire up xpcom ++ if (sWidgetCount == 1) { ++ nsresult rv; ++ ++ nsCOMPtr binDir; ++ if (sCompPath) { ++ rv = NS_NewNativeLocalFile(nsDependentCString(sCompPath), 1, getter_AddRefs(binDir)); ++ if (NS_FAILED(rv)) ++ return; ++ } ++ ++ const char *grePath = sPath; ++ ++ if (!grePath) ++ grePath = getenv("MOZILLA_FIVE_HOME"); ++ ++ if (!grePath) ++ return; ++ ++ nsCOMPtr greDir; ++ rv = NS_NewNativeLocalFile(nsDependentCString(grePath), PR_TRUE, ++ getter_AddRefs(greDir)); ++ if (NS_FAILED(rv)) ++ return; ++ ++ if (sProfileDir && !sProfileLock) { ++ rv = XRE_LockProfileDirectory(sProfileDir, ++ &sProfileLock); ++ if (NS_FAILED(rv)) return; ++ } ++ ++ rv = XRE_InitEmbedding2(greDir, binDir, ++ const_cast(&kDirectoryProvider)); ++ if (NS_FAILED(rv)) ++ return; ++ ++ if (sProfileDir) ++ XRE_NotifyProfile(); ++ ++ RegisterAppComponents(); ++ } ++} ++ ++/* static */ ++void ++EmbedPrivate::PopStartup(void) ++{ ++ sWidgetCount--; ++ if (sWidgetCount == 0) { ++ ++ // destroy the offscreen window ++ DestroyOffscreenWindow(); ++ ++ // we no longer need a reference to the DirectoryServiceProvider ++ if (sAppFileLocProvider) { ++ NS_RELEASE(sAppFileLocProvider); ++ sAppFileLocProvider = nsnull; ++ } ++ ++ // shut down XPCOM/Embedding ++ XRE_TermEmbedding(); ++ ++ NS_IF_RELEASE(sProfileLock); ++ NS_IF_RELEASE(sProfileDir); ++ } ++} ++ ++/* static */ ++void EmbedPrivate::SetPath(const char *aPath) ++{ ++ if (sPath) ++ free(sPath); ++ if (aPath) ++ sPath = strdup(aPath); ++ else ++ sPath = nsnull; ++} ++ ++/* static */ ++void ++EmbedPrivate::SetCompPath(const char *aPath) ++{ ++ if (sCompPath) ++ free(sCompPath); ++ if (aPath) ++ sCompPath = strdup(aPath); ++ else ++ sCompPath = nsnull; ++} ++ ++/* static */ ++void ++EmbedPrivate::SetProfilePath(const char *aDir, const char *aName) ++{ ++ if (sProfileDir) { ++ if (sWidgetCount) { ++ NS_ERROR("Cannot change profile directory during run."); ++ return; ++ } ++ ++ NS_RELEASE(sProfileDir); ++ NS_RELEASE(sProfileLock); ++ } ++ ++ nsresult rv = ++ NS_NewNativeLocalFile(nsDependentCString(aDir), PR_TRUE, &sProfileDir); ++ ++ if (NS_SUCCEEDED(rv) && aName) ++ rv = sProfileDir->AppendNative(nsDependentCString(aName)); ++ ++ if (NS_SUCCEEDED(rv)) { ++ bool exists = PR_FALSE; ++ rv = sProfileDir->Exists(&exists); ++ if (!exists) ++ rv = sProfileDir->Create(nsIFile::DIRECTORY_TYPE, 0700); ++ rv = XRE_LockProfileDirectory(sProfileDir, &sProfileLock); ++ } ++ ++ if (NS_SUCCEEDED(rv)) { ++ if (sWidgetCount) ++ XRE_NotifyProfile(); ++ ++ return; ++ } ++ ++ NS_WARNING("Failed to lock profile."); ++ ++ // Failed ++ NS_IF_RELEASE(sProfileDir); ++ NS_IF_RELEASE(sProfileLock); ++} ++ ++void ++EmbedPrivate::SetDirectoryServiceProvider(nsIDirectoryServiceProvider * appFileLocProvider) ++{ ++ if (sAppFileLocProvider) ++ NS_RELEASE(sAppFileLocProvider); ++ ++ if (appFileLocProvider) { ++ sAppFileLocProvider = appFileLocProvider; ++ NS_ADDREF(sAppFileLocProvider); ++ } ++} ++ ++nsresult ++EmbedPrivate::OpenStream(const char *aBaseURI, const char *aContentType) ++{ ++ nsCOMPtr webBrowser; ++ mWindow->GetWebBrowser(getter_AddRefs(webBrowser)); ++ ++ nsCOMPtr wbStream = do_QueryInterface(webBrowser); ++ if (!wbStream) return NS_ERROR_FAILURE; ++ ++ nsCOMPtr uri; ++ nsresult rv = NS_NewURI(getter_AddRefs(uri), aBaseURI); ++ if (NS_FAILED(rv)) ++ return rv; ++ ++ rv = wbStream->OpenStream(uri, nsDependentCString(aContentType)); ++ return rv; ++} ++ ++nsresult ++EmbedPrivate::AppendToStream(const PRUint8 *aData, PRUint32 aLen) ++{ ++ // Attach listeners to this document since in some cases we don't ++ // get updates for content added this way. ++ ContentStateChange(); ++ ++ nsCOMPtr webBrowser; ++ mWindow->GetWebBrowser(getter_AddRefs(webBrowser)); ++ ++ nsCOMPtr wbStream = do_QueryInterface(webBrowser); ++ if (!wbStream) return NS_ERROR_FAILURE; ++ ++ return wbStream->AppendToStream(aData, aLen); ++} ++ ++nsresult ++EmbedPrivate::CloseStream(void) ++{ ++ nsCOMPtr webBrowser; ++ mWindow->GetWebBrowser(getter_AddRefs(webBrowser)); ++ ++ nsCOMPtr wbStream = do_QueryInterface(webBrowser); ++ if (!wbStream) return NS_ERROR_FAILURE; ++ ++ return wbStream->CloseStream(); ++} ++ ++/* static */ ++EmbedPrivate * ++EmbedPrivate::FindPrivateForBrowser(nsIWebBrowserChrome *aBrowser) ++{ ++ if (!sWindowList) ++ return nsnull; ++ ++ // Get the number of browser windows. ++ PRInt32 count = sWindowList->Length(); ++ // This function doesn't get called very often at all ( only when ++ // creating a new window ) so it's OK to walk the list of open ++ // windows. ++ for (int i = 0; i < count; i++) { ++ EmbedPrivate *tmpPrivate = sWindowList->ElementAt(i); ++ // get the browser object for that window ++ nsIWebBrowserChrome *chrome = static_cast( ++ tmpPrivate->mWindow); ++ if (chrome == aBrowser) ++ return tmpPrivate; ++ } ++ ++ return nsnull; ++} ++ ++void ++EmbedPrivate::ContentStateChange(void) ++{ ++ ++ // we don't attach listeners to chrome ++ if (mListenersAttached && !mIsChrome) ++ return; ++ ++ GetListener(); ++ ++ if (!mEventTarget) ++ return; ++ ++ AttachListeners(); ++ ++} ++ ++void ++EmbedPrivate::ContentFinishedLoading(void) ++{ ++ if (mIsChrome) { ++ // We're done loading. ++ mChromeLoaded = PR_TRUE; ++ ++ // get the web browser ++ nsCOMPtr webBrowser; ++ mWindow->GetWebBrowser(getter_AddRefs(webBrowser)); ++ ++ // get the content DOM window for that web browser ++ nsCOMPtr domWindow; ++ webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow)); ++ if (!domWindow) { ++ NS_WARNING("no dom window in content finished loading\n"); ++ return; ++ } ++ ++ // resize the content ++ domWindow->SizeToContent(); ++ ++ // and since we're done loading show the window, assuming that the ++ // visibility flag has been set. ++ bool visibility; ++ mWindow->GetVisibility(&visibility); ++ if (visibility) ++ mWindow->SetVisibility(PR_TRUE); ++ } ++} ++ ++void ++EmbedPrivate::ChildFocusIn(void) ++{ ++ if (mIsDestroyed) ++ return; ++ ++ nsresult rv; ++ nsCOMPtr webBrowser; ++ rv = mWindow->GetWebBrowser(getter_AddRefs(webBrowser)); ++ if (NS_FAILED(rv)) ++ return; ++ ++ nsCOMPtr webBrowserFocus(do_QueryInterface(webBrowser)); ++ if (!webBrowserFocus) ++ return; ++ ++ webBrowserFocus->Activate(); ++} ++ ++void ++EmbedPrivate::ChildFocusOut(void) ++{ ++ if (mIsDestroyed) ++ return; ++ ++ nsresult rv; ++ nsCOMPtr webBrowser; ++ rv = mWindow->GetWebBrowser(getter_AddRefs(webBrowser)); ++ if (NS_FAILED(rv)) ++ return; ++ ++ nsCOMPtr webBrowserFocus(do_QueryInterface(webBrowser)); ++ if (!webBrowserFocus) ++ return; ++ ++ webBrowserFocus->Deactivate(); ++} ++ ++// Get the event listener for the chrome event handler. ++ ++void ++EmbedPrivate::GetListener(void) ++{ ++ if (mEventTarget) ++ return; ++ ++ nsCOMPtr piWin; ++ GetPIDOMWindow(getter_AddRefs(piWin)); ++ ++ if (!piWin) ++ return; ++ ++ mEventTarget = do_QueryInterface(piWin->GetChromeEventHandler()); ++} ++ ++// attach key and mouse event listeners ++ ++void ++EmbedPrivate::AttachListeners(void) ++{ ++ if (!mEventTarget || mListenersAttached) ++ return; ++ ++ nsIDOMEventListener *eventListener = ++ static_cast(static_cast(mEventListener)); ++ ++ // add the key listener ++ nsresult rv; ++ ++ rv = mEventTarget->AddEventListener(NS_LITERAL_STRING("keydown"), ++ eventListener, PR_FALSE, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv,); ++ ++ rv = mEventTarget->AddEventListener(NS_LITERAL_STRING("keyup"), ++ eventListener, PR_FALSE, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv,); ++ rv = mEventTarget->AddEventListener(NS_LITERAL_STRING("keypress"), ++ eventListener, PR_FALSE, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv,); ++ rv = mEventTarget->AddEventListener(NS_LITERAL_STRING("mousedown"), eventListener, ++ PR_FALSE, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv,); ++ rv = mEventTarget->AddEventListener(NS_LITERAL_STRING("mouseup"), eventListener, ++ PR_FALSE, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv,); ++ rv = mEventTarget->AddEventListener(NS_LITERAL_STRING("click"), eventListener, ++ PR_FALSE, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv,); ++ rv = mEventTarget->AddEventListener(NS_LITERAL_STRING("dblclick"), eventListener, ++ PR_FALSE, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv,); ++ rv = mEventTarget->AddEventListener(NS_LITERAL_STRING("mouseover"), eventListener, ++ PR_FALSE, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv,); ++ rv = mEventTarget->AddEventListener(NS_LITERAL_STRING("mouseout"), eventListener, ++ PR_FALSE, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv,); ++ rv = mEventTarget->AddEventListener(NS_LITERAL_STRING("DOMActivate"), eventListener, ++ PR_FALSE, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv,); ++ rv = mEventTarget->AddEventListener(NS_LITERAL_STRING("DOMFocusIn"), eventListener, ++ PR_FALSE, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv,); ++ rv = mEventTarget->AddEventListener(NS_LITERAL_STRING("DOMFocusOut"), eventListener, ++ PR_FALSE, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv,); ++ ++ // ok, all set. ++ mListenersAttached = PR_TRUE; ++} ++ ++void ++EmbedPrivate::DetachListeners(void) ++{ ++ if (!mListenersAttached || !mEventTarget) ++ return; ++ ++ nsIDOMEventListener *eventListener = ++ static_cast(static_cast(mEventListener)); ++ ++ nsresult rv; ++ rv = mEventTarget->RemoveEventListener(NS_LITERAL_STRING("keydown"), ++ eventListener, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv, ); ++ rv = mEventTarget->RemoveEventListener(NS_LITERAL_STRING("keyup"), ++ eventListener, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv, ); ++ rv = mEventTarget->RemoveEventListener(NS_LITERAL_STRING("keypress"), ++ eventListener, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv, ); ++ rv = mEventTarget->RemoveEventListener(NS_LITERAL_STRING("mousedown"), ++ eventListener, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv, ); ++ rv = mEventTarget->RemoveEventListener(NS_LITERAL_STRING("mouseup"), ++ eventListener, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv, ); ++ rv = mEventTarget->RemoveEventListener(NS_LITERAL_STRING("click"), ++ eventListener, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv, ); ++ rv = mEventTarget->RemoveEventListener(NS_LITERAL_STRING("dblclick"), ++ eventListener, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv, ); ++ rv = mEventTarget->RemoveEventListener(NS_LITERAL_STRING("mouseover"), ++ eventListener, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv, ); ++ rv = mEventTarget->RemoveEventListener(NS_LITERAL_STRING("mouseout"), ++ eventListener, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv, ); ++ rv = mEventTarget->RemoveEventListener(NS_LITERAL_STRING("DOMActivate"), ++ eventListener, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv, ); ++ rv = mEventTarget->RemoveEventListener(NS_LITERAL_STRING("DOMFocusIn"), ++ eventListener, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv, ); ++ rv = mEventTarget->RemoveEventListener(NS_LITERAL_STRING("DOMFocusOut"), ++ eventListener, PR_FALSE); ++ NS_ENSURE_SUCCESS(rv, ); ++ ++ mListenersAttached = PR_FALSE; ++} ++ ++nsresult ++EmbedPrivate::GetPIDOMWindow(nsPIDOMWindow **aPIWin) ++{ ++ *aPIWin = nsnull; ++ ++ // get the web browser ++ nsCOMPtr webBrowser; ++ mWindow->GetWebBrowser(getter_AddRefs(webBrowser)); ++ ++ // get the content DOM window for that web browser ++ nsCOMPtr domWindow; ++ webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow)); ++ if (!domWindow) ++ return NS_ERROR_FAILURE; ++ ++ // get the private DOM window ++ nsCOMPtr domWindowPrivate = do_QueryInterface(domWindow); ++ // and the root window for that DOM window ++ *aPIWin = domWindowPrivate->GetPrivateRoot(); ++ ++ if (*aPIWin) { ++ NS_ADDREF(*aPIWin); ++ return NS_OK; ++ } ++ ++ return NS_ERROR_FAILURE; ++ ++} ++ ++#ifdef MOZ_ACCESSIBILITY_ATK ++void * ++EmbedPrivate::GetAtkObjectForCurrentDocument() ++{ ++ if (!mNavigation) ++ return nsnull; ++ ++ nsCOMPtr accService = ++ do_GetService("@mozilla.org/accessibilityService;1"); ++ if (accService) { ++ //get current document ++ nsCOMPtr domDoc; ++ mNavigation->GetDocument(getter_AddRefs(domDoc)); ++ NS_ENSURE_TRUE(domDoc, nsnull); ++ ++ nsCOMPtr domNode(do_QueryInterface(domDoc)); ++ NS_ENSURE_TRUE(domNode, nsnull); ++ ++ nsCOMPtr acc; ++ accService->GetAccessibleFor(domNode, getter_AddRefs(acc)); ++ NS_ENSURE_TRUE(acc, nsnull); ++ ++ void *atkObj = nsnull; ++ if (NS_SUCCEEDED(acc->GetNativeInterface(&atkObj))) ++ return atkObj; ++ } ++ return nsnull; ++} ++#endif /* MOZ_ACCESSIBILITY_ATK */ ++ ++/* static */ ++void ++EmbedPrivate::RegisterAppComponents(void) ++{ ++ XRE_AddStaticComponent(&kDefaultPromptModule); ++} ++ ++/* static */ ++void ++EmbedPrivate::EnsureOffscreenWindow(void) ++{ ++ if (sOffscreenWindow) ++ return; ++ sOffscreenWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); ++ gtk_widget_realize(sOffscreenWindow); ++ sOffscreenFixed = gtk_fixed_new(); ++ gtk_container_add(GTK_CONTAINER(sOffscreenWindow), sOffscreenFixed); ++ gtk_widget_realize(sOffscreenFixed); ++} ++ ++/* static */ ++void ++EmbedPrivate::DestroyOffscreenWindow(void) ++{ ++ if (!sOffscreenWindow) ++ return; ++ gtk_widget_destroy(sOffscreenWindow); ++ sOffscreenWindow = 0; ++} +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrivate.h.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrivate.h +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrivate.h.gtkmozembed 2012-01-18 16:44:32.479289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrivate.h 2012-01-18 16:44:32.480289973 +0100 +@@ -0,0 +1,188 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#ifndef __EmbedPrivate_h ++#define __EmbedPrivate_h ++ ++#include "nsCOMPtr.h" ++#include "nsStringGlue.h" ++#include "nsIWebNavigation.h" ++#include "nsISHistory.h" ++// for our one function that gets the EmbedPrivate via the chrome ++// object. ++#include "nsIWebBrowserChrome.h" ++#include "nsIAppShell.h" ++#include "nsIDOMEventTarget.h" ++#include "nsTArray.h" ++ ++#include "gtkmozembedprivate.h" ++ ++class EmbedProgress; ++class EmbedWindow; ++class EmbedContentListener; ++class EmbedEventListener; ++ ++class nsPIDOMWindow; ++class nsIDirectoryServiceProvider; ++ ++class EmbedPrivate { ++ ++ public: ++ ++ EmbedPrivate(); ++ ~EmbedPrivate(); ++ ++ nsresult Init (GtkMozEmbed *aOwningWidget); ++ nsresult Realize (PRBool *aAlreadRealized); ++ void Unrealize (void); ++ void Show (void); ++ void Hide (void); ++ void Resize (PRUint32 aWidth, PRUint32 aHeight); ++ void Destroy (void); ++ void SetURI (const char *aURI); ++ void LoadCurrentURI (void); ++ void Reload (PRUint32 reloadFlags); ++ ++ void SetChromeMask (PRUint32 chromeMask); ++ void ApplyChromeMask (); ++ ++ static void PushStartup (void); ++ static void PopStartup (void); ++ static void SetPath (const char *aPath); ++ static void SetCompPath (const char *aPath); ++ static void SetProfilePath (const char *aDir, const char *aName); ++ static void SetDirectoryServiceProvider (nsIDirectoryServiceProvider * appFileLocProvider); ++ ++ nsresult OpenStream (const char *aBaseURI, const char *aContentType); ++ nsresult AppendToStream (const PRUint8 *aData, PRUint32 aLen); ++ nsresult CloseStream (void); ++ ++ // This function will find the specific EmbedPrivate object for a ++ // given nsIWebBrowserChrome. ++ static EmbedPrivate *FindPrivateForBrowser(nsIWebBrowserChrome *aBrowser); ++ ++ // This is an upcall that will come from the progress listener ++ // whenever there is a content state change. We need this so we can ++ // attach event listeners. ++ void ContentStateChange (void); ++ ++ // This is an upcall from the progress listener when content is ++ // finished loading. We have this so that if it's chrome content ++ // that we can size to content properly and show ourselves if ++ // visibility is set. ++ void ContentFinishedLoading(void); ++ ++ // these are when the widget itself gets focus in and focus out ++ // events ++ void ChildFocusIn (void); ++ void ChildFocusOut(void); ++ ++#ifdef MOZ_ACCESSIBILITY_ATK ++ void *GetAtkObjectForCurrentDocument(); ++#endif ++ ++ GtkMozEmbed *mOwningWidget; ++ ++ // all of the objects that we own ++ EmbedWindow *mWindow; ++ nsCOMPtr mWindowGuard; ++ EmbedProgress *mProgress; ++ nsCOMPtr mProgressGuard; ++ EmbedContentListener *mContentListener; ++ nsCOMPtr mContentListenerGuard; ++ EmbedEventListener *mEventListener; ++ nsCOMPtr mEventListenerGuard; ++ ++ nsCOMPtr mNavigation; ++ nsCOMPtr mSessionHistory; ++ ++ // our event receiver ++ nsCOMPtr mEventTarget; ++ ++ // the currently loaded uri ++ nsCString mURI; ++ ++ // the number of widgets that have been created ++ static PRUint32 sWidgetCount; ++ // the path to the GRE ++ static char *sPath; ++ // the path to components ++ static char *sCompPath; ++ // the appshell we have created ++ static nsIAppShell *sAppShell; ++ // the list of all open windows ++ static nsTArray *sWindowList; ++ // what is our profile path? ++ static nsILocalFile *sProfileDir; ++ static nsISupports *sProfileLock; ++ ++ static nsIDirectoryServiceProvider * sAppFileLocProvider; ++ ++ // chrome mask ++ PRUint32 mChromeMask; ++ // is this a chrome window? ++ PRBool mIsChrome; ++ // has the chrome finished loading? ++ PRBool mChromeLoaded; ++ // saved window ID for reparenting later ++ GtkWidget *mMozWindowWidget; ++ // has someone called Destroy() on us? ++ PRBool mIsDestroyed; ++ ++ private: ++ ++ // is the chrome listener attached yet? ++ PRBool mListenersAttached; ++ ++ void GetListener (void); ++ void AttachListeners(void); ++ void DetachListeners(void); ++ ++ // this will get the PIDOMWindow for this widget ++ nsresult GetPIDOMWindow (nsPIDOMWindow **aPIWin); ++ ++ static void RegisterAppComponents(); ++ ++ // offscreen window methods and the offscreen widget ++ static void EnsureOffscreenWindow(void); ++ static void DestroyOffscreenWindow(void); ++ static GtkWidget *sOffscreenWindow; ++ static GtkWidget *sOffscreenFixed; ++ ++}; ++ ++#endif /* __EmbedPrivate_h */ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedProgress.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedProgress.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedProgress.cpp.gtkmozembed 2012-01-18 16:44:32.481289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedProgress.cpp 2012-01-18 16:44:32.481289973 +0100 +@@ -0,0 +1,215 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "EmbedProgress.h" ++ ++#include "nsIChannel.h" ++#include "nsIWebProgress.h" ++#include "nsIDOMWindow.h" ++ ++#include "nsIURI.h" ++ ++EmbedProgress::EmbedProgress(void) ++{ ++ mOwner = nsnull; ++} ++ ++EmbedProgress::~EmbedProgress() ++{ ++} ++ ++NS_IMPL_ISUPPORTS2(EmbedProgress, ++ nsIWebProgressListener, ++ nsISupportsWeakReference) ++ ++nsresult ++EmbedProgress::Init(EmbedPrivate *aOwner) ++{ ++ mOwner = aOwner; ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedProgress::OnStateChange(nsIWebProgress *aWebProgress, ++ nsIRequest *aRequest, ++ PRUint32 aStateFlags, ++ nsresult aStatus) ++{ ++ // give the widget a chance to attach any listeners ++ mOwner->ContentStateChange(); ++ // if we've got the start flag, emit the signal ++ if ((aStateFlags & GTK_MOZ_EMBED_FLAG_IS_NETWORK) && ++ (aStateFlags & GTK_MOZ_EMBED_FLAG_START)) ++ { ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[NET_START], 0); ++ } ++ ++ // get the uri for this request ++ nsCAutoString uriString; ++ RequestToURIString(aRequest, uriString); ++ ++ // is it the same as the current URI? ++ if (mOwner->mURI.Equals(uriString)) ++ { ++ // for people who know what they are doing ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[NET_STATE], 0, ++ aStateFlags, aStatus); ++ } ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[NET_STATE_ALL], 0, ++ uriString.get(), ++ (gint)aStateFlags, (gint)aStatus); ++ // and for stop, too ++ if ((aStateFlags & GTK_MOZ_EMBED_FLAG_IS_NETWORK) && ++ (aStateFlags & GTK_MOZ_EMBED_FLAG_STOP)) ++ { ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[NET_STOP], 0); ++ // let our owner know that the load finished ++ mOwner->ContentFinishedLoading(); ++ } ++ ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedProgress::OnProgressChange(nsIWebProgress *aWebProgress, ++ nsIRequest *aRequest, ++ PRInt32 aCurSelfProgress, ++ PRInt32 aMaxSelfProgress, ++ PRInt32 aCurTotalProgress, ++ PRInt32 aMaxTotalProgress) ++{ ++ ++ nsCAutoString uriString; ++ RequestToURIString(aRequest, uriString); ++ ++ // is it the same as the current uri? ++ if (mOwner->mURI.Equals(uriString)) { ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[PROGRESS], 0, ++ aCurTotalProgress, aMaxTotalProgress); ++ } ++ ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[PROGRESS_ALL], 0, ++ uriString.get(), ++ aCurTotalProgress, aMaxTotalProgress); ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedProgress::OnLocationChange(nsIWebProgress *aWebProgress, ++ nsIRequest *aRequest, ++ nsIURI *aLocation) ++{ ++ nsCAutoString newURI; ++ NS_ENSURE_ARG_POINTER(aLocation); ++ aLocation->GetSpec(newURI); ++ ++ // Make sure that this is the primary frame change and not ++ // just a subframe. ++ PRBool isSubFrameLoad = PR_FALSE; ++ if (aWebProgress) { ++ nsCOMPtr domWindow; ++ nsCOMPtr topDomWindow; ++ ++ aWebProgress->GetDOMWindow(getter_AddRefs(domWindow)); ++ ++ // get the root dom window ++ if (domWindow) ++ domWindow->GetTop(getter_AddRefs(topDomWindow)); ++ ++ if (domWindow != topDomWindow) ++ isSubFrameLoad = PR_TRUE; ++ } ++ ++ if (!isSubFrameLoad) { ++ mOwner->SetURI(newURI.get()); ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[LOCATION], 0); ++ } ++ ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedProgress::OnStatusChange(nsIWebProgress *aWebProgress, ++ nsIRequest *aRequest, ++ nsresult aStatus, ++ const PRUnichar *aMessage) ++{ ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[STATUS_CHANGE], 0, ++ static_cast(aRequest), ++ static_cast(aStatus), ++ static_cast(aMessage)); ++ ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedProgress::OnSecurityChange(nsIWebProgress *aWebProgress, ++ nsIRequest *aRequest, ++ PRUint32 aState) ++{ ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[SECURITY_CHANGE], 0, ++ static_cast(aRequest), ++ aState); ++ return NS_OK; ++} ++ ++/* static */ ++void ++EmbedProgress::RequestToURIString(nsIRequest *aRequest, nsACString &aString) ++{ ++ // is it a channel ++ nsCOMPtr channel; ++ channel = do_QueryInterface(aRequest); ++ if (!channel) ++ return; ++ ++ nsCOMPtr uri; ++ channel->GetURI(getter_AddRefs(uri)); ++ if (!uri) ++ return; ++ ++ uri->GetSpec(aString); ++} +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedProgress.h.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedProgress.h +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedProgress.h.gtkmozembed 2012-01-18 16:44:32.483289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedProgress.h 2012-01-18 16:44:32.483289973 +0100 +@@ -0,0 +1,66 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#ifndef __EmbedProgress_h ++#define __EmbedProgress_h ++ ++#include "nsIWebProgressListener.h" ++#include "nsWeakReference.h" ++#include "EmbedPrivate.h" ++ ++class EmbedProgress : public nsIWebProgressListener, ++ public nsSupportsWeakReference ++{ ++ public: ++ EmbedProgress(); ++ virtual ~EmbedProgress(); ++ ++ nsresult Init(EmbedPrivate *aOwner); ++ ++ NS_DECL_ISUPPORTS ++ ++ NS_DECL_NSIWEBPROGRESSLISTENER ++ ++ private: ++ ++ static void RequestToURIString (nsIRequest *aRequest, nsACString &aString); ++ ++ EmbedPrivate *mOwner; ++ ++}; ++ ++#endif /* __EmbedProgress_h */ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrompter.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrompter.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrompter.cpp.gtkmozembed 2012-01-18 16:44:32.484289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrompter.cpp 2012-01-19 10:42:07.334502360 +0100 +@@ -0,0 +1,411 @@ ++/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ ++/* vim:expandtab:shiftwidth=4:tabstop=4: */ ++/* ***** BEGIN LICENSE BLOCK ***** ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla Public License Version ++ * 1.1 (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * http://www.mozilla.org/MPL/ ++ * ++ * Software distributed under the License is distributed on an "AS IS" basis, ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++ * for the specific language governing rights and limitations under the ++ * License. ++ * ++ * The Original Code is mozilla.org code. ++ * ++ * The Initial Developer of the Original Code is ++ * Netscape Communications Corporation. ++ * Portions created by the Initial Developer are Copyright (C) 2003 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Brian Ryner ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "EmbedPrompter.h" ++ ++enum { ++ INCLUDE_USERNAME = 1 << 0, ++ INCLUDE_PASSWORD = 1 << 1, ++ INCLUDE_CHECKBOX = 1 << 2, ++ INCLUDE_CANCEL = 1 << 3 ++}; ++ ++struct DialogDescription { ++ int flags; ++ const gchar* icon; ++}; ++ ++// This table contains the optional widgets and icons associated with ++// each type of dialog. ++ ++static const DialogDescription DialogTable[] = { ++ { 0, GTK_STOCK_DIALOG_WARNING }, // ALERT ++ { INCLUDE_CHECKBOX, GTK_STOCK_DIALOG_WARNING }, // ALERT_CHECK ++ { INCLUDE_CANCEL, GTK_STOCK_DIALOG_QUESTION }, // CONFIRM ++ { INCLUDE_CHECKBOX | ++ INCLUDE_CANCEL, GTK_STOCK_DIALOG_QUESTION }, // CONFIRM_CHECK ++ { INCLUDE_CANCEL | ++ INCLUDE_CHECKBOX, GTK_STOCK_DIALOG_QUESTION }, // PROMPT ++ { INCLUDE_CANCEL | ++ INCLUDE_USERNAME | ++ INCLUDE_PASSWORD | ++ INCLUDE_CHECKBOX, GTK_STOCK_DIALOG_QUESTION }, // PROMPT_USER_PASS ++ { INCLUDE_CANCEL | ++ INCLUDE_PASSWORD | ++ INCLUDE_CHECKBOX, GTK_STOCK_DIALOG_QUESTION }, // PROMPT_PASS ++ { INCLUDE_CANCEL, GTK_STOCK_DIALOG_QUESTION }, // SELECT ++ { INCLUDE_CANCEL | ++ INCLUDE_CHECKBOX, GTK_STOCK_DIALOG_QUESTION } // UNIVERSAL ++}; ++ ++EmbedPrompter::EmbedPrompter(void) ++ : mCheckValue(PR_FALSE), ++ mItemList(nsnull), ++ mItemCount(0), ++ mButtonPressed(0), ++ mConfirmResult(PR_FALSE), ++ mSelectedItem(0), ++ mWindow(NULL), ++ mUserField(NULL), ++ mPassField(NULL), ++ mTextField(NULL), ++ mComboBox(NULL), ++ mCheckBox(NULL) ++{ ++} ++ ++EmbedPrompter::~EmbedPrompter(void) ++{ ++ if (mItemList) ++ delete[] mItemList; ++} ++ ++nsresult ++EmbedPrompter::Create(PromptType aType, GtkWindow* aParentWindow) ++{ ++ mWindow = gtk_dialog_new_with_buttons(mTitle.get(), aParentWindow, ++ (GtkDialogFlags)0, ++ NULL); ++ ++ // only add the dialog to the window group if the parent already has a window group, ++ // so as not to break app's expectations about modal dialogs. ++ if (aParentWindow && aParentWindow->group) { ++ gtk_window_group_add_window (aParentWindow->group, GTK_WINDOW (mWindow)); ++ } ++ ++ // gtk will resize this for us as necessary ++ gtk_window_set_default_size(GTK_WINDOW(mWindow), 100, 50); ++ ++ // this HBox will contain the icon, and a vbox which contains the ++ // dialog text and other widgets. ++ GtkWidget* dialogHBox = gtk_hbox_new(FALSE, 12); ++ ++ ++ // Set up dialog properties according to the GNOME HIG ++ // (http://developer.gnome.org/projects/gup/hig/1.0/windows.html#alert-windows) ++ ++ gtk_container_set_border_width(GTK_CONTAINER(mWindow), 6); ++ gtk_dialog_set_has_separator(GTK_DIALOG(mWindow), FALSE); ++ gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(mWindow)->vbox), 12); ++ gtk_container_set_border_width(GTK_CONTAINER(dialogHBox), 6); ++ ++ ++ // This is the VBox which will contain the label and other controls. ++ GtkWidget* contentsVBox = gtk_vbox_new(FALSE, 12); ++ ++ // get the stock icon for this dialog and put it in the box ++ const gchar* iconDesc = DialogTable[aType].icon; ++ GtkWidget* icon = gtk_image_new_from_stock(iconDesc, GTK_ICON_SIZE_DIALOG); ++ gtk_misc_set_alignment(GTK_MISC(icon), 0.5, 0.0); ++ gtk_box_pack_start(GTK_BOX(dialogHBox), icon, FALSE, FALSE, 0); ++ ++ // now pack the label into the vbox ++ GtkWidget* label = gtk_label_new(mMessageText.get()); ++ gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); ++ gtk_label_set_selectable(GTK_LABEL(label), TRUE); ++ gtk_box_pack_start(GTK_BOX(contentsVBox), label, FALSE, FALSE, 0); ++ ++ int widgetFlags = DialogTable[aType].flags; ++ ++ if (widgetFlags & (INCLUDE_USERNAME | INCLUDE_PASSWORD)) { ++ ++ // If we're creating a username and/or password field, make an hbox ++ // which will contain two vboxes, one for the labels and one for the ++ // text fields. This will let us line up the textfields. ++ ++ GtkWidget* userPassHBox = gtk_hbox_new(FALSE, 12); ++ GtkWidget* userPassLabels = gtk_vbox_new(TRUE, 6); ++ GtkWidget* userPassFields = gtk_vbox_new(TRUE, 6); ++ ++ if (widgetFlags & INCLUDE_USERNAME) { ++ GtkWidget* userLabel = gtk_label_new("User Name:"); ++ gtk_box_pack_start(GTK_BOX(userPassLabels), userLabel, FALSE, ++ FALSE, 0); ++ ++ mUserField = gtk_entry_new(); ++ ++ if (!mUser.IsEmpty()) ++ gtk_entry_set_text(GTK_ENTRY(mUserField), mUser.get()); ++ ++ gtk_entry_set_activates_default(GTK_ENTRY(mUserField), TRUE); ++ ++ gtk_box_pack_start(GTK_BOX(userPassFields), mUserField, FALSE, ++ FALSE, 0); ++ } ++ if (widgetFlags & INCLUDE_PASSWORD) { ++ GtkWidget* passLabel = gtk_label_new("Password:"); ++ gtk_box_pack_start(GTK_BOX(userPassLabels), passLabel, FALSE, ++ FALSE, 0); ++ ++ mPassField = gtk_entry_new(); ++ ++ if (!mPass.IsEmpty()) ++ gtk_entry_set_text(GTK_ENTRY(mPassField), mPass.get()); ++ ++ gtk_entry_set_visibility(GTK_ENTRY(mPassField), FALSE); ++ gtk_entry_set_activates_default(GTK_ENTRY(mPassField), TRUE); ++ ++ gtk_box_pack_start(GTK_BOX(userPassFields), mPassField, FALSE, ++ FALSE, 0); ++ } ++ ++ gtk_box_pack_start(GTK_BOX(userPassHBox), userPassLabels, FALSE, ++ FALSE, 0); ++ gtk_box_pack_start(GTK_BOX(userPassHBox), userPassFields, FALSE, ++ FALSE, 0); ++ gtk_box_pack_start(GTK_BOX(contentsVBox), userPassHBox, FALSE, FALSE, 0); ++ } ++ ++ if (aType == TYPE_PROMPT) { ++ mTextField = gtk_entry_new(); ++ ++ if (!mTextValue.IsEmpty()) ++ gtk_entry_set_text(GTK_ENTRY(mTextField), mTextValue.get()); ++ ++ gtk_entry_set_activates_default(GTK_ENTRY(mTextField), TRUE); ++ ++ gtk_box_pack_start(GTK_BOX(contentsVBox), mTextField, FALSE, FALSE, 0); ++ } ++ ++ // Add a checkbox ++ if ((widgetFlags & INCLUDE_CHECKBOX) && !mCheckMessage.IsEmpty()) { ++ mCheckBox = gtk_check_button_new_with_label(mCheckMessage.get()); ++ ++ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mCheckBox), ++ mCheckValue); ++ gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(mCheckBox))), ++ TRUE); ++ ++ gtk_box_pack_start(GTK_BOX(contentsVBox), mCheckBox, FALSE, FALSE, 0); ++ } ++ ++ // Add a dropdown menu ++ if (aType == TYPE_SELECT) { ++ // Build up a GtkComboBox containing the items ++ GtkWidget* mComboBox = gtk_combo_box_new_text(); ++ for (PRUint32 i = 0; i < mItemCount; ++i) { ++ gtk_combo_box_append_text(GTK_COMBO_BOX(mComboBox), mItemList[i].get()); ++ } ++ gtk_box_pack_start(GTK_BOX(contentsVBox), mComboBox, FALSE, FALSE, 0); ++ } ++ ++ if (aType == TYPE_UNIVERSAL) { ++ // Create buttons based on the flags passed in. ++ for (PRUint32 i = EMBED_MAX_BUTTONS; i-- > 0; ) { ++ if (!mButtonLabels[i].IsEmpty()) ++ gtk_dialog_add_button(GTK_DIALOG(mWindow), ++ mButtonLabels[i].get(), i); ++ } ++ gtk_dialog_set_default_response(GTK_DIALOG(mWindow), 0); ++ } else { ++ // Create standard ok and cancel buttons ++ if (widgetFlags & INCLUDE_CANCEL) ++ gtk_dialog_add_button(GTK_DIALOG(mWindow), GTK_STOCK_CANCEL, ++ GTK_RESPONSE_CANCEL); ++ ++ GtkWidget* okButton = gtk_dialog_add_button(GTK_DIALOG(mWindow), ++ GTK_STOCK_OK, ++ GTK_RESPONSE_ACCEPT); ++ gtk_widget_grab_default(okButton); ++ } ++ ++ // Pack the contentsVBox into the dialogHBox and the dialog. ++ gtk_box_pack_start(GTK_BOX(dialogHBox), contentsVBox, FALSE, FALSE, 0); ++ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mWindow)->vbox), dialogHBox, FALSE, ++ FALSE, 0); ++ ++ return NS_OK; ++} ++ ++void ++EmbedPrompter::SetTitle(const PRUnichar *aTitle) ++{ ++ mTitle.Assign(NS_ConvertUTF16toUTF8(aTitle)); ++} ++ ++void ++EmbedPrompter::SetTextValue(const PRUnichar *aTextValue) ++{ ++ mTextValue.Assign(NS_ConvertUTF16toUTF8(aTextValue)); ++} ++ ++void ++EmbedPrompter::SetCheckMessage(const PRUnichar *aMessage) ++{ ++ mCheckMessage.Assign(NS_ConvertUTF16toUTF8(aMessage)); ++} ++ ++void ++EmbedPrompter::SetMessageText(const PRUnichar *aMessageText) ++{ ++ mMessageText.Assign(NS_ConvertUTF16toUTF8(aMessageText)); ++} ++ ++void ++EmbedPrompter::SetUser(const PRUnichar *aUser) ++{ ++ mUser.Assign(NS_ConvertUTF16toUTF8(aUser)); ++} ++ ++void ++EmbedPrompter::SetPassword(const PRUnichar *aPass) ++{ ++ mPass.Assign(NS_ConvertUTF16toUTF8(aPass)); ++} ++ ++void ++EmbedPrompter::SetCheckValue(const PRBool aValue) ++{ ++ mCheckValue = aValue; ++} ++ ++void ++EmbedPrompter::SetItems(const PRUnichar** aItemArray, PRUint32 aCount) ++{ ++ if (mItemList) ++ delete[] mItemList; ++ ++ mItemCount = aCount; ++ mItemList = new nsCString[aCount]; ++ for (PRUint32 i = 0; i < aCount; ++i) ++ mItemList[i].Assign(NS_ConvertUTF16toUTF8(aItemArray[i])); ++} ++ ++void ++EmbedPrompter::SetButtons(const PRUnichar* aButton0Label, ++ const PRUnichar* aButton1Label, ++ const PRUnichar* aButton2Label) ++{ ++ mButtonLabels[0].Assign(NS_ConvertUTF16toUTF8(aButton0Label)); ++ mButtonLabels[1].Assign(NS_ConvertUTF16toUTF8(aButton1Label)); ++ mButtonLabels[2].Assign(NS_ConvertUTF16toUTF8(aButton2Label)); ++} ++ ++void ++EmbedPrompter::GetCheckValue(bool *aValue) ++{ ++ *aValue = (bool)mCheckValue; ++} ++ ++void ++EmbedPrompter::GetConfirmValue(bool *aConfirmValue) ++{ ++ *aConfirmValue = (bool)mConfirmResult; ++} ++ ++void ++EmbedPrompter::GetTextValue(PRUnichar **aTextValue) ++{ ++ *aTextValue = ToNewUnicode(NS_ConvertUTF8toUTF16(mTextValue)); ++} ++ ++void ++EmbedPrompter::GetUser(PRUnichar **aUser) ++{ ++ *aUser = ToNewUnicode(NS_ConvertUTF8toUTF16(mUser)); ++} ++ ++void ++EmbedPrompter::GetPassword(PRUnichar **aPass) ++{ ++ *aPass = ToNewUnicode(NS_ConvertUTF8toUTF16(mPass)); ++} ++ ++void ++EmbedPrompter::GetSelectedItem(PRInt32 *aIndex) ++{ ++ *aIndex = mSelectedItem; ++} ++ ++void ++EmbedPrompter::GetButtonPressed(PRInt32 *aButton) ++{ ++ *aButton = mButtonPressed; ++} ++ ++void ++EmbedPrompter::Run(void) ++{ ++ gtk_widget_show_all(mWindow); ++ gint response = gtk_dialog_run(GTK_DIALOG(mWindow)); ++ switch (response) { ++ case GTK_RESPONSE_NONE: ++ case GTK_RESPONSE_CANCEL: ++ case GTK_RESPONSE_DELETE_EVENT: ++ mConfirmResult = PR_FALSE; ++ break; ++ case GTK_RESPONSE_ACCEPT: ++ mConfirmResult = PR_TRUE; ++ SaveDialogValues(); ++ break; ++ default: ++ mButtonPressed = response; ++ SaveDialogValues(); ++ } ++ ++ gtk_widget_destroy(mWindow); ++} ++ ++void ++EmbedPrompter::SaveDialogValues() ++{ ++ if (mUserField) ++ mUser.Assign(gtk_entry_get_text(GTK_ENTRY(mUserField))); ++ ++ if (mPassField) ++ mPass.Assign(gtk_entry_get_text(GTK_ENTRY(mPassField))); ++ ++ if (mCheckBox) ++ mCheckValue = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mCheckBox)); ++ ++ if (mTextField) ++ mTextValue.Assign(gtk_entry_get_text(GTK_ENTRY(mTextField))); ++ ++ if (mComboBox) ++ { ++ gchar *str = gtk_combo_box_get_active_text(GTK_COMBO_BOX(mComboBox)); ++ for (PRUint32 i = 0; i < mItemCount; ++i) { ++ if(mItemList[i].Equals(str)) ++ { ++ mSelectedItem = i; ++ break; ++ } ++ } ++ } ++} +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrompter.h.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrompter.h +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrompter.h.gtkmozembed 2012-01-18 16:44:32.485289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedPrompter.h 2012-01-19 10:42:24.478502751 +0100 +@@ -0,0 +1,113 @@ ++/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ ++/* vim:expandtab:shiftwidth=4:tabstop=4: */ ++/* ***** BEGIN LICENSE BLOCK ***** ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla Public License Version ++ * 1.1 (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * http://www.mozilla.org/MPL/ ++ * ++ * Software distributed under the License is distributed on an "AS IS" basis, ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++ * for the specific language governing rights and limitations under the ++ * License. ++ * ++ * The Original Code is mozilla.org code. ++ * ++ * The Initial Developer of the Original Code is ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * Brian Ryner ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "nsStringGlue.h" ++#include ++ ++#define EMBED_MAX_BUTTONS 3 ++ ++class EmbedPrompter { ++ ++public: ++ ++ EmbedPrompter(); ++ ~EmbedPrompter(); ++ ++ enum PromptType { ++ TYPE_ALERT, ++ TYPE_ALERT_CHECK, ++ TYPE_CONFIRM, ++ TYPE_CONFIRM_CHECK, ++ TYPE_PROMPT, ++ TYPE_PROMPT_USER_PASS, ++ TYPE_PROMPT_PASS, ++ TYPE_SELECT, ++ TYPE_UNIVERSAL ++ }; ++ ++ nsresult Create(PromptType aType, GtkWindow* aParentWindow); ++ void SetTitle(const PRUnichar *aTitle); ++ void SetTextValue (const PRUnichar *aTextValue); ++ void SetCheckMessage(const PRUnichar *aCheckMessage); ++ void SetCheckValue(const PRBool aValue); ++ void SetMessageText(const PRUnichar *aMessageText); ++ void SetUser(const PRUnichar *aUser); ++ void SetPassword(const PRUnichar *aPass); ++ void SetButtons(const PRUnichar* aButton0Label, ++ const PRUnichar* aButton1Label, ++ const PRUnichar* aButton2Label); ++ void SetItems(const PRUnichar **aItemArray, PRUint32 aCount); ++ ++ void GetCheckValue(bool *aValue); ++ void GetConfirmValue(bool *aConfirmValue); ++ void GetTextValue(PRUnichar **aTextValue); ++ void GetUser(PRUnichar **aUser); ++ void GetPassword(PRUnichar **aPass); ++ void GetButtonPressed(PRInt32 *aButton); ++ void GetSelectedItem(PRInt32 *aIndex); ++ ++ void Run(void); ++ ++private: ++ ++ void SaveDialogValues(); ++ ++ nsCString mTitle; ++ nsCString mMessageText; ++ nsCString mTextValue; ++ nsCString mCheckMessage; ++ PRBool mCheckValue; ++ nsCString mUser; ++ nsCString mPass; ++ nsCString mButtonLabels[EMBED_MAX_BUTTONS]; ++ nsCString *mItemList; ++ PRUint32 mItemCount; ++ ++ PRInt32 mButtonPressed; ++ PRBool mConfirmResult; ++ PRInt32 mSelectedItem; ++ ++ GtkWidget *mWindow; ++ GtkWidget *mUserField; ++ GtkWidget *mPassField; ++ GtkWidget *mTextField; ++ GtkWidget *mComboBox; ++ GtkWidget *mCheckBox; ++}; +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindow.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindow.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindow.cpp.gtkmozembed 2012-01-18 16:44:32.487289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindow.cpp 2012-01-19 10:09:43.082457998 +0100 +@@ -0,0 +1,474 @@ ++/* ++ * vim:ts=2:et:sw=2 ++ * ++ * ***** BEGIN LICENSE BLOCK ***** ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla Public License Version ++ * 1.1 (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * http://www.mozilla.org/MPL/ ++ * ++ * Software distributed under the License is distributed on an "AS IS" basis, ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++ * for the specific language governing rights and limitations under the ++ * License. ++ * ++ * The Original Code is mozilla.org code. ++ * ++ * The Initial Developer of the Original Code is ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "nsCWebBrowser.h" ++#include "nsIComponentManager.h" ++#include "nsComponentManagerUtils.h" ++#include "nsIDocShellTreeItem.h" ++#include "nsIWidget.h" ++ ++#include "EmbedWindow.h" ++#include "EmbedPrivate.h" ++#include "EmbedPrompter.h" ++ ++GtkWidget *EmbedWindow::sTipWindow = nsnull; ++ ++EmbedWindow::EmbedWindow(void) ++{ ++ mOwner = nsnull; ++ mVisibility = PR_FALSE; ++ mIsModal = PR_FALSE; ++} ++ ++EmbedWindow::~EmbedWindow(void) ++{ ++ ExitModalEventLoop(PR_FALSE); ++} ++ ++nsresult ++EmbedWindow::Init(EmbedPrivate *aOwner) ++{ ++ // save our owner for later ++ mOwner = aOwner; ++ ++ // create our nsIWebBrowser object and set up some basic defaults. ++ mWebBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID); ++ if (!mWebBrowser) ++ return NS_ERROR_FAILURE; ++ ++ mWebBrowser->SetContainerWindow(static_cast(this)); ++ ++ nsCOMPtr item = do_QueryInterface(mWebBrowser); ++ item->SetItemType(nsIDocShellTreeItem::typeContentWrapper); ++ ++ return NS_OK; ++} ++ ++nsresult ++EmbedWindow::CreateWindow(void) ++{ ++ nsresult rv; ++ GtkWidget *ownerAsWidget = GTK_WIDGET(mOwner->mOwningWidget); ++ ++ // Get the base window interface for the web browser object and ++ // create the window. ++ mBaseWindow = do_QueryInterface(mWebBrowser); ++ rv = mBaseWindow->InitWindow(GTK_WIDGET(mOwner->mOwningWidget), ++ nsnull, ++ 0, 0, ++ ownerAsWidget->allocation.width, ++ ownerAsWidget->allocation.height); ++ if (NS_FAILED(rv)) ++ return rv; ++ ++ rv = mBaseWindow->Create(); ++ if (NS_FAILED(rv)) ++ return rv; ++ ++ return NS_OK; ++} ++ ++void ++EmbedWindow::ReleaseChildren(void) ++{ ++ ExitModalEventLoop(PR_FALSE); ++ ++ mBaseWindow->Destroy(); ++ mBaseWindow = 0; ++ mWebBrowser = 0; ++} ++ ++// nsISupports ++ ++NS_IMPL_ADDREF(EmbedWindow) ++NS_IMPL_RELEASE(EmbedWindow) ++ ++NS_INTERFACE_MAP_BEGIN(EmbedWindow) ++ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserChrome) ++ NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome) ++ NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChromeFocus) ++ NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow) ++ NS_INTERFACE_MAP_ENTRY(nsITooltipListener) ++ NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor) ++NS_INTERFACE_MAP_END ++ ++// nsIWebBrowserChrome ++ ++NS_IMETHODIMP ++EmbedWindow::SetStatus(PRUint32 aStatusType, const PRUnichar *aStatus) ++{ ++ switch (aStatusType) { ++ case STATUS_SCRIPT: ++ { ++ mJSStatus = aStatus; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[JS_STATUS], 0); ++ } ++ break; ++ case STATUS_SCRIPT_DEFAULT: ++ // Gee, that's nice. ++ break; ++ case STATUS_LINK: ++ { ++ mLinkMessage = aStatus; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[LINK_MESSAGE], 0); ++ } ++ break; ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::GetWebBrowser(nsIWebBrowser **aWebBrowser) ++{ ++ *aWebBrowser = mWebBrowser; ++ NS_IF_ADDREF(*aWebBrowser); ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::SetWebBrowser(nsIWebBrowser *aWebBrowser) ++{ ++ mWebBrowser = aWebBrowser; ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::GetChromeFlags(PRUint32 *aChromeFlags) ++{ ++ *aChromeFlags = mOwner->mChromeMask; ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::SetChromeFlags(PRUint32 aChromeFlags) ++{ ++ mOwner->SetChromeMask(aChromeFlags); ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::DestroyBrowserWindow(void) ++{ ++ // mark the owner as destroyed so it won't emit events anymore. ++ mOwner->mIsDestroyed = PR_TRUE; ++ ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[DESTROY_BROWSER], 0); ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY) ++{ ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[SIZE_TO], 0, aCX, aCY); ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::ShowAsModal(void) ++{ ++ mIsModal = PR_TRUE; ++ GtkWidget *toplevel; ++ toplevel = gtk_widget_get_toplevel(GTK_WIDGET(mOwner->mOwningWidget)); ++ gtk_grab_add(toplevel); ++ gtk_main(); ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::IsWindowModal(bool *_retval) ++{ ++ *_retval = mIsModal; ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::ExitModalEventLoop(nsresult aStatus) ++{ ++ if (mIsModal) { ++ GtkWidget *toplevel; ++ toplevel = gtk_widget_get_toplevel(GTK_WIDGET(mOwner->mOwningWidget)); ++ gtk_grab_remove(toplevel); ++ mIsModal = PR_FALSE; ++ gtk_main_quit(); ++ } ++ return NS_OK; ++} ++ ++// nsIWebBrowserChromeFocus ++ ++NS_IMETHODIMP ++EmbedWindow::FocusNextElement() ++{ ++ GtkWidget *toplevel; ++ toplevel = gtk_widget_get_toplevel(GTK_WIDGET(mOwner->mOwningWidget)); ++ if (!GTK_WIDGET_TOPLEVEL(toplevel)) ++ return NS_OK; ++ ++ g_signal_emit_by_name(G_OBJECT(toplevel), "move_focus", ++ GTK_DIR_TAB_FORWARD); ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::FocusPrevElement() ++{ ++ GtkWidget *toplevel; ++ toplevel = gtk_widget_get_toplevel(GTK_WIDGET(mOwner->mOwningWidget)); ++ if (!GTK_WIDGET_TOPLEVEL(toplevel)) ++ return NS_OK; ++ ++ g_signal_emit_by_name(G_OBJECT(toplevel), "move_focus", ++ GTK_DIR_TAB_BACKWARD); ++ return NS_OK; ++} ++ ++// nsIEmbeddingSiteWindow ++ ++NS_IMETHODIMP ++EmbedWindow::SetDimensions(PRUint32 aFlags, PRInt32 aX, PRInt32 aY, ++ PRInt32 aCX, PRInt32 aCY) ++{ ++ if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION && ++ (aFlags & (nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER | ++ nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER))) { ++ return mBaseWindow->SetPositionAndSize(aX, aY, aCX, aCY, PR_TRUE); ++ } ++ else if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) { ++ return mBaseWindow->SetPosition(aX, aY); ++ } ++ else if (aFlags & (nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER | ++ nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)) { ++ return mBaseWindow->SetSize(aCX, aCY, PR_TRUE); ++ } ++ return NS_ERROR_INVALID_ARG; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::GetDimensions(PRUint32 aFlags, PRInt32 *aX, ++ PRInt32 *aY, PRInt32 *aCX, PRInt32 *aCY) ++{ ++ if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION && ++ (aFlags & (nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER | ++ nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER))) { ++ return mBaseWindow->GetPositionAndSize(aX, aY, aCX, aCY); ++ } ++ else if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) { ++ return mBaseWindow->GetPosition(aX, aY); ++ } ++ else if (aFlags & (nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER | ++ nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)) { ++ return mBaseWindow->GetSize(aCX, aCY); ++ } ++ return NS_ERROR_INVALID_ARG; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::SetFocus(void) ++{ ++ // XXX might have to do more here. ++ return mBaseWindow->SetFocus(); ++} ++ ++NS_IMETHODIMP ++EmbedWindow::GetTitle(PRUnichar **aTitle) ++{ ++ *aTitle = ToNewUnicode(mTitle); ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::SetTitle(const PRUnichar *aTitle) ++{ ++ mTitle = aTitle; ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[TITLE], 0); ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::GetSiteWindow(void **aSiteWindow) ++{ ++ GtkWidget *ownerAsWidget (GTK_WIDGET(mOwner->mOwningWidget)); ++ *aSiteWindow = static_cast(ownerAsWidget); ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::GetVisibility(bool *aVisibility) ++{ ++ // XXX See bug 312998 ++ // Work around the problem that sometimes the window ++ // is already visible even though mVisibility isn't true ++ // yet. ++ *aVisibility = mVisibility || ++ (!mOwner->mIsChrome && ++ mOwner->mOwningWidget && ++ GTK_WIDGET_MAPPED(mOwner->mOwningWidget)); ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::SetVisibility(bool aVisibility) ++{ ++ // We always set the visibility so that if it's chrome and we finish ++ // the load we know that we have to show the window. ++ mVisibility = aVisibility; ++ ++ // if this is a chrome window and the chrome hasn't finished loading ++ // yet then don't show the window yet. ++ if (mOwner->mIsChrome && !mOwner->mChromeLoaded) ++ return NS_OK; ++ ++ g_signal_emit(G_OBJECT(mOwner->mOwningWidget), ++ moz_embed_signals[VISIBILITY], 0, ++ aVisibility); ++ return NS_OK; ++} ++ ++// nsITooltipListener ++ ++static gint ++tooltips_paint_window(GtkWidget *window) ++{ ++ // draw tooltip style border around the text ++ gtk_paint_flat_box(window->style, window->window, ++ GTK_STATE_NORMAL, GTK_SHADOW_OUT, ++ NULL, window, "tooltip", ++ 0, 0, ++ window->allocation.width, window->allocation.height); ++ ++ return FALSE; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, ++ const PRUnichar *aTipText) ++{ ++ nsAutoString tipText ( aTipText ); ++ ++ const char* tipString = ToNewUTF8String(tipText); ++ ++ if (sTipWindow) ++ gtk_widget_destroy(sTipWindow); ++ ++ // get the root origin for this content window ++ nsCOMPtr mainWidget; ++ mBaseWindow->GetMainWidget(getter_AddRefs(mainWidget)); ++ GdkWindow *window; ++ window = static_cast(mainWidget->GetNativeData(NS_NATIVE_WINDOW)); ++ gint root_x, root_y; ++ gdk_window_get_origin(window, &root_x, &root_y); ++ ++ // XXX work around until I can get pink to figure out why ++ // tooltips vanish if they show up right at the origin of the ++ // cursor. ++ root_y += 10; ++ ++ sTipWindow = gtk_window_new(GTK_WINDOW_POPUP); ++ gtk_widget_set_app_paintable(sTipWindow, TRUE); ++ gtk_window_set_resizable(GTK_WINDOW(sTipWindow), TRUE); ++ // needed to get colors + fonts etc correctly ++ gtk_widget_set_name(sTipWindow, "gtk-tooltips"); ++ gtk_window_set_type_hint(GTK_WINDOW(sTipWindow), GDK_WINDOW_TYPE_HINT_TOOLTIP); ++ ++ // set up the popup window as a transient of the widget. ++ GtkWidget *toplevel_window; ++ toplevel_window = gtk_widget_get_toplevel(GTK_WIDGET(mOwner->mOwningWidget)); ++ if (!GTK_WINDOW(toplevel_window)) { ++ NS_ERROR("no gtk window in hierarchy!"); ++ return NS_ERROR_FAILURE; ++ } ++ gtk_window_set_transient_for(GTK_WINDOW(sTipWindow), ++ GTK_WINDOW(toplevel_window)); ++ ++ // realize the widget ++ gtk_widget_realize(sTipWindow); ++ ++ g_signal_connect(G_OBJECT(sTipWindow), "expose_event", ++ G_CALLBACK(tooltips_paint_window), NULL); ++ ++ // set up the label for the tooltip ++ GtkWidget *label = gtk_label_new(tipString); ++ // wrap automatically ++ gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); ++ gtk_container_add(GTK_CONTAINER(sTipWindow), label); ++ gtk_container_set_border_width(GTK_CONTAINER(sTipWindow), 4); ++ // set the coords for the widget ++ gtk_widget_set_uposition(sTipWindow, aXCoords + root_x, ++ aYCoords + root_y); ++ ++ // and show it. ++ gtk_widget_show_all(sTipWindow); ++ ++ NS_Free( (void*)tipString ); ++ ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++EmbedWindow::OnHideTooltip(void) ++{ ++ if (sTipWindow) ++ gtk_widget_destroy(sTipWindow); ++ sTipWindow = NULL; ++ return NS_OK; ++} ++ ++// nsIInterfaceRequestor ++ ++NS_IMETHODIMP ++EmbedWindow::GetInterface(const nsIID &aIID, void** aInstancePtr) ++{ ++ nsresult rv; ++ ++ rv = QueryInterface(aIID, aInstancePtr); ++ ++ // pass it up to the web browser object ++ if (NS_FAILED(rv) || !*aInstancePtr) { ++ nsCOMPtr ir = do_QueryInterface(mWebBrowser); ++ return ir->GetInterface(aIID, aInstancePtr); ++ } ++ ++ return rv; ++} +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindowCreator.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindowCreator.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindowCreator.cpp.gtkmozembed 2012-01-18 16:44:32.488289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindowCreator.cpp 2012-01-18 16:44:32.488289973 +0100 +@@ -0,0 +1,106 @@ ++/* ***** 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 ++ * Christopher Blizzard. Portions created by Christopher Blizzard are Copyright (C) Christopher Blizzard. All Rights Reserved. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "EmbedWindowCreator.h" ++#include "EmbedPrivate.h" ++#include "EmbedWindow.h" ++ ++// in order to create orphaned windows ++#include "gtkmozembedprivate.h" ++ ++EmbedWindowCreator::EmbedWindowCreator(void) ++{ ++} ++ ++EmbedWindowCreator::~EmbedWindowCreator() ++{ ++} ++ ++NS_IMPL_ISUPPORTS1(EmbedWindowCreator, nsIWindowCreator) ++ ++NS_IMETHODIMP ++EmbedWindowCreator::CreateChromeWindow(nsIWebBrowserChrome *aParent, ++ PRUint32 aChromeFlags, ++ nsIWebBrowserChrome **_retval) ++{ ++ NS_ENSURE_ARG_POINTER(_retval); ++ ++ GtkMozEmbed *newEmbed = nsnull; ++ ++ // No parent? Ask via the singleton object instead. ++ if (!aParent) { ++ gtk_moz_embed_single_create_window(&newEmbed, ++ (guint)aChromeFlags); ++ } ++ else { ++ // Find the EmbedPrivate object for this web browser chrome object. ++ EmbedPrivate *embedPrivate = EmbedPrivate::FindPrivateForBrowser(aParent); ++ ++ if (!embedPrivate) ++ return NS_ERROR_FAILURE; ++ ++ g_signal_emit(G_OBJECT(embedPrivate->mOwningWidget), ++ moz_embed_signals[NEW_WINDOW], 0, ++ &newEmbed, (guint)aChromeFlags); ++ ++ } ++ ++ // check to make sure that we made a new window ++ if (!newEmbed) ++ return NS_ERROR_FAILURE; ++ ++ // The window _must_ be realized before we pass it back to the ++ // function that created it. Functions that create new windows ++ // will do things like GetDocShell() and the widget has to be ++ // realized before that can happen. ++ gtk_widget_realize(GTK_WIDGET(newEmbed)); ++ ++ EmbedPrivate *newEmbedPrivate = static_cast(newEmbed->data); ++ ++ // set the chrome flag on the new window if it's a chrome open ++ if (aChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME) ++ newEmbedPrivate->mIsChrome = PR_TRUE; ++ ++ *_retval = static_cast(newEmbedPrivate->mWindow); ++ ++ if (*_retval) { ++ NS_ADDREF(*_retval); ++ return NS_OK; ++ } ++ ++ return NS_ERROR_FAILURE; ++} +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindowCreator.h.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindowCreator.h +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindowCreator.h.gtkmozembed 2012-01-18 16:44:32.488289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindowCreator.h 2012-01-18 16:44:32.488289973 +0100 +@@ -0,0 +1,54 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#ifndef __EmbedWindowCreator_h ++#define __EmbedWindowCreator_h ++ ++#include ++ ++class EmbedWindowCreator : public nsIWindowCreator ++{ ++ public: ++ EmbedWindowCreator(); ++ virtual ~EmbedWindowCreator(); ++ ++ NS_DECL_ISUPPORTS ++ NS_DECL_NSIWINDOWCREATOR ++ ++}; ++ ++#endif /* __EmbedWindowCreator_h */ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindow.h.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindow.h +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindow.h.gtkmozembed 2012-01-18 16:44:32.489289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/EmbedWindow.h 2012-01-18 16:44:32.489289973 +0100 +@@ -0,0 +1,101 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#ifndef __EmbedWindow_h ++#define __EmbedWindow_h ++ ++#include "nsIWebBrowserChrome.h" ++#include "nsIWebBrowserChromeFocus.h" ++#include "nsIEmbeddingSiteWindow.h" ++#include "nsITooltipListener.h" ++#include "nsISupports.h" ++#include "nsIWebBrowser.h" ++#include "nsIBaseWindow.h" ++#include "nsIInterfaceRequestor.h" ++#include "nsCOMPtr.h" ++#include "nsStringGlue.h" ++ ++#include ++ ++class EmbedPrivate; ++ ++class EmbedWindow : public nsIWebBrowserChrome, ++ public nsIWebBrowserChromeFocus, ++ public nsIEmbeddingSiteWindow, ++ public nsITooltipListener, ++ public nsIInterfaceRequestor ++{ ++ ++ public: ++ ++ EmbedWindow(); ++ virtual ~EmbedWindow(); ++ ++ nsresult Init (EmbedPrivate *aOwner); ++ nsresult CreateWindow (void); ++ void ReleaseChildren (void); ++ ++ NS_DECL_ISUPPORTS ++ ++ NS_DECL_NSIWEBBROWSERCHROME ++ ++ NS_DECL_NSIWEBBROWSERCHROMEFOCUS ++ ++ NS_DECL_NSIEMBEDDINGSITEWINDOW ++ ++ NS_DECL_NSITOOLTIPLISTENER ++ ++ NS_DECL_NSIINTERFACEREQUESTOR ++ ++ nsString mTitle; ++ nsString mJSStatus; ++ nsString mLinkMessage; ++ ++ nsCOMPtr mBaseWindow; // [OWNER] ++ ++private: ++ ++ EmbedPrivate *mOwner; ++ nsCOMPtr mWebBrowser; // [OWNER] ++ static GtkWidget *sTipWindow; ++ PRBool mVisibility; ++ PRBool mIsModal; ++ ++}; ++ ++ ++#endif /* __EmbedWindow_h */ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed2.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed2.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed2.cpp.gtkmozembed 2012-01-18 16:44:32.491289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed2.cpp 2012-01-19 10:06:52.015454094 +0100 +@@ -0,0 +1,1132 @@ ++/* ***** 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 ++ * Christopher Blizzard. Portions created by Christopher Blizzard are Copyright (C) Christopher Blizzard. All Rights Reserved. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * Ramiro Estrugo ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include ++ ++#include "gtkmozembed.h" ++#include "gtkmozembedprivate.h" ++#include "gtkmozembed_internal.h" ++ ++#include "EmbedPrivate.h" ++#include "EmbedWindow.h" ++ ++// so we can do our get_nsIWebBrowser later... ++#include "nsIWebBrowser.h" ++ ++#include "gtkmozembedmarshal.h" ++ ++#define NEW_TOOLKIT_STRING(x) g_strdup(NS_ConvertUTF16toUTF8(x).get()) ++#define GET_OBJECT_CLASS_TYPE(x) G_OBJECT_CLASS_TYPE(x) ++ ++class nsIDirectoryServiceProvider; ++ ++// class and instance initialization ++ ++static void ++gtk_moz_embed_class_init(GtkMozEmbedClass *klass); ++ ++static void ++gtk_moz_embed_init(GtkMozEmbed *embed); ++ ++// GtkObject methods ++ ++static void ++gtk_moz_embed_destroy(GtkObject *object); ++ ++// GtkWidget methods ++ ++static void ++gtk_moz_embed_realize(GtkWidget *widget); ++ ++static void ++gtk_moz_embed_unrealize(GtkWidget *widget); ++ ++static void ++gtk_moz_embed_size_allocate(GtkWidget *widget, GtkAllocation *allocation); ++ ++static void ++gtk_moz_embed_map(GtkWidget *widget); ++ ++static void ++gtk_moz_embed_unmap(GtkWidget *widget); ++ ++#ifdef MOZ_ACCESSIBILITY_ATK ++static AtkObject* gtk_moz_embed_get_accessible (GtkWidget *widget); ++#endif ++ ++static gint ++handle_child_focus_in(GtkWidget *aWidget, ++ GdkEventFocus *aGdkFocusEvent, ++ GtkMozEmbed *aEmbed); ++ ++static gint ++handle_child_focus_out(GtkWidget *aWidget, ++ GdkEventFocus *aGdkFocusEvent, ++ GtkMozEmbed *aEmbed); ++ ++// globals for this type of widget ++ ++static GtkBinClass *embed_parent_class; ++ ++guint moz_embed_signals[EMBED_LAST_SIGNAL] = { 0 }; ++ ++// GtkObject + class-related functions ++ ++GType ++gtk_moz_embed_get_type(void) ++{ ++ static GType moz_embed_type = 0; ++ if (moz_embed_type == 0) ++ { ++ const GTypeInfo our_info = ++ { ++ sizeof(GtkMozEmbedClass), ++ NULL, /* base_init */ ++ NULL, /* base_finalize */ ++ (GClassInitFunc)gtk_moz_embed_class_init, ++ NULL, ++ NULL, /* class_data */ ++ sizeof(GtkMozEmbed), ++ 0, /* n_preallocs */ ++ (GInstanceInitFunc)gtk_moz_embed_init, ++ }; ++ ++ moz_embed_type = g_type_register_static(GTK_TYPE_BIN, ++ "GtkMozEmbed", ++ &our_info, ++ (GTypeFlags)0); ++ } ++ ++ return moz_embed_type; ++} ++ ++static void ++gtk_moz_embed_class_init(GtkMozEmbedClass *klass) ++{ ++ GtkContainerClass *container_class; ++ GtkWidgetClass *widget_class; ++ GtkObjectClass *object_class; ++ ++ container_class = GTK_CONTAINER_CLASS(klass); ++ widget_class = GTK_WIDGET_CLASS(klass); ++ object_class = GTK_OBJECT_CLASS(klass); ++ ++ embed_parent_class = (GtkBinClass *)g_type_class_peek(gtk_bin_get_type()); ++ ++ widget_class->realize = gtk_moz_embed_realize; ++ widget_class->unrealize = gtk_moz_embed_unrealize; ++ widget_class->size_allocate = gtk_moz_embed_size_allocate; ++ widget_class->map = gtk_moz_embed_map; ++ widget_class->unmap = gtk_moz_embed_unmap; ++ ++#ifdef MOZ_ACCESSIBILITY_ATK ++ widget_class->get_accessible = gtk_moz_embed_get_accessible; ++#endif ++ ++ object_class->destroy = gtk_moz_embed_destroy; ++ ++ // set up our signals ++ ++ moz_embed_signals[LINK_MESSAGE] = ++ g_signal_new("link_message", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, link_message), ++ NULL, NULL, ++ g_cclosure_marshal_VOID__VOID, ++ G_TYPE_NONE, 0); ++ moz_embed_signals[JS_STATUS] = ++ g_signal_new("js_status", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, js_status), ++ NULL, NULL, ++ g_cclosure_marshal_VOID__VOID, ++ G_TYPE_NONE, 0); ++ moz_embed_signals[LOCATION] = ++ g_signal_new("location", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, location), ++ NULL, NULL, ++ g_cclosure_marshal_VOID__VOID, ++ G_TYPE_NONE, 0); ++ moz_embed_signals[TITLE] = ++ g_signal_new("title", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, title), ++ NULL, NULL, ++ g_cclosure_marshal_VOID__VOID, ++ G_TYPE_NONE, 0); ++ moz_embed_signals[PROGRESS] = ++ g_signal_new("progress", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, progress), ++ NULL, NULL, ++ gtkmozembed_VOID__INT_INT, ++ G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); ++ moz_embed_signals[PROGRESS_ALL] = ++ g_signal_new("progress_all", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, progress_all), ++ NULL, NULL, ++ gtkmozembed_VOID__STRING_INT_INT, ++ G_TYPE_NONE, 3, ++ G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE, ++ G_TYPE_INT, G_TYPE_INT); ++ moz_embed_signals[NET_STATE] = ++ g_signal_new("net_state", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, net_state), ++ NULL, NULL, ++ gtkmozembed_VOID__INT_UINT, ++ G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_UINT); ++ moz_embed_signals[NET_STATE_ALL] = ++ g_signal_new("net_state_all", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, net_state_all), ++ NULL, NULL, ++ gtkmozembed_VOID__STRING_INT_UINT, ++ G_TYPE_NONE, 3, ++ G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE, ++ G_TYPE_INT, G_TYPE_UINT); ++ moz_embed_signals[NET_START] = ++ g_signal_new("net_start", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, net_start), ++ NULL, NULL, ++ g_cclosure_marshal_VOID__VOID, ++ G_TYPE_NONE, 0); ++ moz_embed_signals[NET_STOP] = ++ g_signal_new("net_stop", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, net_stop), ++ NULL, NULL, ++ g_cclosure_marshal_VOID__VOID, ++ G_TYPE_NONE, 0); ++ moz_embed_signals[NEW_WINDOW] = ++ g_signal_new("new_window", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, new_window), ++ NULL, NULL, ++ gtkmozembed_VOID__POINTER_UINT, ++ G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_UINT); ++ moz_embed_signals[VISIBILITY] = ++ g_signal_new("visibility", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, visibility), ++ NULL, NULL, ++ g_cclosure_marshal_VOID__BOOLEAN, ++ G_TYPE_NONE, 1, G_TYPE_BOOLEAN); ++ moz_embed_signals[DESTROY_BROWSER] = ++ g_signal_new("destroy_browser", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, destroy_brsr), ++ NULL, NULL, ++ g_cclosure_marshal_VOID__VOID, ++ G_TYPE_NONE, 0); ++ moz_embed_signals[OPEN_URI] = ++ g_signal_new("open_uri", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, open_uri), ++ NULL, NULL, ++ gtkmozembed_BOOL__STRING, ++ G_TYPE_BOOLEAN, 1, G_TYPE_STRING | ++ G_SIGNAL_TYPE_STATIC_SCOPE); ++ moz_embed_signals[SIZE_TO] = ++ g_signal_new("size_to", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, size_to), ++ NULL, NULL, ++ gtkmozembed_VOID__INT_INT, ++ G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); ++ moz_embed_signals[DOM_KEY_DOWN] = ++ g_signal_new("dom_key_down", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, dom_key_down), ++ NULL, NULL, ++ gtkmozembed_BOOL__POINTER, ++ G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); ++ moz_embed_signals[DOM_KEY_PRESS] = ++ g_signal_new("dom_key_press", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, dom_key_press), ++ NULL, NULL, ++ gtkmozembed_BOOL__POINTER, ++ G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); ++ moz_embed_signals[DOM_KEY_UP] = ++ g_signal_new("dom_key_up", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, dom_key_up), ++ NULL, NULL, ++ gtkmozembed_BOOL__POINTER, ++ G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); ++ moz_embed_signals[DOM_MOUSE_DOWN] = ++ g_signal_new("dom_mouse_down", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_down), ++ NULL, NULL, ++ gtkmozembed_BOOL__POINTER, ++ G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); ++ moz_embed_signals[DOM_MOUSE_UP] = ++ g_signal_new("dom_mouse_up", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_up), ++ NULL, NULL, ++ gtkmozembed_BOOL__POINTER, ++ G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); ++ moz_embed_signals[DOM_MOUSE_CLICK] = ++ g_signal_new("dom_mouse_click", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_click), ++ NULL, NULL, ++ gtkmozembed_BOOL__POINTER, ++ G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); ++ moz_embed_signals[DOM_MOUSE_DBL_CLICK] = ++ g_signal_new("dom_mouse_dbl_click", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_dbl_click), ++ NULL, NULL, ++ gtkmozembed_BOOL__POINTER, ++ G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); ++ moz_embed_signals[DOM_MOUSE_OVER] = ++ g_signal_new("dom_mouse_over", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_over), ++ NULL, NULL, ++ gtkmozembed_BOOL__POINTER, ++ G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); ++ moz_embed_signals[DOM_MOUSE_OUT] = ++ g_signal_new("dom_mouse_out", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_out), ++ NULL, NULL, ++ gtkmozembed_BOOL__POINTER, ++ G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); ++ moz_embed_signals[SECURITY_CHANGE] = ++ g_signal_new("security_change", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, security_change), ++ NULL, NULL, ++ gtkmozembed_VOID__POINTER_UINT, ++ G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_UINT); ++ moz_embed_signals[STATUS_CHANGE] = ++ g_signal_new("status_change", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, status_change), ++ NULL, NULL, ++ gtkmozembed_VOID__POINTER_INT_POINTER, ++ G_TYPE_NONE, 3, ++ G_TYPE_POINTER, G_TYPE_INT, G_TYPE_POINTER); ++ moz_embed_signals[DOM_ACTIVATE] = ++ g_signal_new("dom_activate", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, dom_activate), ++ NULL, NULL, ++ gtkmozembed_BOOL__POINTER, ++ G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); ++ moz_embed_signals[DOM_FOCUS_IN] = ++ g_signal_new("dom_focus_in", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, dom_focus_in), ++ NULL, NULL, ++ gtkmozembed_BOOL__POINTER, ++ G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); ++ moz_embed_signals[DOM_FOCUS_OUT] = ++ g_signal_new("dom_focus_out", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(GtkMozEmbedClass, dom_focus_out), ++ NULL, NULL, ++ gtkmozembed_BOOL__POINTER, ++ G_TYPE_BOOLEAN, 1, G_TYPE_POINTER); ++} ++ ++static void ++gtk_moz_embed_init(GtkMozEmbed *embed) ++{ ++ EmbedPrivate *priv = new EmbedPrivate(); ++ embed->data = priv; ++ gtk_widget_set_name(GTK_WIDGET(embed), "gtkmozembed"); ++ ++ GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(embed), GTK_NO_WINDOW); ++} ++ ++GtkWidget * ++gtk_moz_embed_new(void) ++{ ++ return GTK_WIDGET(g_object_new(GTK_TYPE_MOZ_EMBED, NULL)); ++} ++ ++// GtkObject methods ++ ++static void ++gtk_moz_embed_destroy(GtkObject *object) ++{ ++ GtkMozEmbed *embed; ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail(object != NULL); ++ g_return_if_fail(GTK_IS_MOZ_EMBED(object)); ++ ++ embed = GTK_MOZ_EMBED(object); ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ if (embedPrivate) { ++ ++ // Destroy the widget only if it's been Init()ed. ++ if(embedPrivate->mMozWindowWidget != 0) { ++ embedPrivate->Destroy(); ++ } ++ ++ delete embedPrivate; ++ embed->data = NULL; ++ } ++} ++ ++// GtkWidget methods ++ ++static void ++gtk_moz_embed_realize(GtkWidget *widget) ++{ ++ GtkMozEmbed *embed; ++ EmbedPrivate *embedPrivate; ++ GdkWindowAttr attributes; ++ gint attributes_mask; ++ ++ g_return_if_fail(widget != NULL); ++ g_return_if_fail(GTK_IS_MOZ_EMBED(widget)); ++ ++ embed = GTK_MOZ_EMBED(widget); ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); ++ ++ attributes.window_type = GDK_WINDOW_CHILD; ++ attributes.x = widget->allocation.x; ++ attributes.y = widget->allocation.y; ++ attributes.width = widget->allocation.width; ++ attributes.height = widget->allocation.height; ++ attributes.wclass = GDK_INPUT_OUTPUT; ++ attributes.visual = gtk_widget_get_visual (widget); ++ attributes.colormap = gtk_widget_get_colormap (widget); ++ attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK; ++ ++ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; ++ ++ widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), ++ &attributes, attributes_mask); ++ gdk_window_set_user_data (widget->window, embed); ++ ++ widget->style = gtk_style_attach (widget->style, widget->window); ++ gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); ++ ++ // initialize the window ++ nsresult rv; ++ rv = embedPrivate->Init(embed); ++ g_return_if_fail(NS_SUCCEEDED(rv)); ++ ++ PRBool alreadyRealized = PR_FALSE; ++ rv = embedPrivate->Realize(&alreadyRealized); ++ g_return_if_fail(NS_SUCCEEDED(rv)); ++ ++ // if we're already realized we don't need to hook up to anything below ++ if (alreadyRealized) ++ return; ++ ++ if (embedPrivate->mURI.Length()) ++ embedPrivate->LoadCurrentURI(); ++ ++ // connect to the focus out event for the child ++ GtkWidget *child_widget = GTK_BIN(widget)->child; ++ g_signal_connect_object(G_OBJECT(child_widget), ++ "focus_out_event", ++ G_CALLBACK(handle_child_focus_out), ++ embed, ++ G_CONNECT_AFTER); ++ g_signal_connect_object(G_OBJECT(child_widget), ++ "focus_in_event", ++ G_CALLBACK(handle_child_focus_in), ++ embed, ++ G_CONNECT_AFTER); ++} ++ ++static void ++gtk_moz_embed_unrealize(GtkWidget *widget) ++{ ++ GtkMozEmbed *embed; ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail(widget != NULL); ++ g_return_if_fail(GTK_IS_MOZ_EMBED(widget)); ++ ++ embed = GTK_MOZ_EMBED(widget); ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ if (embedPrivate) { ++ embedPrivate->Unrealize(); ++ } ++ ++ if (GTK_WIDGET_CLASS(embed_parent_class)->unrealize) ++ (* GTK_WIDGET_CLASS(embed_parent_class)->unrealize)(widget); ++} ++ ++static void ++gtk_moz_embed_size_allocate(GtkWidget *widget, GtkAllocation *allocation) ++{ ++ GtkMozEmbed *embed; ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail(widget != NULL); ++ g_return_if_fail(GTK_IS_MOZ_EMBED(widget)); ++ ++ embed = GTK_MOZ_EMBED(widget); ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ widget->allocation = *allocation; ++ ++ if (GTK_WIDGET_REALIZED(widget)) ++ { ++ gdk_window_move_resize(widget->window, ++ allocation->x, allocation->y, ++ allocation->width, allocation->height); ++ embedPrivate->Resize(allocation->width, allocation->height); ++ } ++} ++ ++static void ++gtk_moz_embed_map(GtkWidget *widget) ++{ ++ GtkMozEmbed *embed; ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail(widget != NULL); ++ g_return_if_fail(GTK_IS_MOZ_EMBED(widget)); ++ ++ embed = GTK_MOZ_EMBED(widget); ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED); ++ ++ embedPrivate->Show(); ++ ++ gdk_window_show(widget->window); ++ ++} ++ ++static void ++gtk_moz_embed_unmap(GtkWidget *widget) ++{ ++ GtkMozEmbed *embed; ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail(widget != NULL); ++ g_return_if_fail(GTK_IS_MOZ_EMBED(widget)); ++ ++ embed = GTK_MOZ_EMBED(widget); ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ GTK_WIDGET_UNSET_FLAGS(widget, GTK_MAPPED); ++ ++ gdk_window_hide(widget->window); ++ ++ embedPrivate->Hide(); ++} ++ ++#ifdef MOZ_ACCESSIBILITY_ATK ++static AtkObject* ++gtk_moz_embed_get_accessible (GtkWidget *widget) ++{ ++ g_return_val_if_fail(widget != NULL, NULL); ++ g_return_val_if_fail(GTK_IS_MOZ_EMBED(widget), NULL); ++ ++ GtkMozEmbed *embed = GTK_MOZ_EMBED(widget);; ++ EmbedPrivate *embedPrivate = (EmbedPrivate *)embed->data; ++ return static_cast( ++ embedPrivate->GetAtkObjectForCurrentDocument()); ++} ++#endif /* MOZ_ACCESSIBILITY_ATK */ ++ ++static gint ++handle_child_focus_in(GtkWidget *aWidget, ++ GdkEventFocus *aGdkFocusEvent, ++ GtkMozEmbed *aEmbed) ++{ ++ EmbedPrivate *embedPrivate; ++ ++ embedPrivate = (EmbedPrivate *)aEmbed->data; ++ ++ embedPrivate->ChildFocusIn(); ++ ++ return FALSE; ++} ++ ++static gint ++handle_child_focus_out(GtkWidget *aWidget, ++ GdkEventFocus *aGdkFocusEvent, ++ GtkMozEmbed *aEmbed) ++{ ++ EmbedPrivate *embedPrivate; ++ ++ embedPrivate = (EmbedPrivate *)aEmbed->data; ++ ++ embedPrivate->ChildFocusOut(); ++ ++ return FALSE; ++} ++ ++// Widget methods ++ ++void ++gtk_moz_embed_push_startup(void) ++{ ++ EmbedPrivate::PushStartup(); ++} ++ ++void ++gtk_moz_embed_pop_startup(void) ++{ ++ EmbedPrivate::PopStartup(); ++} ++ ++void ++gtk_moz_embed_set_path(const char *aPath) ++{ ++ EmbedPrivate::SetPath(aPath); ++} ++ ++void ++gtk_moz_embed_set_comp_path(const char *aPath) ++{ ++ EmbedPrivate::SetCompPath(aPath); ++} ++ ++void ++gtk_moz_embed_set_profile_path(const char *aDir, const char *aName) ++{ ++ EmbedPrivate::SetProfilePath(aDir, aName); ++} ++ ++void ++gtk_moz_embed_set_directory_service_provider(nsIDirectoryServiceProvider *appFileLocProvider) { ++ EmbedPrivate::SetDirectoryServiceProvider(appFileLocProvider); ++} ++ ++void ++gtk_moz_embed_load_url(GtkMozEmbed *embed, const char *url) ++{ ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail(embed != NULL); ++ g_return_if_fail(GTK_IS_MOZ_EMBED(embed)); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ embedPrivate->SetURI(url); ++ ++ // If the widget is realized, load the URI. If it isn't then we ++ // will load it later. ++ if (GTK_WIDGET_REALIZED(embed)) ++ embedPrivate->LoadCurrentURI(); ++} ++ ++void ++gtk_moz_embed_stop_load(GtkMozEmbed *embed) ++{ ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail(embed != NULL); ++ g_return_if_fail(GTK_IS_MOZ_EMBED(embed)); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ if (embedPrivate->mNavigation) ++ embedPrivate->mNavigation->Stop(nsIWebNavigation::STOP_ALL); ++} ++ ++gboolean ++gtk_moz_embed_can_go_back(GtkMozEmbed *embed) ++{ ++ bool retval = PR_FALSE; ++ EmbedPrivate *embedPrivate; ++ ++ g_return_val_if_fail ((embed != NULL), FALSE); ++ g_return_val_if_fail (GTK_IS_MOZ_EMBED(embed), FALSE); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ if (embedPrivate->mNavigation) ++ embedPrivate->mNavigation->GetCanGoBack(&retval); ++ return retval; ++} ++ ++gboolean ++gtk_moz_embed_can_go_forward(GtkMozEmbed *embed) ++{ ++ bool retval = PR_FALSE; ++ EmbedPrivate *embedPrivate; ++ ++ g_return_val_if_fail ((embed != NULL), FALSE); ++ g_return_val_if_fail (GTK_IS_MOZ_EMBED(embed), FALSE); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ if (embedPrivate->mNavigation) ++ embedPrivate->mNavigation->GetCanGoForward(&retval); ++ return retval; ++} ++ ++void ++gtk_moz_embed_go_back(GtkMozEmbed *embed) ++{ ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail (embed != NULL); ++ g_return_if_fail (GTK_IS_MOZ_EMBED(embed)); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ if (embedPrivate->mNavigation) ++ embedPrivate->mNavigation->GoBack(); ++} ++ ++void ++gtk_moz_embed_go_forward(GtkMozEmbed *embed) ++{ ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail (embed != NULL); ++ g_return_if_fail (GTK_IS_MOZ_EMBED(embed)); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ if (embedPrivate->mNavigation) ++ embedPrivate->mNavigation->GoForward(); ++} ++ ++void ++gtk_moz_embed_render_data(GtkMozEmbed *embed, const char *data, ++ guint32 len, const char *base_uri, ++ const char *mime_type) ++{ ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail (embed != NULL); ++ g_return_if_fail (GTK_IS_MOZ_EMBED(embed)); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ embedPrivate->OpenStream(base_uri, mime_type); ++ embedPrivate->AppendToStream((const PRUint8*)data, len); ++ embedPrivate->CloseStream(); ++} ++ ++void ++gtk_moz_embed_open_stream(GtkMozEmbed *embed, const char *base_uri, ++ const char *mime_type) ++{ ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail (embed != NULL); ++ g_return_if_fail (GTK_IS_MOZ_EMBED(embed)); ++ g_return_if_fail (GTK_WIDGET_REALIZED(GTK_WIDGET(embed))); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ embedPrivate->OpenStream(base_uri, mime_type); ++} ++ ++void gtk_moz_embed_append_data(GtkMozEmbed *embed, const char *data, ++ guint32 len) ++{ ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail (embed != NULL); ++ g_return_if_fail (GTK_IS_MOZ_EMBED(embed)); ++ g_return_if_fail (GTK_WIDGET_REALIZED(GTK_WIDGET(embed))); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ embedPrivate->AppendToStream((const PRUint8*)data, len); ++} ++ ++void ++gtk_moz_embed_close_stream(GtkMozEmbed *embed) ++{ ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail (embed != NULL); ++ g_return_if_fail (GTK_IS_MOZ_EMBED(embed)); ++ g_return_if_fail (GTK_WIDGET_REALIZED(GTK_WIDGET(embed))); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ embedPrivate->CloseStream(); ++} ++ ++char * ++gtk_moz_embed_get_link_message(GtkMozEmbed *embed) ++{ ++ char *retval = nsnull; ++ EmbedPrivate *embedPrivate; ++ ++ g_return_val_if_fail ((embed != NULL), (char *)NULL); ++ g_return_val_if_fail (GTK_IS_MOZ_EMBED(embed), (char *)NULL); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ if (embedPrivate->mWindow) ++ retval = NEW_TOOLKIT_STRING(embedPrivate->mWindow->mLinkMessage); ++ ++ return retval; ++} ++ ++char * ++gtk_moz_embed_get_js_status(GtkMozEmbed *embed) ++{ ++ char *retval = nsnull; ++ EmbedPrivate *embedPrivate; ++ ++ g_return_val_if_fail ((embed != NULL), (char *)NULL); ++ g_return_val_if_fail (GTK_IS_MOZ_EMBED(embed), (char *)NULL); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ if (embedPrivate->mWindow) ++ retval = NEW_TOOLKIT_STRING(embedPrivate->mWindow->mJSStatus); ++ ++ return retval; ++} ++ ++char * ++gtk_moz_embed_get_title(GtkMozEmbed *embed) ++{ ++ char *retval = nsnull; ++ EmbedPrivate *embedPrivate; ++ ++ g_return_val_if_fail ((embed != NULL), (char *)NULL); ++ g_return_val_if_fail (GTK_IS_MOZ_EMBED(embed), (char *)NULL); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ if (embedPrivate->mWindow) ++ retval = NEW_TOOLKIT_STRING(embedPrivate->mWindow->mTitle); ++ ++ return retval; ++} ++ ++char * ++gtk_moz_embed_get_location(GtkMozEmbed *embed) ++{ ++ char *retval = nsnull; ++ EmbedPrivate *embedPrivate; ++ ++ g_return_val_if_fail ((embed != NULL), (char *)NULL); ++ g_return_val_if_fail (GTK_IS_MOZ_EMBED(embed), (char *)NULL); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ if (!embedPrivate->mURI.IsEmpty()) ++ retval = g_strdup(embedPrivate->mURI.get()); ++ ++ return retval; ++} ++ ++void ++gtk_moz_embed_reload(GtkMozEmbed *embed, gint32 flags) ++{ ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail (embed != NULL); ++ g_return_if_fail (GTK_IS_MOZ_EMBED(embed)); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ PRUint32 reloadFlags = 0; ++ ++ // map the external API to the internal web navigation API. ++ switch (flags) { ++ case GTK_MOZ_EMBED_FLAG_RELOADNORMAL: ++ reloadFlags = 0; ++ break; ++ case GTK_MOZ_EMBED_FLAG_RELOADBYPASSCACHE: ++ reloadFlags = nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE; ++ break; ++ case GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXY: ++ reloadFlags = nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY; ++ break; ++ case GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXYANDCACHE: ++ reloadFlags = (nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY | ++ nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE); ++ break; ++ case GTK_MOZ_EMBED_FLAG_RELOADCHARSETCHANGE: ++ reloadFlags = nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE; ++ break; ++ default: ++ reloadFlags = 0; ++ break; ++ } ++ ++ embedPrivate->Reload(reloadFlags); ++} ++ ++void ++gtk_moz_embed_set_chrome_mask(GtkMozEmbed *embed, guint32 flags) ++{ ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail (embed != NULL); ++ g_return_if_fail (GTK_IS_MOZ_EMBED(embed)); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ embedPrivate->SetChromeMask(flags); ++} ++ ++guint32 ++gtk_moz_embed_get_chrome_mask(GtkMozEmbed *embed) ++{ ++ EmbedPrivate *embedPrivate; ++ ++ g_return_val_if_fail ((embed != NULL), 0); ++ g_return_val_if_fail (GTK_IS_MOZ_EMBED(embed), 0); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ return embedPrivate->mChromeMask; ++} ++ ++void ++gtk_moz_embed_get_nsIWebBrowser (GtkMozEmbed *embed, nsIWebBrowser **retval) ++{ ++ EmbedPrivate *embedPrivate; ++ ++ g_return_if_fail (embed != NULL); ++ g_return_if_fail (GTK_IS_MOZ_EMBED(embed)); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ if (embedPrivate->mWindow) ++ embedPrivate->mWindow->GetWebBrowser(retval); ++} ++ ++PRUnichar * ++gtk_moz_embed_get_title_unichar (GtkMozEmbed *embed) ++{ ++ PRUnichar *retval = nsnull; ++ EmbedPrivate *embedPrivate; ++ ++ g_return_val_if_fail ((embed != NULL), (PRUnichar *)NULL); ++ g_return_val_if_fail (GTK_IS_MOZ_EMBED(embed), (PRUnichar *)NULL); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ if (embedPrivate->mWindow) ++ retval = ToNewUnicode(embedPrivate->mWindow->mTitle); ++ ++ return retval; ++} ++ ++PRUnichar * ++gtk_moz_embed_get_js_status_unichar (GtkMozEmbed *embed) ++{ ++ PRUnichar *retval = nsnull; ++ EmbedPrivate *embedPrivate; ++ ++ g_return_val_if_fail ((embed != NULL), (PRUnichar *)NULL); ++ g_return_val_if_fail (GTK_IS_MOZ_EMBED(embed), (PRUnichar *)NULL); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ if (embedPrivate->mWindow) ++ retval = ToNewUnicode(embedPrivate->mWindow->mJSStatus); ++ ++ return retval; ++} ++ ++PRUnichar * ++gtk_moz_embed_get_link_message_unichar (GtkMozEmbed *embed) ++{ ++ PRUnichar *retval = nsnull; ++ EmbedPrivate *embedPrivate; ++ ++ g_return_val_if_fail ((embed != NULL), (PRUnichar *)NULL); ++ g_return_val_if_fail (GTK_IS_MOZ_EMBED(embed), (PRUnichar *)NULL); ++ ++ embedPrivate = (EmbedPrivate *)embed->data; ++ ++ if (embedPrivate->mWindow) ++ retval = ToNewUnicode(embedPrivate->mWindow->mLinkMessage); ++ ++ return retval; ++} ++ ++// class and instance initialization ++ ++static void ++gtk_moz_embed_single_class_init(GtkMozEmbedSingleClass *klass); ++ ++static void ++gtk_moz_embed_single_init(GtkMozEmbedSingle *embed); ++ ++GtkMozEmbedSingle * ++gtk_moz_embed_single_new(void); ++ ++enum { ++ NEW_WINDOW_ORPHAN, ++ SINGLE_LAST_SIGNAL ++}; ++ ++guint moz_embed_single_signals[SINGLE_LAST_SIGNAL] = { 0 }; ++ ++// GtkObject + class-related functions ++ ++GType ++gtk_moz_embed_single_get_type(void) ++{ ++ static GType moz_embed_single_type = 0; ++ if (moz_embed_single_type == 0) ++ { ++ const GTypeInfo our_info = ++ { ++ sizeof(GtkMozEmbedClass), ++ NULL, /* base_init */ ++ NULL, /* base_finalize */ ++ (GClassInitFunc)gtk_moz_embed_single_class_init, ++ NULL, ++ NULL, /* class_data */ ++ sizeof(GtkMozEmbed), ++ 0, /* n_preallocs */ ++ (GInstanceInitFunc)gtk_moz_embed_single_init, ++ }; ++ ++ moz_embed_single_type = g_type_register_static(GTK_TYPE_OBJECT, ++ "GtkMozEmbedSingle", ++ &our_info, ++ (GTypeFlags)0); ++ } ++ ++ return moz_embed_single_type; ++} ++ ++static void ++gtk_moz_embed_single_class_init(GtkMozEmbedSingleClass *klass) ++{ ++ GtkObjectClass *object_class; ++ ++ object_class = GTK_OBJECT_CLASS(klass); ++ ++ // set up our signals ++ ++ moz_embed_single_signals[NEW_WINDOW_ORPHAN] = ++ g_signal_new("new_window_orphan", ++ G_TYPE_FROM_CLASS(klass), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET(GtkMozEmbedSingleClass, new_window_orphan), ++ NULL, NULL, ++ gtkmozembed_VOID__POINTER_UINT, ++ G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_UINT); ++ ++} ++ ++static void ++gtk_moz_embed_single_init(GtkMozEmbedSingle *embed) ++{ ++ // this is a placeholder for later in case we need to stash data at ++ // a later data and maintain backwards compatibility. ++ embed->data = nsnull; ++} ++ ++GtkMozEmbedSingle * ++gtk_moz_embed_single_new(void) ++{ ++ return (GtkMozEmbedSingle *)g_object_new(GTK_TYPE_MOZ_EMBED_SINGLE, NULL); ++} ++ ++GtkMozEmbedSingle * ++gtk_moz_embed_single_get(void) ++{ ++ static GtkMozEmbedSingle *singleton_object = nsnull; ++ if (!singleton_object) ++ { ++ singleton_object = gtk_moz_embed_single_new(); ++ } ++ ++ return singleton_object; ++} ++ ++// our callback from the window creator service ++void ++gtk_moz_embed_single_create_window(GtkMozEmbed **aNewEmbed, ++ guint aChromeFlags) ++{ ++ GtkMozEmbedSingle *single = gtk_moz_embed_single_get(); ++ ++ *aNewEmbed = nsnull; ++ ++ if (!single) ++ return; ++ ++ g_signal_emit(G_OBJECT(single), ++ moz_embed_single_signals[NEW_WINDOW_ORPHAN], 0, ++ aNewEmbed, aChromeFlags); ++ ++} +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed_glue.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed_glue.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed_glue.cpp.gtkmozembed 2012-01-18 16:44:32.493289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed_glue.cpp 2012-01-18 16:44:32.494289973 +0100 +@@ -0,0 +1,116 @@ ++/* ***** 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 embedding. ++ * ++ * The Initial Developer of the Original Code is ++ * Benjamin Smedberg . ++ * ++ * Portions created by the Initial Developer are Copyright (C) 2005 ++ * the Mozilla Foundation . 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 ***** */ ++ ++// This file is an implementation file, meant to be #included in a ++// single C++ file of an embedding application. It is called after ++// XPCOMGlueStartup to glue the gtkmozembed functions. ++ ++#include "gtkmozembed.h" ++#include "gtkmozembed_internal.h" ++#include "nsXPCOMGlue.h" ++ ++#ifndef XPCOM_GLUE ++#error This file only makes sense when XPCOM_GLUE is defined. ++#endif ++ ++#define GTKMOZEMBED_FUNCTIONS \ ++ GTKF(gtk_moz_embed_get_type) \ ++ GTKF(gtk_moz_embed_new) \ ++ GTKF(gtk_moz_embed_push_startup) \ ++ GTKF(gtk_moz_embed_pop_startup) \ ++ GTKF(gtk_moz_embed_set_path) \ ++ GTKF(gtk_moz_embed_set_comp_path) \ ++ GTKF(gtk_moz_embed_set_profile_path) \ ++ GTKF(gtk_moz_embed_load_url) \ ++ GTKF(gtk_moz_embed_stop_load) \ ++ GTKF(gtk_moz_embed_can_go_back) \ ++ GTKF(gtk_moz_embed_can_go_forward) \ ++ GTKF(gtk_moz_embed_go_back) \ ++ GTKF(gtk_moz_embed_go_forward) \ ++ GTKF(gtk_moz_embed_render_data) \ ++ GTKF(gtk_moz_embed_open_stream) \ ++ GTKF(gtk_moz_embed_append_data) \ ++ GTKF(gtk_moz_embed_close_stream) \ ++ GTKF(gtk_moz_embed_get_link_message) \ ++ GTKF(gtk_moz_embed_get_js_status) \ ++ GTKF(gtk_moz_embed_get_title) \ ++ GTKF(gtk_moz_embed_get_location) \ ++ GTKF(gtk_moz_embed_reload) \ ++ GTKF(gtk_moz_embed_set_chrome_mask) \ ++ GTKF(gtk_moz_embed_get_chrome_mask) \ ++ GTKF(gtk_moz_embed_single_get_type) \ ++ GTKF(gtk_moz_embed_single_get) ++ ++#define GTKMOZEMBED_FUNCTIONS_INTERNAL \ ++ GTKF(gtk_moz_embed_get_nsIWebBrowser) \ ++ GTKF(gtk_moz_embed_get_title_unichar) \ ++ GTKF(gtk_moz_embed_get_js_status_unichar) \ ++ GTKF(gtk_moz_embed_get_link_message_unichar) \ ++ GTKF(gtk_moz_embed_set_directory_service_provider) ++ ++#define GTKF(fname) fname##Type fname; ++ ++GTKMOZEMBED_FUNCTIONS ++GTKMOZEMBED_FUNCTIONS_INTERNAL ++ ++#undef GTKF ++ ++#define GTKF(fname) { #fname, (NSFuncPtr*) &fname }, ++ ++static const nsDynamicFunctionLoad GtkSymbols[] = { ++GTKMOZEMBED_FUNCTIONS ++ { nsnull, nsnull } ++}; ++ ++static const nsDynamicFunctionLoad GtkSymbolsInternal[] = { ++GTKMOZEMBED_FUNCTIONS_INTERNAL ++ { nsnull, nsnull } ++}; ++#undef GTKF ++ ++static nsresult ++GTKEmbedGlueStartup() ++{ ++ return XPCOMGlueLoadXULFunctions(GtkSymbols); ++} ++ ++static nsresult ++GTKEmbedGlueStartupInternal() ++{ ++ return XPCOMGlueLoadXULFunctions(GtkSymbolsInternal); ++} ++ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed.h.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed.h +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed.h.gtkmozembed 2012-01-18 16:44:32.495289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed.h 2012-01-18 16:44:32.495289973 +0100 +@@ -0,0 +1,287 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * Ramiro Estrugo ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#ifndef gtkmozembed_h ++#define gtkmozembed_h ++ ++#include ++#include ++ ++#ifdef MOZILLA_CLIENT ++#include "nscore.h" ++#else /* MOZILLA_CLIENT */ ++#ifndef nscore_h__ ++/* Because this header may be included from files which not part of the mozilla ++ build system, define macros from nscore.h */ ++ ++#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) ++#define NS_HIDDEN __attribute__((visibility("hidden"))) ++#else ++#define NS_HIDDEN ++#endif ++ ++#define NS_FROZENCALL ++#define NS_EXPORT_(type) type ++#define NS_IMPORT_(type) type ++#endif /* nscore_h__ */ ++#endif /* MOZILLA_CLIENT */ ++ ++#ifdef XPCOM_GLUE ++ ++#define GTKMOZEMBED_API(type, name, params) \ ++ typedef type (NS_FROZENCALL * name##Type) params; \ ++ extern name##Type name NS_HIDDEN; ++ ++#else /* XPCOM_GLUE */ ++ ++#ifdef _IMPL_GTKMOZEMBED ++#define GTKMOZEMBED_API(type, name, params) NS_EXPORT_(type) name params; ++#else ++#define GTKMOZEMBED_API(type,name, params) NS_IMPORT_(type) name params; ++#endif ++ ++#endif /* XPCOM_GLUE */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif /* __cplusplus */ ++ ++#define GTK_TYPE_MOZ_EMBED (gtk_moz_embed_get_type()) ++#define GTK_MOZ_EMBED(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_MOZ_EMBED, GtkMozEmbed) ++#define GTK_MOZ_EMBED_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_MOZ_EMBED, GtkMozEmbedClass) ++#define GTK_IS_MOZ_EMBED(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_MOZ_EMBED) ++#define GTK_IS_MOZ_EMBED_CLASS(klass) G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_MOZ_EMBED) ++ ++typedef struct _GtkMozEmbed GtkMozEmbed; ++typedef struct _GtkMozEmbedClass GtkMozEmbedClass; ++ ++struct _GtkMozEmbed ++{ ++ GtkBin bin; ++ void *data; ++}; ++ ++struct _GtkMozEmbedClass ++{ ++ GtkBinClass parent_class; ++ ++ void (* link_message) (GtkMozEmbed *embed); ++ void (* js_status) (GtkMozEmbed *embed); ++ void (* location) (GtkMozEmbed *embed); ++ void (* title) (GtkMozEmbed *embed); ++ void (* progress) (GtkMozEmbed *embed, gint curprogress, ++ gint maxprogress); ++ void (* progress_all) (GtkMozEmbed *embed, const char *aURI, ++ gint curprogress, gint maxprogress); ++ void (* net_state) (GtkMozEmbed *embed, gint state, guint status); ++ void (* net_state_all) (GtkMozEmbed *embed, const char *aURI, ++ gint state, guint status); ++ void (* net_start) (GtkMozEmbed *embed); ++ void (* net_stop) (GtkMozEmbed *embed); ++ void (* new_window) (GtkMozEmbed *embed, GtkMozEmbed **newEmbed, ++ guint chromemask); ++ void (* visibility) (GtkMozEmbed *embed, gboolean visibility); ++ void (* destroy_brsr) (GtkMozEmbed *embed); ++ gint (* open_uri) (GtkMozEmbed *embed, const char *aURI); ++ void (* size_to) (GtkMozEmbed *embed, gint width, gint height); ++ gint (* dom_key_down) (GtkMozEmbed *embed, gpointer dom_event); ++ gint (* dom_key_press) (GtkMozEmbed *embed, gpointer dom_event); ++ gint (* dom_key_up) (GtkMozEmbed *embed, gpointer dom_event); ++ gint (* dom_mouse_down) (GtkMozEmbed *embed, gpointer dom_event); ++ gint (* dom_mouse_up) (GtkMozEmbed *embed, gpointer dom_event); ++ gint (* dom_mouse_click) (GtkMozEmbed *embed, gpointer dom_event); ++ gint (* dom_mouse_dbl_click) (GtkMozEmbed *embed, gpointer dom_event); ++ gint (* dom_mouse_over) (GtkMozEmbed *embed, gpointer dom_event); ++ gint (* dom_mouse_out) (GtkMozEmbed *embed, gpointer dom_event); ++ void (* security_change) (GtkMozEmbed *embed, gpointer request, ++ guint state); ++ void (* status_change) (GtkMozEmbed *embed, gpointer request, ++ gint status, gpointer message); ++ gint (* dom_activate) (GtkMozEmbed *embed, gpointer dom_event); ++ gint (* dom_focus_in) (GtkMozEmbed *embed, gpointer dom_event); ++ gint (* dom_focus_out) (GtkMozEmbed *embed, gpointer dom_event); ++}; ++ ++GTKMOZEMBED_API(GType, gtk_moz_embed_get_type, (void)) ++GTKMOZEMBED_API(GtkWidget*, gtk_moz_embed_new, (void)) ++GTKMOZEMBED_API(void, gtk_moz_embed_push_startup, (void)) ++GTKMOZEMBED_API(void, gtk_moz_embed_pop_startup, (void)) ++ ++/* Tell gtkmozembed where the gtkmozembed libs live. If this is not specified, ++ The MOZILLA_FIVE_HOME environment variable is checked. */ ++GTKMOZEMBED_API(void, gtk_moz_embed_set_path, (const char *aPath)) ++ ++GTKMOZEMBED_API(void, gtk_moz_embed_set_comp_path, (const char *aPath)) ++GTKMOZEMBED_API(void, gtk_moz_embed_set_profile_path, (const char *aDir, ++ const char *aName)) ++GTKMOZEMBED_API(void, gtk_moz_embed_load_url, (GtkMozEmbed *embed, ++ const char *url)) ++GTKMOZEMBED_API(void, gtk_moz_embed_stop_load, (GtkMozEmbed *embed)) ++GTKMOZEMBED_API(gboolean, gtk_moz_embed_can_go_back, (GtkMozEmbed *embed)) ++GTKMOZEMBED_API(gboolean, gtk_moz_embed_can_go_forward, (GtkMozEmbed *embed)) ++GTKMOZEMBED_API(void, gtk_moz_embed_go_back, (GtkMozEmbed *embed)) ++GTKMOZEMBED_API(void, gtk_moz_embed_go_forward, (GtkMozEmbed *embed)) ++GTKMOZEMBED_API(void, gtk_moz_embed_render_data, (GtkMozEmbed *embed, ++ const char *data, ++ guint32 len, ++ const char *base_uri, ++ const char *mime_type)) ++GTKMOZEMBED_API(void, gtk_moz_embed_open_stream, (GtkMozEmbed *embed, ++ const char *base_uri, ++ const char *mime_type)) ++GTKMOZEMBED_API(void, gtk_moz_embed_append_data, (GtkMozEmbed *embed, ++ const char *data, ++ guint32 len)) ++GTKMOZEMBED_API(void, gtk_moz_embed_close_stream, (GtkMozEmbed *embed)) ++GTKMOZEMBED_API(char*, gtk_moz_embed_get_link_message, (GtkMozEmbed *embed)) ++GTKMOZEMBED_API(char*, gtk_moz_embed_get_js_status, (GtkMozEmbed *embed)) ++GTKMOZEMBED_API(char*, gtk_moz_embed_get_title, (GtkMozEmbed *embed)) ++GTKMOZEMBED_API(char*, gtk_moz_embed_get_location, (GtkMozEmbed *embed)) ++GTKMOZEMBED_API(void, gtk_moz_embed_reload, (GtkMozEmbed *embed, ++ gint32 flags)) ++GTKMOZEMBED_API(void, gtk_moz_embed_set_chrome_mask, (GtkMozEmbed *embed, ++ guint32 flags)) ++GTKMOZEMBED_API(guint32, gtk_moz_embed_get_chrome_mask, (GtkMozEmbed *embed)) ++ ++/* These are straight out of nsIWebProgressListener.h */ ++ ++typedef enum ++{ ++ GTK_MOZ_EMBED_FLAG_START = 1, ++ GTK_MOZ_EMBED_FLAG_REDIRECTING = 2, ++ GTK_MOZ_EMBED_FLAG_TRANSFERRING = 4, ++ GTK_MOZ_EMBED_FLAG_NEGOTIATING = 8, ++ GTK_MOZ_EMBED_FLAG_STOP = 16, ++ ++ GTK_MOZ_EMBED_FLAG_IS_REQUEST = 65536, ++ GTK_MOZ_EMBED_FLAG_IS_DOCUMENT = 131072, ++ GTK_MOZ_EMBED_FLAG_IS_NETWORK = 262144, ++ GTK_MOZ_EMBED_FLAG_IS_WINDOW = 524288, ++ ++ GTK_MOZ_EMBED_FLAG_RESTORING = 16777216 ++} GtkMozEmbedProgressFlags; ++ ++/* These are from various networking headers */ ++ ++typedef enum ++{ ++ /* NS_ERROR_UNKNOWN_HOST */ ++ GTK_MOZ_EMBED_STATUS_FAILED_DNS = 2152398878U, ++ /* NS_ERROR_CONNECTION_REFUSED */ ++ GTK_MOZ_EMBED_STATUS_FAILED_CONNECT = 2152398861U, ++ /* NS_ERROR_NET_TIMEOUT */ ++ GTK_MOZ_EMBED_STATUS_FAILED_TIMEOUT = 2152398862U, ++ /* NS_BINDING_ABORTED */ ++ GTK_MOZ_EMBED_STATUS_FAILED_USERCANCELED = 2152398850U ++} GtkMozEmbedStatusFlags; ++ ++/* These used to be straight out of nsIWebNavigation.h until the API ++ changed. Now there's a mapping table that maps these values to the ++ internal values. */ ++ ++typedef enum ++{ ++ GTK_MOZ_EMBED_FLAG_RELOADNORMAL = 0, ++ GTK_MOZ_EMBED_FLAG_RELOADBYPASSCACHE = 1, ++ GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXY = 2, ++ GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXYANDCACHE = 3, ++ GTK_MOZ_EMBED_FLAG_RELOADCHARSETCHANGE = 4 ++} GtkMozEmbedReloadFlags; ++ ++/* These are straight out of nsIWebBrowserChrome.h */ ++ ++typedef enum ++{ ++ GTK_MOZ_EMBED_FLAG_DEFAULTCHROME = 1U, ++ GTK_MOZ_EMBED_FLAG_WINDOWBORDERSON = 2U, ++ GTK_MOZ_EMBED_FLAG_WINDOWCLOSEON = 4U, ++ GTK_MOZ_EMBED_FLAG_WINDOWRESIZEON = 8U, ++ GTK_MOZ_EMBED_FLAG_MENUBARON = 16U, ++ GTK_MOZ_EMBED_FLAG_TOOLBARON = 32U, ++ GTK_MOZ_EMBED_FLAG_LOCATIONBARON = 64U, ++ GTK_MOZ_EMBED_FLAG_STATUSBARON = 128U, ++ GTK_MOZ_EMBED_FLAG_PERSONALTOOLBARON = 256U, ++ GTK_MOZ_EMBED_FLAG_SCROLLBARSON = 512U, ++ GTK_MOZ_EMBED_FLAG_TITLEBARON = 1024U, ++ GTK_MOZ_EMBED_FLAG_EXTRACHROMEON = 2048U, ++ GTK_MOZ_EMBED_FLAG_ALLCHROME = 4094U, ++ GTK_MOZ_EMBED_FLAG_WINDOWRAISED = 33554432U, ++ GTK_MOZ_EMBED_FLAG_WINDOWLOWERED = 67108864U, ++ GTK_MOZ_EMBED_FLAG_CENTERSCREEN = 134217728U, ++ GTK_MOZ_EMBED_FLAG_DEPENDENT = 268435456U, ++ GTK_MOZ_EMBED_FLAG_MODAL = 536870912U, ++ GTK_MOZ_EMBED_FLAG_OPENASDIALOG = 1073741824U, ++ GTK_MOZ_EMBED_FLAG_OPENASCHROME = 2147483648U ++} GtkMozEmbedChromeFlags; ++ ++/* this is a singleton object that you can hook up to to get signals ++ that are not handed out on a per widget basis. */ ++ ++#define GTK_TYPE_MOZ_EMBED_SINGLE (gtk_moz_embed_single_get_type()) ++#define GTK_MOZ_EMBED_SINGLE(obj) GTK_CHECK_CAST((obj), GTK_TYPE_MOZ_EMBED_SINGLE, GtkMozEmbedSingle) ++#define GTK_MOZ_EMBED_SINGLE_CLASS(klass) GTK_CHEK_CLASS_CAST((klass), GTK_TYPE_MOZ_EMBED_SINGLE, GtkMozEmbedSingleClass) ++#define GTK_IS_MOZ_EMBED_SINGLE(obj) GTK_CHECK_TYPE((obj), GTK_TYPE_MOZ_EMBED_SINGLE) ++#define GTK_IS_MOZ_EMBED_SINGLE_CLASS(klass) GTK_CHECK_CLASS_TYPE((klass), GTK_TYPE_MOZ_EMBED) ++#define GTK_MOZ_EMBED_SINGLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MOZ_EMBED_SINGLE, GtkMozEmbedSingleClass)) ++ ++typedef struct _GtkMozEmbedSingle GtkMozEmbedSingle; ++typedef struct _GtkMozEmbedSingleClass GtkMozEmbedSingleClass; ++ ++struct _GtkMozEmbedSingle ++{ ++ GtkObject object; ++ void *data; ++}; ++ ++struct _GtkMozEmbedSingleClass ++{ ++ GtkObjectClass parent_class; ++ ++ void (* new_window_orphan) (GtkMozEmbedSingle *embed, ++ GtkMozEmbed **newEmbed, ++ guint chromemask); ++}; ++ ++GTKMOZEMBED_API(GType, gtk_moz_embed_single_get_type, (void)) ++GTKMOZEMBED_API(GtkMozEmbedSingle *, gtk_moz_embed_single_get, (void)) ++ ++#ifdef __cplusplus ++} ++#endif /* __cplusplus */ ++ ++#endif /* gtkmozembed_h */ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed_internal.h.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed_internal.h +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed_internal.h.gtkmozembed 2012-01-18 16:44:32.495289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembed_internal.h 2012-01-18 16:44:32.495289973 +0100 +@@ -0,0 +1,70 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#ifndef gtkmozembed_internal_h ++#define gtkmozembed_internal_h ++ ++#include "nsIWebBrowser.h" ++#include "nsXPCOM.h" ++ ++struct nsModuleComponentInfo; ++ ++#ifdef __cplusplus ++extern "C" { ++#endif /* __cplusplus */ ++ ++GTKMOZEMBED_API(void, ++ gtk_moz_embed_get_nsIWebBrowser, (GtkMozEmbed *embed, ++ nsIWebBrowser **retval)) ++GTKMOZEMBED_API(PRUnichar*, ++ gtk_moz_embed_get_title_unichar, (GtkMozEmbed *embed)) ++ ++GTKMOZEMBED_API(PRUnichar*, ++ gtk_moz_embed_get_js_status_unichar, (GtkMozEmbed *embed)) ++ ++GTKMOZEMBED_API(PRUnichar*, ++ gtk_moz_embed_get_link_message_unichar, (GtkMozEmbed *embed)) ++ ++GTKMOZEMBED_API(void, ++ gtk_moz_embed_set_directory_service_provider, (nsIDirectoryServiceProvider *appFileLocProvider)) ++ ++#ifdef __cplusplus ++} ++#endif /* __cplusplus */ ++ ++#endif /* gtkmozembed_internal_h */ ++ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembedmarshal.list.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembedmarshal.list +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembedmarshal.list.gtkmozembed 2012-01-18 16:44:32.496289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembedmarshal.list 2012-01-18 16:44:32.496289973 +0100 +@@ -0,0 +1,34 @@ ++BOOL:STRING ++BOOL:STRING,STRING ++BOOL:STRING,STRING,POINTER ++BOOL:STRING,STRING,POINTER,INT ++BOOL:STRING,STRING,POINTER,POINTER,STRING,POINTER ++BOOL:STRING,STRING,POINTER,STRING,POINTER ++BOOL:STRING,STRING,STRING,POINTER ++INT:STRING,INT,INT,INT,INT,INT ++INT:STRING,STRING,INT,INT,INT,INT ++INT:STRING,STRING,UINT,STRING,STRING,STRING,STRING,POINTER ++INT:VOID ++STRING:STRING,STRING ++VOID:BOOL ++VOID:INT,INT ++VOID:INT,INT,BOOL ++VOID:INT,STRING ++VOID:INT,STRING,STRING ++VOID:INT,UINT ++VOID:POINTER,INT,POINTER ++VOID:POINTER,INT,STRING,STRING,STRING,STRING,STRING,BOOLEAN,INT ++VOID:POINTER,STRING,BOOL,BOOL ++VOID:STRING,INT,INT ++VOID:STRING,INT,UINT ++VOID:STRING,STRING ++VOID:STRING,STRING,POINTER ++VOID:STRING,STRING,STRING,ULONG,INT ++VOID:STRING,STRING,STRING,POINTER ++VOID:UINT,INT,INT,STRING,STRING,STRING,STRING ++VOID:ULONG,ULONG,ULONG ++VOID:POINTER,UINT ++BOOL:POINTER,UINT ++BOOL:POINTER ++VOID:POINTER ++BOOL:STRING,STRING,POINTER +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembedprivate.h.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembedprivate.h +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembedprivate.h.gtkmozembed 2012-01-18 16:44:32.498289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/gtkmozembedprivate.h 2012-01-18 16:44:32.498289973 +0100 +@@ -0,0 +1,91 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#ifndef gtkmozembedprivate_h ++#define gtkmozembedprivate_h ++ ++#ifdef __cplusplus ++extern "C" { ++#endif /* __cplusplus */ ++ ++#include "gtkmozembed.h" ++ ++/* signals */ ++ ++enum { ++ LINK_MESSAGE, ++ JS_STATUS, ++ LOCATION, ++ TITLE, ++ PROGRESS, ++ PROGRESS_ALL, ++ NET_STATE, ++ NET_STATE_ALL, ++ NET_START, ++ NET_STOP, ++ NEW_WINDOW, ++ VISIBILITY, ++ DESTROY_BROWSER, ++ OPEN_URI, ++ SIZE_TO, ++ DOM_KEY_DOWN, ++ DOM_KEY_PRESS, ++ DOM_KEY_UP, ++ DOM_MOUSE_DOWN, ++ DOM_MOUSE_UP, ++ DOM_MOUSE_CLICK, ++ DOM_MOUSE_DBL_CLICK, ++ DOM_MOUSE_OVER, ++ DOM_MOUSE_OUT, ++ SECURITY_CHANGE, ++ STATUS_CHANGE, ++ DOM_ACTIVATE, ++ DOM_FOCUS_IN, ++ DOM_FOCUS_OUT, ++ EMBED_LAST_SIGNAL ++}; ++ ++extern guint moz_embed_signals[EMBED_LAST_SIGNAL]; ++ ++extern void gtk_moz_embed_single_create_window(GtkMozEmbed **aNewEmbed, ++ guint aChromeFlags); ++ ++#ifdef __cplusplus ++} ++#endif /* __cplusplus */ ++ ++#endif /* gtkmozembedprivate_h */ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/GtkPromptService.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/GtkPromptService.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/GtkPromptService.cpp.gtkmozembed 2012-01-18 16:44:32.499289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/GtkPromptService.cpp 2012-01-19 10:43:20.021504018 +0100 +@@ -0,0 +1,349 @@ ++/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ ++/* vim:expandtab:shiftwidth=4:tabstop=4: */ ++/* ***** BEGIN LICENSE BLOCK ***** ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla Public License Version ++ * 1.1 (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * http://www.mozilla.org/MPL/ ++ * ++ * Software distributed under the License is distributed on an "AS IS" basis, ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++ * for the specific language governing rights and limitations under the ++ * License. ++ * ++ * The Original Code is mozilla.org code. ++ * ++ * The Initial Developer of the Original Code is ++ * Netscape Communications Corporation. ++ * Portions created by the Initial Developer are Copyright (C) 2003 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Brian Ryner ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "GtkPromptService.h" ++#include "EmbedPrompter.h" ++#include "nsStringGlue.h" ++#include "nsIWindowWatcher.h" ++#include "nsIWebBrowserChrome.h" ++#include "nsIEmbeddingSiteWindow.h" ++#include "nsCOMPtr.h" ++#include "nsIServiceManager.h" ++#include "nsServiceManagerUtils.h" ++ ++GtkPromptService::GtkPromptService() ++{ ++} ++ ++GtkPromptService::~GtkPromptService() ++{ ++} ++ ++NS_IMPL_ISUPPORTS1(GtkPromptService, nsIPromptService) ++ ++NS_IMETHODIMP ++GtkPromptService::Alert(nsIDOMWindow* aParent, const PRUnichar* aDialogTitle, ++ const PRUnichar* aDialogText) ++{ ++ EmbedPrompter prompter; ++ prompter.SetTitle(aDialogTitle ? aDialogTitle : NS_LITERAL_STRING("Alert").get()); ++ prompter.SetMessageText(aDialogText); ++ prompter.Create(EmbedPrompter::TYPE_ALERT, ++ GetGtkWindowForDOMWindow(aParent)); ++ prompter.Run(); ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++GtkPromptService::AlertCheck(nsIDOMWindow* aParent, ++ const PRUnichar* aDialogTitle, ++ const PRUnichar* aDialogText, ++ const PRUnichar* aCheckMsg, bool* aCheckValue) ++{ ++ NS_ENSURE_ARG_POINTER(aCheckValue); ++ ++ EmbedPrompter prompter; ++ prompter.SetTitle(aDialogTitle ? aDialogTitle : NS_LITERAL_STRING("Alert").get()); ++ prompter.SetMessageText(aDialogText); ++ prompter.SetCheckMessage(aCheckMsg); ++ prompter.SetCheckValue(*aCheckValue); ++ prompter.Create(EmbedPrompter::TYPE_ALERT_CHECK, ++ GetGtkWindowForDOMWindow(aParent)); ++ prompter.Run(); ++ prompter.GetCheckValue(aCheckValue); ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++GtkPromptService::Confirm(nsIDOMWindow* aParent, ++ const PRUnichar* aDialogTitle, ++ const PRUnichar* aDialogText, bool* aConfirm) ++{ ++ EmbedPrompter prompter; ++ prompter.SetTitle(aDialogTitle ? aDialogTitle : NS_LITERAL_STRING("Confirm").get()); ++ prompter.SetMessageText(aDialogText); ++ prompter.Create(EmbedPrompter::TYPE_CONFIRM, ++ GetGtkWindowForDOMWindow(aParent)); ++ prompter.Run(); ++ prompter.GetConfirmValue(aConfirm); ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++GtkPromptService::ConfirmCheck(nsIDOMWindow* aParent, ++ const PRUnichar* aDialogTitle, ++ const PRUnichar* aDialogText, ++ const PRUnichar* aCheckMsg, ++ bool* aCheckValue, bool* aConfirm) ++{ ++ NS_ENSURE_ARG_POINTER(aCheckValue); ++ ++ EmbedPrompter prompter; ++ prompter.SetTitle(aDialogTitle ? aDialogTitle : NS_LITERAL_STRING("Confirm").get()); ++ prompter.SetMessageText(aDialogText); ++ prompter.SetCheckMessage(aCheckMsg); ++ prompter.SetCheckValue(*aCheckValue); ++ prompter.Create(EmbedPrompter::TYPE_CONFIRM_CHECK, ++ GetGtkWindowForDOMWindow(aParent)); ++ prompter.Run(); ++ prompter.GetCheckValue(aCheckValue); ++ prompter.GetConfirmValue(aConfirm); ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++GtkPromptService::ConfirmEx(nsIDOMWindow* aParent, ++ const PRUnichar* aDialogTitle, ++ const PRUnichar* aDialogText, ++ PRUint32 aButtonFlags, ++ const PRUnichar* aButton0Title, ++ const PRUnichar* aButton1Title, ++ const PRUnichar* aButton2Title, ++ const PRUnichar* aCheckMsg, bool* aCheckValue, ++ PRInt32* aRetVal) ++{ ++ EmbedPrompter prompter; ++ prompter.SetTitle(aDialogTitle ? aDialogTitle : NS_LITERAL_STRING("Confirm").get()); ++ prompter.SetMessageText(aDialogText); ++ ++ nsAutoString button0Label, button1Label, button2Label; ++ GetButtonLabel(aButtonFlags, BUTTON_POS_0, aButton0Title, button0Label); ++ GetButtonLabel(aButtonFlags, BUTTON_POS_1, aButton1Title, button1Label); ++ GetButtonLabel(aButtonFlags, BUTTON_POS_2, aButton2Title, button2Label); ++ prompter.SetButtons(button0Label.get(), button1Label.get(), ++ button2Label.get()); ++ ++ if (aCheckMsg) ++ prompter.SetCheckMessage(aCheckMsg); ++ if (aCheckValue) ++ prompter.SetCheckValue(*aCheckValue); ++ ++ prompter.Create(EmbedPrompter::TYPE_UNIVERSAL, ++ GetGtkWindowForDOMWindow(aParent)); ++ prompter.Run(); ++ ++ if (aCheckValue) ++ prompter.GetCheckValue(aCheckValue); ++ ++ prompter.GetButtonPressed(aRetVal); ++ ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++GtkPromptService::Prompt(nsIDOMWindow* aParent, const PRUnichar* aDialogTitle, ++ const PRUnichar* aDialogText, PRUnichar** aValue, ++ const PRUnichar* aCheckMsg, bool* aCheckValue, ++ bool* aConfirm) ++{ ++ EmbedPrompter prompter; ++ prompter.SetTitle(aDialogTitle ? aDialogTitle : NS_LITERAL_STRING("Prompt").get()); ++ prompter.SetMessageText(aDialogText); ++ prompter.SetTextValue(*aValue); ++ if (aCheckMsg) ++ prompter.SetCheckMessage(aCheckMsg); ++ if (aCheckValue) ++ prompter.SetCheckValue(*aCheckValue); ++ ++ prompter.Create(EmbedPrompter::TYPE_PROMPT, ++ GetGtkWindowForDOMWindow(aParent)); ++ prompter.Run(); ++ if (aCheckValue) ++ prompter.GetCheckValue(aCheckValue); ++ prompter.GetConfirmValue(aConfirm); ++ if (*aConfirm) { ++ if (*aValue) ++ NS_Free(*aValue); ++ prompter.GetTextValue(aValue); ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++GtkPromptService::PromptUsernameAndPassword(nsIDOMWindow* aParent, ++ const PRUnichar* aDialogTitle, ++ const PRUnichar* aDialogText, ++ PRUnichar** aUsername, ++ PRUnichar** aPassword, ++ const PRUnichar* aCheckMsg, ++ bool* aCheckValue, ++ bool* aConfirm) ++{ ++ EmbedPrompter prompter; ++ prompter.SetTitle(aDialogTitle ? aDialogTitle : NS_LITERAL_STRING("Prompt").get()); ++ prompter.SetMessageText(aDialogText); ++ prompter.SetUser(*aUsername); ++ prompter.SetPassword(*aPassword); ++ if (aCheckMsg) ++ prompter.SetCheckMessage(aCheckMsg); ++ if (aCheckValue) ++ prompter.SetCheckValue(*aCheckValue); ++ ++ prompter.Create(EmbedPrompter::TYPE_PROMPT_USER_PASS, ++ GetGtkWindowForDOMWindow(aParent)); ++ prompter.Run(); ++ if (aCheckValue) ++ prompter.GetCheckValue(aCheckValue); ++ prompter.GetConfirmValue(aConfirm); ++ if (*aConfirm) { ++ if (*aUsername) ++ NS_Free(*aUsername); ++ prompter.GetUser(aUsername); ++ ++ if (*aPassword) ++ NS_Free(*aPassword); ++ prompter.GetPassword(aPassword); ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++GtkPromptService::PromptPassword(nsIDOMWindow* aParent, ++ const PRUnichar* aDialogTitle, ++ const PRUnichar* aDialogText, ++ PRUnichar** aPassword, ++ const PRUnichar* aCheckMsg, ++ bool* aCheckValue, bool* aConfirm) ++{ ++ EmbedPrompter prompter; ++ prompter.SetTitle(aDialogTitle ? aDialogTitle : NS_LITERAL_STRING("Prompt").get()); ++ prompter.SetMessageText(aDialogText); ++ prompter.SetPassword(*aPassword); ++ if (aCheckMsg) ++ prompter.SetCheckMessage(aCheckMsg); ++ if (aCheckValue) ++ prompter.SetCheckValue(*aCheckValue); ++ ++ prompter.Create(EmbedPrompter::TYPE_PROMPT_PASS, ++ GetGtkWindowForDOMWindow(aParent)); ++ prompter.Run(); ++ if (aCheckValue) ++ prompter.GetCheckValue(aCheckValue); ++ prompter.GetConfirmValue(aConfirm); ++ if (*aConfirm) { ++ if (*aPassword) ++ NS_Free(*aPassword); ++ prompter.GetPassword(aPassword); ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP ++GtkPromptService::Select(nsIDOMWindow* aParent, const PRUnichar* aDialogTitle, ++ const PRUnichar* aDialogText, PRUint32 aCount, ++ const PRUnichar** aSelectList, PRInt32* outSelection, ++ bool* aConfirm) ++{ ++ EmbedPrompter prompter; ++ prompter.SetTitle(aDialogTitle ? aDialogTitle : NS_LITERAL_STRING("Select").get()); ++ prompter.SetMessageText(aDialogText); ++ prompter.SetItems(aSelectList, aCount); ++ prompter.Create(EmbedPrompter::TYPE_SELECT, ++ GetGtkWindowForDOMWindow(aParent)); ++ prompter.Run(); ++ prompter.GetSelectedItem(outSelection); ++ prompter.GetConfirmValue(aConfirm); ++ return NS_OK; ++} ++ ++GtkWindow* ++GtkPromptService::GetGtkWindowForDOMWindow(nsIDOMWindow* aDOMWindow) ++{ ++ nsCOMPtr wwatch = do_GetService("@mozilla.org/embedcomp/window-watcher;1"); ++ ++ if (!aDOMWindow) ++ return NULL; ++ ++ nsCOMPtr chrome; ++ wwatch->GetChromeForWindow(aDOMWindow, getter_AddRefs(chrome)); ++ nsCOMPtr siteWindow = do_QueryInterface(chrome); ++ ++ if (!siteWindow) ++ return NULL; ++ ++ GtkWidget* parentWidget; ++ siteWindow->GetSiteWindow((void**)&parentWidget); ++ ++ if (!parentWidget) ++ return NULL; ++ ++ GtkWidget* gtkWin = gtk_widget_get_toplevel(parentWidget); ++ if (GTK_WIDGET_TOPLEVEL(gtkWin)) ++ return GTK_WINDOW(gtkWin); ++ ++ return NULL; ++} ++ ++void ++GtkPromptService::GetButtonLabel(PRUint32 aFlags, PRUint32 aPos, ++ const PRUnichar* aStringValue, ++ nsAString& aLabel) ++{ ++ PRUint32 posFlag = (aFlags & (255 * aPos)) / aPos; ++ switch (posFlag) { ++ case 0: ++ break; ++ case BUTTON_TITLE_OK: ++ aLabel.AssignLiteral(GTK_STOCK_OK); ++ break; ++ case BUTTON_TITLE_CANCEL: ++ aLabel.AssignLiteral(GTK_STOCK_CANCEL); ++ break; ++ case BUTTON_TITLE_YES: ++ aLabel.AssignLiteral(GTK_STOCK_YES); ++ break; ++ case BUTTON_TITLE_NO: ++ aLabel.AssignLiteral(GTK_STOCK_NO); ++ break; ++ case BUTTON_TITLE_SAVE: ++ aLabel.AssignLiteral(GTK_STOCK_SAVE); ++ break; ++ case BUTTON_TITLE_DONT_SAVE: ++ aLabel.AssignLiteral("Don't Save"); ++ break; ++ case BUTTON_TITLE_REVERT: ++ aLabel.AssignLiteral("Revert"); ++ break; ++ case BUTTON_TITLE_IS_STRING: ++ aLabel = aStringValue; ++ break; ++ default: ++ NS_WARNING("Unexpected button flags"); ++ } ++} +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/GtkPromptService.h.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/GtkPromptService.h +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/GtkPromptService.h.gtkmozembed 2012-01-18 16:44:32.500289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/GtkPromptService.h 2012-01-18 16:44:32.500289973 +0100 +@@ -0,0 +1,59 @@ ++/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ ++/* vim:expandtab:shiftwidth=4:tabstop=4: */ ++/* ***** BEGIN LICENSE BLOCK ***** ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla Public License Version ++ * 1.1 (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * http://www.mozilla.org/MPL/ ++ * ++ * Software distributed under the License is distributed on an "AS IS" basis, ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++ * for the specific language governing rights and limitations under the ++ * License. ++ * ++ * The Original Code is mozilla.org code. ++ * ++ * The Initial Developer of the Original Code is ++ * Netscape Communications Corporation. ++ * Portions created by the Initial Developer are Copyright (C) 2003 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Brian Ryner ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "nsIPromptService.h" ++#include "nsStringGlue.h" ++#include ++ ++class nsIDOMWindow; ++ ++class GtkPromptService : public nsIPromptService ++{ ++public: ++ GtkPromptService(); ++ virtual ~GtkPromptService(); ++ ++ NS_DECL_ISUPPORTS ++ NS_DECL_NSIPROMPTSERVICE ++ ++private: ++ GtkWindow* GetGtkWindowForDOMWindow(nsIDOMWindow* aDOMWindow); ++ void GetButtonLabel(PRUint32 aFlags, PRUint32 aPos, ++ const PRUnichar* aStringValue, nsAString &aLabel); ++}; +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/Makefile.in.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/Makefile.in +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/Makefile.in.gtkmozembed 2012-01-18 16:44:32.501289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/src/Makefile.in 2012-01-18 16:44:32.501289973 +0100 +@@ -0,0 +1,112 @@ ++# ++# ***** 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 Mozilla browser. ++# ++# The Initial Developer of the Original Code is ++# Christopher Blizzard. ++# Portions created by the Initial Developer are Copyright (C) 1999 ++# the Initial Developer. All Rights Reserved. ++# ++# Contributor(s): ++# Christopher Blizzard ++# ++# 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 ***** ++ ++DEPTH = ../../../.. ++topsrcdir = @top_srcdir@ ++srcdir = @srcdir@ ++VPATH = @srcdir@ ++ ++include $(DEPTH)/config/autoconf.mk ++ ++MODULE = gtkembedmoz ++LIBRARY_NAME = gtkembedmoz ++LIBXUL_LIBRARY = 1 ++FORCE_STATIC_LIB = 1 ++DEFINES += -DIMPL_XREAPI ++ ++ ++ ++CPPSRCS = \ ++ gtkmozembed2.cpp \ ++ EmbedPrivate.cpp \ ++ EmbedWindow.cpp \ ++ EmbedProgress.cpp \ ++ EmbedContentListener.cpp \ ++ EmbedEventListener.cpp \ ++ EmbedWindowCreator.cpp \ ++ $(NULL) ++ ++ifdef MOZ_ENABLE_GTK2 ++CSRCS = \ ++ gtkmozembedmarshal.c ++CPPSRCS += \ ++ EmbedPrompter.cpp \ ++ GtkPromptService.cpp ++endif ++ ++LOCAL_INCLUDES += \ ++ -I. \ ++ $(NULL) ++ ++include $(topsrcdir)/config/config.mk ++ ++EXPORTS = \ ++ gtkmozembed.h \ ++ gtkmozembed_glue.cpp \ ++ gtkmozembed_internal.h ++ ++include $(topsrcdir)/config/rules.mk ++ ++ifeq ($(OS_ARCH), SunOS) ++ifndef GNU_CC ++# When using Sun's WorkShop compiler, including ++# /wherever/workshop-5.0/SC5.0/include/CC/std/time.h ++# causes most of these compiles to fail with: ++# line 29: Error: Multiple declaration for std::tm. ++# So, this gets around the problem. ++DEFINES += -D_TIME_H=1 ++endif ++endif ++ ++CXXFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS) ++CFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS) ++DEFINES += -D_IMPL_GTKMOZEMBED ++ ++MARSHAL_FILE = gtkmozembedmarshal ++MARSHAL_PREFIX = gtkmozembed ++ ++$(MARSHAL_FILE).h: $(MARSHAL_FILE).list ++ glib-genmarshal --prefix=$(MARSHAL_PREFIX) $(srcdir)/$(MARSHAL_FILE).list --skip-source --header > $@ ++ ++$(MARSHAL_FILE).c: $(MARSHAL_FILE).list $(MARSHAL_FILE).h ++ glib-genmarshal --prefix=$(MARSHAL_PREFIX) $(srcdir)/$(MARSHAL_FILE).list --skip-source --body > $@ ++ ++gtkmozembed2.$(OBJ_SUFFIX): $(MARSHAL_FILE).h ++ ++GARBAGE += $(MARSHAL_FILE).h $(MARSHAL_FILE).c ++ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/Makefile.in.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/Makefile.in +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/Makefile.in.gtkmozembed 2012-01-18 16:44:32.502289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/Makefile.in 2012-01-18 16:44:32.502289973 +0100 +@@ -0,0 +1,101 @@ ++# ++# ***** 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 Mozilla browser. ++# ++# The Initial Developer of the Original Code is ++# Christopher Blizzard. ++# Portions created by the Initial Developer are Copyright (C) 1999 ++# the Initial Developer. All Rights Reserved. ++# ++# Contributor(s): ++# Christopher Blizzard ++# ++# 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 ***** ++ ++DEPTH = ../../../.. ++topsrcdir = @top_srcdir@ ++srcdir = @srcdir@ ++VPATH = @srcdir@ ++ ++include $(DEPTH)/config/autoconf.mk ++ ++MODULE = gtkembedmoz ++ ++CPPSRCS = \ ++ TestGtkEmbed.cpp \ ++ TestGtkEmbedNotebook.cpp ++ ++ifdef MOZ_X11 ++CPPSRCS += TestGtkEmbedSocket.cpp \ ++ TestGtkEmbedChild.cpp ++endif ++ ++SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=) ++ ++# ENABLE_GNOME=1 ++ ++ifdef ENABLE_GNOME ++CPPSRCS += TestGtkEmbedMDI.cpp ++endif ++ ++ifdef MOZ_ENABLE_GTK2 ++LIBS += \ ++ $(XLDFLAGS) \ ++ $(XLIBS) \ ++ $(NULL) ++endif ++ ++include $(topsrcdir)/config/config.mk ++ ++include $(topsrcdir)/config/rules.mk ++ ++LIBS += $(XPCOM_STANDALONE_GLUE_LDOPTS) ++ ++DEFINES += -DXPCOM_GLUE ++STL_FLAGS = ++ ++CXXFLAGS += $(MOZ_GTK2_CFLAGS) ++ ++ifdef ENABLE_GNOME ++CXXFLAGS += `gnome-config --cflags gnomeui` ++EXTRA_LIBS += `gnome-config --libs gnomeui` ++endif ++ ++EXTRA_LIBS += \ ++ $(TK_LIBS) \ ++ $(NULL) ++ ++ifeq ($(OS_ARCH), SunOS) ++ifndef GNU_CC ++# When using Sun's WorkShop compiler, including ++# /wherever/workshop-5.0/SC5.0/include/CC/std/time.h ++# causes most of these compiles to fail with: ++# line 29: Error: Multiple declaration for std::tm. ++# So, this gets around the problem. ++DEFINES += -D_TIME_H=1 ++endif ++endif +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedChild.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedChild.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedChild.cpp.gtkmozembed 2012-01-18 16:44:32.504289973 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedChild.cpp 2012-01-18 16:44:32.716289979 +0100 +@@ -0,0 +1,185 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "gtkmozembed.h" ++#include ++#include ++#include ++#include ++ ++#include "nsStringAPI.h" ++#include "gtkmozembed_glue.cpp" ++ ++int (*old_handler) (Display *, XErrorEvent *); ++ ++int error_handler (Display *d, XErrorEvent *e) ++{ ++ if ((e->error_code == BadWindow) || (e->error_code == BadDrawable)) ++ { ++ XID resourceid = e->resourceid; ++ GdkWindow *window = gdk_window_lookup (resourceid); ++ ++ if (window) ++ { ++ if (!g_dataset_get_data (window, "bonobo-error")) ++ { ++ g_dataset_set_data_full (window, "bonobo-error", ++ g_new (gint, 1), ++ (GDestroyNotify)g_free); ++ ++ g_warning ("Error accessing window %ld", resourceid); ++ } ++ } ++ return 0; ++ } ++ else ++ { ++ return (*old_handler)(d, e); ++ } ++} ++ ++void ++load_page(gpointer data); ++ ++GtkWidget *embed = 0; ++GtkWidget *entry = 0; ++ ++int ++main(int argc, char **argv) ++{ ++ guint32 xid; ++ ++ GtkWidget *window; ++ GtkWidget *hbox; ++ GtkWidget *vbox; ++ GtkWidget *button; ++ ++ gtk_init(&argc, &argv); ++ ++ static const GREVersionRange greVersion = { ++ "1.9a", PR_TRUE, ++ "2", PR_TRUE ++ }; ++ ++ char xpcomPath[PATH_MAX]; ++ ++ nsresult rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, ++ xpcomPath, sizeof(xpcomPath)); ++ if (NS_FAILED(rv)) { ++ fprintf(stderr, "Couldn't find a compatible GRE.\n"); ++ return 1; ++ } ++ ++ rv = XPCOMGlueStartup(xpcomPath); ++ if (NS_FAILED(rv)) { ++ fprintf(stderr, "Couldn't start XPCOM."); ++ return 1; ++ } ++ ++ rv = GTKEmbedGlueStartup(); ++ if (NS_FAILED(rv)) { ++ fprintf(stderr, "Couldn't find GTKMozEmbed symbols."); ++ return 1; ++ } ++ ++ char *lastSlash = strrchr(xpcomPath, '/'); ++ if (lastSlash) ++ *lastSlash = '\0'; ++ ++ gtk_moz_embed_set_path(xpcomPath); ++ ++ old_handler = XSetErrorHandler (error_handler); ++ ++ if (argc < 2) { ++ fprintf(stderr, "Usage: TestGtkEmbedChild WINDOW_ID\n"); ++ exit(1); ++ } ++ ++ xid = strtol (argv[1], (char **)NULL, 0); ++ ++ if (xid == 0) { ++ fprintf(stderr, "Invalid window id '%s'\n", argv[1]); ++ exit(1); ++ } ++ ++ window = gtk_plug_new(xid); ++ ++ g_signal_connect(GTK_OBJECT(window), "destroy", ++ G_CALLBACK(gtk_main_quit), NULL); ++ ++ gtk_container_set_border_width(GTK_CONTAINER(window), 0); ++ ++ vbox = gtk_vbox_new (FALSE, 0); ++ gtk_container_add(GTK_CONTAINER(window), vbox); ++ gtk_widget_show(vbox); ++ ++ hbox = gtk_hbox_new (FALSE, 0); ++ gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); ++ gtk_widget_show (hbox); ++ ++ entry = gtk_entry_new (); ++ gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); ++ gtk_widget_show (entry); ++ ++ button = gtk_button_new_with_label("Load"); ++ gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); ++ gtk_widget_show(button); ++ ++ g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(load_page), NULL); ++ ++ embed = gtk_moz_embed_new(); ++ gtk_box_pack_start(GTK_BOX(vbox), embed, TRUE, TRUE, 0); ++ gtk_widget_set_size_request(embed, 200, 200); ++ gtk_widget_show(embed); ++ ++ gtk_widget_show(window); ++ ++ gtk_main(); ++ ++ fprintf(stderr, "exiting.\n"); ++ ++ return 0; ++} ++ ++void ++load_page(gpointer data) ++{ ++ gchar *text = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); ++ g_print("load url %s\n", text); ++ gtk_moz_embed_load_url(GTK_MOZ_EMBED(embed), text); ++ g_free(text); ++} +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbed.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbed.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbed.cpp.gtkmozembed 2012-01-18 16:44:32.719289978 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbed.cpp 2012-01-18 16:44:32.719289978 +0100 +@@ -0,0 +1,1145 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "gtkmozembed.h" ++#include ++#include ++#include ++#include ++ ++// mozilla specific headers ++#include "nsIDOMKeyEvent.h" ++#include "nsIDOMMouseEvent.h" ++#include "nsIDOMUIEvent.h" ++ ++#include "nsCOMPtr.h" ++#include "nsISupportsUtils.h" ++#include "nsServiceManagerUtils.h" ++#include "nsIObserverService.h" ++ ++#include "nsStringAPI.h" ++#include "gtkmozembed_glue.cpp" ++ ++typedef struct _TestGtkBrowser { ++ GtkWidget *topLevelWindow; ++ GtkWidget *topLevelVBox; ++ GtkWidget *menuBar; ++ GtkWidget *fileMenuItem; ++ GtkWidget *fileMenu; ++ GtkWidget *fileOpenNewBrowser; ++ GtkWidget *fileStream; ++ GtkWidget *fileMemory; ++ GtkWidget *fileClose; ++ GtkWidget *fileQuit; ++ GtkWidget *toolbarHBox; ++ GtkWidget *toolbar; ++ GtkWidget *backButton; ++ GtkWidget *stopButton; ++ GtkWidget *forwardButton; ++ GtkWidget *reloadButton; ++ GtkWidget *urlEntry; ++ GtkWidget *mozEmbed; ++ GtkWidget *progressAreaHBox; ++ GtkWidget *progressBar; ++ GtkWidget *statusAlign; ++ GtkWidget *statusBar; ++ const char *statusMessage; ++ int loadPercent; ++ int bytesLoaded; ++ int maxBytesLoaded; ++ char *tempMessage; ++ gboolean menuBarOn; ++ gboolean toolBarOn; ++ gboolean locationBarOn; ++ gboolean statusBarOn; ++ ++} TestGtkBrowser; ++ ++// the list of browser windows currently open ++GList *browser_list = g_list_alloc(); ++ ++static TestGtkBrowser *new_gtk_browser (guint32 chromeMask); ++static void set_browser_visibility (TestGtkBrowser *browser, ++ gboolean visibility); ++ ++static int num_browsers = 0; ++ ++// callbacks from the UI ++static void back_clicked_cb (GtkButton *button, ++ TestGtkBrowser *browser); ++static void stop_clicked_cb (GtkButton *button, ++ TestGtkBrowser *browser); ++static void forward_clicked_cb (GtkButton *button, ++ TestGtkBrowser *browser); ++static void reload_clicked_cb (GtkButton *button, ++ TestGtkBrowser *browser); ++static void url_activate_cb (GtkEditable *widget, ++ TestGtkBrowser *browser); ++static void menu_open_new_cb (GtkMenuItem *menuitem, ++ TestGtkBrowser *browser); ++static void menu_stream_cb (GtkMenuItem *menuitem, ++ TestGtkBrowser *browser); ++static void menu_memory_cb (GtkMenuItem *menuitem, ++ TestGtkBrowser *browser); ++static void menu_close_cb (GtkMenuItem *menuitem, ++ TestGtkBrowser *browser); ++static void menu_quit_cb (GtkMenuItem *menuitem, ++ TestGtkBrowser *browser); ++static gboolean delete_cb (GtkWidget *widget, GdkEventAny *event, ++ TestGtkBrowser *browser); ++static void destroy_cb (GtkWidget *widget, ++ TestGtkBrowser *browser); ++ ++// callbacks from the widget ++static void location_changed_cb (GtkMozEmbed *embed, TestGtkBrowser *browser); ++static void title_changed_cb (GtkMozEmbed *embed, TestGtkBrowser *browser); ++static void load_started_cb (GtkMozEmbed *embed, TestGtkBrowser *browser); ++static void load_finished_cb (GtkMozEmbed *embed, TestGtkBrowser *browser); ++static void net_state_change_cb (GtkMozEmbed *embed, gint flags, ++ guint status, TestGtkBrowser *browser); ++static void net_state_change_all_cb (GtkMozEmbed *embed, const char *uri, ++ gint flags, guint status, ++ TestGtkBrowser *browser); ++static void progress_change_cb (GtkMozEmbed *embed, gint cur, gint max, ++ TestGtkBrowser *browser); ++static void progress_change_all_cb (GtkMozEmbed *embed, const char *uri, ++ gint cur, gint max, ++ TestGtkBrowser *browser); ++static void link_message_cb (GtkMozEmbed *embed, TestGtkBrowser *browser); ++static void js_status_cb (GtkMozEmbed *embed, TestGtkBrowser *browser); ++static void new_window_cb (GtkMozEmbed *embed, ++ GtkMozEmbed **retval, guint chromemask, ++ TestGtkBrowser *browser); ++static void visibility_cb (GtkMozEmbed *embed, ++ gboolean visibility, ++ TestGtkBrowser *browser); ++static void destroy_brsr_cb (GtkMozEmbed *embed, TestGtkBrowser *browser); ++static gint open_uri_cb (GtkMozEmbed *embed, const char *uri, ++ TestGtkBrowser *browser); ++static void size_to_cb (GtkMozEmbed *embed, gint width, ++ gint height, TestGtkBrowser *browser); ++static gint dom_key_down_cb (GtkMozEmbed *embed, nsIDOMKeyEvent *event, ++ TestGtkBrowser *browser); ++static gint dom_key_press_cb (GtkMozEmbed *embed, nsIDOMKeyEvent *event, ++ TestGtkBrowser *browser); ++static gint dom_key_up_cb (GtkMozEmbed *embed, nsIDOMKeyEvent *event, ++ TestGtkBrowser *browser); ++static gint dom_mouse_down_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event, ++ TestGtkBrowser *browser); ++static gint dom_mouse_up_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event, ++ TestGtkBrowser *browser); ++static gint dom_mouse_click_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event, ++ TestGtkBrowser *browser); ++static gint dom_mouse_dbl_click_cb (GtkMozEmbed *embed, ++ nsIDOMMouseEvent *event, ++ TestGtkBrowser *browser); ++static gint dom_mouse_over_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event, ++ TestGtkBrowser *browser); ++static gint dom_mouse_out_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event, ++ TestGtkBrowser *browser); ++static gint dom_activate_cb (GtkMozEmbed *embed, nsIDOMUIEvent *event, ++ TestGtkBrowser *browser); ++static gint dom_focus_in_cb (GtkMozEmbed *embed, nsIDOMUIEvent *event, ++ TestGtkBrowser *browser); ++static gint dom_focus_out_cb (GtkMozEmbed *embed, nsIDOMUIEvent *event, ++ TestGtkBrowser *browser); ++ ++// callbacks from the singleton object ++static void new_window_orphan_cb (GtkMozEmbedSingle *embed, ++ GtkMozEmbed **retval, guint chromemask, ++ gpointer data); ++ ++// some utility functions ++static void update_status_bar_text (TestGtkBrowser *browser); ++static void update_temp_message (TestGtkBrowser *browser, ++ const char *message); ++static void update_nav_buttons (TestGtkBrowser *browser); ++ ++int ++main(int argc, char **argv) ++{ ++ gtk_set_locale(); ++ gtk_init(&argc, &argv); ++ ++ static const GREVersionRange greVersion = { ++ "1.9a", PR_TRUE, ++ "2", PR_TRUE ++ }; ++ ++ char xpcomPath[PATH_MAX]; ++ ++ nsresult rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, ++ xpcomPath, sizeof(xpcomPath)); ++ if (NS_FAILED(rv)) { ++ fprintf(stderr, "Couldn't find a compatible GRE.\n"); ++ return 1; ++ } ++ ++ rv = XPCOMGlueStartup(xpcomPath); ++ if (NS_FAILED(rv)) { ++ fprintf(stderr, "Couldn't start XPCOM."); ++ return 1; ++ } ++ ++ rv = GTKEmbedGlueStartup(); ++ if (NS_FAILED(rv)) { ++ fprintf(stderr, "Couldn't find GTKMozEmbed symbols."); ++ return 1; ++ } ++ ++ char *lastSlash = strrchr(xpcomPath, '/'); ++ if (lastSlash) ++ *lastSlash = '\0'; ++ ++ gtk_moz_embed_set_path(xpcomPath); ++ ++ char *home_path; ++ char *full_path; ++ home_path = getenv("HOME"); ++ if (!home_path) { ++ fprintf(stderr, "Failed to get HOME\n"); ++ exit(1); ++ } ++ ++ full_path = g_strdup_printf("%s/%s", home_path, ".TestGtkEmbed"); ++ ++ gtk_moz_embed_set_profile_path(full_path, "TestGtkEmbed"); ++ ++ TestGtkBrowser *browser = new_gtk_browser(GTK_MOZ_EMBED_FLAG_DEFAULTCHROME); ++ ++ // set our minimum size ++ gtk_widget_set_size_request(browser->mozEmbed, 400, 400); ++ ++ set_browser_visibility(browser, TRUE); ++ ++ if (argc > 1) ++ gtk_moz_embed_load_url(GTK_MOZ_EMBED(browser->mozEmbed), argv[1]); ++ ++ // get the singleton object and hook up to its new window callback ++ // so we can create orphaned windows. ++ ++ GtkMozEmbedSingle *single; ++ ++ single = gtk_moz_embed_single_get(); ++ if (!single) { ++ fprintf(stderr, "Failed to get singleton embed object!\n"); ++ exit(1); ++ } ++ ++ g_signal_connect(GTK_OBJECT(single), "new_window_orphan", ++ G_CALLBACK(new_window_orphan_cb), NULL); ++ ++ gtk_moz_embed_push_startup(); ++ gtk_main(); ++ gtk_moz_embed_pop_startup(); ++} ++ ++static TestGtkBrowser * ++new_gtk_browser(guint32 chromeMask) ++{ ++ guint32 actualChromeMask = chromeMask; ++ TestGtkBrowser *browser = 0; ++ ++ num_browsers++; ++ ++ browser = g_new0(TestGtkBrowser, 1); ++ ++ browser_list = g_list_prepend(browser_list, browser); ++ ++ browser->menuBarOn = FALSE; ++ browser->toolBarOn = FALSE; ++ browser->locationBarOn = FALSE; ++ browser->statusBarOn = FALSE; ++ ++ g_print("new_gtk_browser\n"); ++ ++ if (chromeMask == GTK_MOZ_EMBED_FLAG_DEFAULTCHROME) ++ actualChromeMask = GTK_MOZ_EMBED_FLAG_ALLCHROME; ++ ++ if (actualChromeMask & GTK_MOZ_EMBED_FLAG_MENUBARON) ++ { ++ browser->menuBarOn = TRUE; ++ g_print("\tmenu bar\n"); ++ } ++ if (actualChromeMask & GTK_MOZ_EMBED_FLAG_TOOLBARON) ++ { ++ browser->toolBarOn = TRUE; ++ g_print("\ttool bar\n"); ++ } ++ if (actualChromeMask & GTK_MOZ_EMBED_FLAG_LOCATIONBARON) ++ { ++ browser->locationBarOn = TRUE; ++ g_print("\tlocation bar\n"); ++ } ++ if (actualChromeMask & GTK_MOZ_EMBED_FLAG_STATUSBARON) ++ { ++ browser->statusBarOn = TRUE; ++ g_print("\tstatus bar\n"); ++ } ++ ++ // create our new toplevel window ++ browser->topLevelWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); ++ // new vbox ++ browser->topLevelVBox = gtk_vbox_new(FALSE, 0); ++ // add it to the toplevel window ++ gtk_container_add(GTK_CONTAINER(browser->topLevelWindow), ++ browser->topLevelVBox); ++ // create our menu bar ++ browser->menuBar = gtk_menu_bar_new(); ++ // create the file menu ++ browser->fileMenuItem = gtk_menu_item_new_with_label("File"); ++ browser->fileMenu = gtk_menu_new(); ++ gtk_menu_item_set_submenu (GTK_MENU_ITEM(browser->fileMenuItem), ++ browser->fileMenu); ++ ++ browser->fileOpenNewBrowser = ++ gtk_menu_item_new_with_label("Open New Browser"); ++ gtk_menu_shell_append((GtkMenuShell *)GTK_MENU(browser->fileMenu), ++ browser->fileOpenNewBrowser); ++ ++ browser->fileStream = ++ gtk_menu_item_new_with_label("Test Stream"); ++ gtk_menu_shell_append((GtkMenuShell *)GTK_MENU(browser->fileMenu), ++ browser->fileStream); ++ ++ browser->fileMemory = ++ gtk_menu_item_new_with_label("Release Memory"); ++ gtk_menu_shell_append((GtkMenuShell *)GTK_MENU(browser->fileMenu), ++ browser->fileMemory); ++ ++ browser->fileClose = ++ gtk_menu_item_new_with_label("Close"); ++ gtk_menu_shell_append((GtkMenuShell *)GTK_MENU(browser->fileMenu), ++ browser->fileClose); ++ ++ browser->fileQuit = ++ gtk_menu_item_new_with_label("Quit"); ++ gtk_menu_shell_append((GtkMenuShell *)GTK_MENU(browser->fileMenu), ++ browser->fileQuit); ++ ++ // append it ++ gtk_menu_shell_append((GtkMenuShell *)GTK_MENU_BAR(browser->menuBar), ++ browser->fileMenuItem); ++ ++ // add it to the vbox ++ gtk_box_pack_start(GTK_BOX(browser->topLevelVBox), ++ browser->menuBar, ++ FALSE, // expand ++ FALSE, // fill ++ 0); // padding ++ // create the hbox that will contain the toolbar and the url text entry bar ++ browser->toolbarHBox = gtk_hbox_new(FALSE, 0); ++ // add that hbox to the vbox ++ gtk_box_pack_start(GTK_BOX(browser->topLevelVBox), ++ browser->toolbarHBox, ++ FALSE, // expand ++ FALSE, // fill ++ 0); // padding ++ // new horiz toolbar with buttons + icons ++ browser->toolbar = gtk_toolbar_new(); ++ gtk_toolbar_set_orientation(GTK_TOOLBAR(browser->toolbar), ++ GTK_ORIENTATION_HORIZONTAL); ++ gtk_toolbar_set_style(GTK_TOOLBAR(browser->toolbar), ++ GTK_TOOLBAR_BOTH); ++ ++ // add it to the hbox ++ gtk_box_pack_start(GTK_BOX(browser->toolbarHBox), browser->toolbar, ++ FALSE, // expand ++ FALSE, // fill ++ 0); // padding ++ // new back button ++ browser->backButton = ++ gtk_toolbar_append_item(GTK_TOOLBAR(browser->toolbar), ++ "Back", ++ "Go Back", ++ "Go Back", ++ 0, // XXX replace with icon ++ G_CALLBACK(back_clicked_cb), ++ browser); ++ // new stop button ++ browser->stopButton = ++ gtk_toolbar_append_item(GTK_TOOLBAR(browser->toolbar), ++ "Stop", ++ "Stop", ++ "Stop", ++ 0, // XXX replace with icon ++ G_CALLBACK(stop_clicked_cb), ++ browser); ++ // new forward button ++ browser->forwardButton = ++ gtk_toolbar_append_item(GTK_TOOLBAR(browser->toolbar), ++ "Forward", ++ "Forward", ++ "Forward", ++ 0, // XXX replace with icon ++ G_CALLBACK(forward_clicked_cb), ++ browser); ++ // new reload button ++ browser->reloadButton = ++ gtk_toolbar_append_item(GTK_TOOLBAR(browser->toolbar), ++ "Reload", ++ "Reload", ++ "Reload", ++ 0, // XXX replace with icon ++ G_CALLBACK(reload_clicked_cb), ++ browser); ++ // create the url text entry ++ browser->urlEntry = gtk_entry_new(); ++ // add it to the hbox ++ gtk_box_pack_start(GTK_BOX(browser->toolbarHBox), browser->urlEntry, ++ TRUE, // expand ++ TRUE, // fill ++ 0); // padding ++ // create our new gtk moz embed widget ++ browser->mozEmbed = gtk_moz_embed_new(); ++ gtk_moz_embed_push_startup(); ++ // add it to the toplevel vbox ++ gtk_box_pack_start(GTK_BOX(browser->topLevelVBox), browser->mozEmbed, ++ TRUE, // expand ++ TRUE, // fill ++ 0); // padding ++ // create the new hbox for the progress area ++ browser->progressAreaHBox = gtk_hbox_new(FALSE, 0); ++ // add it to the vbox ++ gtk_box_pack_start(GTK_BOX(browser->topLevelVBox), browser->progressAreaHBox, ++ FALSE, // expand ++ FALSE, // fill ++ 0); // padding ++ // create our new progress bar ++ browser->progressBar = gtk_progress_bar_new(); ++ // add it to the hbox ++ gtk_box_pack_start(GTK_BOX(browser->progressAreaHBox), browser->progressBar, ++ FALSE, // expand ++ FALSE, // fill ++ 0); // padding ++ ++ // create our status area and the alignment object that will keep it ++ // from expanding ++ browser->statusAlign = gtk_alignment_new(0, 0, 1, 1); ++ gtk_widget_set_size_request(browser->statusAlign, 1, -1); ++ // create the status bar ++ browser->statusBar = gtk_statusbar_new(); ++ gtk_container_add(GTK_CONTAINER(browser->statusAlign), browser->statusBar); ++ // add it to the hbox ++ gtk_box_pack_start(GTK_BOX(browser->progressAreaHBox), browser->statusAlign, ++ TRUE, // expand ++ TRUE, // fill ++ 0); // padding ++ // by default none of the buttons are marked as sensitive. ++ gtk_widget_set_sensitive(browser->backButton, FALSE); ++ gtk_widget_set_sensitive(browser->stopButton, FALSE); ++ gtk_widget_set_sensitive(browser->forwardButton, FALSE); ++ gtk_widget_set_sensitive(browser->reloadButton, FALSE); ++ ++ // catch the destruction of the toplevel window ++ g_signal_connect(GTK_OBJECT(browser->topLevelWindow), "delete_event", ++ G_CALLBACK(delete_cb), browser); ++ ++ // hook up the activate signal to the right callback ++ g_signal_connect(GTK_OBJECT(browser->urlEntry), "activate", ++ G_CALLBACK(url_activate_cb), browser); ++ ++ // hook up to the open new browser activation ++ g_signal_connect(GTK_OBJECT(browser->fileOpenNewBrowser), "activate", ++ G_CALLBACK(menu_open_new_cb), browser); ++ // hook up to the stream test ++ g_signal_connect(GTK_OBJECT(browser->fileStream), "activate", ++ G_CALLBACK(menu_stream_cb), browser); ++ // hook up the memory pressure release function ++ g_signal_connect(GTK_OBJECT(browser->fileMemory), "activate", ++ G_CALLBACK(menu_memory_cb), browser); ++ // close this window ++ g_signal_connect(GTK_OBJECT(browser->fileClose), "activate", ++ G_CALLBACK(menu_close_cb), browser); ++ // quit the application ++ g_signal_connect(GTK_OBJECT(browser->fileQuit), "activate", ++ G_CALLBACK(menu_quit_cb), browser); ++ ++ // hook up the location change to update the urlEntry ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "location", ++ G_CALLBACK(location_changed_cb), browser); ++ // hook up the title change to update the window title ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "title", ++ G_CALLBACK(title_changed_cb), browser); ++ // hook up the start and stop signals ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_start", ++ G_CALLBACK(load_started_cb), browser); ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_stop", ++ G_CALLBACK(load_finished_cb), browser); ++ // hook up to the change in network status ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_state", ++ G_CALLBACK(net_state_change_cb), browser); ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_state_all", ++ G_CALLBACK(net_state_change_all_cb), browser); ++ // hookup to changes in progress ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "progress", ++ G_CALLBACK(progress_change_cb), browser); ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "progress_all", ++ G_CALLBACK(progress_change_all_cb), browser); ++ // hookup to changes in over-link message ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "link_message", ++ G_CALLBACK(link_message_cb), browser); ++ // hookup to changes in js status message ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "js_status", ++ G_CALLBACK(js_status_cb), browser); ++ // hookup to see whenever a new window is requested ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "new_window", ++ G_CALLBACK(new_window_cb), browser); ++ // hookup to any requested visibility changes ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "visibility", ++ G_CALLBACK(visibility_cb), browser); ++ // hookup to the signal that says that the browser requested to be ++ // destroyed ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "destroy_browser", ++ G_CALLBACK(destroy_brsr_cb), browser); ++ // hookup to the signal that is called when someone clicks on a link ++ // to load a new uri ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "open_uri", ++ G_CALLBACK(open_uri_cb), browser); ++ // this signal is emitted when there's a request to change the ++ // containing browser window to a certain height, like with width ++ // and height args for a window.open in javascript ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "size_to", ++ G_CALLBACK(size_to_cb), browser); ++ // key event signals ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_key_down", ++ G_CALLBACK(dom_key_down_cb), browser); ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_key_press", ++ G_CALLBACK(dom_key_press_cb), browser); ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_key_up", ++ G_CALLBACK(dom_key_up_cb), browser); ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_down", ++ G_CALLBACK(dom_mouse_down_cb), browser); ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_up", ++ G_CALLBACK(dom_mouse_up_cb), browser); ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_click", ++ G_CALLBACK(dom_mouse_click_cb), browser); ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_dbl_click", ++ G_CALLBACK(dom_mouse_dbl_click_cb), browser); ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_over", ++ G_CALLBACK(dom_mouse_over_cb), browser); ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_out", ++ G_CALLBACK(dom_mouse_out_cb), browser); ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_activate", ++ G_CALLBACK(dom_activate_cb), browser); ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_focus_in", ++ G_CALLBACK(dom_focus_in_cb), browser); ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_focus_out", ++ G_CALLBACK(dom_focus_out_cb), browser); ++ // hookup to when the window is destroyed ++ g_signal_connect(GTK_OBJECT(browser->mozEmbed), "destroy", ++ G_CALLBACK(destroy_cb), browser); ++ ++ // set the chrome type so it's stored in the object ++ gtk_moz_embed_set_chrome_mask(GTK_MOZ_EMBED(browser->mozEmbed), ++ actualChromeMask); ++ ++ return browser; ++} ++ ++void ++set_browser_visibility (TestGtkBrowser *browser, gboolean visibility) ++{ ++ if (!visibility) ++ { ++ gtk_widget_hide(browser->topLevelWindow); ++ return; ++ } ++ ++ if (browser->menuBarOn) ++ gtk_widget_show_all(browser->menuBar); ++ else ++ gtk_widget_hide_all(browser->menuBar); ++ ++ // since they are on the same line here... ++ if (browser->toolBarOn || browser->locationBarOn) ++ gtk_widget_show_all(browser->toolbarHBox); ++ else ++ gtk_widget_hide_all(browser->toolbarHBox); ++ ++ if (browser->statusBarOn) ++ gtk_widget_show_all(browser->progressAreaHBox); ++ else ++ gtk_widget_hide_all(browser->progressAreaHBox); ++ ++ gtk_widget_show(browser->mozEmbed); ++ gtk_widget_show(browser->topLevelVBox); ++ gtk_widget_show(browser->topLevelWindow); ++} ++ ++void ++back_clicked_cb (GtkButton *button, TestGtkBrowser *browser) ++{ ++ gtk_moz_embed_go_back(GTK_MOZ_EMBED(browser->mozEmbed)); ++} ++ ++void ++stop_clicked_cb (GtkButton *button, TestGtkBrowser *browser) ++{ ++ g_print("stop_clicked_cb\n"); ++ gtk_moz_embed_stop_load(GTK_MOZ_EMBED(browser->mozEmbed)); ++} ++ ++void ++forward_clicked_cb (GtkButton *button, TestGtkBrowser *browser) ++{ ++ g_print("forward_clicked_cb\n"); ++ gtk_moz_embed_go_forward(GTK_MOZ_EMBED(browser->mozEmbed)); ++} ++ ++void ++reload_clicked_cb (GtkButton *button, TestGtkBrowser *browser) ++{ ++ g_print("reload_clicked_cb\n"); ++ GdkModifierType state = (GdkModifierType)0; ++ gint x, y; ++ gdk_window_get_pointer(NULL, &x, &y, &state); ++ ++ gtk_moz_embed_reload(GTK_MOZ_EMBED(browser->mozEmbed), ++ (state & GDK_SHIFT_MASK) ? ++ GTK_MOZ_EMBED_FLAG_RELOADBYPASSCACHE : ++ GTK_MOZ_EMBED_FLAG_RELOADNORMAL); ++} ++ ++void ++stream_clicked_cb (GtkButton *button, TestGtkBrowser *browser) ++{ ++ const char *data; ++ const char *data2; ++ data = "Hi"; ++ data2 = " there\n"; ++ g_print("stream_clicked_cb\n"); ++ gtk_moz_embed_open_stream(GTK_MOZ_EMBED(browser->mozEmbed), ++ "file://", "text/html"); ++ gtk_moz_embed_append_data(GTK_MOZ_EMBED(browser->mozEmbed), ++ data, strlen(data)); ++ gtk_moz_embed_append_data(GTK_MOZ_EMBED(browser->mozEmbed), ++ data2, strlen(data2)); ++ gtk_moz_embed_close_stream(GTK_MOZ_EMBED(browser->mozEmbed)); ++} ++ ++void ++url_activate_cb (GtkEditable *widget, TestGtkBrowser *browser) ++{ ++ gchar *text = gtk_editable_get_chars(widget, 0, -1); ++ g_print("loading url %s\n", text); ++ gtk_moz_embed_load_url(GTK_MOZ_EMBED(browser->mozEmbed), text); ++ g_free(text); ++} ++ ++void ++menu_open_new_cb (GtkMenuItem *menuitem, TestGtkBrowser *browser) ++{ ++ g_print("opening new browser.\n"); ++ TestGtkBrowser *newBrowser = ++ new_gtk_browser(GTK_MOZ_EMBED_FLAG_DEFAULTCHROME); ++ gtk_widget_set_size_request(newBrowser->mozEmbed, 400, 400); ++ set_browser_visibility(newBrowser, TRUE); ++} ++ ++void ++menu_stream_cb (GtkMenuItem *menuitem, TestGtkBrowser *browser) ++{ ++ g_print("menu_stream_cb\n"); ++ const char *data; ++ const char *data2; ++ data = "Hi"; ++ data2 = " there\n"; ++ g_print("stream_clicked_cb\n"); ++ gtk_moz_embed_open_stream(GTK_MOZ_EMBED(browser->mozEmbed), ++ "file://", "text/html"); ++ gtk_moz_embed_append_data(GTK_MOZ_EMBED(browser->mozEmbed), ++ data, strlen(data)); ++ gtk_moz_embed_append_data(GTK_MOZ_EMBED(browser->mozEmbed), ++ data2, strlen(data2)); ++ gtk_moz_embed_close_stream(GTK_MOZ_EMBED(browser->mozEmbed)); ++} ++ ++void ++menu_memory_cb (GtkMenuItem *menuitem, TestGtkBrowser *browser) ++{ ++ g_print("menu_memory_cb\n"); ++ nsCOMPtr os = do_GetService("@mozilla.org/observer-service;1"); ++ if (!os) ++ return; ++ ++ // Compact like you mean it. We do this three times to give the ++ // cycle collector a chance to try and reclaim as much as we can. ++ os->NotifyObservers(nsnull, "memory-pressure", NS_LITERAL_STRING("heap-minimize").get()); ++ os->NotifyObservers(nsnull, "memory-pressure", NS_LITERAL_STRING("heap-minimize").get()); ++ os->NotifyObservers(nsnull, "memory-pressure", NS_LITERAL_STRING("heap-minimize").get()); ++} ++ ++void ++menu_close_cb (GtkMenuItem *menuitem, TestGtkBrowser *browser) ++{ ++ gtk_widget_destroy(browser->topLevelWindow); ++} ++ ++void ++menu_quit_cb (GtkMenuItem *menuitem, TestGtkBrowser *browser) ++{ ++ TestGtkBrowser *tmpBrowser; ++ GList *tmp_list = browser_list; ++ tmpBrowser = (TestGtkBrowser *)tmp_list->data; ++ while (tmpBrowser) { ++ tmp_list = tmp_list->next; ++ gtk_widget_destroy(tmpBrowser->topLevelWindow); ++ tmpBrowser = (TestGtkBrowser *)tmp_list->data; ++ } ++} ++ ++gboolean ++delete_cb(GtkWidget *widget, GdkEventAny *event, TestGtkBrowser *browser) ++{ ++ g_print("delete_cb\n"); ++ gtk_widget_destroy(widget); ++ return TRUE; ++} ++ ++static gboolean ++idle_quit(void*) ++{ ++ gtk_main_quit(); ++ return FALSE; ++} ++ ++static gboolean ++idle_pop(void*) ++{ ++ gtk_moz_embed_pop_startup(); ++ return FALSE; ++} ++ ++void ++destroy_cb (GtkWidget *widget, TestGtkBrowser *browser) ++{ ++ GList *tmp_list; ++ g_print("destroy_cb\n"); ++ num_browsers--; ++ tmp_list = g_list_find(browser_list, browser); ++ browser_list = g_list_remove_link(browser_list, tmp_list); ++ if (browser->tempMessage) ++ g_free(browser->tempMessage); ++ g_idle_add(idle_pop, NULL); ++ if (num_browsers == 0) ++ g_idle_add (idle_quit, NULL); ++} ++ ++void ++location_changed_cb (GtkMozEmbed *embed, TestGtkBrowser *browser) ++{ ++ char *newLocation; ++ int newPosition = 0; ++ g_print("location_changed_cb\n"); ++ newLocation = gtk_moz_embed_get_location(embed); ++ if (newLocation) ++ { ++ gtk_editable_delete_text(GTK_EDITABLE(browser->urlEntry), 0, -1); ++ gtk_editable_insert_text(GTK_EDITABLE(browser->urlEntry), ++ newLocation, strlen(newLocation), &newPosition); ++ g_free(newLocation); ++ } ++ else ++ g_print("failed to get location!\n"); ++ // always make sure to clear the tempMessage. it might have been ++ // set from the link before a click and we wouldn't have gotten the ++ // callback to unset it. ++ update_temp_message(browser, 0); ++ // update the nav buttons on a location change ++ update_nav_buttons(browser); ++} ++ ++void ++title_changed_cb (GtkMozEmbed *embed, TestGtkBrowser *browser) ++{ ++ char *newTitle; ++ g_print("title_changed_cb\n"); ++ newTitle = gtk_moz_embed_get_title(embed); ++ if (newTitle) ++ { ++ gtk_window_set_title(GTK_WINDOW(browser->topLevelWindow), newTitle); ++ g_free(newTitle); ++ } ++ ++} ++ ++void ++load_started_cb (GtkMozEmbed *embed, TestGtkBrowser *browser) ++{ ++ g_print("load_started_cb\n"); ++ gtk_widget_set_sensitive(browser->stopButton, TRUE); ++ gtk_widget_set_sensitive(browser->reloadButton, FALSE); ++ browser->loadPercent = 0; ++ browser->bytesLoaded = 0; ++ browser->maxBytesLoaded = 0; ++ update_status_bar_text(browser); ++} ++ ++void ++load_finished_cb (GtkMozEmbed *embed, TestGtkBrowser *browser) ++{ ++ g_print("load_finished_cb\n"); ++ gtk_widget_set_sensitive(browser->stopButton, FALSE); ++ gtk_widget_set_sensitive(browser->reloadButton, TRUE); ++ browser->loadPercent = 0; ++ browser->bytesLoaded = 0; ++ browser->maxBytesLoaded = 0; ++ update_status_bar_text(browser); ++ gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(browser->progressBar), 0); ++} ++ ++ ++void ++net_state_change_cb (GtkMozEmbed *embed, gint flags, guint status, ++ TestGtkBrowser *browser) ++{ ++ g_print("net_state_change_cb %d\n", flags); ++ if (flags & GTK_MOZ_EMBED_FLAG_IS_REQUEST) { ++ if (flags & GTK_MOZ_EMBED_FLAG_REDIRECTING) ++ browser->statusMessage = "Redirecting to site..."; ++ else if (flags & GTK_MOZ_EMBED_FLAG_TRANSFERRING) ++ browser->statusMessage = "Transferring data from site..."; ++ else if (flags & GTK_MOZ_EMBED_FLAG_NEGOTIATING) ++ browser->statusMessage = "Waiting for authorization..."; ++ } ++ ++ if (status == GTK_MOZ_EMBED_STATUS_FAILED_DNS) ++ browser->statusMessage = "Site not found."; ++ else if (status == GTK_MOZ_EMBED_STATUS_FAILED_CONNECT) ++ browser->statusMessage = "Failed to connect to site."; ++ else if (status == GTK_MOZ_EMBED_STATUS_FAILED_TIMEOUT) ++ browser->statusMessage = "Failed due to connection timeout."; ++ else if (status == GTK_MOZ_EMBED_STATUS_FAILED_USERCANCELED) ++ browser->statusMessage = "User canceled connecting to site."; ++ ++ if (flags & GTK_MOZ_EMBED_FLAG_IS_DOCUMENT) { ++ if (flags & GTK_MOZ_EMBED_FLAG_START) ++ browser->statusMessage = "Loading site..."; ++ else if (flags & GTK_MOZ_EMBED_FLAG_STOP) ++ browser->statusMessage = "Done."; ++ } ++ ++ update_status_bar_text(browser); ++ ++} ++ ++void net_state_change_all_cb (GtkMozEmbed *embed, const char *uri, ++ gint flags, guint status, ++ TestGtkBrowser *browser) ++{ ++ // g_print("net_state_change_all_cb %s %d %d\n", uri, flags, status); ++} ++ ++void progress_change_cb (GtkMozEmbed *embed, gint cur, gint max, ++ TestGtkBrowser *browser) ++{ ++ g_print("progress_change_cb cur %d max %d\n", cur, max); ++ ++ // avoid those pesky divide by zero errors ++ if (max < 1) ++ { ++ browser->loadPercent = 0; ++ browser->bytesLoaded = cur; ++ browser->maxBytesLoaded = 0; ++ update_status_bar_text(browser); ++ } ++ else ++ { ++ browser->bytesLoaded = cur; ++ browser->maxBytesLoaded = max; ++ if (cur > max) ++ browser->loadPercent = 100; ++ else ++ browser->loadPercent = (cur * 100) / max; ++ update_status_bar_text(browser); ++ gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(browser->progressBar), ++ browser->loadPercent / 100.0); ++ } ++ ++} ++ ++void progress_change_all_cb (GtkMozEmbed *embed, const char *uri, ++ gint cur, gint max, ++ TestGtkBrowser *browser) ++{ ++ //g_print("progress_change_all_cb %s cur %d max %d\n", uri, cur, max); ++} ++ ++void ++link_message_cb (GtkMozEmbed *embed, TestGtkBrowser *browser) ++{ ++ char *message; ++ g_print("link_message_cb\n"); ++ message = gtk_moz_embed_get_link_message(embed); ++ if (!message || !*message) ++ update_temp_message(browser, 0); ++ else ++ update_temp_message(browser, message); ++ if (message) ++ g_free(message); ++} ++ ++void ++js_status_cb (GtkMozEmbed *embed, TestGtkBrowser *browser) ++{ ++ char *message; ++ g_print("js_status_cb\n"); ++ message = gtk_moz_embed_get_js_status(embed); ++ if (!message || !*message) ++ update_temp_message(browser, 0); ++ else ++ update_temp_message(browser, message); ++ if (message) ++ g_free(message); ++} ++ ++void ++new_window_cb (GtkMozEmbed *embed, GtkMozEmbed **newEmbed, guint chromemask, TestGtkBrowser *browser) ++{ ++ g_print("new_window_cb\n"); ++ g_print("embed is %p chromemask is %d\n", (void *)embed, chromemask); ++ TestGtkBrowser *newBrowser = new_gtk_browser(chromemask); ++ gtk_widget_set_size_request(newBrowser->mozEmbed, 400, 400); ++ *newEmbed = GTK_MOZ_EMBED(newBrowser->mozEmbed); ++ g_print("new browser is %p\n", (void *)*newEmbed); ++} ++ ++void ++visibility_cb (GtkMozEmbed *embed, gboolean visibility, TestGtkBrowser *browser) ++{ ++ g_print("visibility_cb %d\n", visibility); ++ set_browser_visibility(browser, visibility); ++} ++ ++void ++destroy_brsr_cb (GtkMozEmbed *embed, TestGtkBrowser *browser) ++{ ++ g_print("destroy_brsr_cb\n"); ++ gtk_widget_destroy(browser->topLevelWindow); ++} ++ ++gint ++open_uri_cb (GtkMozEmbed *embed, const char *uri, TestGtkBrowser *browser) ++{ ++ g_print("open_uri_cb %s\n", uri); ++ ++ // interrupt this test load ++ if (!strcmp(uri, "http://people.redhat.com/blizzard/monkeys.txt")) ++ return TRUE; ++ // don't interrupt anything ++ return FALSE; ++} ++ ++void ++size_to_cb (GtkMozEmbed *embed, gint width, gint height, ++ TestGtkBrowser *browser) ++{ ++ g_print("*** size_to_cb %d %d\n", width, height); ++ gtk_widget_set_size_request(browser->mozEmbed, width, height); ++} ++ ++gint dom_key_down_cb (GtkMozEmbed *embed, nsIDOMKeyEvent *event, ++ TestGtkBrowser *browser) ++{ ++ PRUint32 keyCode = 0; ++ // g_print("dom_key_down_cb\n"); ++ event->GetKeyCode(&keyCode); ++ // g_print("key code is %d\n", keyCode); ++ return NS_OK; ++} ++ ++gint dom_key_press_cb (GtkMozEmbed *embed, nsIDOMKeyEvent *event, ++ TestGtkBrowser *browser) ++{ ++ PRUint32 keyCode = 0; ++ // g_print("dom_key_press_cb\n"); ++ event->GetCharCode(&keyCode); ++ // g_print("char code is %d\n", keyCode); ++ return NS_OK; ++} ++ ++gint dom_key_up_cb (GtkMozEmbed *embed, nsIDOMKeyEvent *event, ++ TestGtkBrowser *browser) ++{ ++ PRUint32 keyCode = 0; ++ // g_print("dom_key_up_cb\n"); ++ event->GetKeyCode(&keyCode); ++ // g_print("key code is %d\n", keyCode); ++ return NS_OK; ++} ++ ++gint dom_mouse_down_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event, ++ TestGtkBrowser *browser) ++{ ++ // g_print("dom_mouse_down_cb\n"); ++ return NS_OK; ++ } ++ ++gint dom_mouse_up_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event, ++ TestGtkBrowser *browser) ++{ ++ // g_print("dom_mouse_up_cb\n"); ++ return NS_OK; ++} ++ ++gint dom_mouse_click_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event, ++ TestGtkBrowser *browser) ++{ ++ // g_print("dom_mouse_click_cb\n"); ++ PRUint16 button; ++ event->GetButton(&button); ++ printf("button was %d\n", button); ++ return NS_OK; ++} ++ ++gint dom_mouse_dbl_click_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event, ++ TestGtkBrowser *browser) ++{ ++ // g_print("dom_mouse_dbl_click_cb\n"); ++ return NS_OK; ++} ++ ++gint dom_mouse_over_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event, ++ TestGtkBrowser *browser) ++{ ++ //g_print("dom_mouse_over_cb\n"); ++ return NS_OK; ++} ++ ++gint dom_mouse_out_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event, ++ TestGtkBrowser *browser) ++{ ++ //g_print("dom_mouse_out_cb\n"); ++ return NS_OK; ++} ++ ++gint dom_activate_cb (GtkMozEmbed *embed, nsIDOMUIEvent *event, ++ TestGtkBrowser *browser) ++{ ++ //g_print("dom_activate_cb\n"); ++ return NS_OK; ++} ++ ++gint dom_focus_in_cb (GtkMozEmbed *embed, nsIDOMUIEvent *event, ++ TestGtkBrowser *browser) ++{ ++ //g_print("dom_focus_in_cb\n"); ++ return NS_OK; ++} ++ ++gint dom_focus_out_cb (GtkMozEmbed *embed, nsIDOMUIEvent *event, ++ TestGtkBrowser *browser) ++{ ++ //g_print("dom_focus_out_cb\n"); ++ return NS_OK; ++} ++ ++void new_window_orphan_cb (GtkMozEmbedSingle *embed, ++ GtkMozEmbed **retval, guint chromemask, ++ gpointer data) ++{ ++ g_print("new_window_orphan_cb\n"); ++ g_print("chromemask is %d\n", chromemask); ++ TestGtkBrowser *newBrowser = new_gtk_browser(chromemask); ++ *retval = GTK_MOZ_EMBED(newBrowser->mozEmbed); ++ g_print("new browser is %p\n", (void *)*retval); ++} ++ ++// utility functions ++ ++void ++update_status_bar_text(TestGtkBrowser *browser) ++{ ++ gchar message[256]; ++ ++ gtk_statusbar_pop(GTK_STATUSBAR(browser->statusBar), 1); ++ if (browser->tempMessage) ++ gtk_statusbar_push(GTK_STATUSBAR(browser->statusBar), 1, browser->tempMessage); ++ else ++ { ++ if (browser->loadPercent) ++ { ++ g_snprintf(message, 255, "%s (%d%% complete, %d bytes of %d loaded)", browser->statusMessage, browser->loadPercent, browser->bytesLoaded, browser->maxBytesLoaded); ++ } ++ else if (browser->bytesLoaded) ++ { ++ g_snprintf(message, 255, "%s (%d bytes loaded)", browser->statusMessage, browser->bytesLoaded); ++ } ++ else if (browser->statusMessage == NULL) ++ { ++ g_snprintf(message, 255, " "); ++ } ++ else ++ { ++ g_snprintf(message, 255, "%s", browser->statusMessage); ++ } ++ gtk_statusbar_push(GTK_STATUSBAR(browser->statusBar), 1, message); ++ } ++} ++ ++void ++update_temp_message(TestGtkBrowser *browser, const char *message) ++{ ++ if (browser->tempMessage) ++ g_free(browser->tempMessage); ++ if (message) ++ browser->tempMessage = g_strdup(message); ++ else ++ browser->tempMessage = 0; ++ // now that we've updated the temp message, redraw the status bar ++ update_status_bar_text(browser); ++} ++ ++ ++void ++update_nav_buttons (TestGtkBrowser *browser) ++{ ++ gboolean can_go_back; ++ gboolean can_go_forward; ++ can_go_back = gtk_moz_embed_can_go_back(GTK_MOZ_EMBED(browser->mozEmbed)); ++ can_go_forward = gtk_moz_embed_can_go_forward(GTK_MOZ_EMBED(browser->mozEmbed)); ++ if (can_go_back) ++ gtk_widget_set_sensitive(browser->backButton, TRUE); ++ else ++ gtk_widget_set_sensitive(browser->backButton, FALSE); ++ if (can_go_forward) ++ gtk_widget_set_sensitive(browser->forwardButton, TRUE); ++ else ++ gtk_widget_set_sensitive(browser->forwardButton, FALSE); ++ } ++ +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedMDI.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedMDI.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedMDI.cpp.gtkmozembed 2012-01-18 16:44:32.789289981 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedMDI.cpp 2012-01-18 16:44:32.789289981 +0100 +@@ -0,0 +1,142 @@ ++/** simplemdi.c **/ ++/* ++ * Sample code from "GNOME/GTK+ Programming Bible" by Arthur Griffith ++ * Modified by Kevin Gibbs (kgibbs@stanford.edu) to provide sample of ++ * GtkMozEmbed realization/unrealization crashes. ++ * ++ * To get a fatal crash, simply run the program, click on the "Mozilla" ++ * tab to display the MozEmbed widget, and then try to drag that MDI tab ++ * off to a new window. ++ * ++ * Although this test might seem elaborate, it is really only a convenient ++ * to create a situation where the widget is realized, unrealized, and ++ * realized again at some point. (Dragging the MDI tab off to a new window ++ * causes all widgets to be unrealized in the old window, and then realized ++ * again in the new window.) ++ */ ++ ++#include ++#include "gtkmozembed.h" ++ ++// Testing flags ++// ++ ++// Define this flag to have the test program use the gtkmozembed widget. ++// Without this flag, mozilla is never loaded in the program, and a simple ++// widget is used in place of the mozembed widget. ++#define USE_MOZILLA_TEST ++ ++// Define this flag to have a simpler test than the usual one. The normal ++// test builds a notebook inside of each MDI view, with one page being a label ++// and the other page being a browser widget. The simpler test does not ++// build a notebook and simply puts the browser widget in the MDI view itself. ++// Currently, this test is not very interesting, since for some reason all ++// the webshells just create and destroy themselves. (???) ++//#define SIMPLER_TEST ++ ++// Define this flag to use a GnomePixmap instead of a GtkLabel as the ++// replacement for the gtkmozembed widget when USE_MOZILLA_TEST is ++// undefined. This is to stress test the program a bit more by providing a ++// replacement widget slightly more complex than GtkLabel. ++// (Has no effect when USE_MOZILLA_TEST is defined.) ++#define SAMPLE_PIXMAP ++ ++ ++gint eventDelete(GtkWidget *widget, ++ GdkEvent *event,gpointer data); ++gint eventDestroy(GtkWidget *widget, ++ GdkEvent *event,gpointer data); ++ ++static void addChild(GtkObject *mdi,gchar *name); ++static GtkWidget *setLabel(GnomeMDIChild *child, ++ GtkWidget *currentLabel,gpointer data); ++static GtkWidget *createView(GnomeMDIChild *child, ++ gpointer data); ++ ++int main(int argc,char *argv[]) ++{ ++ GtkObject *mdi; ++ ++ gnome_init("simplemdi","1.0",argc,argv); ++ mdi = gnome_mdi_new("simplemdi","Simple MDI"); ++ gtk_signal_connect(mdi,"destroy", ++ GTK_SIGNAL_FUNC(eventDestroy),NULL); ++ ++ addChild(mdi,"First"); ++ addChild(mdi,"Second"); ++ addChild(mdi,"Third"); ++ addChild(mdi,"Last"); ++ ++ gnome_mdi_set_mode(GNOME_MDI(mdi),GNOME_MDI_NOTEBOOK); ++ //gnome_mdi_open_toplevel(GNOME_MDI(mdi)); ++ ++ gtk_main(); ++ exit(0); ++} ++static void addChild(GtkObject *mdi,gchar *name) ++{ ++ GnomeMDIGenericChild *child; ++ ++ child = gnome_mdi_generic_child_new(name); ++ gnome_mdi_add_child(GNOME_MDI(mdi), ++ GNOME_MDI_CHILD(child)); ++ ++ gnome_mdi_generic_child_set_view_creator(child, ++ createView,name); ++ gnome_mdi_generic_child_set_label_func(child,setLabel, ++ NULL); ++ gnome_mdi_add_view(GNOME_MDI(mdi), ++ GNOME_MDI_CHILD(child)); ++} ++static GtkWidget *createView(GnomeMDIChild *child, ++ gpointer data) ++{ ++#ifdef USE_MOZILLA_TEST ++ GtkWidget *browser = gtk_moz_embed_new(); ++#else ++#ifndef SAMPLE_PIXMAP ++ GtkWidget *browser = gtk_label_new("lynx 0.01a"); ++#else ++ /* Another example -- */ ++ GtkWidget *browser = ++ gnome_pixmap_new_from_file("/usr/share/pixmaps/emacs.png"); ++#endif /* SAMPLE_PIXMAP */ ++#endif /* USE_MOZILLA_TEST */ ++ ++ GtkWidget *notebook = gtk_notebook_new(); ++ char str[80]; ++ ++ sprintf(str,"View of the\n%s widget",(gchar *)data); ++ ++#ifdef USE_MOZILLA_TEST ++ gtk_moz_embed_load_url(GTK_MOZ_EMBED(browser), "http://www.mozilla.org"); ++#endif /* USE_MOZILLA_TEST */ ++ ++#ifndef SIMPLER_TEST ++ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), gtk_label_new(str), ++ gtk_label_new("Label")); ++ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), browser, ++ gtk_label_new("Mozilla")); ++ gtk_widget_show_all(notebook); ++ return (notebook); ++#else ++ gtk_widget_show(browser); ++ return (browser); ++#endif /* SIMPLER_TEST */ ++} ++ ++static GtkWidget *setLabel(GnomeMDIChild *child, ++ GtkWidget *currentLabel,gpointer data) ++{ ++ if(currentLabel == NULL) ++ return(gtk_label_new(child->name)); ++ ++ gtk_label_set_text(GTK_LABEL(currentLabel), ++ child->name); ++ return(currentLabel); ++} ++gint eventDestroy(GtkWidget *widget, ++ GdkEvent *event,gpointer data) { ++ gtk_main_quit(); ++ return(0); ++} +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedNotebook.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedNotebook.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedNotebook.cpp.gtkmozembed 2012-01-18 16:44:32.807289982 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedNotebook.cpp 2012-01-18 16:44:32.808289981 +0100 +@@ -0,0 +1,86 @@ ++#include ++#include ++#include ++#include "nsStringAPI.h" ++#include "gtkmozembed_glue.cpp" ++ ++int main(int argc, char *argv[]) ++{ ++ GtkWidget *window; ++ GtkWidget *label; ++ GtkWidget *mozembed; ++ GtkWidget *container; ++ char *url; ++ ++ gtk_init(&argc, &argv); ++ ++ static const GREVersionRange greVersion = { ++ "1.9a", PR_TRUE, ++ "2", PR_TRUE ++ }; ++ ++ char xpcomPath[PATH_MAX]; ++ ++ nsresult rv = ++ GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, ++ xpcomPath, sizeof(xpcomPath)); ++ if (NS_FAILED(rv)) { ++ fprintf(stderr, "Couldn't find a compatible GRE.\n"); ++ return 1; ++ } ++ ++ rv = XPCOMGlueStartup(xpcomPath); ++ if (NS_FAILED(rv)) { ++ fprintf(stderr, "Couldn't start XPCOM."); ++ return 1; ++ } ++ ++ rv = GTKEmbedGlueStartup(); ++ if (NS_FAILED(rv)) { ++ fprintf(stderr, "Couldn't find GTKMozEmbed symbols."); ++ return 1; ++ } ++ ++ char *lastSlash = strrchr(xpcomPath, '/'); ++ if (lastSlash) ++ *lastSlash = '\0'; ++ ++ gtk_moz_embed_set_path(xpcomPath); ++ ++ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); ++ ++ container = gtk_notebook_new(); ++ mozembed = gtk_moz_embed_new(); ++ label = gtk_label_new("Can you see this message?\n" ++ "Once you switch to mozembed page " ++ "you never see this message."); ++ ++ g_signal_connect(GTK_OBJECT(mozembed), "destroy", ++ G_CALLBACK(gtk_main_quit), ++NULL); ++ ++ gtk_container_add(GTK_CONTAINER(window), container); ++ ++ gtk_notebook_append_page(GTK_NOTEBOOK(container), ++ label, ++ gtk_label_new("gtk label")); ++ ++ gtk_notebook_append_page(GTK_NOTEBOOK(container), ++ mozembed, ++ gtk_label_new("mozembed")); ++ ++ ++ ++ ++ gtk_widget_set_size_request(window, 400, 300); ++ gtk_widget_show(mozembed); ++ gtk_widget_show(label); ++ gtk_widget_show_all(window); ++ ++ url = (argc > 1) ? argv[1] : (char *)"localhost"; ++ gtk_moz_embed_load_url(GTK_MOZ_EMBED(mozembed), url); ++ ++ gtk_main(); ++ ++ return 0; ++} +diff -up xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedSocket.cpp.gtkmozembed xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedSocket.cpp +--- xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedSocket.cpp.gtkmozembed 2012-01-18 16:44:32.808289981 +0100 ++++ xulrunner-10.0/mozilla-beta/embedding/browser/gtk/tests/TestGtkEmbedSocket.cpp 2012-01-18 16:44:32.808289981 +0100 +@@ -0,0 +1,109 @@ ++/* ***** 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 ++ * Christopher Blizzard. ++ * Portions created by the Initial Developer are Copyright (C) 2001 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Christopher Blizzard ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++GtkWidget *toplevel_window = 0; ++GtkWidget *button = 0; ++GtkWidget *vbox = 0; ++GtkWidget *gtk_socket = 0; ++ ++void ++insert_mozilla(gpointer data); ++ ++int ++main(int argc, char **argv) ++{ ++ gtk_init(&argc, &argv); ++ ++ toplevel_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); ++ ++ g_signal_connect(GTK_OBJECT(toplevel_window), "destroy", ++ G_CALLBACK(exit), NULL); ++ ++ vbox = gtk_vbox_new(FALSE, 0); ++ gtk_container_add(GTK_CONTAINER(toplevel_window), vbox); ++ gtk_widget_show(vbox); ++ ++ button = gtk_button_new_with_label("Insert Mozilla"); ++ ++ gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); ++ gtk_widget_show(button); ++ ++ g_signal_connect(GTK_OBJECT(button), "clicked", ++ G_CALLBACK(insert_mozilla), NULL); ++ ++ gtk_widget_show(toplevel_window); ++ ++ gtk_main(); ++ ++ return 0; ++} ++ ++void ++insert_mozilla(gpointer data) ++{ ++ char buffer[20]; ++ int pid; ++ ++ if (gtk_socket) ++ return; ++ ++ gtk_socket = gtk_socket_new(); ++ gtk_box_pack_start(GTK_BOX(vbox), gtk_socket, TRUE, TRUE, 0); ++ gtk_widget_show(gtk_socket); ++ ++ sprintf(buffer, "%#lx", GDK_WINDOW_XWINDOW(gtk_socket->window)); ++ ++ gdk_flush(); ++ ++ if ((pid = fork()) == 0) { /* child */ ++ execl("./TestGtkEmbedChild", "./TestGtkEmbedChild", buffer, NULL); ++ fprintf(stderr, "can't exec child\n"); ++ _exit(1); ++ } ++ else if (pid > 0) { /* parent */ ++ } ++ else { ++ fprintf(stderr, "Can't fork.\n"); ++ } ++} +diff -up xulrunner-10.0/mozilla-beta/toolkit/library/Makefile.in.gtkmozembed xulrunner-10.0/mozilla-beta/toolkit/library/Makefile.in +--- xulrunner-10.0/mozilla-beta/toolkit/library/Makefile.in.gtkmozembed 2012-01-11 18:15:04.000000000 +0100 ++++ xulrunner-10.0/mozilla-beta/toolkit/library/Makefile.in 2012-01-18 16:44:32.809289980 +0100 +@@ -73,6 +73,8 @@ CPPSRCS += dlldeps-xul.cpp + endif + + ifneq (,$(MOZ_ENABLE_GTK2)) ++SHARED_LIBRARY_LIBS += \ ++ $(DEPTH)/embedding/browser/gtk/src/$(LIB_PREFIX)gtkembedmoz.$(LIB_SUFFIX) + DEFINES += -DMOZ_ENABLE_GTK2 + endif + +diff -up xulrunner-10.0/mozilla-beta/toolkit/toolkit-makefiles.sh.gtkmozembed xulrunner-10.0/mozilla-beta/toolkit/toolkit-makefiles.sh +--- xulrunner-10.0/mozilla-beta/toolkit/toolkit-makefiles.sh.gtkmozembed 2012-01-11 18:15:08.000000000 +0100 ++++ xulrunner-10.0/mozilla-beta/toolkit/toolkit-makefiles.sh 2012-01-18 16:44:32.810289980 +0100 +@@ -554,6 +554,9 @@ MAKEFILES_embedding=" + embedding/browser/Makefile + embedding/browser/build/Makefile + embedding/browser/webBrowser/Makefile ++ embedding/browser/gtk/Makefile ++ embedding/browser/gtk/src/Makefile ++ embedding/browser/gtk/tests/Makefile + embedding/components/Makefile + embedding/components/appstartup/src/Makefile + embedding/components/build/Makefile +diff -up xulrunner-10.0/mozilla-beta/toolkit/toolkit-tiers.mk.gtkmozembed xulrunner-10.0/mozilla-beta/toolkit/toolkit-tiers.mk +--- xulrunner-10.0/mozilla-beta/toolkit/toolkit-tiers.mk.gtkmozembed 2012-01-11 18:15:08.000000000 +0100 ++++ xulrunner-10.0/mozilla-beta/toolkit/toolkit-tiers.mk 2012-01-18 16:44:32.811289981 +0100 +@@ -221,6 +221,12 @@ endif + + tier_platform_dirs += services/crypto/component + ++ifndef BUILD_STATIC_LIBS ++ifneq (,$(MOZ_ENABLE_GTK2)) ++tier_platform_dirs += embedding/browser/gtk ++endif ++endif ++ + tier_platform_dirs += startupcache + + tier_platform_dirs += js/ductwork/debugger +@@ -268,4 +274,3 @@ tier_platform_dirs += testing/mochitest + tier_platform_dirs += testing/xpcshell + tier_platform_dirs += testing/tools/screenshot + endif +- +diff -up xulrunner-10.0/mozilla-beta/xulrunner/installer/Makefile.in.gtkmozembed xulrunner-10.0/mozilla-beta/xulrunner/installer/Makefile.in +--- xulrunner-10.0/mozilla-beta/xulrunner/installer/Makefile.in.gtkmozembed 2012-01-18 16:44:32.403289971 +0100 ++++ xulrunner-10.0/mozilla-beta/xulrunner/installer/Makefile.in 2012-01-18 16:44:32.817289981 +0100 +@@ -78,6 +78,8 @@ pkg_config_files = \ + libxul-embedding.pc \ + mozilla-js.pc \ + mozilla-plugin.pc \ ++ mozilla-gtkmozembed.pc \ ++ mozilla-gtkmozembed-embedding.pc \ + $(NULL) + + ifdef MOZ_NATIVE_NSPR +diff -up xulrunner-10.0/mozilla-beta/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in.gtkmozembed xulrunner-10.0/mozilla-beta/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in +--- xulrunner-10.0/mozilla-beta/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in.gtkmozembed 2012-01-18 16:44:32.812289981 +0100 ++++ xulrunner-10.0/mozilla-beta/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in 2012-01-18 16:44:32.812289981 +0100 +@@ -0,0 +1,9 @@ ++prefix=%prefix% ++sdkdir=%sdkdir% ++includedir=%includedir% ++libdir=%libdir% ++ ++Name: mozilla-gtkembedmoz ++Description: Static version-independent Mozilla Embedding Widget for Gtk+ ++Version: %MOZILLA_VERSION% ++Requires: libxul-embedding = %MOZILLA_VERSION% +diff -up xulrunner-10.0/mozilla-beta/xulrunner/installer/mozilla-gtkmozembed.pc.in.gtkmozembed xulrunner-10.0/mozilla-beta/xulrunner/installer/mozilla-gtkmozembed.pc.in +--- xulrunner-10.0/mozilla-beta/xulrunner/installer/mozilla-gtkmozembed.pc.in.gtkmozembed 2012-01-18 16:44:32.813289981 +0100 ++++ xulrunner-10.0/mozilla-beta/xulrunner/installer/mozilla-gtkmozembed.pc.in 2012-01-18 16:44:32.813289981 +0100 +@@ -0,0 +1,9 @@ ++prefix=%prefix% ++sdkdir=%sdkdir% ++includedir=%includedir% ++libdir=%libdir% ++ ++Name: mozilla-gtkembedmoz ++Description: Mozilla Embedding Widget for Gtk+ ++Version: %MOZILLA_VERSION% ++Requires: libxul = %MOZILLA_VERSION% diff --git a/crashreporter-remove-static.patch b/crashreporter-remove-static.patch new file mode 100644 index 0000000..b94d165 --- /dev/null +++ b/crashreporter-remove-static.patch @@ -0,0 +1,11 @@ +diff -up comm-1.9.2/mozilla/toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/Makefile.in.static comm-1.9.2/mozilla/toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/Makefile.in +--- mozilla/toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/Makefile.in.static 2010-06-23 19:47:11.000000000 +0200 ++++ mozilla/toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/Makefile.in 2010-07-12 15:51:41.000000000 +0200 +@@ -64,6 +64,6 @@ FORCE_USE_PIC = 1 + + #XXX: bug 554854 causes us to be unable to run binaries on the build slaves + # due to them having an older libstdc++ +-HOST_LDFLAGS += -static ++#HOST_LDFLAGS += -static + + include $(topsrcdir)/config/rules.mk diff --git a/dead.package b/dead.package deleted file mode 100644 index 3f37036..0000000 --- a/dead.package +++ /dev/null @@ -1 +0,0 @@ -This package is no longer supported by upstream diff --git a/mozilla-193-pkgconfig.patch b/mozilla-193-pkgconfig.patch new file mode 100644 index 0000000..67ec302 --- /dev/null +++ b/mozilla-193-pkgconfig.patch @@ -0,0 +1,32 @@ +diff -up xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul-embedding.pc.in.pk xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul-embedding.pc.in +--- xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul-embedding.pc.in.pk 2010-08-06 03:09:24.000000000 +0200 ++++ xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul-embedding.pc.in 2010-08-16 11:12:32.000000000 +0200 +@@ -6,5 +6,6 @@ idldir=%idldir% + Name: libxul-embedding + Description: Static library for version-independent embedding of the Mozilla runtime + Version: %MOZILLA_VERSION% ++Requires: %NSPR_NAME% >= %NSPR_VERSION% + Libs: -L${sdkdir}/lib -lxpcomglue -ldl + Cflags: -DXPCOM_GLUE -I${includedir} %WCHAR_CFLAGS% +diff -up xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul.pc.in.pk xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul.pc.in +--- xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul.pc.in.pk 2010-08-06 03:09:24.000000000 +0200 ++++ xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul.pc.in 2010-08-16 11:07:52.000000000 +0200 +@@ -2,6 +2,7 @@ prefix=%prefix% + sdkdir=%sdkdir% + includedir=%includedir% + idldir=%idldir% ++libdir=%libdir% + + Name: libxul + Description: The Mozilla Runtime and Embedding Engine +diff -up xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/Makefile.in.pk xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/Makefile.in +--- xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/Makefile.in.pk 2010-08-16 11:07:52.000000000 +0200 ++++ xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/Makefile.in 2010-08-16 11:07:52.000000000 +0200 +@@ -116,6 +116,7 @@ endif + -e "s|%includedir%|$(includedir)|" \ + -e "s|%idldir%|$(idldir)|" \ + -e "s|%sdkdir%|$(sdkdir)|" \ ++ -e "s|%libdir%|$(installdir)|" \ + -e "s|%MOZ_APP_NAME%|$(MOZ_APP_NAME)|" \ + -e "s|%MOZILLA_VERSION%|$(MOZ_APP_VERSION)|" \ + -e "s|%WCHAR_CFLAGS%|$(WCHAR_CFLAGS)|" \ diff --git a/mozilla-639554.patch b/mozilla-639554.patch new file mode 100644 index 0000000..12d32b2 --- /dev/null +++ b/mozilla-639554.patch @@ -0,0 +1,15 @@ +--- a/toolkit/mozapps/installer/packager.mk ++++ b/toolkit/mozapps/installer/packager.mk +@@ -621,10 +621,12 @@ ifdef INSTALL_SDK # Here comes the hard + (cd $(DESTDIR)$(idldir) && tar -xf -) + # SDK directory is the libs + a bunch of symlinks + $(NSINSTALL) -D $(DESTDIR)$(sdkdir)/sdk/lib ++ $(NSINSTALL) -D $(DESTDIR)$(sdkdir)/sdk/bin + if test -f $(DIST)/include/xpcom-config.h; then \ + $(SYSINSTALL) $(IFLAGS1) $(DIST)/include/xpcom-config.h $(DESTDIR)$(sdkdir); \ + fi + (cd $(DIST)/sdk/lib && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DESTDIR)$(sdkdir)/sdk/lib && tar -xf -) ++ (cd $(DIST)/sdk/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DESTDIR)$(sdkdir)/sdk/bin && tar -xf -) + $(RM) -f $(DESTDIR)$(sdkdir)/lib $(DESTDIR)$(sdkdir)/bin $(DESTDIR)$(sdkdir)/include $(DESTDIR)$(sdkdir)/include $(DESTDIR)$(sdkdir)/sdk/idl $(DESTDIR)$(sdkdir)/idl + ln -s $(sdkdir)/sdk/lib $(DESTDIR)$(sdkdir)/lib + ln -s $(installdir) $(DESTDIR)$(sdkdir)/bin diff --git a/mozilla-682832-proxy.patch b/mozilla-682832-proxy.patch new file mode 100644 index 0000000..0f643f9 --- /dev/null +++ b/mozilla-682832-proxy.patch @@ -0,0 +1,358 @@ +diff -up xulrunner-10.0/mozilla-beta/toolkit/system/gnome/nsGSettingsService.cpp.682832 xulrunner-10.0/mozilla-beta/toolkit/system/gnome/nsGSettingsService.cpp +--- xulrunner-10.0/mozilla-beta/toolkit/system/gnome/nsGSettingsService.cpp.682832 2012-01-18 17:25:24.000000000 +0100 ++++ xulrunner-10.0/mozilla-beta/toolkit/system/gnome/nsGSettingsService.cpp 2012-01-23 15:40:14.803170842 +0100 +@@ -44,6 +44,8 @@ + #include "nsMemory.h" + #include "prlink.h" + #include "nsComponentManagerUtils.h" ++#include "nsIMutableArray.h" ++#include "nsISupportsPrimitives.h" + + #include + #include +@@ -60,6 +62,7 @@ typedef struct _GVariant GVariant; + # define G_VARIANT_TYPE_STRING ((const GVariantType *) "s") + # define G_VARIANT_TYPE_OBJECT_PATH ((const GVariantType *) "o") + # define G_VARIANT_TYPE_SIGNATURE ((const GVariantType *) "g") ++# define G_VARIANT_TYPE_STRING_ARRAY ((const GVariantType *) "as") + #endif + + #define GSETTINGS_FUNCTIONS \ +@@ -72,6 +75,7 @@ typedef struct _GVariant GVariant; + FUNC(g_variant_get_int32, gint32, (GVariant* variant)) \ + FUNC(g_variant_get_boolean, gboolean, (GVariant* variant)) \ + FUNC(g_variant_get_string, const char *, (GVariant* value, gsize* length)) \ ++ FUNC(g_variant_get_strv, const char **, (GVariant* value, gsize* length)) \ + FUNC(g_variant_is_of_type, gboolean, (GVariant* value, const GVariantType* type)) \ + FUNC(g_variant_new_int32, GVariant *, (gint32 value)) \ + FUNC(g_variant_new_boolean, GVariant *, (gboolean value)) \ +@@ -95,6 +99,7 @@ GSETTINGS_FUNCTIONS + #define g_variant_get_int32 _g_variant_get_int32 + #define g_variant_get_boolean _g_variant_get_boolean + #define g_variant_get_string _g_variant_get_string ++#define g_variant_get_strv _g_variant_get_strv + #define g_variant_is_of_type _g_variant_is_of_type + #define g_variant_new_int32 _g_variant_new_int32 + #define g_variant_new_boolean _g_variant_new_boolean +@@ -267,6 +272,49 @@ nsGSettingsCollection::GetInt(const nsAC + return NS_OK; + } + ++NS_IMETHODIMP ++nsGSettingsCollection::GetStringList(const nsACString& aKey, nsIArray** aResult) ++{ ++ if (!KeyExists(aKey)) ++ return NS_ERROR_INVALID_ARG; ++ ++ nsCOMPtr items(do_CreateInstance(NS_ARRAY_CONTRACTID)); ++ if (!items) { ++ return NS_ERROR_OUT_OF_MEMORY; ++ } ++ ++ GVariant *value = g_settings_get_value(mSettings, ++ PromiseFlatCString(aKey).get()); ++ ++ if (!g_variant_is_of_type(value, G_VARIANT_TYPE_STRING_ARRAY)) { ++ g_variant_unref(value); ++ return NS_ERROR_FAILURE; ++ } ++ ++ const gchar ** gs_strings = g_variant_get_strv(value, NULL); ++ if (!gs_strings) { ++ // empty array ++ NS_ADDREF(*aResult = items); ++ g_variant_unref(value); ++ return NS_OK; ++ } ++ ++ const gchar** p_gs_strings = gs_strings; ++ while (*p_gs_strings != NULL) ++ { ++ nsCOMPtr obj(do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID)); ++ if (obj) { ++ obj->SetData(nsDependentCString(*p_gs_strings)); ++ items->AppendElement(obj, false); ++ } ++ p_gs_strings++; ++ } ++ g_free(gs_strings); ++ NS_ADDREF(*aResult = items); ++ g_variant_unref(value); ++ return NS_OK; ++} ++ + // These types are local to nsGSettingsService::Init, but ISO C++98 doesn't + // allow a template (ArrayLength) to be instantiated based on a local type. + // Boo-urns! +diff -up xulrunner-10.0/mozilla-beta/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp.682832 xulrunner-10.0/mozilla-beta/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp +--- xulrunner-10.0/mozilla-beta/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp.682832 2012-01-18 17:25:24.000000000 +0100 ++++ xulrunner-10.0/mozilla-beta/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp 2012-01-23 15:39:23.083172529 +0100 +@@ -49,6 +49,7 @@ + #include "nsPrintfCString.h" + #include "nsNetUtil.h" + #include "nsISupportsPrimitives.h" ++#include "nsIGSettingsService.h" + + class nsUnixSystemProxySettings : public nsISystemProxySettings { + public: +@@ -62,9 +63,12 @@ private: + ~nsUnixSystemProxySettings() {} + + nsCOMPtr mGConf; ++ nsCOMPtr mGSettings; + bool IsProxyMode(const char* aMode); + nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult); + nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); ++ nsresult GetProxyFromGSettings(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); ++ nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType, nsACString& aResult); + }; + + NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings) +@@ -73,6 +77,7 @@ nsresult + nsUnixSystemProxySettings::Init() + { + mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); ++ mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); + return NS_OK; + } + +@@ -87,14 +92,31 @@ nsUnixSystemProxySettings::IsProxyMode(c + nsresult + nsUnixSystemProxySettings::GetPACURI(nsACString& aResult) + { +- if (!mGConf || !IsProxyMode("auto")) { +- // Return an empty string in this case +- aResult.Truncate(); +- return NS_OK; ++ if (mGSettings) { ++ nsCOMPtr proxy_settings; ++ mGSettings->GetCollectionForSchema(NS_LITERAL_CSTRING("org.gnome.system.proxy"), ++ getter_AddRefs(proxy_settings)); ++ if (proxy_settings) { ++ nsCString proxyMode; ++ // Check if mode is auto ++ nsresult rv = proxy_settings->GetString(NS_LITERAL_CSTRING("mode"), proxyMode); ++ if (rv == NS_OK && proxyMode.Equals("auto")) { ++ return proxy_settings->GetString(NS_LITERAL_CSTRING("autoconfig-url"), aResult); ++ } ++ /* The org.gnome.system.proxy schema has been found, but auto mode is not set. ++ * Don't try the GConf and return empty string. */ ++ aResult.Truncate(); ++ return NS_OK; ++ } + } + +- return mGConf->GetString(NS_LITERAL_CSTRING("/system/proxy/autoconfig_url"), +- aResult); ++ if (mGConf && IsProxyMode("auto")) { ++ return mGConf->GetString(NS_LITERAL_CSTRING("/system/proxy/autoconfig_url"), ++ aResult); ++ } ++ // Return an empty string when auto mode is not set. ++ aResult.Truncate(); ++ return NS_OK; + } + + static bool +@@ -231,7 +253,38 @@ nsUnixSystemProxySettings::SetProxyResul + PRInt32 port; + rv = mGConf->GetInt(portKey, &port); + NS_ENSURE_SUCCESS(rv, rv); ++ ++ /* When port is 0, proxy is not considered as enabled even if host is set. */ ++ if (port == 0) ++ return NS_ERROR_FAILURE; ++ ++ SetProxyResult(aType, host, port, aResult); ++ return NS_OK; ++} ++ ++nsresult ++nsUnixSystemProxySettings::SetProxyResultFromGSettings(const char* aKeyBase, const char* aType, ++ nsACString& aResult) ++{ ++ nsCOMPtr proxy_settings; ++ nsresult rv = mGSettings->GetCollectionForSchema(nsDependentCString(aKeyBase), ++ getter_AddRefs(proxy_settings)); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ nsCAutoString host; ++ rv = proxy_settings->GetString(NS_LITERAL_CSTRING("host"), host); ++ NS_ENSURE_SUCCESS(rv, rv); ++ if (host.IsEmpty()) ++ return NS_ERROR_FAILURE; ++ ++ PRInt32 port; ++ rv = proxy_settings->GetInt(NS_LITERAL_CSTRING("port"), &port); ++ NS_ENSURE_SUCCESS(rv, rv); + ++ /* When port is 0, proxy is not considered as enabled even if host is set. */ ++ if (port == 0) ++ return NS_ERROR_FAILURE; ++ + SetProxyResult(aType, host, port, aResult); + return NS_OK; + } +@@ -271,17 +324,17 @@ static bool ConvertToIPV6Addr(const nsAC + PRIPv6Addr* aAddr) + { + PRNetAddr addr; ++ // try to convert hostname to IP + if (PR_StringToNetAddr(PromiseFlatCString(aName).get(), &addr) != PR_SUCCESS) + return false; + +- PRIPv6Addr ipv6; + // convert parsed address to IPv6 + if (addr.raw.family == PR_AF_INET) { + // convert to IPv4-mapped address +- PR_ConvertIPv4AddrToIPv6(addr.inet.ip, &ipv6); ++ PR_ConvertIPv4AddrToIPv6(addr.inet.ip, aAddr); + } else if (addr.raw.family == PR_AF_INET6) { + // copy the address +- memcpy(&ipv6, &addr.ipv6.ip, sizeof(PRIPv6Addr)); ++ memcpy(aAddr, &addr.ipv6.ip, sizeof(PRIPv6Addr)); + } else { + return false; + } +@@ -289,8 +342,8 @@ static bool ConvertToIPV6Addr(const nsAC + return true; + } + +-static bool GConfIgnoreHost(const nsACString& aIgnore, +- const nsACString& aHost) ++static bool HostIgnoredByProxy(const nsACString& aIgnore, ++ const nsACString& aHost) + { + if (aIgnore.Equals(aHost, nsCaseInsensitiveCStringComparator())) + return true; +@@ -321,8 +374,9 @@ static bool GConfIgnoreHost(const nsACSt + slash = end; + } + ++ nsDependentCSubstring ignoreStripped(start, slash); + PRIPv6Addr ignoreAddr, hostAddr; +- if (!ConvertToIPV6Addr(aIgnore, &ignoreAddr) || ++ if (!ConvertToIPV6Addr(ignoreStripped, &ignoreAddr) || + !ConvertToIPV6Addr(aHost, &hostAddr)) + return false; + +@@ -355,7 +409,7 @@ nsUnixSystemProxySettings::GetProxyFromG + if (str) { + nsAutoString s; + if (NS_SUCCEEDED(str->GetData(s)) && !s.IsEmpty()) { +- if (GConfIgnoreHost(NS_ConvertUTF16toUTF8(s), aHost)) { ++ if (HostIgnoredByProxy(NS_ConvertUTF16toUTF8(s), aHost)) { + aResult.AppendLiteral("DIRECT"); + return NS_OK; + } +@@ -392,6 +446,71 @@ nsUnixSystemProxySettings::GetProxyFromG + } + + nsresult ++nsUnixSystemProxySettings::GetProxyFromGSettings(const nsACString& aScheme, ++ const nsACString& aHost, ++ PRInt32 aPort, ++ nsACString& aResult) ++{ ++ nsCOMPtr proxy_settings; ++ nsresult rv; ++ ++ rv = mGSettings->GetCollectionForSchema(NS_LITERAL_CSTRING("org.gnome.system.proxy"), ++ getter_AddRefs(proxy_settings)); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ nsCString proxyMode; ++ rv = proxy_settings->GetString(NS_LITERAL_CSTRING("mode"), proxyMode); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ if (!proxyMode.Equals("manual")) { ++ aResult.AppendLiteral("DIRECT"); ++ return NS_OK; ++ } ++ ++ nsCOMPtr ignoreList; ++ if (NS_SUCCEEDED(proxy_settings->GetStringList(NS_LITERAL_CSTRING("ignore-hosts"), ++ getter_AddRefs(ignoreList))) && ignoreList) { ++ PRUint32 len = 0; ++ ignoreList->GetLength(&len); ++ for (PRUint32 i = 0; i < len; ++i) { ++ nsCOMPtr str = do_QueryElementAt(ignoreList, i); ++ if (str) { ++ nsCString s; ++ if (NS_SUCCEEDED(str->GetData(s)) && !s.IsEmpty()) { ++ if (HostIgnoredByProxy(s, aHost)) { ++ aResult.AppendLiteral("DIRECT"); ++ return NS_OK; ++ } ++ } ++ } ++ } ++ } ++ ++ if (aScheme.LowerCaseEqualsLiteral("http")) { ++ rv = SetProxyResultFromGSettings("org.gnome.system.proxy.http", "PROXY", aResult); ++ } else if (aScheme.LowerCaseEqualsLiteral("https")) { ++ rv = SetProxyResultFromGSettings("org.gnome.system.proxy.https", "PROXY", aResult); ++ /* Try to use HTTP proxy when HTTPS proxy is not explicitly defined */ ++ if (rv != NS_OK) ++ rv = SetProxyResultFromGSettings("org.gnome.system.proxy.http", "PROXY", aResult); ++ } else if (aScheme.LowerCaseEqualsLiteral("ftp")) { ++ rv = SetProxyResultFromGSettings("org.gnome.system.proxy.ftp", "PROXY", aResult); ++ } else { ++ rv = NS_ERROR_FAILURE; ++ } ++ if (rv != NS_OK) { ++ /* If proxy for scheme is not specified, use SOCKS proxy for all schemes */ ++ rv = SetProxyResultFromGSettings("org.gnome.system.proxy.socks", "SOCKS", aResult); ++ } ++ ++ if (NS_FAILED(rv)) { ++ aResult.AppendLiteral("DIRECT"); ++ } ++ ++ return NS_OK; ++} ++ ++nsresult + nsUnixSystemProxySettings::GetProxyForURI(nsIURI* aURI, nsACString& aResult) + { + nsCAutoString scheme; +@@ -406,10 +525,15 @@ nsUnixSystemProxySettings::GetProxyForUR + rv = aURI->GetPort(&port); + NS_ENSURE_SUCCESS(rv, rv); + +- if (!mGConf) +- return GetProxyFromEnvironment(scheme, host, port, aResult); ++ if (mGSettings) { ++ rv = GetProxyFromGSettings(scheme, host, port, aResult); ++ if (rv == NS_OK) ++ return rv; ++ } ++ if (mGConf) ++ return GetProxyFromGConf(scheme, host, port, aResult); + +- return GetProxyFromGConf(scheme, host, port, aResult); ++ return GetProxyFromEnvironment(scheme, host, port, aResult); + } + + #define NS_UNIXSYSTEMPROXYSERVICE_CID /* 0fa3158c-d5a7-43de-9181-a285e74cf1d4 */\ +diff -up xulrunner-10.0/mozilla-beta/xpcom/system/nsIGSettingsService.idl.682832 xulrunner-10.0/mozilla-beta/xpcom/system/nsIGSettingsService.idl +--- xulrunner-10.0/mozilla-beta/xpcom/system/nsIGSettingsService.idl.682832 2012-01-18 17:25:28.000000000 +0100 ++++ xulrunner-10.0/mozilla-beta/xpcom/system/nsIGSettingsService.idl 2012-01-23 15:32:29.890186340 +0100 +@@ -39,7 +39,7 @@ + #include "nsISupports.idl" + #include "nsIArray.idl" + +-[scriptable, uuid(09637d3c-3c07-40b4-aff9-1d2a0f046f3c)] ++[scriptable, uuid(16d5b0ed-e756-4f1b-a8ce-9132e869acd8)] + interface nsIGSettingsCollection : nsISupports + { + void setString(in AUTF8String key, in AUTF8String value); +@@ -48,6 +48,7 @@ interface nsIGSettingsCollection : nsISu + AUTF8String getString(in AUTF8String key); + boolean getBoolean(in AUTF8String key); + long getInt(in AUTF8String key); ++ nsIArray getStringList(in AUTF8String key); + }; + + [scriptable, uuid(849c088b-57d1-4f24-b7b2-3dc4acb04c0a)] diff --git a/mozilla-691898.patch b/mozilla-691898.patch new file mode 100644 index 0000000..dab2016 --- /dev/null +++ b/mozilla-691898.patch @@ -0,0 +1,285 @@ +From: Mike Hommey +Date: Sat, 24 Dec 2011 09:56:58 +0100 +Subject: Bug 691898 - Use YARR interpreter instead of PCRE on platforms where + YARR JIT is not supported + +--- + js/src/Makefile.in | 21 +++++++++++++-------- + js/src/vm/RegExpObject-inl.h | 28 ++++++---------------------- + js/src/vm/RegExpObject.cpp | 36 ------------------------------------ + js/src/vm/RegExpObject.h | 27 ++++++--------------------- + js/src/yarr/wtfbridge.h | 2 -- + 5 files changed, 25 insertions(+), 89 deletions(-) + +diff --git a/js/src/Makefile.in b/js/src/Makefile.in +index fc48cbd..49f0bdc 100644 +--- a/js/src/Makefile.in ++++ b/js/src/Makefile.in +@@ -416,15 +416,20 @@ CPPSRCS += checks.cc \ + + ifeq (,$(filter arm% sparc %86 x86_64,$(TARGET_CPU))) + +-VPATH += $(srcdir)/yarr/pcre \ ++VPATH += $(srcdir)/assembler \ ++ $(srcdir)/assembler/wtf \ ++ $(srcdir)/yarr \ + $(NULL) + + CPPSRCS += \ +- pcre_compile.cpp \ +- pcre_exec.cpp \ +- pcre_tables.cpp \ +- pcre_xclass.cpp \ +- pcre_ucp_searchfuncs.cpp \ ++ Assertions.cpp \ ++ OSAllocatorOS2.cpp \ ++ OSAllocatorPosix.cpp \ ++ OSAllocatorWin.cpp \ ++ PageBlock.cpp \ ++ YarrInterpreter.cpp \ ++ YarrPattern.cpp \ ++ YarrSyntaxChecker.cpp \ + $(NULL) + else + +@@ -1015,10 +1020,10 @@ endif + # Needed to "configure" it correctly. Unfortunately these + # flags wind up being applied to all code in js/src, not just + # the code in js/src/assembler. +-CXXFLAGS += -DUSE_SYSTEM_MALLOC=1 -DENABLE_ASSEMBLER=1 ++CXXFLAGS += -DUSE_SYSTEM_MALLOC=1 + + ifneq (,$(ENABLE_YARR_JIT)$(ENABLE_TRACEJIT)$(ENABLE_METHODJIT)) +-CXXFLAGS += -DENABLE_JIT=1 ++CXXFLAGS += -DENABLE_JIT=1 -DENABLE_ASSEMBLER=1 + endif + + INCLUDES += -I$(srcdir)/assembler -I$(srcdir)/yarr +diff --git a/js/src/vm/RegExpObject-inl.h b/js/src/vm/RegExpObject-inl.h +index 5f7817d..91108a7 100644 +--- a/js/src/vm/RegExpObject-inl.h ++++ b/js/src/vm/RegExpObject-inl.h +@@ -327,6 +327,7 @@ RegExpPrivate::create(JSContext *cx, JSString *source, RegExpFlag flags, TokenSt + return RetType(self); + } + ++#if ENABLE_YARR_JIT + /* This function should be deleted once bad Android platforms phase out. See bug 604774. */ + inline bool + RegExpPrivateCode::isJITRuntimeEnabled(JSContext *cx) +@@ -337,12 +338,12 @@ RegExpPrivateCode::isJITRuntimeEnabled(JSContext *cx) + return true; + #endif + } ++#endif + + inline bool + RegExpPrivateCode::compile(JSContext *cx, JSLinearString &pattern, TokenStream *ts, + uintN *parenCount, RegExpFlag flags) + { +-#if ENABLE_YARR_JIT + /* Parse the pattern. */ + ErrorCode yarrError; + YarrPattern yarrPattern(pattern, bool(flags & IgnoreCaseFlag), bool(flags & MultilineFlag), +@@ -359,7 +360,7 @@ RegExpPrivateCode::compile(JSContext *cx, JSLinearString &pattern, TokenStream * + * case we have to bytecode compile it. + */ + +-#ifdef JS_METHODJIT ++#if ENABLE_YARR_JIT && defined(JS_METHODJIT) + if (isJITRuntimeEnabled(cx) && !yarrPattern.m_containsBackreferences) { + if (!cx->compartment->ensureJaegerCompartmentExists(cx)) + return false; +@@ -371,21 +372,11 @@ RegExpPrivateCode::compile(JSContext *cx, JSLinearString &pattern, TokenStream * + } + #endif + ++#if ENABLE_YARR_JIT + codeBlock.setFallBack(true); ++#endif + byteCode = byteCompile(yarrPattern, cx->compartment->regExpAllocator).get(); + return true; +-#else /* !defined(ENABLE_YARR_JIT) */ +- int error = 0; +- compiled = jsRegExpCompile(pattern.chars(), pattern.length(), +- ignoreCase() ? JSRegExpIgnoreCase : JSRegExpDoNotIgnoreCase, +- multiline() ? JSRegExpMultiline : JSRegExpSingleLine, +- parenCount, &error); +- if (error) { +- reportPCREError(cx, error); +- return false; +- } +- return true; +-#endif + } + + inline bool +@@ -431,19 +422,12 @@ RegExpPrivateCode::execute(JSContext *cx, const jschar *chars, size_t start, siz + else + result = JSC::Yarr::execute(codeBlock, chars, start, length, output); + #else +- result = jsRegExpExecute(cx, compiled, chars, length, start, output, outputCount); ++ result = JSC::Yarr::interpret(byteCode, chars, start, length, output); + #endif + + if (result == -1) + return Success_NotFound; + +-#if !ENABLE_YARR_JIT +- if (result < 0) { +- reportPCREError(cx, result); +- return Error; +- } +-#endif +- + JS_ASSERT(result >= 0); + return Success; + } +diff --git a/js/src/vm/RegExpObject.cpp b/js/src/vm/RegExpObject.cpp +index f75c6a5..7631dd5 100644 +--- a/js/src/vm/RegExpObject.cpp ++++ b/js/src/vm/RegExpObject.cpp +@@ -251,7 +251,6 @@ Class js::RegExpClass = { + NULL /* trace */ + }; + +-#if ENABLE_YARR_JIT + void + RegExpPrivateCode::reportYarrError(JSContext *cx, TokenStream *ts, ErrorCode error) + { +@@ -283,41 +282,6 @@ RegExpPrivateCode::reportYarrError(JSContext *cx, TokenStream *ts, ErrorCode err + } + } + +-#else /* !ENABLE_YARR_JIT */ +- +-void +-RegExpPrivateCode::reportPCREError(JSContext *cx, int error) +-{ +-#define REPORT(msg_) \ +- JS_ReportErrorFlagsAndNumberUC(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL, msg_); \ +- return +- switch (error) { +- case -2: REPORT(JSMSG_REGEXP_TOO_COMPLEX); +- case 0: JS_NOT_REACHED("Precondition violation: an error must have occurred."); +- case 1: REPORT(JSMSG_TRAILING_SLASH); +- case 2: REPORT(JSMSG_TRAILING_SLASH); +- case 3: REPORT(JSMSG_REGEXP_TOO_COMPLEX); +- case 4: REPORT(JSMSG_BAD_QUANTIFIER); +- case 5: REPORT(JSMSG_BAD_QUANTIFIER); +- case 6: REPORT(JSMSG_BAD_CLASS_RANGE); +- case 7: REPORT(JSMSG_REGEXP_TOO_COMPLEX); +- case 8: REPORT(JSMSG_BAD_CLASS_RANGE); +- case 9: REPORT(JSMSG_BAD_QUANTIFIER); +- case 10: REPORT(JSMSG_UNMATCHED_RIGHT_PAREN); +- case 11: REPORT(JSMSG_REGEXP_TOO_COMPLEX); +- case 12: REPORT(JSMSG_UNMATCHED_RIGHT_PAREN); +- case 13: REPORT(JSMSG_REGEXP_TOO_COMPLEX); +- case 14: REPORT(JSMSG_MISSING_PAREN); +- case 15: REPORT(JSMSG_BAD_BACKREF); +- case 16: REPORT(JSMSG_REGEXP_TOO_COMPLEX); +- case 17: REPORT(JSMSG_REGEXP_TOO_COMPLEX); +- default: +- JS_NOT_REACHED("Precondition violation: unknown PCRE error code."); +- } +-#undef REPORT +-} +-#endif /* ENABLE_YARR_JIT */ +- + bool + js::ParseRegExpFlags(JSContext *cx, JSString *flagStr, RegExpFlag *flagsOut) + { +diff --git a/js/src/vm/RegExpObject.h b/js/src/vm/RegExpObject.h +index 1449d56..279f3c0 100644 +--- a/js/src/vm/RegExpObject.h ++++ b/js/src/vm/RegExpObject.h +@@ -49,8 +49,6 @@ + #include "yarr/Yarr.h" + #if ENABLE_YARR_JIT + #include "yarr/YarrJIT.h" +-#else +-#include "yarr/pcre/pcre.h" + #endif + + namespace js { +@@ -153,48 +151,39 @@ ResetRegExpObject(JSContext *cx, AlreadyIncRefed rep); + /* Abstracts away the gross |RegExpPrivate| backend details. */ + class RegExpPrivateCode + { +-#if ENABLE_YARR_JIT + typedef JSC::Yarr::BytecodePattern BytecodePattern; + typedef JSC::Yarr::ErrorCode ErrorCode; ++ typedef JSC::Yarr::YarrPattern YarrPattern; ++#if ENABLE_YARR_JIT + typedef JSC::Yarr::JSGlobalData JSGlobalData; + typedef JSC::Yarr::YarrCodeBlock YarrCodeBlock; +- typedef JSC::Yarr::YarrPattern YarrPattern; + + /* Note: Native code is valid only if |codeBlock.isFallBack() == false|. */ + YarrCodeBlock codeBlock; +- BytecodePattern *byteCode; +-#else +- JSRegExp *compiled; + #endif ++ BytecodePattern *byteCode; + + public: + RegExpPrivateCode() + : + #if ENABLE_YARR_JIT + codeBlock(), +- byteCode(NULL) +-#else +- compiled(NULL) + #endif ++ byteCode(NULL) + { } + + ~RegExpPrivateCode() { + #if ENABLE_YARR_JIT + codeBlock.release(); ++#endif + if (byteCode) + Foreground::delete_(byteCode); +-#else +- if (compiled) +- jsRegExpFree(compiled); +-#endif + } + + #if ENABLE_YARR_JIT + static inline bool isJITRuntimeEnabled(JSContext *cx); +- void reportYarrError(JSContext *cx, TokenStream *ts, JSC::Yarr::ErrorCode error); +-#else +- void reportPCREError(JSContext *cx, int error); + #endif ++ void reportYarrError(JSContext *cx, TokenStream *ts, JSC::Yarr::ErrorCode error); + + inline bool compile(JSContext *cx, JSLinearString &pattern, TokenStream *ts, uintN *parenCount, + RegExpFlag flags); +@@ -205,11 +194,7 @@ class RegExpPrivateCode + int *output, size_t outputCount); + + static size_t getOutputSize(size_t pairCount) { +-#if ENABLE_YARR_JIT + return pairCount * 2; +-#else +- return pairCount * 3; /* Should be x2, but PCRE has... needs. */ +-#endif + } + }; + +diff --git a/js/src/yarr/wtfbridge.h b/js/src/yarr/wtfbridge.h +index ac41d08..fb8eb86 100644 +--- a/js/src/yarr/wtfbridge.h ++++ b/js/src/yarr/wtfbridge.h +@@ -49,9 +49,7 @@ + #include "jsprvtd.h" + #include "vm/String.h" + #include "assembler/wtf/Platform.h" +-#if ENABLE_YARR_JIT + #include "assembler/jit/ExecutableAllocator.h" +-#endif + + namespace JSC { namespace Yarr { + diff --git a/mozilla-696393.patch b/mozilla-696393.patch new file mode 100644 index 0000000..26c558f --- /dev/null +++ b/mozilla-696393.patch @@ -0,0 +1,68 @@ +diff -up xulrunner-9.0/mozilla-beta/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390x.cpp.696393 xulrunner-9.0/mozilla-beta/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390x.cpp +--- xulrunner-9.0/mozilla-beta/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390x.cpp.696393 2011-12-07 07:28:08.000000000 +0100 ++++ xulrunner-9.0/mozilla-beta/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390x.cpp 2011-12-09 15:07:07.609097348 +0100 +@@ -194,55 +194,22 @@ invoke_copy_to_stack(PRUint32 paramCount + } + } + ++typedef nsresult (*vtable_func)(nsISupports *, PRUint64, PRUint64, PRUint64, PRUint64, double, double, double, double); ++ + EXPORT_XPCOM_API(nsresult) + NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) + { +- PRUint64 *vtable = *(PRUint64 **)that; +- PRUint64 method = vtable[methodIndex]; ++ vtable_func *vtable = *reinterpret_cast(that); ++ vtable_func method = vtable[methodIndex]; + PRUint64 overflow = invoke_count_words (paramCount, params); ++ PRUint64 *stack_space = reinterpret_cast(__builtin_alloca((overflow + 8 /* 4 64-bits gpr + 4 64-bits fpr */) * 8)); + PRUint64 result; + +- __asm__ __volatile__ +- ( +- "lgr 7,15\n\t" +- "aghi 7,-64\n\t" +- +- "lgr 3,%3\n\t" +- "sllg 3,3,3\n\t" +- "lcgr 3,3\n\t" +- "lg 2,0(15)\n\t" +- "la 15,0(3,7)\n\t" +- "stg 2,0(15)\n\t" +- +- "lgr 2,%1\n\t" +- "lgr 3,%2\n\t" +- "la 4,160(15)\n\t" +- "lgr 5,%3\n\t" +- "basr 14,%4\n\t" ++ invoke_copy_to_stack(paramCount, params, stack_space, overflow); + +- "lgr 2,%5\n\t" +- "ld 0,192(7)\n\t" +- "ld 2,200(7)\n\t" +- "ld 4,208(7)\n\t" +- "ld 6,216(7)\n\t" +- "lmg 3,6,160(7)\n\t" +- "basr 14,%6\n\t" ++ PRUint64 *d_gpr = stack_space + overflow; ++ double *d_fpr = reinterpret_cast(d_gpr + 4); + +- "la 15,64(7)\n\t" +- +- "lgr %0,2\n\t" +- : "=r" (result) +- : "r" ((PRUint64)paramCount), +- "r" (params), +- "r" (overflow), +- "a" (invoke_copy_to_stack), +- "a" (that), +- "a" (method) +- : "2", "3", "4", "5", "6", "7", "14", "cc", "memory", +- "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7" +- ); +- +- return result; ++ return method(that, d_gpr[0], d_gpr[1], d_gpr[2], d_gpr[3], d_fpr[0], d_fpr[1], d_fpr[2], d_fpr[3]); + } +- diff --git a/mozilla-706724.patch b/mozilla-706724.patch new file mode 100644 index 0000000..b0792ed --- /dev/null +++ b/mozilla-706724.patch @@ -0,0 +1,12 @@ +diff -up mozilla-beta/ipc/chromium/src/base/file_util.cc.old mozilla-beta/ipc/chromium/src/base/file_util.cc +--- mozilla-beta/ipc/chromium/src/base/file_util.cc.old 2012-01-25 13:48:11.000000000 +0100 ++++ mozilla-beta/ipc/chromium/src/base/file_util.cc 2012-01-25 13:52:25.096659244 +0100 +@@ -8,7 +8,7 @@ + #include + #endif + #include +-#if defined(ANDROID) ++#if defined(ANDROID) || defined(OS_POSIX) + #include + #endif + diff --git a/mozilla-722127.patch b/mozilla-722127.patch new file mode 100644 index 0000000..63a9e0a --- /dev/null +++ b/mozilla-722127.patch @@ -0,0 +1,74 @@ +# HG changeset patch +# Parent 0a6f3638cdaba9d3b5ef2eef73a42b2a167dc52a +# User ojab +Bug 722127 - Build --with-system-libvpx is broken for libvpx-1.0.0 + +diff -up xulrunner-10.0/mozilla-beta/configure.in.vpx1.0.0 xulrunner-10.0/mozilla-beta/configure.in +--- xulrunner-10.0/mozilla-beta/configure.in.vpx1.0.0 2012-01-24 02:59:49.000000000 -0500 ++++ xulrunner-10.0/mozilla-beta/configure.in 2012-01-30 13:11:22.303053551 -0500 +@@ -5616,20 +5616,20 @@ if test -n "$MOZ_WEBM"; then + [MOZ_NATIVE_LIBVPX_DEC_TEST=1], + ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])) + if test -n "$MOZ_NATIVE_LIBVPX_DEC_TEST" ; then +- AC_MSG_CHECKING([for libvpx version >= v0.9.7]) +- dnl We need at least v0.9.7 to fix several crash bugs (for which we +- dnl had local patches prior to v0.9.7). ++ AC_MSG_CHECKING([for libvpx version >= v1.0.0]) ++ dnl We need at least v1.0.0 to fix several crash bugs (for which we ++ dnl had local patches prior to v1.0.0). + dnl + dnl This is a terrible test for the library version, but we don't + dnl have a good one. There is no version number in a public header, + dnl and testing the headers still doesn't guarantee we link against + dnl the right version. While we could call vpx_codec_version() at + dnl run-time, that would break cross-compiling. There are no +- dnl additional exported symbols between the v0.9.7 release and the +- dnl v0.9.6 one to check for. ++ dnl additional exported decoder symbols between the v1.0.0 release ++ dnl and the v0.9.7 one to check for. + AC_TRY_COMPILE([ + #include +- #if !defined(VPX_CODEC_USE_INPUT_PARTITION) ++ #if !defined(VPX_CODEC_USE_INPUT_FRAGMENTS) + #error "test failed." + #endif + ], +@@ -5639,7 +5639,7 @@ if test -n "$MOZ_WEBM"; then + MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include" + MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"], + [AC_MSG_RESULT([no]) +- AC_MSG_ERROR([--with-system-libvpx requested but it is not v0.9.7 or later])]) ++ AC_MSG_ERROR([--with-system-libvpx requested but it is not v1.0.0 or later])]) + fi + CFLAGS=$_SAVE_CFLAGS + LDFLAGS=$_SAVE_LDFLAGS +diff -up xulrunner-10.0/mozilla-beta/configure.vpx1.0.0 xulrunner-10.0/mozilla-beta/configure +--- xulrunner-10.0/mozilla-beta/configure.vpx1.0.0 2012-01-30 13:11:47.805847514 -0500 ++++ xulrunner-10.0/mozilla-beta/configure 2012-01-30 13:14:07.818716354 -0500 +@@ -17727,14 +17727,14 @@ else + fi + + if test -n "$MOZ_NATIVE_LIBVPX_DEC_TEST" ; then +- echo $ac_n "checking for libvpx version >= v0.9.7""... $ac_c" 1>&6 +-echo "configure:17732: checking for libvpx version >= v0.9.7" >&5 ++ echo $ac_n "checking for libvpx version >= v1.0.0""... $ac_c" 1>&6 ++echo "configure:17732: checking for libvpx version >= v1.0.0" >&5 + cat > conftest.$ac_ext < +- #if !defined(VPX_CODEC_USE_INPUT_PARTITION) ++ #if !defined(VPX_CODEC_USE_INPUT_FRAGMENTS) + #error "test failed." + #endif + +@@ -17753,7 +17753,7 @@ else + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +- { echo "configure: error: --with-system-libvpx requested but it is not v0.9.7 or later" 1>&2; exit 1; } ++ { echo "configure: error: --with-system-libvpx requested but it is not v1.0.0 or later" 1>&2; exit 1; } + fi + rm -f conftest* + fi diff --git a/mozilla-724615.patch b/mozilla-724615.patch new file mode 100644 index 0000000..cc78c1b --- /dev/null +++ b/mozilla-724615.patch @@ -0,0 +1,24 @@ +# HG changeset patch +# Parent 6292e55419d1730a2e88a56fd30b2440ce0b393a +# User Raúl Porcel +Bug XXXXXX - Fix TARGET_CPU usage on ARM + + +diff --git a/xpcom/glue/objs.mk b/xpcom/glue/objs.mk +--- a/xpcom/glue/objs.mk ++++ b/xpcom/glue/objs.mk +@@ -71,13 +71,13 @@ XPCOM_GLUENS_SRC_LCPPSRCS = \ + SSE.cpp \ + unused.cpp \ + nsProxyRelease.cpp \ + nsTextFormatter.cpp \ + GenericFactory.cpp \ + FileUtils.cpp \ + $(NULL) + +-ifeq (arm,$(TARGET_CPU)) ++ifneq (,$(filter arm%,$(TARGET_CPU))) + XPCOM_GLUENS_SRC_LCPPSRCS += arm.cpp + endif + + XPCOM_GLUENS_SRC_CPPSRCS = $(addprefix $(topsrcdir)/xpcom/glue/,$(XPCOM_GLUENS_SRC_LCPPSRCS)) diff --git a/mozilla-727401.patch b/mozilla-727401.patch new file mode 100644 index 0000000..df7ff6d --- /dev/null +++ b/mozilla-727401.patch @@ -0,0 +1,38 @@ +# HG changeset patch +# User Benjamin Smedberg +# Date 1329314881 18000 +# Node ID 355163c56ea5ad5037ac6da754252aaea67d2217 +# Parent 81f6b9cbb2a92ac08d1ccc0c1b44d6a5c28f6e2a +Bug 727401 - import libpng overflow patch from http://codereview.chromium.org/9363013 + +diff --git a/media/libpng/pngrutil.c b/media/libpng/pngrutil.c +--- a/media/libpng/pngrutil.c ++++ b/media/libpng/pngrutil.c +@@ -396,18 +396,25 @@ png_decompress_chunk(png_structp png_ptr + #if defined(PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED) || \ + defined(PNG_USER_CHUNK_MALLOC_MAX) + else + #endif + if (expanded_size > 0) + { + /* Success (maybe) - really uncompress the chunk. */ + png_size_t new_size = 0; +- png_charp text = png_malloc_warn(png_ptr, +- prefix_size + expanded_size + 1); ++ png_charp text = NULL; ++ /* Need to check for both truncation (64-bit platforms) and integer ++ * overflow. ++ */ ++ if (prefix_size + expanded_size > prefix_size && ++ prefix_size + expanded_size < 0xffffffffU) ++ { ++ text = png_malloc_warn(png_ptr, prefix_size + expanded_size + 1); ++ } + + if (text != NULL) + { + png_memcpy(text, png_ptr->chunkdata, prefix_size); + new_size = png_inflate(png_ptr, + (png_bytep)(png_ptr->chunkdata + prefix_size), + chunklength - prefix_size, + (png_bytep)(text + prefix_size), expanded_size); diff --git a/mozilla-build.patch b/mozilla-build.patch new file mode 100644 index 0000000..065ca9f --- /dev/null +++ b/mozilla-build.patch @@ -0,0 +1,23 @@ +diff -up xulrunner-1.9.3.0/mozilla-central/security/manager/Makefile.in.build xulrunner-1.9.3.0/mozilla-central/security/manager/Makefile.in +--- xulrunner-1.9.3.0/mozilla-central/security/manager/Makefile.in.build 2010-08-06 03:09:27.000000000 +0200 ++++ xulrunner-1.9.3.0/mozilla-central/security/manager/Makefile.in 2010-08-16 10:49:10.000000000 +0200 +@@ -181,7 +181,6 @@ DEFAULT_GMAKE_FLAGS += NSPR_INCLUDE_DIR= + DEFAULT_GMAKE_FLAGS += NSPR_LIB_DIR=$(NSPR_LIB_DIR) + DEFAULT_GMAKE_FLAGS += MOZILLA_CLIENT=1 + DEFAULT_GMAKE_FLAGS += NO_MDUPDATE=1 +-DEFAULT_GMAKE_FLAGS += NSS_ENABLE_ECC=1 + DEFAULT_GMAKE_FLAGS += NSINSTALL="$(NSINSTALL)" + ifndef MOZ_NATIVE_SQLITE + DEFAULT_GMAKE_FLAGS += SQLITE_LIB_NAME=mozsqlite3 +diff -up xulrunner-1.9.3.0/mozilla-central/security/manager/ssl/src/Makefile.in.build xulrunner-1.9.3.0/mozilla-central/security/manager/ssl/src/Makefile.in +--- xulrunner-1.9.3.0/mozilla-central/security/manager/ssl/src/Makefile.in.build 2010-08-06 03:09:17.000000000 +0200 ++++ xulrunner-1.9.3.0/mozilla-central/security/manager/ssl/src/Makefile.in 2010-08-16 10:46:22.000000000 +0200 +@@ -113,8 +113,6 @@ CSRCS += md4.c + + EXTRA_DEPS = $(NSS_DEP_LIBS) + +-DEFINES += -DNSS_ENABLE_ECC +- + # Use local includes because they are inserted before INCLUDES + # so that Mozilla's nss.h is used, not glibc's + LOCAL_INCLUDES += $(NSS_CFLAGS) diff --git a/mozilla-file.patch b/mozilla-file.patch new file mode 100644 index 0000000..14b0182 --- /dev/null +++ b/mozilla-file.patch @@ -0,0 +1,26 @@ +diff -up mozilla-beta/ipc/chromium/src/base/file_util_linux.cc.file mozilla-beta/ipc/chromium/src/base/file_util_linux.cc +--- mozilla-beta/ipc/chromium/src/base/file_util_linux.cc.file 2012-01-24 09:00:00.000000000 +0100 ++++ mozilla-beta/ipc/chromium/src/base/file_util_linux.cc 2012-01-25 15:30:43.707796295 +0100 +@@ -5,6 +5,9 @@ + #include "base/file_util.h" + + #include ++#if defined(ANDROID) || defined(OS_POSIX) ++#include ++#endif + + #include + #include +diff -up mozilla-beta/ipc/chromium/src/base/message_pump_libevent.cc.file mozilla-beta/ipc/chromium/src/base/message_pump_libevent.cc +--- mozilla-beta/ipc/chromium/src/base/message_pump_libevent.cc.file 2012-01-24 09:00:00.000000000 +0100 ++++ mozilla-beta/ipc/chromium/src/base/message_pump_libevent.cc 2012-01-25 15:13:11.947771212 +0100 +@@ -6,6 +6,9 @@ + + #include + #include ++#if defined(ANDROID) || defined(OS_POSIX) ++#include ++#endif + + #include "eintr_wrapper.h" + #include "base/logging.h" diff --git a/sources b/sources new file mode 100644 index 0000000..0c40318 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +265c53120fd923c742164b0002ebbf6c xulrunner-10.0.1.source.tar.bz2 diff --git a/wmclass.patch b/wmclass.patch new file mode 100644 index 0000000..5fe76ac --- /dev/null +++ b/wmclass.patch @@ -0,0 +1,29 @@ +# +# Online Desktop expects WMCLASS to match the .desktop file +# Since renaming the .desktop file is bad, work around this here +# + +diff -up ./widget/src/gtk2/nsWindow.cpp.wmclass ./widget/src/gtk2/nsWindow.cpp +--- ./widget/src/gtk2/nsWindow.cpp.wmclass 2010-10-25 11:33:21.649433261 -0700 ++++ ./widget/src/gtk2/nsWindow.cpp 2010-10-25 11:36:19.864431870 -0700 +@@ -3738,6 +3738,10 @@ nsWindow::Create(nsIWidget *aPare + GetBrandName(brandName); + NS_ConvertUTF16toUTF8 cBrand(brandName); + ++ if (brandName.EqualsLiteral("Minefield")) { ++ cBrand.Assign("Firefox"); ++ } ++ + if (mWindowType == eWindowType_dialog) { + mShell = gtk_window_new(GTK_WINDOW_TOPLEVEL); + SetDefaultIcon(); +@@ -4109,6 +4113,9 @@ nsWindow::SetWindowClass(const nsAString + #ifdef MOZ_X11 + nsXPIDLString brandName; + GetBrandName(brandName); ++ if (brandName.EqualsLiteral("Minefield")) { ++ brandName.AssignLiteral("Firefox"); ++ } + + XClassHint *class_hint = XAllocClassHint(); + if (!class_hint) diff --git a/xulrunner-10.0-gcc47.patch b/xulrunner-10.0-gcc47.patch new file mode 100644 index 0000000..91a948a --- /dev/null +++ b/xulrunner-10.0-gcc47.patch @@ -0,0 +1,25 @@ +diff -up mozilla-beta/ipc/chromium/src/base/time_posix.cc.gcc47 mozilla-beta/ipc/chromium/src/base/time_posix.cc +--- mozilla-beta/ipc/chromium/src/base/time_posix.cc.gcc47 2012-01-24 03:00:00.000000000 -0500 ++++ mozilla-beta/ipc/chromium/src/base/time_posix.cc 2012-01-30 14:12:49.198472212 -0500 +@@ -14,6 +14,8 @@ + #include + #endif + ++#include ++ + #include + + #include "base/basictypes.h" +diff -up mozilla-beta/toolkit/crashreporter/client/Makefile.in.gcc47 mozilla-beta/toolkit/crashreporter/client/Makefile.in +--- mozilla-beta/toolkit/crashreporter/client/Makefile.in.gcc47 2012-01-30 14:41:14.475441039 -0500 ++++ mozilla-beta/toolkit/crashreporter/client/Makefile.in 2012-01-30 14:43:03.587646656 -0500 +@@ -69,6 +69,9 @@ CPPSRCS = \ + $(STDCXX_COMPAT) \ + $(NULL) + ++# Needed for moz_free ++LIBS += -L$(LIBXUL_DIST)/lib -lmozalloc ++ + ifeq ($(OS_ARCH),WINNT) + CPPSRCS += crashreporter_win.cpp + LIBS += \ diff --git a/xulrunner-2.0-chromium-types.patch b/xulrunner-2.0-chromium-types.patch new file mode 100644 index 0000000..dfc82cc --- /dev/null +++ b/xulrunner-2.0-chromium-types.patch @@ -0,0 +1,33 @@ +Bug 627669 - add support for s390(x) and ppc(64) + +diff -up mozilla-release/gfx/ycbcr/chromium_types.h.chromium-types mozilla-release/gfx/ycbcr/chromium_types.h +--- mozilla-release/gfx/ycbcr/chromium_types.h.chromium-types 2011-06-15 23:57:26.000000000 +0200 ++++ mozilla-release/gfx/ycbcr/chromium_types.h 2011-06-30 10:04:25.105032221 +0200 +@@ -61,7 +61,11 @@ typedef PRInt16 int16; + #define ARCH_CPU_ARM_FAMILY 1 + #define ARCH_CPU_ARMEL 1 + #define ARCH_CPU_32_BITS 1 +-#elif defined(__ppc__) || defined(__powerpc) || defined(__PPC__) ++#elif defined(__ppc64__) || defined(__powerpc64__) ++#define ARCH_CPU_PPC_FAMILY 1 ++#define ARCH_CPU_PPC 1 ++#define ARCH_CPU_64_BITS 1 ++#elif defined(__ppc__) || defined(__powerpc__) || defined(__PPC__) + #define ARCH_CPU_PPC_FAMILY 1 + #define ARCH_CPU_PPC 1 + #define ARCH_CPU_32_BITS 1 +@@ -73,6 +77,14 @@ typedef PRInt16 int16; + #define ARCH_CPU_SPARC_FAMILY 1 + #define ARCH_CPU_SPARC 1 + #define ARCH_CPU_64_BITS 1 ++#elif defined(__s390x__) ++#define ARCH_CPU_S390_FAMILY 1 ++#define ARCH_CPU_S390 1 ++#define ARCH_CPU_64_BITS 1 ++#elif defined(__s390__) ++#define ARCH_CPU_S390_FAMILY 1 ++#define ARCH_CPU_S390 1 ++#define ARCH_CPU_32_BITS 1 + #else + #warning Please add support for your architecture in chromium_types.h + #endif diff --git a/xulrunner-8.0-fix-maemo-checks-in-npapi.patch b/xulrunner-8.0-fix-maemo-checks-in-npapi.patch new file mode 100644 index 0000000..99c9b7f --- /dev/null +++ b/xulrunner-8.0-fix-maemo-checks-in-npapi.patch @@ -0,0 +1,21 @@ +diff -up mozilla-release/dom/plugins/base/npapi.h.BAD mozilla-release/dom/plugins/base/npapi.h +--- mozilla-release/dom/plugins/base/npapi.h.BAD 2011-12-06 13:31:16.364405916 -0500 ++++ mozilla-release/dom/plugins/base/npapi.h 2011-12-06 13:31:47.131109006 -0500 +@@ -379,7 +379,7 @@ typedef enum { + , NPPVpluginCoreAnimationLayer = 1003 + #endif + +-#if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6) ++#if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)) + , NPPVpluginWindowlessLocalBool = 2002 + #endif + } NPPVariable; +@@ -432,7 +432,7 @@ typedef enum { + , NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports + CA model compositing */ + #endif +-#if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6) ++#if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)) + , NPNVSupportsWindowlessLocal = 2002 + #endif + } NPNVariable; diff --git a/xulrunner-9.0-secondary-build-fix.patch b/xulrunner-9.0-secondary-build-fix.patch new file mode 100644 index 0000000..fc1c1db --- /dev/null +++ b/xulrunner-9.0-secondary-build-fix.patch @@ -0,0 +1,11 @@ +diff -up xulrunner-9.0.1/mozilla-release/js/src/jscompartment.cpp.orig xulrunner-9.0.1/mozilla-release/js/src/jscompartment.cpp +--- xulrunner-9.0.1/mozilla-release/js/src/jscompartment.cpp.orig 2012-01-04 11:06:39.000000000 +0100 ++++ xulrunner-9.0.1/mozilla-release/js/src/jscompartment.cpp 2012-01-04 11:06:43.000000000 +0100 +@@ -50,7 +50,6 @@ + #include "jswatchpoint.h" + #include "jswrapper.h" + #include "assembler/wtf/Platform.h" +-#include "assembler/jit/ExecutableAllocator.h" + #include "yarr/BumpPointerAllocator.h" + #include "methodjit/MethodJIT.h" + #include "methodjit/PolyIC.h" diff --git a/xulrunner-mozconfig b/xulrunner-mozconfig new file mode 100644 index 0000000..3ec51d2 --- /dev/null +++ b/xulrunner-mozconfig @@ -0,0 +1,48 @@ +. $topsrcdir/xulrunner/config/mozconfig +# --with-system-png is disabled because Mozilla requires APNG support in libpng +#ac_add_options --with-system-png + +ac_add_options --prefix="$PREFIX" +ac_add_options --libdir="$LIBDIR" +ac_add_options --with-system-nspr +ac_add_options --with-system-nss +ac_add_options --with-system-jpeg +ac_add_options --with-system-zlib +ac_add_options --with-system-bz2 +ac_add_options --with-system-libvpx +ac_add_options --enable-system-hunspell +ac_add_options --enable-system-cairo +ac_add_options --with-pthreads +ac_add_options --disable-strip +ac_add_options --disable-tests +ac_add_options --disable-mochitest +ac_add_options --disable-installer +ac_add_options --disable-debug +ac_add_options --enable-optimize +ac_add_options --enable-xinerama +ac_add_options --enable-default-toolkit=cairo-gtk2 +ac_add_options --enable-pango +ac_add_options --enable-svg +ac_add_options --enable-canvas +ac_add_options --disable-javaxpcom +ac_add_options --disable-crashreporter +ac_add_options --enable-safe-browsing +ac_add_options --enable-extensions=default +ac_add_options --enable-libnotify +ac_add_options --disable-necko-wifi +ac_add_options --enable-startup-notification +ac_add_options --disable-cpp-exceptions +ac_add_options --enable-shared-js +ac_add_options --enable-url-classifier +ac_add_options --enable-gio +ac_add_options --disable-gnomevfs +ac_add_options --disable-updater +ac_add_options --enable-chrome-format=omni + +export BUILD_OFFICIAL=1 +export MOZILLA_OFFICIAL=1 +export MOZ_UA_BUILDID=20100101 + +mk_add_options BUILD_OFFICIAL=1 +mk_add_options MOZILLA_OFFICIAL=1 +mk_add_options MOZ_OBJDIR=@TOPSRCDIR@ diff --git a/xulrunner-mozconfig-debuginfo b/xulrunner-mozconfig-debuginfo new file mode 100644 index 0000000..4dd2427 --- /dev/null +++ b/xulrunner-mozconfig-debuginfo @@ -0,0 +1,5 @@ +# For mozilla's debuginfo: +export CFLAGS="$CFLAGS -gdwarf-2" +export CXXFLAGS="$CXXFLAGS -gdwarf-2" +export MOZ_DEBUG_SYMBOLS=1 +ac_add_options --enable-crashreporter diff --git a/xulrunner-omnijar-5.patch b/xulrunner-omnijar-5.patch new file mode 100644 index 0000000..4cf2ac2 --- /dev/null +++ b/xulrunner-omnijar-5.patch @@ -0,0 +1,1324 @@ +# HG changeset patch +# Parent a7dea879b4b445a23186f438900562155bb39e99 +Bug 620931 part 1 - Use chrome manifest to register resource://gre-resources/ + +diff -up xulrunner-5.0/mozilla-release/browser/locales/Makefile.in.omnijar xulrunner-5.0/mozilla-release/browser/locales/Makefile.in +--- xulrunner-5.0/mozilla-release/browser/locales/Makefile.in.omnijar 2011-06-15 23:57:18.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/browser/locales/Makefile.in 2011-06-21 13:16:56.434904620 +0200 +@@ -186,7 +186,7 @@ libs-%: + @$(MAKE) -C ../../toolkit/locales libs-$* BOTH_MANIFESTS=1 + @$(MAKE) -C ../../services/sync/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1 + @$(MAKE) -C ../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1 +- @$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=defaults/pref BOTH_MANIFESTS=1 ++ @$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=$(PREF_DIR) BOTH_MANIFESTS=1 + @$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1 + + +diff -up xulrunner-5.0/mozilla-release/ipc/glue/GeckoChildProcessHost.cpp.omnijar xulrunner-5.0/mozilla-release/ipc/glue/GeckoChildProcessHost.cpp +--- xulrunner-5.0/mozilla-release/ipc/glue/GeckoChildProcessHost.cpp.omnijar 2011-06-15 23:57:27.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/ipc/glue/GeckoChildProcessHost.cpp 2011-06-21 12:46:33.537167186 +0200 +@@ -492,16 +492,19 @@ GeckoChildProcessHost::PerformAsyncLaunc + + childArgv.insert(childArgv.end(), aExtraOpts.begin(), aExtraOpts.end()); + +-#ifdef MOZ_OMNIJAR + // Make sure the child process can find the omnijar + // See XRE_InitCommandLine in nsAppRunner.cpp +- nsCAutoString omnijarPath; +- if (mozilla::OmnijarPath()) { +- mozilla::OmnijarPath()->GetNativePath(omnijarPath); +- childArgv.push_back("-omnijar"); +- childArgv.push_back(omnijarPath.get()); ++ nsCAutoString path; ++ nsCOMPtr file = mozilla::Omnijar::GetBase(mozilla::Omnijar::GRE); ++ if (file && NS_SUCCEEDED(file->GetNativePath(path))) { ++ childArgv.push_back("-grebase"); ++ childArgv.push_back(path.get()); ++ } ++ file = mozilla::Omnijar::GetBase(mozilla::Omnijar::APP); ++ if (file && NS_SUCCEEDED(file->GetNativePath(path))) { ++ childArgv.push_back("-appbase"); ++ childArgv.push_back(path.get()); + } +-#endif + + childArgv.push_back(pidstring); + +@@ -604,16 +607,19 @@ GeckoChildProcessHost::PerformAsyncLaunc + + cmdLine.AppendLooseValue(std::wstring(mGroupId.get())); + +-#ifdef MOZ_OMNIJAR + // Make sure the child process can find the omnijar + // See XRE_InitCommandLine in nsAppRunner.cpp +- nsAutoString omnijarPath; +- if (mozilla::OmnijarPath()) { +- mozilla::OmnijarPath()->GetPath(omnijarPath); +- cmdLine.AppendLooseValue(UTF8ToWide("-omnijar")); +- cmdLine.AppendLooseValue(omnijarPath.get()); ++ nsAutoString path; ++ nsCOMPtr file = mozilla::Omnijar::GetBase(mozilla::Omnijar::GRE); ++ if (file && NS_SUCCEEDED(file->GetPath(path))) { ++ cmdLine.AppendLooseValue(UTF8ToWide("-grebase")); ++ cmdLine.AppendLooseValue(path.get()); ++ } ++ file = mozilla::Omnijar::GetBase(mozilla::Omnijar::APP); ++ if (file && NS_SUCCEEDED(file->GetPath(path))) { ++ cmdLine.AppendLooseValue(UTF8ToWide("-appbase")); ++ cmdLine.AppendLooseValue(path.get()); + } +-#endif + + cmdLine.AppendLooseValue(UTF8ToWide(pidstring)); + +diff -up xulrunner-5.0/mozilla-release/js/src/xpconnect/loader/mozJSComponentLoader.cpp.omnijar xulrunner-5.0/mozilla-release/js/src/xpconnect/loader/mozJSComponentLoader.cpp +--- xulrunner-5.0/mozilla-release/js/src/xpconnect/loader/mozJSComponentLoader.cpp.omnijar 2011-06-15 23:57:31.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/js/src/xpconnect/loader/mozJSComponentLoader.cpp 2011-06-21 13:34:03.057293901 +0200 +@@ -86,6 +86,7 @@ + #include "nsILocalFileWin.h" + #endif + #include "xpcprivate.h" ++#include "nsIResProtocolHandler.h" + + #ifdef MOZ_ENABLE_LIBXUL + #include "mozilla/scache/StartupCache.h" +@@ -626,24 +627,11 @@ mozJSComponentLoader::LoadModuleFromJAR( + #if !defined(XPCONNECT_STANDALONE) + nsresult rv; + +- nsCAutoString fullSpec; +- +-#ifdef MOZ_OMNIJAR +- PRBool equal; +- rv = aJarFile->Equals(mozilla::OmnijarPath(), &equal); +- if (NS_SUCCEEDED(rv) && equal) { +- fullSpec = "resource://gre/"; +- } else { +-#endif +- nsCAutoString fileSpec; +- NS_GetURLSpecFromActualFile(aJarFile, fileSpec); +- fullSpec = "jar:"; +- fullSpec += fileSpec; +- fullSpec += "!/"; +-#ifdef MOZ_OMNIJAR +- } +-#endif +- ++ nsCAutoString fullSpec, fileSpec; ++ NS_GetURLSpecFromActualFile(aJarFile, fileSpec); ++ fullSpec = "jar:"; ++ fullSpec += fileSpec; ++ fullSpec += "!/"; + fullSpec += aComponentPath; + + nsCOMPtr uri; +@@ -827,47 +815,129 @@ class JSPrincipalsHolder + JSPrincipals *mPrincipals; + }; + ++static const char baseName[2][5] = { "gre/", "app/" }; ++ ++static inline PRBool ++canonicalizeBase(nsCAutoString &spec, nsACString &out, mozilla::Omnijar::Type aType) ++{ ++ nsCAutoString base; ++ nsresult rv = mozilla::Omnijar::GetURIString(aType, base); ++ ++ if (NS_FAILED(rv) || !base.Length()) ++ return PR_FALSE; ++ ++ if (base.Compare(spec.get(), PR_FALSE, base.Length())) ++ return PR_FALSE; ++ ++ out.Append("/resource/"); ++ out.Append(baseName[aType]); ++ out.Append(Substring(spec, base.Length())); ++ return PR_TRUE; ++} ++ + /** + * PathifyURI transforms mozilla .js uris into useful zip paths + * to make it makes it easier to manipulate startup cache entries + * using standard zip tools. + * Transformations applied: +- * * jsloader/ prefix is used to group mozJSComponentLoader cache entries in ++ * * jsloader/ prefix is used to group mozJSComponentLoader cache entries in + * a top-level zip directory. +- * * In MOZ_OMNIJAR case resource:/// and resource://gre/ URIs refer to the same path +- * so treat both of them as resource://gre/ ++ * * resource:// URIs are resolved to their corresponding file/jar URI to ++ * canonicalize resources URIs other than gre and app. ++ * * Paths under GRE or APP directory have their base path replaced with ++ * resource/gre or resource/app to avoid depending on install location. ++ * * jar:file:///path/to/file.jar!/sub/path urls are replaced with ++ * /path/to/file.jar/sub/path + * * .bin suffix is added to the end of the path to indicate that jsloader/ entries + * are binary representations of JS source. + * For example: +- * resource://gre/modules/XPCOMUtils.jsm becomes +- * jsloader/resource/gre/modules/XPCOMUtils.jsm.bin ++ * resource://gre/modules/XPCOMUtils.jsm or ++ * file://$GRE_DIR/modules/XPCOMUtils.jsm or ++ * jar:file://$GRE_DIR/omni.jar!/modules/XPCOMUtils.jsm become ++ * jsloader/resource/gre/modules/XPCOMUtils.jsm.bin ++ * file://$PROFILE_DIR/extensions/{uuid}/components/component.js becomes ++ * jsloader/$PROFILE_DIR/extensions/%7Buuid%7D/components/component.js.bin ++ * jar:file://$PROFILE_DIR/extensions/some.xpi!/components/component.js becomes ++ * jsloader/$PROFILE_DIR/extensions/some.xpi/components/component.js.bin + */ + static nsresult + PathifyURI(nsIURI *in, nsACString &out) + { +- out = "jsloader/"; +- nsCAutoString scheme; +- nsresult rv = in->GetScheme(scheme); +- NS_ENSURE_SUCCESS(rv, rv); +- out.Append(scheme); +- nsCAutoString host; +- // OK for GetHost to fail since it's not implemented sometimes +- in->GetHost(host); +-#ifdef MOZ_OMNIJAR +- if (scheme.Equals("resource") && host.Length() == 0){ +- host = "gre"; +- } +-#endif +- if (host.Length()) { +- out.Append("/"); +- out.Append(host); +- } +- nsCAutoString path; +- rv = in->GetPath(path); +- NS_ENSURE_SUCCESS(rv, rv); +- out.Append(path); +- out.Append(".bin"); +- return NS_OK; ++ PRBool equals; ++ nsresult rv; ++ nsCOMPtr uri = in; ++ nsCAutoString spec; ++ ++ out = "jsloader"; ++ ++ // Resolve resource:// URIs. At the end of this if/else block, we ++ // have both spec and uri variables identifying the same URI. ++ if (NS_SUCCEEDED(in->SchemeIs("resource", &equals)) && equals) { ++ nsCOMPtr ioService = do_GetIOService(&rv); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ nsCOMPtr ph; ++ rv = ioService->GetProtocolHandler("resource", getter_AddRefs(ph)); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ nsCOMPtr irph(do_QueryInterface(ph, &rv)); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ rv = irph->ResolveURI(in, spec); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ rv = ioService->NewURI(spec, nsnull, nsnull, getter_AddRefs(uri)); ++ NS_ENSURE_SUCCESS(rv, rv); ++ } else { ++ rv = in->GetSpec(spec); ++ NS_ENSURE_SUCCESS(rv, rv); ++ } ++ ++ if (!canonicalizeBase(spec, out, mozilla::Omnijar::GRE) && ++ !canonicalizeBase(spec, out, mozilla::Omnijar::APP)) { ++ if (NS_SUCCEEDED(uri->SchemeIs("file", &equals)) && equals) { ++ nsCOMPtr baseFileURL; ++ baseFileURL = do_QueryInterface(uri, &rv); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ nsCAutoString path; ++ rv = baseFileURL->GetPath(path); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ out.Append(path); ++ } else if (NS_SUCCEEDED(uri->SchemeIs("jar", &equals)) && equals) { ++ nsCOMPtr jarURI = do_QueryInterface(uri, &rv); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ nsCOMPtr jarFileURI; ++ rv = jarURI->GetJARFile(getter_AddRefs(jarFileURI)); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ nsCOMPtr jarFileURL; ++ jarFileURL = do_QueryInterface(jarFileURI, &rv); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ nsCAutoString path; ++ rv = jarFileURL->GetPath(path); ++ NS_ENSURE_SUCCESS(rv, rv); ++ out.Append(path); ++ ++ rv = jarURI->GetJAREntry(path); ++ NS_ENSURE_SUCCESS(rv, rv); ++ out.Append("/"); ++ out.Append(path); ++ } else { // Very unlikely ++ nsCAutoString spec; ++ rv = uri->GetSpec(spec); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ out.Append("/"); ++ out.Append(spec); ++ } ++ } ++ ++ out.Append(".bin"); ++ return NS_OK; + } + + /* static */ +diff -up xulrunner-5.0/mozilla-release/layout/style/jar.mn.omnijar xulrunner-5.0/mozilla-release/layout/style/jar.mn +--- xulrunner-5.0/mozilla-release/layout/style/jar.mn.omnijar 2011-06-15 23:57:39.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/layout/style/jar.mn 2011-06-21 12:46:33.530167305 +0200 +@@ -6,3 +6,5 @@ toolkit.jar: + * res/forms.css (forms.css) + res/arrow.gif (arrow.gif) + res/arrowd.gif (arrowd.gif) ++ ++% resource gre-resources %res/ +diff -up xulrunner-5.0/mozilla-release/modules/libjar/nsJAR.cpp.omnijar xulrunner-5.0/mozilla-release/modules/libjar/nsJAR.cpp +--- xulrunner-5.0/mozilla-release/modules/libjar/nsJAR.cpp.omnijar 2011-06-15 23:58:10.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/modules/libjar/nsJAR.cpp 2011-06-21 13:23:23.829895163 +0200 +@@ -177,16 +177,14 @@ nsJAR::Open(nsIFile* zipFile) + mOuterZipEntry.Truncate(); + mOpened = PR_TRUE; + +-#ifdef MOZ_OMNIJAR + // The omnijar is special, it is opened early on and closed late + // this avoids reopening it +- PRBool equals; +- nsresult rv = zipFile->Equals(mozilla::OmnijarPath(), &equals); +- if (NS_SUCCEEDED(rv) && equals) { +- mZip = mozilla::OmnijarReader(); ++ nsZipArchive *zip = mozilla::Omnijar::GetReader(zipFile); ++ if (zip) { ++ mZip = zip; + return NS_OK; + } +-#endif ++ + return mZip->OpenArchive(zipFile); + } + +@@ -235,13 +233,13 @@ nsJAR::Close() + mGlobalStatus = JAR_MANIFEST_NOT_PARSED; + mTotalItemsInManifest = 0; + +-#ifdef MOZ_OMNIJAR +- if (mZip == mozilla::OmnijarReader()) { ++ if ((mZip == mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE)) || ++ (mZip == mozilla::Omnijar::GetReader(mozilla::Omnijar::APP))) { + mZip.forget(); + mZip = new nsZipArchive(); + return NS_OK; + } +-#endif ++ + return mZip->CloseArchive(); + } + +@@ -392,12 +390,11 @@ nsJAR::GetCertificatePrincipal(const cha + return NS_ERROR_NULL_POINTER; + *aPrincipal = nsnull; + +-#ifdef MOZ_OMNIJAR + // Don't check signatures in the omnijar - this is only + // interesting for extensions/XPIs. +- if (mZip == mozilla::OmnijarReader()) ++ if ((mZip == mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE)) || ++ (mZip == mozilla::Omnijar::GetReader(mozilla::Omnijar::APP))) + return NS_OK; +-#endif + + //-- Parse the manifest + nsresult rv = ParseManifest(); +diff -up xulrunner-5.0/mozilla-release/modules/libpref/src/nsPrefService.cpp.omnijar xulrunner-5.0/mozilla-release/modules/libpref/src/nsPrefService.cpp +--- xulrunner-5.0/mozilla-release/modules/libpref/src/nsPrefService.cpp.omnijar 2011-06-15 23:57:41.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/modules/libpref/src/nsPrefService.cpp 2011-06-21 12:46:33.545167043 +0200 +@@ -70,10 +70,8 @@ + + #include "nsITimelineService.h" + +-#ifdef MOZ_OMNIJAR + #include "mozilla/Omnijar.h" + #include "nsZipArchive.h" +-#endif + + // Definitions + #define INITIAL_PREF_FILES 10 +@@ -784,30 +782,6 @@ static nsresult pref_LoadPrefsInDirList( + return NS_OK; + } + +-//---------------------------------------------------------------------------------------- +-// Initialize default preference JavaScript buffers from +-// appropriate TEXT resources +-//---------------------------------------------------------------------------------------- +-static nsresult pref_InitDefaults() +-{ +- nsCOMPtr greprefsFile; +- nsresult rv; +- +- rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(greprefsFile)); +- NS_ENSURE_SUCCESS(rv, rv); +- +- rv = greprefsFile->AppendNative(NS_LITERAL_CSTRING("greprefs.js")); +- NS_ENSURE_SUCCESS(rv, rv); +- +- rv = openPrefFile(greprefsFile); +- if (NS_FAILED(rv)) { +- NS_WARNING("Error parsing GRE default preferences. Is this an old-style embedding app?"); +- } +- +- return NS_OK; +-} +- +-#ifdef MOZ_OMNIJAR + static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name) + { + nsZipItemPtr manifest(jarReader, name, true); +@@ -821,77 +795,121 @@ static nsresult pref_ReadPrefFromJar(nsZ + return rv; + } + +-static nsresult pref_InitAppDefaultsFromOmnijar() ++//---------------------------------------------------------------------------------------- ++// Initialize default preference JavaScript buffers from ++// appropriate TEXT resources ++//---------------------------------------------------------------------------------------- ++static nsresult pref_InitInitialObjects() + { + nsresult rv; + +- nsZipArchive* jarReader = mozilla::OmnijarReader(); +- if (!jarReader) +- return pref_InitDefaults(); +- +- rv = pref_ReadPrefFromJar(jarReader, "greprefs.js"); +- NS_ENSURE_SUCCESS(rv, rv); ++ // In omni.jar case, we load the following prefs: ++ // - jar:$gre/omni.jar!/greprefs.js ++ // - jar:$gre/omni.jar!/defaults/pref/*.js ++ // In non omni.jar case, we load: ++ // - $gre/greprefs.js ++ // ++ // When $app == $gre, we additionally load, in all cases: ++ // - $gre/defaults/pref/*.js ++ // This is kept for bug 591866 (channel-prefs.js should not be in omni.jar). ++ // We load all files instead of channel-prefs.js only to have the same ++ // behaviour as $app != $gre. ++ // ++ // When $app != $gre, we additionally load, in omni.jar case: ++ // - jar:$app/omni.jar!/defaults/preferences/*.js ++ // - $app/defaults/preferences/*.js ++ // and in non omni.jar case: ++ // - $app/defaults/preferences/*.js + + nsZipFind *findPtr; +- rv = jarReader->FindInit("defaults/pref/*.js$", &findPtr); +- NS_ENSURE_SUCCESS(rv, rv); +- +- nsAutoPtr find(findPtr); +- ++ nsAutoPtr find; + nsTArray prefEntries; + const char *entryName; + PRUint16 entryNameLen; +- while (NS_SUCCEEDED(find->FindNext(&entryName, &entryNameLen))) { +- prefEntries.AppendElement(Substring(entryName, entryName + entryNameLen)); +- } + +- prefEntries.Sort(); +- for (PRUint32 i = prefEntries.Length(); i--; ) { +- rv = pref_ReadPrefFromJar(jarReader, prefEntries[i].get()); +- if (NS_FAILED(rv)) +- NS_WARNING("Error parsing preferences."); +- } ++ nsZipArchive* jarReader = mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE); ++ if (jarReader) { ++ // Load jar:$gre/omni.jar!/greprefs.js ++ rv = pref_ReadPrefFromJar(jarReader, "greprefs.js"); ++ NS_ENSURE_SUCCESS(rv, rv); + +- return NS_OK; +-} +-#endif ++ // Load jar:$gre/omni.jar!/defaults/pref/*.js ++ rv = jarReader->FindInit("defaults/pref/*.js$", &findPtr); ++ NS_ENSURE_SUCCESS(rv, rv); + +-static nsresult pref_InitInitialObjects() +-{ +- nsresult rv; ++ find = findPtr; ++ while (NS_SUCCEEDED(find->FindNext(&entryName, &entryNameLen))) { ++ prefEntries.AppendElement(Substring(entryName, entryName + entryNameLen)); ++ } + +- // first we parse the GRE default prefs. This also works if we're not using a GRE, +-#ifdef MOZ_OMNIJAR +- rv = pref_InitAppDefaultsFromOmnijar(); +-#else +- rv = pref_InitDefaults(); +-#endif +- NS_ENSURE_SUCCESS(rv, rv); ++ prefEntries.Sort(); ++ for (PRUint32 i = prefEntries.Length(); i--; ) { ++ rv = pref_ReadPrefFromJar(jarReader, prefEntries[i].get()); ++ if (NS_FAILED(rv)) ++ NS_WARNING("Error parsing preferences."); ++ } ++ } else { ++ // Load $gre/greprefs.js ++ nsCOMPtr greprefsFile; ++ rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(greprefsFile)); ++ NS_ENSURE_SUCCESS(rv, rv); + +- nsCOMPtr defaultPrefDir; +- // now parse the "application" default preferences +- rv = NS_GetSpecialDirectory(NS_APP_PREF_DEFAULTS_50_DIR, getter_AddRefs(defaultPrefDir)); +- NS_ENSURE_SUCCESS(rv, rv); ++ rv = greprefsFile->AppendNative(NS_LITERAL_CSTRING("greprefs.js")); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ rv = openPrefFile(greprefsFile); ++ if (NS_FAILED(rv)) ++ NS_WARNING("Error parsing GRE default preferences. Is this an old-style embedding app?"); ++ } ++ ++ if (!mozilla::Omnijar::HasOmnijar(mozilla::Omnijar::APP)) { ++ // Load $gre/defaults/pref/*.js ++ nsCOMPtr defaultPrefDir; ++ ++ rv = NS_GetSpecialDirectory(NS_APP_PREF_DEFAULTS_50_DIR, getter_AddRefs(defaultPrefDir)); ++ NS_ENSURE_SUCCESS(rv, rv); + +- /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */ +- static const char* specialFiles[] = { ++ /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */ ++ static const char* specialFiles[] = { + #if defined(XP_MAC) || defined(XP_MACOSX) + "macprefs.js" + #elif defined(XP_WIN) + "winpref.js" + #elif defined(XP_UNIX) + "unix.js" +-#if defined(_AIX) ++#if defined(VMS) ++ , "openvms.js" ++#elif defined(_AIX) + , "aix.js" + #endif + #elif defined(XP_OS2) + "os2pref.js" ++#elif defined(XP_BEOS) ++ "beos.js" + #endif +- }; ++ }; + +- rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, NS_ARRAY_LENGTH(specialFiles)); +- if (NS_FAILED(rv)) { +- NS_WARNING("Error parsing application default preferences."); ++ rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, NS_ARRAY_LENGTH(specialFiles)); ++ if (NS_FAILED(rv)) ++ NS_WARNING("Error parsing application default preferences."); ++ } ++ ++ // Load jar:$app/omni.jar!/defaults/preferences/*.js ++ nsZipArchive *appJarReader = mozilla::Omnijar::GetReader(mozilla::Omnijar::APP); ++ if (appJarReader) { ++ rv = appJarReader->FindInit("defaults/preferences/*.js$", &findPtr); ++ NS_ENSURE_SUCCESS(rv, rv); ++ find = findPtr; ++ prefEntries.Clear(); ++ while (NS_SUCCEEDED(find->FindNext(&entryName, &entryNameLen))) { ++ prefEntries.AppendElement(Substring(entryName, entryName + entryNameLen)); ++ } ++ prefEntries.Sort(); ++ for (PRUint32 i = prefEntries.Length(); i--; ) { ++ rv = pref_ReadPrefFromJar(appJarReader, prefEntries[i].get()); ++ if (NS_FAILED(rv)) ++ NS_WARNING("Error parsing preferences."); ++ } + } + + rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST); +diff -up xulrunner-5.0/mozilla-release/netwerk/protocol/res/nsResProtocolHandler.cpp.omnijar xulrunner-5.0/mozilla-release/netwerk/protocol/res/nsResProtocolHandler.cpp +--- xulrunner-5.0/mozilla-release/netwerk/protocol/res/nsResProtocolHandler.cpp.omnijar 2011-06-15 23:57:50.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/netwerk/protocol/res/nsResProtocolHandler.cpp 2011-06-21 13:30:07.167653046 +0200 +@@ -76,8 +76,8 @@ static nsResProtocolHandler *gResHandler + static PRLogModuleInfo *gResLog; + #endif + ++#define kAPP NS_LITERAL_CSTRING("app") + #define kGRE NS_LITERAL_CSTRING("gre") +-#define kGRE_RESOURCES NS_LITERAL_CSTRING("gre-resources") + + //---------------------------------------------------------------------------- + // nsResURL : overrides nsStandardURL::GetFile to provide nsIFile resolution +@@ -155,20 +155,6 @@ nsResProtocolHandler::~nsResProtocolHand + } + + nsresult +-nsResProtocolHandler::AddSpecialDir(const char* aSpecialDir, const nsACString& aSubstitution) +-{ +- nsCOMPtr file; +- nsresult rv = NS_GetSpecialDirectory(aSpecialDir, getter_AddRefs(file)); +- NS_ENSURE_SUCCESS(rv, rv); +- +- nsCOMPtr uri; +- rv = mIOService->NewFileURI(file, getter_AddRefs(uri)); +- NS_ENSURE_SUCCESS(rv, rv); +- +- return SetSubstitution(aSubstitution, uri); +-} +- +-nsresult + nsResProtocolHandler::Init() + { + if (!mSubstitutions.Init(32)) +@@ -179,38 +165,39 @@ nsResProtocolHandler::Init() + mIOService = do_GetIOService(&rv); + NS_ENSURE_SUCCESS(rv, rv); + +-#ifdef MOZ_OMNIJAR +- nsCOMPtr omniJar(mozilla::OmnijarPath()); +- if (omniJar) +- return Init(omniJar); +-#endif ++ nsCAutoString appURI, greURI; ++ rv = mozilla::Omnijar::GetURIString(mozilla::Omnijar::APP, appURI); ++ NS_ENSURE_SUCCESS(rv, rv); ++ rv = mozilla::Omnijar::GetURIString(mozilla::Omnijar::GRE, greURI); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ // ++ // make resource:/// point to the application directory or omnijar ++ // ++ nsCOMPtr uri; ++ rv = NS_NewURI(getter_AddRefs(uri), appURI.Length() ? appURI : greURI); ++ NS_ENSURE_SUCCESS(rv, rv); + +- // these entries should be kept in sync with the omnijar Init function ++ rv = SetSubstitution(EmptyCString(), uri); ++ NS_ENSURE_SUCCESS(rv, rv); + + // +- // make resource:/// point to the application directory ++ // make resource://app/ point to the application directory or omnijar + // +- rv = AddSpecialDir(NS_OS_CURRENT_PROCESS_DIR, EmptyCString()); ++ rv = SetSubstitution(kAPP, uri); + NS_ENSURE_SUCCESS(rv, rv); + + // + // make resource://gre/ point to the GRE directory + // +- rv = AddSpecialDir(NS_GRE_DIR, kGRE); ++ if (appURI.Length()) { // We already have greURI in uri if appURI.Length() is 0. ++ rv = NS_NewURI(getter_AddRefs(uri), greURI); ++ NS_ENSURE_SUCCESS(rv, rv); ++ } ++ ++ rv = SetSubstitution(kGRE, uri); + NS_ENSURE_SUCCESS(rv, rv); + +- // make resource://gre-resources/ point to gre toolkit[.jar]/res +- nsCOMPtr greURI; +- nsCOMPtr greResURI; +- GetSubstitution(kGRE, getter_AddRefs(greURI)); +-#ifdef MOZ_CHROME_FILE_FORMAT_JAR +- NS_NAMED_LITERAL_CSTRING(strGRE_RES_URL, "jar:chrome/toolkit.jar!/res/"); +-#else +- NS_NAMED_LITERAL_CSTRING(strGRE_RES_URL, "chrome/toolkit/res/"); +-#endif +- rv = mIOService->NewURI(strGRE_RES_URL, nsnull, greURI, +- getter_AddRefs(greResURI)); +- SetSubstitution(kGRE_RESOURCES, greResURI); + //XXXbsmedberg Neil wants a resource://pchrome/ for the profile chrome dir... + // but once I finish multiple chrome registration I'm not sure that it is needed + +@@ -220,40 +207,6 @@ nsResProtocolHandler::Init() + return rv; + } + +-#ifdef MOZ_OMNIJAR +-nsresult +-nsResProtocolHandler::Init(nsIFile *aOmniJar) +-{ +- nsresult rv; +- nsCOMPtr uri; +- nsCAutoString omniJarSpec; +- NS_GetURLSpecFromActualFile(aOmniJar, omniJarSpec, mIOService); +- +- nsCAutoString urlStr("jar:"); +- urlStr += omniJarSpec; +- urlStr += "!/"; +- +- rv = mIOService->NewURI(urlStr, nsnull, nsnull, getter_AddRefs(uri)); +- NS_ENSURE_SUCCESS(rv, rv); +- +- // these entries should be kept in sync with the normal Init function +- +- // resource:/// points to jar:omni.jar!/ +- SetSubstitution(EmptyCString(), uri); +- +- // resource://gre/ points to jar:omni.jar!/ +- SetSubstitution(kGRE, uri); +- +- urlStr += "chrome/toolkit/res/"; +- rv = mIOService->NewURI(urlStr, nsnull, nsnull, getter_AddRefs(uri)); +- NS_ENSURE_SUCCESS(rv, rv); +- +- // resource://gre-resources/ points to jar:omni.jar!/chrome/toolkit/res/ +- SetSubstitution(kGRE_RESOURCES, uri); +- return NS_OK; +-} +-#endif +- + static PLDHashOperator + EnumerateSubstitution(const nsACString& aKey, + nsIURI* aURI, +diff -up xulrunner-5.0/mozilla-release/startupcache/StartupCache.cpp.omnijar xulrunner-5.0/mozilla-release/startupcache/StartupCache.cpp +--- xulrunner-5.0/mozilla-release/startupcache/StartupCache.cpp.omnijar 2011-06-15 23:57:54.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/startupcache/StartupCache.cpp 2011-06-21 13:10:46.687518879 +0200 +@@ -250,17 +250,26 @@ StartupCache::GetBuffer(const char* id, + } + } + +-#ifdef MOZ_OMNIJAR +- if (mozilla::OmnijarReader()) { ++ if (mozilla::Omnijar::GetReader(mozilla::Omnijar::APP)) { + // no need to checksum omnijarred entries +- nsZipItemPtr zipItem(mozilla::OmnijarReader(), id); ++ nsZipItemPtr zipItem(mozilla::Omnijar::GetReader(mozilla::Omnijar::APP), id); + if (zipItem) { + *outbuf = zipItem.Forget(); + *length = zipItem.Length(); + return NS_OK; + } + } +-#endif ++ ++ if (mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE)) { ++ // no need to checksum omnijarred entries ++ nsZipItemPtr zipItem(mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE), id); ++ if (zipItem) { ++ *outbuf = zipItem.Forget(); ++ *length = zipItem.Length(); ++ return NS_OK; ++ } ++ } ++ + return NS_ERROR_NOT_AVAILABLE; + } + +diff -up xulrunner-5.0/mozilla-release/toolkit/mozapps/installer/packager.mk.omnijar xulrunner-5.0/mozilla-release/toolkit/mozapps/installer/packager.mk +--- xulrunner-5.0/mozilla-release/toolkit/mozapps/installer/packager.mk.omnijar 2011-06-15 23:58:10.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/toolkit/mozapps/installer/packager.mk 2011-06-21 12:46:33.535167224 +0200 +@@ -397,7 +397,7 @@ OMNIJAR_FILES = \ + + NON_OMNIJAR_FILES += \ + chrome/icons/\* \ +- defaults/pref/channel-prefs.js \ ++ $(PREF_DIR)/channel-prefs.js \ + res/cursors/\* \ + res/MainMenu.nib/\* \ + $(NULL) +diff -up xulrunner-5.0/mozilla-release/toolkit/xre/nsAppRunner.cpp.omnijar xulrunner-5.0/mozilla-release/toolkit/xre/nsAppRunner.cpp +--- xulrunner-5.0/mozilla-release/toolkit/xre/nsAppRunner.cpp.omnijar 2011-06-15 23:57:56.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/toolkit/xre/nsAppRunner.cpp 2011-06-21 13:20:33.307973388 +0200 +@@ -3877,25 +3877,35 @@ XRE_InitCommandLine(int aArgc, char* aAr + delete[] canonArgs; + #endif + +-#ifdef MOZ_OMNIJAR +- const char *omnijarPath = nsnull; +- ArgResult ar = CheckArg("omnijar", PR_FALSE, &omnijarPath); ++ const char *path = nsnull; ++ ArgResult ar = CheckArg("grebase", PR_FALSE, &path); + if (ar == ARG_BAD) { +- PR_fprintf(PR_STDERR, "Error: argument -omnijar requires an omnijar path\n"); ++ PR_fprintf(PR_STDERR, "Error: argument -grebase requires a path argument\n"); + return NS_ERROR_FAILURE; + } + +- if (!omnijarPath) ++ if (!path) + return rv; + +- nsCOMPtr omnijar; +- rv = NS_NewNativeLocalFile(nsDependentCString(omnijarPath), PR_TRUE, +- getter_AddRefs(omnijar)); +- if (NS_SUCCEEDED(rv)) +- mozilla::SetOmnijar(omnijar); +-#endif ++ nsCOMPtr greBase; ++ rv = XRE_GetFileFromPath(path, getter_AddRefs(greBase)); ++ if (NS_FAILED(rv)) ++ return rv; + +- return rv; ++ ar = CheckArg("appbase", PR_FALSE, &path); ++ if (ar == ARG_BAD) { ++ PR_fprintf(PR_STDERR, "Error: argument -appbase requires a path argument\n"); ++ return NS_ERROR_FAILURE; ++ } ++ ++ nsCOMPtr appBase; ++ if (path) { ++ rv = XRE_GetFileFromPath(path, getter_AddRefs(appBase)); ++ if (NS_FAILED(rv)) ++ return rv; ++ } ++ ++ return mozilla::Omnijar::SetBase(greBase, appBase); + } + + nsresult +diff -up xulrunner-5.0/mozilla-release/toolkit/xre/nsEmbedFunctions.cpp.omnijar xulrunner-5.0/mozilla-release/toolkit/xre/nsEmbedFunctions.cpp +--- xulrunner-5.0/mozilla-release/toolkit/xre/nsEmbedFunctions.cpp.omnijar 2011-06-15 23:57:56.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/toolkit/xre/nsEmbedFunctions.cpp 2011-06-21 12:46:33.558166809 +0200 +@@ -512,9 +512,7 @@ XRE_InitChildProcess(int aArgc, + // Allow ProcessChild to clean up after itself before going out of + // scope and being deleted + process->CleanUp(); +-#ifdef MOZ_OMNIJAR +- mozilla::SetOmnijar(nsnull); +-#endif ++ mozilla::Omnijar::SetBase(nsnull, nsnull); + } + } + +diff -up xulrunner-5.0/mozilla-release/toolkit/xre/nsXREDirProvider.cpp.omnijar xulrunner-5.0/mozilla-release/toolkit/xre/nsXREDirProvider.cpp +--- xulrunner-5.0/mozilla-release/toolkit/xre/nsXREDirProvider.cpp.omnijar 2011-06-15 23:57:57.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/toolkit/xre/nsXREDirProvider.cpp 2011-06-21 12:46:33.575166505 +0200 +@@ -301,9 +301,6 @@ nsXREDirProvider::GetFile(const char* aP + if (NS_SUCCEEDED(rv)) + file = lf; + } +- else if (!strcmp(aProperty, "resource:app")) { +- rv = GetAppDir()->Clone(getter_AddRefs(file)); +- } + + else if (!strcmp(aProperty, NS_APP_PROFILE_DIR_STARTUP) && mProfileDir) { + return mProfileDir->Clone(aFile); +diff -up xulrunner-5.0/mozilla-release/xpcom/build/Makefile.in.omnijar xulrunner-5.0/mozilla-release/xpcom/build/Makefile.in +--- xulrunner-5.0/mozilla-release/xpcom/build/Makefile.in.omnijar 2011-06-15 23:57:58.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/xpcom/build/Makefile.in 2011-06-21 12:46:33.560166773 +0200 +@@ -69,6 +69,7 @@ CPPSRCS = \ + nsXPComInit.cpp \ + nsXPCOMStrings.cpp \ + Services.cpp \ ++ Omnijar.cpp \ + $(NULL) + + ifndef MOZ_ENABLE_LIBXUL +@@ -77,10 +78,6 @@ CPPSRCS += dlldeps.cpp + endif + endif + +-ifdef MOZ_OMNIJAR +-CPPSRCS += Omnijar.cpp +-endif +- + SHARED_LIBRARY_LIBS = \ + $(DEPTH)/chrome/src/$(LIB_PREFIX)chrome_s.$(LIB_SUFFIX) \ + ../ds/$(LIB_PREFIX)xpcomds_s.$(LIB_SUFFIX) \ +diff -up xulrunner-5.0/mozilla-release/xpcom/build/nsXPComInit.cpp.omnijar xulrunner-5.0/mozilla-release/xpcom/build/nsXPComInit.cpp +--- xulrunner-5.0/mozilla-release/xpcom/build/nsXPComInit.cpp.omnijar 2011-06-15 23:58:00.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/xpcom/build/nsXPComInit.cpp 2011-06-21 13:15:00.545014024 +0200 +@@ -457,25 +457,25 @@ NS_InitXPCOM2(nsIServiceManager* *result + if (NS_FAILED(rv)) return rv; + } + +-#ifdef MOZ_OMNIJAR + NS_TIME_FUNCTION_MARK("Next: Omnijar init"); + +- if (!mozilla::OmnijarPath()) { +- nsCOMPtr omnijar; ++ if (!mozilla::Omnijar::IsInitialized()) { ++ nsCOMPtr greDir, appDir; + nsCOMPtr file; + +- rv = NS_ERROR_FAILURE; + nsDirectoryService::gService->Get(NS_GRE_DIR, + NS_GET_IID(nsIFile), ++ getter_AddRefs(file)); ++ greDir = do_QueryInterface(file); ++ ++ nsDirectoryService::gService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, ++ NS_GET_IID(nsIFile), + getter_AddRefs(file)); +- if (file) +- rv = file->Append(NS_LITERAL_STRING("omni.jar")); +- if (NS_SUCCEEDED(rv)) +- omnijar = do_QueryInterface(file); +- if (NS_SUCCEEDED(rv)) +- mozilla::SetOmnijar(omnijar); ++ appDir = do_QueryInterface(file); ++ ++ rv = mozilla::Omnijar::SetBase(greDir, appDir); ++ NS_ENSURE_SUCCESS(rv, rv); + } +-#endif + + if ((sCommandLineWasInitialized = !CommandLine::IsInitialized())) { + NS_TIME_FUNCTION_MARK("Next: IPC command line init"); +@@ -755,9 +755,7 @@ ShutdownXPCOM(nsIServiceManager* servMgr + sExitManager = nsnull; + } + +-#ifdef MOZ_OMNIJAR +- mozilla::SetOmnijar(nsnull); +-#endif ++ mozilla::Omnijar::SetBase(nsnull, nsnull); + + NS_LogTerm(); + +diff -up xulrunner-5.0/mozilla-release/xpcom/build/Omnijar.cpp.omnijar xulrunner-5.0/mozilla-release/xpcom/build/Omnijar.cpp +--- xulrunner-5.0/mozilla-release/xpcom/build/Omnijar.cpp.omnijar 2011-06-15 23:57:58.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/xpcom/build/Omnijar.cpp 2011-06-21 12:46:33.563166721 +0200 +@@ -21,6 +21,7 @@ + * + * Contributor(s): + * Michael Wu ++ * Mike Hommey + * + * 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 +@@ -38,64 +39,170 @@ + + #include "Omnijar.h" + +-#include "nsILocalFile.h" +-#include "nsXULAppAPI.h" ++#include "nsIFile.h" + #include "nsZipArchive.h" ++#include "nsNetUtil.h" + +-static nsILocalFile* sOmnijarPath = nsnull; +-static nsZipArchive* sOmnijarReader = nsnull; ++namespace mozilla { + +-static void +-SetupReader() ++nsIFile *Omnijar::sPath[2] = { nsnull, nsnull }; ++PRBool Omnijar::sIsOmnijar[2] = { PR_FALSE, PR_FALSE }; ++ ++#ifdef MOZ_ENABLE_LIBXUL ++nsZipArchive *Omnijar::sReader[2] = { nsnull, nsnull }; ++#endif ++ ++static already_AddRefed ++ComputePath(nsIFile *aPath, PRBool &aIsOmnijar) + { +- if (!sOmnijarPath) { +- return; +- } ++ PRBool isDir; ++ aIsOmnijar = PR_FALSE; ++ if (!aPath || NS_FAILED(aPath->IsDirectory(&isDir)) || !isDir) ++ return nsnull; ++ ++ nsCOMPtr path; ++#ifdef MOZ_ENABLE_LIBXUL ++ // Search for omni.jar in the given directory ++ if (!isDir || NS_FAILED(aPath->Clone(getter_AddRefs(path)))) ++ return nsnull; ++ ++ if (NS_FAILED(path->AppendNative(NS_LITERAL_CSTRING("omni.jar")))) ++ return nsnull; ++ ++ if (NS_FAILED(path->Exists(&aIsOmnijar))) ++ return nsnull; ++#endif + +- nsZipArchive* zipReader = new nsZipArchive(); +- if (!zipReader) { +- NS_IF_RELEASE(sOmnijarPath); +- return; ++ if (!aIsOmnijar && NS_FAILED(aPath->Clone(getter_AddRefs(path)))) ++ return nsnull; ++ ++ return path.forget(); ++} ++ ++nsresult ++Omnijar::SetBase(nsIFile *aGrePath, nsIFile *aAppPath) ++{ ++ NS_ABORT_IF_FALSE(aGrePath || !aAppPath, "Omnijar::SetBase(NULL, something) call forbidden"); ++ ++#ifdef MOZ_ENABLE_LIBXUL ++ if (sReader[GRE]) { ++ sReader[GRE]->CloseArchive(); ++ delete sReader[GRE]; ++ } ++ if (sReader[APP]) { ++ sReader[APP]->CloseArchive(); ++ delete sReader[APP]; + } ++ sReader[APP] = sReader[GRE] = nsnull; ++#endif + +- if (NS_FAILED(zipReader->OpenArchive(sOmnijarPath))) { +- delete zipReader; +- NS_IF_RELEASE(sOmnijarPath); +- return; ++ nsresult rv; ++ PRBool equals; ++ if (aAppPath) { ++ rv = aAppPath->Equals(aGrePath, &equals); ++ NS_ENSURE_SUCCESS(rv, rv); ++ } else { ++ equals = PR_TRUE; + } + +- sOmnijarReader = zipReader; ++ nsCOMPtr grePath = ComputePath(aGrePath, sIsOmnijar[GRE]); ++ nsCOMPtr appPath = ComputePath(equals ? nsnull : aAppPath, sIsOmnijar[APP]); ++ ++ NS_IF_RELEASE(sPath[GRE]); ++ sPath[GRE] = grePath; ++ NS_IF_ADDREF(sPath[GRE]); ++ ++ NS_IF_RELEASE(sPath[APP]); ++ sPath[APP] = appPath; ++ NS_IF_ADDREF(sPath[APP]); ++ ++ return NS_OK; + } + +-nsILocalFile* +-mozilla::OmnijarPath() ++already_AddRefed ++Omnijar::GetBase(Type aType) + { +- if (!sOmnijarReader) +- SetupReader(); ++ NS_ABORT_IF_FALSE(sPath[0], "Omnijar not initialized"); ++ ++ if (!sIsOmnijar[aType]) { ++ NS_IF_ADDREF(sPath[aType]); ++ return sPath[aType]; ++ } + +- return sOmnijarPath; ++ nsCOMPtr file, path; ++ if (NS_FAILED(sPath[aType]->Clone(getter_AddRefs(file)))) ++ return nsnull; ++ ++ if (NS_FAILED(file->GetParent(getter_AddRefs(path)))) ++ return nsnull; ++ return path.forget(); + } + +-nsZipArchive* +-mozilla::OmnijarReader() ++#ifdef MOZ_ENABLE_LIBXUL ++nsZipArchive * ++Omnijar::GetReader(Type aType) + { +- if (!sOmnijarReader) +- SetupReader(); ++ if (!sIsOmnijar[aType]) ++ return nsnull; + +- return sOmnijarReader; ++ if (sReader[aType]) ++ return sReader[aType]; ++ ++ nsZipArchive* zipReader = new nsZipArchive(); ++ if (!zipReader) ++ return nsnull; ++ ++ if (NS_FAILED(zipReader->OpenArchive(sPath[aType]))) { ++ delete zipReader; ++ return nsnull; ++ } ++ ++ return (sReader[aType] = zipReader); + } + +-void +-mozilla::SetOmnijar(nsILocalFile* aPath) ++nsZipArchive * ++Omnijar::GetReader(nsIFile *aPath) + { +- NS_IF_RELEASE(sOmnijarPath); +- if (sOmnijarReader) { +- sOmnijarReader->CloseArchive(); +- delete sOmnijarReader; +- sOmnijarReader = nsnull; ++ PRBool equals; ++ nsresult rv; ++ ++ if (sIsOmnijar[GRE]) { ++ rv = sPath[GRE]->Equals(aPath, &equals); ++ if (NS_SUCCEEDED(rv) && equals) ++ return GetReader(GRE); + } ++ if (sIsOmnijar[APP]) { ++ rv = sPath[APP]->Equals(aPath, &equals); ++ if (NS_SUCCEEDED(rv) && equals) ++ return GetReader(APP); ++ } ++ return nsnull; ++} ++#endif ++ ++nsresult ++Omnijar::GetURIString(Type aType, nsCString &result) ++{ ++ NS_ABORT_IF_FALSE(sPath[0], "Omnijar not initialized"); + +- sOmnijarPath = aPath; +- NS_IF_ADDREF(sOmnijarPath); ++ result = ""; ++ ++ if ((aType == APP) && (!sPath[APP])) ++ return NS_OK; ++ ++ nsCAutoString omniJarSpec; ++ nsresult rv = NS_GetURLSpecFromActualFile(sPath[aType], omniJarSpec); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ if (sIsOmnijar[aType]) { ++ result = "jar:"; ++ result += omniJarSpec; ++ result += "!"; ++ } else { ++ result = omniJarSpec; ++ } ++ result += "/"; ++ return NS_OK; + } + ++} /* namespace mozilla */ +diff -up xulrunner-5.0/mozilla-release/xpcom/build/Omnijar.h.omnijar xulrunner-5.0/mozilla-release/xpcom/build/Omnijar.h +--- xulrunner-5.0/mozilla-release/xpcom/build/Omnijar.h.omnijar 2011-06-15 23:57:58.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/xpcom/build/Omnijar.h 2011-06-21 12:46:33.564166703 +0200 +@@ -21,6 +21,7 @@ + * + * Contributor(s): + * Michael Wu ++ * Mike Hommey + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or +@@ -39,24 +40,132 @@ + #ifndef mozilla_Omnijar_h + #define mozilla_Omnijar_h + +-class nsILocalFile; +-class nsZipArchive; ++#include "nscore.h" ++#include "nsTArray.h" ++#include "nsCOMPtr.h" ++#include "nsString.h" + +-#ifdef MOZ_OMNIJAR ++class nsIFile; ++class nsZipArchive; ++class nsIURI; + + namespace mozilla { + ++#ifdef MOZ_ENABLE_LIBXUL ++#define OMNIJAR_EXPORT ++#else ++#define OMNIJAR_EXPORT NS_EXPORT ++#endif ++ ++class OMNIJAR_EXPORT Omnijar { ++private: ++/** ++ * Store an nsIFile for either a base directory when there is no omni.jar, ++ * or omni.jar itself. We can store two paths here, one for GRE ++ * (corresponding to resource://gre/) and one for APP ++ * (corresponding to resource:/// and resource://app/), but only ++ * store one when both point to the same location (unified). ++ */ ++static nsIFile *sPath[2]; + /** +- * This returns the path to the omnijar. +- * If the omnijar isn't available, this function will return null. +- * Callers should fallback to flat packaging if null. +- */ +-nsILocalFile *OmnijarPath(); +-nsZipArchive *OmnijarReader(); +-void SetOmnijar(nsILocalFile* aPath); ++ * Store whether the corresponding sPath is an omni.jar or a directory ++ */ ++static PRBool sIsOmnijar[2]; + +-} /* namespace mozilla */ ++#ifdef MOZ_ENABLE_LIBXUL ++/** ++ * Cached nsZipArchives for the corresponding sPath ++ */ ++static nsZipArchive *sReader[2]; ++#endif ++ ++public: ++enum Type { ++ GRE = 0, ++ APP = 1 ++}; ++ ++/** ++ * Returns whether SetBase has been called at least once with ++ * a valid nsIFile ++ */ ++static PRBool ++IsInitialized() ++{ ++ // GRE path is always set after initialization. ++ return sPath[0] != nsnull; ++} ++ ++/** ++ * Sets the base directories for GRE and APP. APP base directory ++ * may be nsnull, in case the APP and GRE directories are the same. ++ */ ++static nsresult SetBase(nsIFile *aGrePath, nsIFile *aAppPath); ++ ++/** ++ * Returns an nsIFile pointing to the omni.jar file for GRE or APP. ++ * Returns nsnull when there is no corresponding omni.jar. ++ * Also returns nsnull for APP in the unified case. ++ */ ++static already_AddRefed ++GetPath(Type aType) ++{ ++ NS_ABORT_IF_FALSE(sPath[0], "Omnijar not initialized"); ++ ++ if (sIsOmnijar[aType]) { ++ NS_IF_ADDREF(sPath[aType]); ++ return sPath[aType]; ++ } ++ return nsnull; ++} ++ ++/** ++ * Returns whether GRE or APP use an omni.jar. Returns PR_False when ++ * using an omni.jar in the unified case. ++ */ ++static PRBool ++HasOmnijar(Type aType) ++{ ++ return sIsOmnijar[aType]; ++} ++ ++/** ++ * Returns the base directory for GRE or APP. In the unified case, ++ * returns nsnull for APP. ++ */ ++static already_AddRefed GetBase(Type aType); ++ ++/** ++ * Returns a nsZipArchive pointer for the omni.jar file for GRE or ++ * APP. Returns nsnull in the same cases GetPath() would. ++ */ ++#ifdef MOZ_ENABLE_LIBXUL ++static nsZipArchive *GetReader(Type aType); ++#else ++static nsZipArchive *GetReader(Type aType) { return nsnull; } ++#endif + +-#endif /* MOZ_OMNIJAR */ ++/** ++ * Returns a nsZipArchive pointer for the given path IAOI the given ++ * path is the omni.jar for either GRE or APP. ++ */ ++#ifdef MOZ_ENABLE_LIBXUL ++static nsZipArchive *GetReader(nsIFile *aPath); ++#else ++static nsZipArchive *GetReader(nsIFile *aPath) { return nsnull; } ++#endif ++ ++/** ++ * Returns the URI string corresponding to the omni.jar or directory ++ * for GRE or APP. i.e. jar:/path/to/omni.jar!/ for omni.jar and ++ * /path/to/base/dir/ otherwise. Returns an empty string for APP in ++ * the unified case. ++ * The returned URI is guaranteed to end with a slash. ++ */ ++static nsresult GetURIString(Type aType, nsCString &result); ++ ++}; /* class Omnijar */ ++ ++} /* namespace mozilla */ + + #endif /* mozilla_Omnijar_h */ +diff -up xulrunner-5.0/mozilla-release/xpcom/components/nsComponentManager.cpp.omnijar xulrunner-5.0/mozilla-release/xpcom/components/nsComponentManager.cpp +--- xulrunner-5.0/mozilla-release/xpcom/components/nsComponentManager.cpp.omnijar 2011-06-15 23:58:01.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/xpcom/components/nsComponentManager.cpp 2011-06-21 12:46:33.569166613 +0200 +@@ -174,8 +174,6 @@ NS_DEFINE_CID(kCategoryManagerCID, NS_CA + #define COMPMGR_TIME_FUNCTION_CONTRACTID(cid) do {} while (0) + #endif + +-#define kOMNIJAR_PREFIX NS_LITERAL_CSTRING("resource:///") +- + nsresult + nsGetServiceFromCategory::operator()(const nsIID& aIID, void** aInstancePtr) const + { +@@ -385,14 +383,20 @@ nsresult nsComponentManagerImpl::Init() + for (PRUint32 i = 0; i < sStaticModules->Length(); ++i) + RegisterModule((*sStaticModules)[i], NULL); + +-#ifdef MOZ_OMNIJAR +- if (mozilla::OmnijarPath()) { +- nsCOMPtr omnijarReader = new nsJAR(); +- rv = omnijarReader->Open(mozilla::OmnijarPath()); +- if (NS_SUCCEEDED(rv)) +- RegisterJarManifest(omnijarReader, "chrome.manifest", false); ++ nsCOMPtr appOmnijar = mozilla::Omnijar::GetPath(mozilla::Omnijar::APP); ++ if (appOmnijar) { ++ cl = sModuleLocations->InsertElementAt(1); // Insert after greDir ++ cl->type = NS_COMPONENT_LOCATION; ++ cl->location = do_QueryInterface(appOmnijar); ++ cl->jar = true; ++ } ++ nsCOMPtr greOmnijar = mozilla::Omnijar::GetPath(mozilla::Omnijar::GRE); ++ if (greOmnijar) { ++ cl = sModuleLocations->InsertElementAt(0); ++ cl->type = NS_COMPONENT_LOCATION; ++ cl->location = do_QueryInterface(greOmnijar); ++ cl->jar = true; + } +-#endif + + for (PRUint32 i = 0; i < sModuleLocations->Length(); ++i) { + ComponentLocation& l = sModuleLocations->ElementAt(i); +@@ -407,15 +411,6 @@ nsresult nsComponentManagerImpl::Init() + RegisterJarManifest(reader, "chrome.manifest", false); + } + +-#ifdef MOZ_OMNIJAR +- if (mozilla::OmnijarPath()) { +- cl = sModuleLocations->InsertElementAt(0); +- cl->type = NS_COMPONENT_LOCATION; +- cl->location = mozilla::OmnijarPath(); +- cl->jar = true; +- } +-#endif +- + nsCategoryManager::GetSingleton()->SuppressNotifications(false); + + mStatus = NORMAL; +diff -up xulrunner-5.0/mozilla-release/xulrunner/confvars.sh.omnijar xulrunner-5.0/mozilla-release/xulrunner/confvars.sh +--- xulrunner-5.0/mozilla-release/xulrunner/confvars.sh.omnijar 2011-06-15 23:58:02.000000000 +0200 ++++ xulrunner-5.0/mozilla-release/xulrunner/confvars.sh 2011-06-21 12:46:33.578166451 +0200 +@@ -41,6 +41,7 @@ MOZ_APP_DISPLAYNAME=XULRunner + MOZ_UPDATER=1 + MOZ_XULRUNNER=1 + MOZ_ENABLE_LIBXUL=1 ++MOZ_CHROME_FILE_FORMAT=omni + MOZ_STATIC_BUILD_UNSUPPORTED=1 + MOZ_APP_VERSION=$MOZILLA_VERSION + if test "$MOZ_STORAGE"; then diff --git a/xulrunner-redhat-default-prefs.js b/xulrunner-redhat-default-prefs.js new file mode 100644 index 0000000..15a1e2a --- /dev/null +++ b/xulrunner-redhat-default-prefs.js @@ -0,0 +1,8 @@ +pref("app.update.enabled", false); +pref("app.update.autoInstallEnabled", false); +pref("general.smoothScroll", true); +pref("intl.locale.matchOS", true); +pref("network.manage-offline-status", true); +pref("toolkit.storage.synchronous", 0); +pref("toolkit.networkmanager.disable", false); +pref("offline.autoDetect", true); diff --git a/xulrunner-version.patch b/xulrunner-version.patch new file mode 100644 index 0000000..d08bde9 --- /dev/null +++ b/xulrunner-version.patch @@ -0,0 +1,13 @@ +diff -up mozilla/toolkit/mozapps/update/src/updater/module.ver mozilla/toolkit/mozapps/update/src/updater/module +diff -up mozilla/xulrunner/installer/Makefile.in.ver mozilla/xulrunner/installer/Makefile.in +--- mozilla/xulrunner/installer/Makefile.in.ver 2007-12-14 09:51:34.000000000 +0100 ++++ mozilla/xulrunner/installer/Makefile.in 2007-12-14 09:52:03.000000000 +0100 +@@ -44,6 +44,8 @@ VPATH = @srcdir@ + + include $(DEPTH)/config/autoconf.mk + ++MOZ_APP_VERSION="__RPM_VERSION_INTERNAL__" ++ + NO_PKG_FILES = \ + xulrunner-config \ + regchrome* \ diff --git a/xulrunner.sh.in b/xulrunner.sh.in new file mode 100644 index 0000000..8f76b27 --- /dev/null +++ b/xulrunner.sh.in @@ -0,0 +1,69 @@ +#!/bin/sh +# +# 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. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# + +## +## Usage: +## +## $ xulrunner +## +## This script is meant to run a xulrunner program from the xulrunner +## rpm installation. +## + +cmdname=`basename $0` + +## +## Variables +## +XUL_ARCH=$(uname -m) +case $XUL_ARCH in + x86_64 | ia64 | s390 ) + XUL_LIB_DIR="/usr/lib64" + SECONDARY_LIB_DIR="/usr/lib" + ;; + * ) + XUL_LIB_DIR="/usr/lib" + SECONDARY_LIB_DIR="/usr/lib64" + ;; +esac + +if [ ! -x $XUL_LIB_DIR/xulrunner-XULRUNNER_VERSION/xulrunner ]; then + if [ ! -x $SECONDARY_LIB_DIR/xulrunner-XULRUNNER_VERSION/xulrunner ]; then + echo "Error: $XUL_LIB_DIR/xulrunner-XULRUNNER_VERSION/xulrunner not found" + if [ -d $SECONDARY_LIB_DIR ]; then + echo " $SECONDARY_LIB_DIR/xulrunner-XULRUNNER_VERSION/xulrunner not found" + fi + exit 1 + fi + XUL_LIB_DIR="$SECONDARY_LIB_DIR" +fi +XUL_DIST_BIN="$XUL_LIB_DIR/xulrunner-XULRUNNER_VERSION" +XUL_PROGRAM="$XUL_DIST_BIN/xulrunner" + +## +## Enable WebGL +## +MOZ_GLX_IGNORE_BLACKLIST=1 +export MOZ_GLX_IGNORE_BLACKLIST + + +exec $XUL_PROGRAM "$@" diff --git a/xulrunner.spec b/xulrunner.spec new file mode 100644 index 0000000..e32882a --- /dev/null +++ b/xulrunner.spec @@ -0,0 +1,1133 @@ +# Use system sqlite? +%if 0%{?fedora} <= 15 +%define system_sqlite 0 +%else +%define system_sqlite 1 +%endif + +# Minimal required versions +%global nspr_version 4.8.9 +%global nss_version 3.13.1 +%global cairo_version 1.10.2 +%global freetype_version 2.1.9 +%global libnotify_version 0.7.0 +%global libvpx_version 1.0.0 + +%if %{?system_sqlite} +%global sqlite_version 3.7.7.1 +# The actual sqlite version (see #480989): +%global sqlite_build_version %(pkg-config --silence-errors --modversion sqlite3 2>/dev/null || echo 65536) +%endif + +# gecko_dir_ver should be set to the version in our directory names +# alpha_version should be set to the alpha number if using an alpha, 0 otherwise +# beta_version should be set to the beta number if using a beta, 0 otherwise +# rc_version should be set to the RC number if using an RC, 0 otherwise +%global gecko_dir_ver 2 +%global alpha_version 0 +%global beta_version 0 +%global rc_version 0 + +%global mozappdir %{_libdir}/%{name}-%{gecko_dir_ver} +%global tarballdir mozilla-release + +# crash reporter work only on x86/x86_64 +%ifarch %{ix86} x86_64 +%global enable_mozilla_crashreporter 1 +%else +%global enable_mozilla_crashreporter 0 +%endif + +%if %{alpha_version} > 0 +%global pre_version a%{alpha_version} +%global tarballdir mozilla-beta +%endif +%if %{beta_version} > 0 +%global pre_version b%{beta_version} +%global tarballdir mozilla-beta +%endif +%if %{rc_version} > 0 +%global pre_version rc%{rc_version} +%global tarballdir mozilla-release +%endif + +%if %{defined pre_version} +%global gecko_verrel %{expand:%%{version}}-%{pre_version} +%global pre_tag .%{pre_version} +%else +%global gecko_verrel %{expand:%%{version}} +%endif + +Summary: XUL Runtime for Gecko Applications +Name: xulrunner +Version: 10.0.1 +Release: 5.1%{?pre_tag}%{?dist} +URL: http://developer.mozilla.org/En/XULRunner +License: MPLv1.1 or GPLv2+ or LGPLv2+ +Group: Applications/Internet +# You can get sources at ftp://ftp.mozilla.org/pub/firefox/releases/%{version}%{?pre_ver}/source +Source0: %{name}-%{version}%{?pre_version}.source.tar.bz2 +Source10: %{name}-mozconfig +Source11: %{name}-mozconfig-debuginfo +Source12: %{name}-redhat-default-prefs.js +Source21: %{name}.sh.in + +# build patches +Patch0: xulrunner-version.patch +Patch1: mozilla-build.patch +Patch14: xulrunner-2.0-chromium-types.patch +%if 0%{?fedora} <= 15 +Patch16: add-gtkmozembed-10.0.patch +%endif +Patch17: xulrunner-10.0-gcc47.patch + + +# Fedora specific patches +Patch20: mozilla-193-pkgconfig.patch +Patch23: wmclass.patch +Patch24: crashreporter-remove-static.patch + +# Upstream patches +Patch38: mozilla-696393.patch +# https://bugzilla.mozilla.org/show_bug.cgi?id=707993 +Patch39: xulrunner-8.0-fix-maemo-checks-in-npapi.patch +Patch40: mozilla-682832-proxy.patch +# cherry-picked from 13afcd4c097c +Patch41: xulrunner-9.0-secondary-build-fix.patch +Patch42: mozilla-706724.patch +Patch43: mozilla-file.patch +# Needed to detect/use libvpx-1.0.0 +# https://bugzilla.mozilla.org/show_bug.cgi?id=722127 +Patch44: mozilla-722127.patch +Patch45: mozilla-727401.patch +Patch46: mozilla-724615.patch +Patch47: mozilla-691898.patch + +# --------------------------------------------------- + +BuildRequires: nspr-devel >= %{nspr_version} +BuildRequires: nss-devel >= %{nss_version} +BuildRequires: cairo-devel >= %{cairo_version} +BuildRequires: libpng-devel +BuildRequires: libjpeg-devel +BuildRequires: zip +BuildRequires: bzip2-devel +BuildRequires: zlib-devel +BuildRequires: libIDL-devel +BuildRequires: gtk2-devel +BuildRequires: krb5-devel +BuildRequires: pango-devel +BuildRequires: freetype-devel >= %{freetype_version} +BuildRequires: libXt-devel +BuildRequires: libXrender-devel +BuildRequires: hunspell-devel +BuildRequires: startup-notification-devel +BuildRequires: alsa-lib-devel +BuildRequires: libnotify-devel >= %{libnotify_version} +BuildRequires: mesa-libGL-devel +BuildRequires: libcurl-devel +BuildRequires: libvpx-devel >= %{libvpx_version} + +Requires: mozilla-filesystem +Requires: nspr >= %{nspr_version} +Requires: nss >= %{nss_version} +Provides: gecko-libs = %{gecko_verrel} +Provides: gecko-libs%{?_isa} = %{gecko_verrel} +Conflicts: firefox < 3.6 + +%if %{?system_sqlite} +BuildRequires: sqlite-devel >= %{sqlite_version} +Requires: sqlite >= %{sqlite_build_version} +%endif + +%description +XULRunner is a Mozilla runtime package that can be used to bootstrap XUL+XPCOM +applications that are as rich as Firefox and Thunderbird. It provides mechanisms +for installing, upgrading, and uninstalling these applications. XULRunner also +provides libxul, a solution which allows the embedding of Mozilla technologies +in other projects and products. + +%package devel +Summary: Development files for Gecko +Group: Development/Libraries +Obsoletes: mozilla-devel < 1.9 +Obsoletes: firefox-devel < 2.1 +Obsoletes: xulrunner-devel-unstable +Provides: gecko-devel = %{gecko_verrel} +Provides: gecko-devel%{?_isa} = %{gecko_verrel} +Provides: gecko-devel-unstable = %{gecko_verrel} +Provides: gecko-devel-unstable%{?_isa} = %{gecko_verrel} + +Requires: xulrunner = %{version}-%{release} +Requires: nspr-devel >= %{nspr_version} +Requires: nss-devel >= %{nss_version} +Requires: cairo-devel >= %{cairo_version} +Requires: libjpeg-devel +Requires: zip +Requires: bzip2-devel +Requires: zlib-devel +Requires: libIDL-devel +Requires: gtk2-devel +Requires: krb5-devel +Requires: pango-devel +Requires: freetype-devel >= %{freetype_version} +Requires: libXt-devel +Requires: libXrender-devel +Requires: hunspell-devel +%if %{?system_sqlite} +Requires: sqlite-devel +%endif +Requires: startup-notification-devel +Requires: alsa-lib-devel +Requires: libnotify-devel +Requires: mesa-libGL-devel + +%description devel +This package contains the libraries amd header files that are needed +for writing XUL+XPCOM applications with Mozilla XULRunner and Gecko. + +%if %{enable_mozilla_crashreporter} +%global moz_debug_prefix %{_prefix}/lib/debug +%global moz_debug_dir %{moz_debug_prefix}%{mozappdir} +%global uname_m %(uname -m) +%global symbols_file_name %{name}-%{version}.en-US.%{_os}-%{uname_m}.crashreporter-symbols.zip +%global symbols_file_path %{moz_debug_dir}/%{symbols_file_name} +%global _find_debuginfo_opts -p %{symbols_file_path} -o debugcrashreporter.list +%global crashreporter_pkg_name mozilla-crashreporter-%{name}-debuginfo +%package -n %{crashreporter_pkg_name} +Summary: Debugging symbols used by Mozilla's crash reporter servers +Group: Development/Debug +%description -n %{crashreporter_pkg_name} +This package provides debug information for XULRunner, for use by +Mozilla's crash reporter servers. If you are trying to locally +debug %{name}, you want to install %{name}-debuginfo instead. +%files -n %{crashreporter_pkg_name} -f debugcrashreporter.list +%defattr(-,root,root) +%endif + +#--------------------------------------------------------------------- + +%prep +%setup -q -c +cd %{tarballdir} + +sed -e 's/__RPM_VERSION_INTERNAL__/%{gecko_dir_ver}/' %{P:%%PATCH0} \ + > version.patch +%{__patch} -p1 -b --suffix .version --fuzz=0 < version.patch + +%patch1 -p2 -b .build +%patch14 -p1 -b .chromium-types +%if 0%{?fedora} <= 15 +%patch16 -p2 -b .gtkmozembed +%endif +%patch17 -p1 -b .gcc47 + +%patch20 -p2 -b .pk +%patch23 -p1 -b .wmclass +%patch24 -p1 -b .static + +%patch38 -p2 -b .696393 +%patch39 -p1 -b .707993 +%patch40 -p2 -b .682832 +%patch41 -p2 -b .secondary-build +%patch42 -p1 -b .706724 +%patch43 -p1 -b .file +%patch44 -p2 -b .vpx1.0.0 +%patch45 -p1 -b .727401 +%patch46 -p1 -b .724615 +%patch47 -p1 -b .691898 + +%{__rm} -f .mozconfig +%{__cp} %{SOURCE10} .mozconfig +%if %{enable_mozilla_crashreporter} +%{__cat} %{SOURCE11} >> .mozconfig +%endif + +%if %{?system_sqlite} +echo "ac_add_options --enable-system-sqlite" >> .mozconfig +%else +echo "ac_add_options --disable-system-sqlite" >> .mozconfig +%endif + +# s390(x) fails to start with jemalloc enabled +%ifarch s390 s390x +echo "ac_add_options --disable-jemalloc" >> .mozconfig +%endif + +%ifarch armv7hl +echo "ac_add_options --with-arch=armv7-a" >> .mozconfig +echo "ac_add_options --with-float-abi=hard" >> .mozconfig +echo "ac_add_options --with-fpu=vfpv3-d16" >> .mozconfig +echo "ac_add_options --disable-elf-hack" >> .mozconfig +%endif +%ifarch armv7hnl +echo "ac_add_options --with-arch=armv7-a" >> .mozconfig +echo "ac_add_options --with-float-abi=hard" >> .mozconfig +echo "ac_add_options --with-fpu=neon" >> .mozconfig +echo "ac_add_options --disable-elf-hack" >> .mozconfig +%endif +%ifarch armv5tel +echo "ac_add_options --with-arch=armv5te" >> .mozconfig +echo "ac_add_options --with-float-abi=soft" >> .mozconfig +echo "ac_add_options --disable-elf-hack" >> .mozconfig +%endif + +%ifnarch %{ix86} x86_64 +echo "ac_add_options --disable-methodjit" >> .mozconfig +echo "ac_add_options --disable-monoic" >> .mozconfig +echo "ac_add_options --disable-polyic" >> .mozconfig +echo "ac_add_options --disable-tracejit" >> .mozconfig +%endif + +#--------------------------------------------------------------------- + +%build +%if %{?system_sqlite} +# Do not proceed with build if the sqlite require would be broken: +# make sure the minimum requirement is non-empty, ... +sqlite_version=$(expr "%{sqlite_version}" : '\([0-9]*\.\)[0-9]*\.') || exit 1 +# ... and that major number of the computed build-time version matches: +case "%{sqlite_build_version}" in + "$sqlite_version"*) ;; + *) exit 1 ;; +esac +%endif + +cd %{tarballdir} + +# -fpermissive is needed to build with gcc 4.6+ which has become stricter +# +# Mozilla builds with -Wall with exception of a few warnings which show up +# everywhere in the code; so, don't override that. +# +# Disable C++ exceptions since Mozilla code is not exception-safe +# +MOZ_OPT_FLAGS=$(echo "$RPM_OPT_FLAGS -fpermissive" | \ + %{__sed} -e 's/-Wall//' -e 's/-fexceptions/-fno-exceptions/g') +export CFLAGS=$MOZ_OPT_FLAGS +export CXXFLAGS=$MOZ_OPT_FLAGS + +export PREFIX='%{_prefix}' +export LIBDIR='%{_libdir}' + +MOZ_SMP_FLAGS=-j1 +# On x86 architectures, Mozilla can build up to 4 jobs at once in parallel, +# however builds tend to fail on other arches when building in parallel. +%ifarch %{ix86} x86_64 +[ -z "$RPM_BUILD_NCPUS" ] && \ + RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" +[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 +[ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 +%endif + +make -f client.mk build STRIP="/bin/true" MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" MOZ_SERVICES_SYNC="1" + +# create debuginfo for crash-stats.mozilla.com +%if %{enable_mozilla_crashreporter} +#cd %{moz_objdir} +make buildsymbols +%endif + +#--------------------------------------------------------------------- + +%install +cd %{tarballdir} + +# set up our prefs before install, so it gets pulled in to omni.jar +%{__cp} -p %{SOURCE12} dist/bin/defaults/pref/all-redhat.js + +DESTDIR=$RPM_BUILD_ROOT make install + +# Start script install +%{__rm} -rf $RPM_BUILD_ROOT%{_bindir}/%{name} +%{__cat} %{SOURCE21} | %{__sed} -e 's,XULRUNNER_VERSION,%{gecko_dir_ver},g' > \ + $RPM_BUILD_ROOT%{_bindir}/%{name} +%{__chmod} 755 $RPM_BUILD_ROOT%{_bindir}/%{name} + +%{__rm} -f $RPM_BUILD_ROOT%{mozappdir}/%{name}-config + +# Copy pc files (for compatibility with 1.9.1) +%{__cp} $RPM_BUILD_ROOT/%{_libdir}/pkgconfig/libxul.pc \ + $RPM_BUILD_ROOT/%{_libdir}/pkgconfig/libxul-unstable.pc +%{__cp} $RPM_BUILD_ROOT/%{_libdir}/pkgconfig/libxul-embedding.pc \ + $RPM_BUILD_ROOT/%{_libdir}/pkgconfig/libxul-embedding-unstable.pc + +# Fix multilib devel conflicts... +function install_file() { +genheader=$* +mv ${genheader}.h ${genheader}%{__isa_bits}.h +cat > ${genheader}.h << EOF +/* This file exists to fix multilib conflicts */ +#if defined(__x86_64__) || defined(__ia64__) || defined(__s390x__) || defined(__powerpc64__) || (defined(__sparc__) && defined(__arch64__)) +#include "${genheader}64.h" +#else +#include "${genheader}32.h" +#endif +EOF +} + +INTERNAL_APP_NAME=%{name}-%{gecko_dir_ver} + +pushd $RPM_BUILD_ROOT/%{_includedir}/${INTERNAL_APP_NAME} +install_file "mozilla-config" +install_file "js-config" +popd + +# Link libraries in sdk directory instead of copying them: +pushd $RPM_BUILD_ROOT%{_libdir}/%{name}-devel-%{gecko_dir_ver}/sdk/lib +for i in *.so; do + rm $i + ln -s %{mozappdir}/$i $i +done +popd + +# Library path +LD_SO_CONF_D=%{_sysconfdir}/ld.so.conf.d +LD_CONF_FILE=xulrunner-%{__isa_bits}.conf + +%{__mkdir_p} ${RPM_BUILD_ROOT}${LD_SO_CONF_D} +%{__cat} > ${RPM_BUILD_ROOT}${LD_SO_CONF_D}/${LD_CONF_FILE} << EOF +%{mozappdir} +EOF + +# Copy over the LICENSE +%{__install} -p -c -m 644 LICENSE $RPM_BUILD_ROOT%{mozappdir} + +# Use the system hunspell dictionaries +%{__rm} -rf ${RPM_BUILD_ROOT}%{mozappdir}/dictionaries +ln -s %{_datadir}/myspell ${RPM_BUILD_ROOT}%{mozappdir}/dictionaries + +# ghost files +%{__mkdir_p} $RPM_BUILD_ROOT%{mozappdir}/components +touch $RPM_BUILD_ROOT%{mozappdir}/components/compreg.dat +touch $RPM_BUILD_ROOT%{mozappdir}/components/xpti.dat + +# Add debuginfo for crash-stats.mozilla.com +%if %{enable_mozilla_crashreporter} +%{__mkdir_p} $RPM_BUILD_ROOT/%{moz_debug_dir} +%{__cp} dist/%{symbols_file_name} $RPM_BUILD_ROOT/%{moz_debug_dir} +%endif + +#--------------------------------------------------------------------- + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%preun +# is it a final removal? +if [ $1 -eq 0 ]; then + %{__rm} -rf %{mozappdir}/components +fi + +%files +%defattr(-,root,root,-) +%{_bindir}/xulrunner +%dir %{mozappdir} +%doc %attr(644, root, root) %{mozappdir}/LICENSE +%doc %attr(644, root, root) %{mozappdir}/README.txt +%{mozappdir}/chrome +%{mozappdir}/chrome.manifest +%{mozappdir}/dictionaries +%dir %{mozappdir}/components +%ghost %{mozappdir}/components/compreg.dat +%ghost %{mozappdir}/components/xpti.dat +%{mozappdir}/components/*.so +%{mozappdir}/components/*.manifest +%{mozappdir}/omni.ja +%{mozappdir}/plugins +%{mozappdir}/*.so +%{mozappdir}/mozilla-xremote-client +%{mozappdir}/run-mozilla.sh +%{mozappdir}/xulrunner +%{mozappdir}/xulrunner-bin +%{mozappdir}/xulrunner-stub +%{mozappdir}/platform.ini +%{mozappdir}/dependentlibs.list +%{_sysconfdir}/ld.so.conf.d/xulrunner*.conf +%{mozappdir}/plugin-container + +%if %{enable_mozilla_crashreporter} +%{mozappdir}/crashreporter +%{mozappdir}/crashreporter.ini +%{mozappdir}/Throbber-small.gif +%endif + +%files devel +%defattr(-,root,root,-) +%dir %{_libdir}/%{name}-devel-* +%{_datadir}/idl/%{name}*%{gecko_dir_ver} +%{_includedir}/%{name}*%{gecko_dir_ver} +%{_libdir}/%{name}-devel-*/* +%{_libdir}/pkgconfig/*.pc +%{mozappdir}/xpcshell + +#--------------------------------------------------------------------- + +%changelog +* Mon May 07 2012 Karsten Hopp 10.0.1-5.1 +- xulrunner-10 was the latest version that worked on PPC, need to + bump release and rebuild + +* Fri Mar 09 2012 Dan Horák - 10.0.1-5 +- Add fix for secondary arches from mozb#691898 + +* Mon Feb 27 2012 Martin Stransky - 10.0.1-4 +- Added fix from rhbz#796929 - xulrunner doesn't compile on ARM + +* Tue Feb 16 2012 Martin Stransky - 10.0.1-3 +- Added fix for mozbz#727401 + +* Tue Feb 14 2012 Martin Stransky - 10.0.1-2 +- Allow network manager to handle the offline status + +* Thu Feb 9 2012 Jan Horak - 10.0.1-1 +- Update to 10.0.1 + +* Tue Jan 31 2012 Jan Horak - 10.0-1 +- Update to 10.0 + +* Mon Jan 30 2012 Tom Callaway 10.0-3 +- fix issues causing ftbfs in rawhide + +* Mon Jan 30 2012 Tom Callaway 10.0-2 +- rebuild against libvpx 1.0.0 (and BR 1.0.0 or greater) + +* Mon Jan 23 2012 Martin Stransky 10.0-1 +- Update to 10.0 Beta 6 + +* Thu Jan 19 2012 Dennis Gilmore - 9.0.1-4 +- add missing v from armv7hl and armv7hnl config options + +* Wed Jan 04 2012 Dan Horák - 9.0.1-3 +- fix build on secondary arches (cherry-picked from 13afcd4c097c) + +* Fri Dec 23 2011 Peter Robinson - 9.0.1-2 +- Add compile options for ARM hfp/sfp - RHBZ #738509 + +* Fri Dec 23 2011 Jan Horak - 9.0.1-1 +- Update to 9.0.1 + +* Tue Dec 20 2011 Jan Horak - 9.0-2 +- Update to 9.0 + +* Fri Dec 9 2011 Martin Stransky 9.0-1.beta5 +- Updated to 9.0 Beta 5 + +* Wed Dec 7 2011 Jan Horak - 8.0-5 +- Gnome 3 proxy settings are now honoured (mozbz#682832) + +* Tue Dec 6 2011 Tom Callaway 8.0-4 +- fix bug in npapi.h causing compile failures + +* Fri Nov 25 2011 Martin Stransky 8.0-3 +- s390 build fixes + +* Mon Nov 7 2011 Martin Stransky 8.0-1 +- Updated to 8.0 + +* Tue Oct 18 2011 Ville Skyttä - 7.0.1-5 +- Avoid %%post/un shell invocations + and dependencies (rhbz#736830). + +* Tue Oct 18 2011 Martin Stransky 7.0.1-4 +- Updated cairo dependency (rhbz#742853) + +* Tue Oct 11 2011 Dan Horák 7.0.1-3 +- fix build on secondary arches + +* Mon Oct 10 2011 Martin Stransky 7.0.1-2 +- Removed GRE stuff +- Removed xulrunner rpath (mozbz#686434) + +* Fri Sep 30 2011 Jan Horak - 7.0.1-1 +- Update to 7.0.1 + +* Tue Sep 27 2011 Jan Horak - 7.0-1 +- Update to 7.0 + +* Tue Sep 6 2011 Jan Horak - 6.0.2-1 +- Update to 6.0.2 + +* Wed Aug 31 2011 Jan Horak - 6.0-3 +- Distrust a specific Certificate Authority + +* Tue Aug 16 2011 Martin Stransky 6.0-2 +- Updated gtkmozembed patch + +* Tue Aug 16 2011 Martin Stransky 6.0-1 +- 6.0 + +* Thu Jun 30 2011 Martin Stransky 5.0-5 +- Fixed build on powerpc(64) + +* Tue Jun 28 2011 Dan Horák - 5.0-4 +- fix build on secondary arches with IPC enabled + +* Tue Jun 24 2011 Martin Stransky 5.0-3 +- libCurl build fix + +* Wed Jun 22 2011 Martin Stransky 5.0-2 +- Reverted mozbz#648156 - Remove gtkmozembed + +* Tue Jun 21 2011 Martin Stransky 5.0-1 +- 5.0 + +* Thu May 26 2011 Martin Stransky 2.0.1-2 +- Rebuild for new hunspell (rhbz#707760) + +* Thu Apr 28 2011 Christopher Aillon - 2.0.1-1 +- 2.0.1 + +* Thu Apr 21 2011 Christopher Aillon - 2.0-4 +- Split out mozilla crashreporter symbols to its own debuginfo package + +* Sun Apr 10 2011 Christopher Aillon - 2.0-3 +- Fix offline status issue on version upgrades +- Fix a hang with 20+ extensions + +* Mon Apr 4 2011 Christopher Aillon - 2.0-2 +- Fix SIGABRT in X_CloseDevice: XI_BadDevice +- Updates for NetworkManager 0.9 +- Updates for GNOME 3 + +* Tue Mar 22 2011 Christopher Aillon - 2.0-1 +- 2.0 + +* Fri Mar 18 2011 Christopher Aillon - 2.0-0.28 +- Update to 2.0 RC2 + +* Thu Mar 17 2011 Jan Horak - 2.0-0.27 +- Disabled gnomevfs +- Enabled gio +- Build with system libvpx + +* Wed Mar 9 2011 Christopher Aillon - 2.0-0.26 +- Update to 2.0 RC 1 + +* Sun Feb 27 2011 Christopher Aillon - 2.0-0.25 +- Make Firefox's User-Agent string match upstream's + +* Sat Feb 26 2011 Christopher Aillon - 2.0-0.24 +- Switch to using the omni chrome file format + +* Fri Feb 25 2011 Christopher Aillon - 2.0-0.23 +- Update to 2.0 Beta 12 + +* Sun Feb 13 2011 Dennis Gilmore 2.0-0.22 +- disable nanojit on sparc64 its not supported and doesnt get automatically switched off + +* Thu Feb 10 2011 Christopher Aillon - 2.0-0.21 +- Also provide arch-agnostic versions of gecko virtual provides + +* Thu Feb 10 2011 Christopher Aillon - 2.0-0.20 +- Introduce better versioning for our gecko virtual provides +- Now, the gecko-libs and gecko-devel virtual provides will be pinned + to an individual Gecko release, so packages can do things like + Requires: gecko-libs = 2.0-beta11 + BuildRequires: gecko-libs = 2.0-beta11 +- Final releases will be pinned to e.g. 2.0-1 regardless of %%{release} +- Also, make sure those virtual provides are arch-specific + +* Tue Feb 8 2011 Christopher Aillon - 2.0-0.19 +- Update to 2.0 Beta 11 + +* Wed Jan 26 2011 Christopher Aillon - 2.0-0.18 +- Fix issue with popup windows showing in the wrong place + +* Tue Jan 25 2011 Christopher Aillon - 2.0-0.17 +- Update to 2.0 Beta 10 + +* Fri Jan 21 2011 Dan Horák - 2.0-0.16.b9 +- updated the 64bit-big-endian patch (bmo#627664) +- added fix for build with --disable-methodjit (bmo#623277) + +* Fri Jan 14 2011 Christopher Aillon 2.0-0.15.b9 +- Update to 2.0 Beta 9 + +* Thu Jan 11 2011 Tom Callaway 2.0-0.14.b8 +- enable system sqlite (see https://fedorahosted.org/fpc/ticket/34) + +* Thu Dec 23 2010 Martin Stransky 2.0-0.13.b8 +- reverted fix for rhbz#658471 + +* Wed Dec 22 2010 Dan Horák - 2.0-0.11.b8 +- updated the 64bit-big-endian patch + +* Tue Dec 21 2010 Martin Stransky 2.0-0.11.b8 +- enable url-classifier and jar format for chrome files + +* Tue Dec 21 2010 Martin Stransky 2.0-0.10.b8 +- Update to 2.0b8 + +* Mon Dec 20 2010 Martin Stransky 2.0-0.9.b8 +- removed unused library path (rhbz#658471) + +* Fri Dec 17 2010 Dan Horák - 2.0-0.8.b7 +- disable the crash reporter on non-x86 arches +- add sparc64 as 64-bit arch + +* Tue Dec 14 2010 Jan Horak - 2.0-0.7.b7 +- Enable mozilla crash reporter + +* Thu Nov 11 2010 Dan Horák - 2.0-0.6.b7 +- The s390 patch is not needed anymore + +* Thu Nov 11 2010 Jan Horak - 2.0-0.5.b7 +- Update to 2.0b7 + +* Thu Nov 4 2010 Christopher Aillon 2.0-0.4.b6 +- Ensure that WM_CLASS matches the desktop file + +* Wed Nov 3 2010 Martin Stransky 2.0-0.3.b6 +- Libnotify rebuild (rhbz#649071) + +* Wed Sep 29 2010 jkeating - 2.0-0.2b6 +- Rebuilt for gcc bug 634757 + +* Tue Sep 21 2010 Martin Stransky 2.0-0.1.b6 +- Update to 2.0b6 + +* Tue Sep 7 2010 Tom "spot" Callaway 1.9.3.0-0.2.b4 +- spec file cleanup + +* Fri Aug 27 2010 Martin Stransky 1.9.3.0-0.1.b4 +- Update to 1.9.3.1 beta 4 + +* Mon Aug 16 2010 Martin Stransky 1.9.3.0-0.b3 +- Update to 1.9.3.1 beta 3 + +* Tue Jul 20 2010 Jan Horak - 1.9.2.7-1 +- Update to 1.9.2.7 + +* Wed Jul 1 2010 Martin Stransky 1.9.2.6-2 +- Disabled oopp on unsupported arches (rhbz#614363) + +* Wed Jun 30 2010 Jan Horak - 1.9.2.6-1 +- Update to 1.9.2.6 + +* Tue Jun 22 2010 Jan Horak - 1.9.2.4-1 +- Update to 1.9.2.4 + +* Tue Jun 15 2010 Dan Horák 1.9.2.3-2 +- Fixed build on s390 + +* Fri Apr 2 2010 Martin Stransky 1.9.2.3-1 +- Update to 1.9.2.3 + +* Tue Mar 23 2010 Jan Horak - 1.9.2.2-1 +- Update to 1.9.2.2 + +* Mon Mar 15 2010 Colin Walters - 1.9.2.1-4 +- Enable startup notification, closes #445543 + +* Thu Feb 18 2010 Jan Horak - 1.9.2.1-3 +- Added fix for mozbz#462919 - Override NSS database path + for xulrunner application + +* Wed Feb 17 2010 Martin Stransky 1.9.2.1-2 +- Added fix for #564184 - xulrunner-devel multilib conflict + +* Fri Jan 22 2010 Martin Stransky 1.9.2.1-1 +- Update to 1.9.2.1 + +* Wed Jan 18 2010 Martin Stransky 1.9.2.1-0.10.rc1 +- Update to 1.9.2.1 RC2 + +* Wed Jan 13 2010 Martin Stransky 1.9.2.1-0.9.rc1 +- Update to 1.9.2.1 RC1 + +* Mon Dec 21 2009 Martin Stransky 1.9.2.1-0.8.b5 +- Update to 1.9.2.1 Beta 5 + +* Thu Dec 17 2009 Martin Stransky 1.9.2.1-0.7.b4 +- Added fix for mozbz#543585 - jemalloc alignment assertion + and abort on Linux + +* Thu Dec 3 2009 Martin Stransky 1.9.2.1-0.6.b4 +- Added fix for #543585 - mozilla-plugin.pc contains incorrect CFLAGS + +* Fri Nov 27 2009 Martin Stransky 1.9.2.1-0.5.b4 +- Update to 1.9.2.1 Beta 4 + +* Mon Nov 23 2009 Martin Stransky 1.9.2.1-0.4.b3 +- added -unstable.pc files for compatibility with 1.9.1 + +* Fri Nov 20 2009 Martin Stransky 1.9.2.1-0.3.b3 +- Necko wifi monitor disabled +- fixed a dependency (#539261) +- added source URL (#521704) + +* Wed Nov 18 2009 Martin Stransky 1.9.2.1-0.2.b3 +- Rebase to 1.9.2.1 Beta 3 + +* Fri Nov 13 2009 Martin Stransky 1.9.2.1-0.1.beta2 +- Rebase to 1.9.2.1 Beta 2 +- fix the sqlite runtime requires again (#480989), add a check + that the sqlite requires is sane (by Stepan Kasal) + +* Thu Nov 5 2009 Jan Horak - 1.9.1.5-1 +- Update to 1.9.1.5 + +* Mon Oct 26 2009 Jan Horak - 1.9.1.4-1 +- Update to 1.9.1.4 + +* Mon Sep 7 2009 Jan Horak - 1.9.1.3-1 +- Update to 1.9.1.3 + +* Fri Aug 21 2009 Jan Horak - 1.9.1.2-4 +- Added libnotify support + +* Wed Aug 12 2009 Martin Stransky 1.9.1.2-3 +- Added fix from #516118 - Headers not C89 + +* Mon Aug 6 2009 Martin Stransky 1.9.1.2-2 +- Rebuilt + +* Mon Aug 3 2009 Martin Stransky 1.9.1.2-1 +- Update to 1.9.1.2 + +* Mon Jul 27 2009 Fedora Release Engineering - 1.9.1.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Fri Jul 17 2009 Christopher Aillon - 1.9.1.1-1 +- Update to 1.9.1.1 + +* Mon Jul 13 2009 Jan Horak - 1.9.1-3 +- Fixed wrong version of Firefox when loading 'about:' as location +- Added patch to compile against latest GTK + +* Tue Jun 30 2009 Yanko Kaneti - 1.9.1-2 +- Build using system hunspell + +* Tue Jun 30 2009 Christopher Aillon 1.9.1-1 +- Update to 1.9.1 final release + +* Wed Jun 24 2009 Martin Stransky 1.9.1-0.23 +- Rebuilt because of gcc update (#506952) + +* Thu Jun 18 2009 Martin Stransky 1.9.1-0.22 +- Backed out last change, it does not work inside mock (koji) + +* Tue Jun 16 2009 Stepan Kasal 1.9.1-0.21 +- require sqlite of version >= what was used at buildtime (#480989) +- in devel subpackage, drop version from sqlite-devel require; that's + handled indirectly through the versioned require in main package + +* Mon Apr 27 2009 Christopher Aillon 1.9.1-0.20 +- 1.9.1 beta 4 + +* Fri Mar 27 2009 Christopher Aillon 1.9.1-0.11 +- Add patches for MFSA-2009-12, MFSA-2009-13 + +* Fri Mar 13 2009 Christopher Aillon 1.9.1-0.10 +- 1.9.1 beta 3 + +* Fri Feb 27 2009 Martin Stransky 1.9.1-0.9 +- Build fix for pango 1.23 +- Misc. build fixes + +* Thu Feb 26 2009 Fedora Release Engineering - 1.9.1-0.8.beta2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Wed Jan 28 2009 Christopher Aillon 1.9.1-0.7 +- Re-enable NM by default + +* Wed Jan 7 2009 Martin Stransky 1.9.1-0.6 +- Copied mozilla-config.h to stable include dir (#478445) + +* Mon Dec 22 2008 Christopher Aillon 1.9.1-0.5 +- Typo fix + +* Sat Dec 20 2008 Christopher Aillon 1.9.1-0.4 +- 1.9.1 beta 2 + +* Tue Dec 9 2008 Christopher Aillon 1.9.1-0.3 +- Mark this as a pre-release + +* Tue Dec 9 2008 Christopher Aillon 1.9.1-0.2 +- Add needed -devel requires to the -devel package + +* Thu Dec 4 2008 Christopher Aillon 1.9.1-0.1 +- 1.9.1 beta 1 + +* Wed Nov 12 2008 Christopher Aillon 1.9.0.4-1 +- Update to 1.9.0.4 + +* Mon Oct 27 2008 Christopher Aillon 1.9.0.2-5 +- Password manager fixes from upstream + +* Tue Oct 7 2008 Marco Pesenti Gritti 1.9.0.2-4 +- Add missing dependency on python-devel + +* Sun Oct 5 2008 Christopher Aillon 1.9.0.2-3 +- Enable PyXPCOM + +* Thu Sep 25 2008 Martin Stransky 1.9.0.2-2 +- Build with system cairo (#463341) + +* Tue Sep 23 2008 Christopher Aillon 1.9.0.2-1 +- Update to 1.9.0.2 + +* Wed Jul 23 2008 Christopher Aillon 1.9.0.1-2 +- Disable system hunspell for now as it's causing some crashes (447444) + +* Wed Jul 16 2008 Christopher Aillon 1.9.0.1-1 +- Update to 1.9.0.1 + +* Tue Jun 17 2008 Christopher Aillon 1.9-1 +- Update to 1.9 final + +* Thu May 29 2008 Christopher Aillon 1.9-0.63 +- Simplify PS/PDF operators + +* Thu May 22 2008 Christopher Aillon 1.9-0.62 +- Upstream patch to fsync() less + +* Thu May 08 2008 Colin Walters 1.9-0.61 +- Ensure we enable startup notification; add BR and modify config + (bug #445543) + +* Wed Apr 30 2008 Christopher Aillon 1.9-0.60 +- Some files moved to mozilla-filesystem; kill them and add the Req + +* Mon Apr 28 2008 Christopher Aillon 1.9-0.59 +- Clean up the %%files list and get rid of the executable bit on some files + +* Sat Apr 26 2008 Christopher Aillon 1.9-0.58 +- Fix font scaling + +* Fri Apr 25 2008 Martin Stransky 1.9-0.57 +- Enabled phishing protection (#443403) + +* Wed Apr 23 2008 Martin Stransky 1.9-0.56 +- Changed "__ppc64__" to "__powerpc64__", + "__ppc64__" doesn't work anymore +- Added fix for #443725 - Critical hanging bug with fix + available upstream (mozbz#429903) + +* Fri Apr 18 2008 Martin Stransky 1.9-0.55 +- Fixed multilib issues, added starting script instead of a symlink + to binary (#436393) + +* Sat Apr 12 2008 Christopher Aillon 1.9-0.54 +- Add upstream patches for dpi, toolbar buttons, and invalid keys +- Re-enable system cairo + +* Mon Apr 7 2008 Christopher Aillon 1.9-0.53 +- Spec cleanups + +* Wed Apr 2 2008 Christopher Aillon 1.9-0.52 +- Beta 5 + +* Mon Mar 31 2008 Christopher Aillon 1.9-0.51 +- Beta 5 RC2 + +* Thu Mar 27 2008 Christopher Aillon 1.9-0.50 +- Update to latest trunk (2008-03-27) + +* Wed Mar 26 2008 Christopher Aillon 1.9-0.49 +- Update to latest trunk (2008-03-26) + +* Tue Mar 25 2008 Christopher Aillon 1.9-0.48 +- Update to latest trunk (2008-03-25) + +* Mon Mar 24 2008 Christopher Aillon 1.9-0.47 +- Update to latest trunk (2008-03-24) + +* Thu Mar 20 2008 Christopher Aillon 1.9-0.46 +- Update to latest trunk (2008-03-20) + +* Mon Mar 17 2008 Christopher Aillon 1.9-0.45 +- Update to latest trunk (2008-03-17) + +* Mon Mar 17 2008 Christopher Aillon 1.9-0.44 +- Revert to trunk from the 15th to fix crashes on HTTPS sites + +* Sun Mar 16 2008 Christopher Aillon 1.9-0.43 +- Update to latest trunk (2008-03-16) +- Add patch to negate a11y slowdown on some pages (#431162) + +* Sat Mar 15 2008 Christopher Aillon 1.9-0.42 +- Update to latest trunk (2008-03-15) + +* Sat Mar 15 2008 Christopher Aillon 1.9-0.41 +- Avoid conflicts between gecko debuginfo packages + +* Wed Mar 12 2008 Christopher Aillon 1.9-0.40 +- Update to latest trunk (2008-03-12) + +* Tue Mar 11 2008 Christopher Aillon 1.9-0.39 +- Update to latest trunk (2008-03-11) + +* Mon Mar 10 2008 Christopher Aillon 1.9-0.38 +- Update to latest trunk (2008-03-10) + +* Sun Mar 9 2008 Christopher Aillon 1.9-0.37 +- Update to latest trunk (2008-03-09) + +* Fri Mar 7 2008 Christopher Aillon 1.9-0.beta4.36 +- Update to latest trunk (2008-03-07) + +* Thu Mar 6 2008 Christopher Aillon 1.9-0.beta4.35 +- Update to latest trunk (2008-03-06) + +* Tue Mar 4 2008 Christopher Aillon 1.9-0.beta4.34 +- Update to latest trunk (2008-03-04) + +* Sun Mar 2 2008 Christopher Aillon 1.9-0.beta3.33 +- Update to latest trunk (2008-03-02) + +* Sat Mar 1 2008 Christopher Aillon 1.9-0.beta3.32 +- Update to latest trunk (2008-03-01) + +* Fri Feb 29 2008 Christopher Aillon 1.9-0.beta3.31 +- Update to latest trunk (2008-02-29) + +* Thu Feb 28 2008 Christopher Aillon 1.9-0.beta3.30 +- Update to latest trunk (2008-02-28) + +* Wed Feb 27 2008 Christopher Aillon 1.9-0.beta3.29 +- Update to latest trunk (2008-02-27) + +* Tue Feb 26 2008 Christopher Aillon 1.9-0.beta3.28 +- Update to latest trunk (2008-02-26) + +* Sat Feb 23 2008 Christopher Aillon 1.9-0.beta3.27 +- Update to latest trunk (2008-02-23) + +* Fri Feb 22 2008 Christopher Aillon 1.9-0.beta3.26 +- Update to latest trunk (2008-02-22) + +* Thu Feb 21 2008 Christopher Aillon 1.9-0.beta3.25 +- Update to latest trunk (2008-02-21) + +* Wed Feb 20 2008 Christopher Aillon 1.9-0.beta3.24 +- Update to latest trunk (2008-02-20) + +* Sun Feb 17 2008 Christopher Aillon 1.9-0.beta3.23 +- Update to latest trunk (2008-02-17) + +* Fri Feb 15 2008 Christopher Aillon 1.9-0.beta3.22 +- Update to latest trunk (2008-02-15) + +* Thu Feb 14 2008 Christopher Aillon 1.9-0.beta3.21 +- Update to latest trunk (2008-02-14) +- Use system hunspell + +* Mon Feb 11 2008 Christopher Aillon 1.9-0.beta2.19 +- Update to latest trunk (2008-02-11) + +* Mon Feb 11 2008 Adam Jackson 1.9-0.beta2.19 +- STRIP="/bin/true" on the %%make line so xulrunner-debuginfo contains, + you know, debuginfo. + +* Sun Feb 10 2008 Christopher Aillon 1.9-0.beta2.18 +- Update to latest trunk (2008-02-10) + +* Sat Feb 9 2008 Christopher Aillon 1.9-0.beta2.17 +- Update to latest trunk (2008-02-09) + +* Wed Feb 6 2008 Christopher Aillon 1.9-0.beta2.16 +- Update to latest trunk (2008-02-06) + +* Tue Jan 29 2008 Christopher Aillon 1.9-0.beta2.15 +- Update to latest trunk (2008-01-30) + +* Wed Jan 25 2008 Martin Stransky 1.9-0.beta2.14 +- rebuild agains new nss +- enabled gnome vfs + +* Wed Jan 23 2008 Martin Stransky 1.9-0.beta2.13 +- fixed stable pkg-config files (#429654) +- removed sqlite patch + +* Mon Jan 21 2008 Christopher Aillon 1.9-0.beta2.12 +- Update to latest trunk (2008-01-21) + +* Tue Jan 15 2008 Christopher Aillon 1.9-0.beta2.11 +- Update to latest trunk (2008-01-15) +- Now with system extensions directory support + +* Sat Jan 13 2008 Christopher Aillon 1.9-0.beta2.10 +- Update to latest trunk (2008-01-13) +- Use CFLAGS instead of configure arguments +- Random cleanups: BuildRequires, scriptlets, prefs, etc. + +* Sat Jan 12 2008 Christopher Aillon 1.9-0.beta2.9 +- Provide gecko-devel-unstable as well + +* Wed Jan 9 2008 Martin Stransky 1.9-0.beta2.8 +- divided devel package to devel and devel-unstable + +* Mon Jan 7 2008 Martin Stransky 1.9-0.beta2.7 +- removed fedora specific pkg-config files +- updated to the latest trunk (2008-01-07) +- removed unnecessary patches +- fixed idl dir (#427965) + +* Thu Jan 3 2008 Christopher Aillon 1.9-0.beta2.6 +- Re-enable camellia256 support now that NSS supports it + +* Thu Jan 3 2008 Martin Stransky 1.9-0.beta2.5 +- updated to the latest trunk (2008-01-03) + +* Mon Dec 24 2007 Christopher Aillon 1.9-0.beta2.4 +- Don't Provide webclient (xulrunner is not itself a webclient) +- Don't Obsolete old firefox, only firefox-devel +- Kill legacy obsoletes (phoenix, etc) that were never in rawhide + +* Thu Dec 21 2007 Martin Stransky 1.9-0.beta2.3 +- added java and plugin subdirs to plugin includes + +* Thu Dec 20 2007 Martin Stransky 1.9-0.beta2.2 +- dependency fixes, obsoletes firefox < 3 and firefox-devel now + +* Wed Dec 12 2007 Martin Stransky 1.9-0.beta2.1 +- updated to Beta 2. +- moved SDK to xulrunner-sdk + +* Thu Dec 06 2007 Martin Stransky 1.9-0.beta1.4 +- fixed mozilla-plugin.pc (#412971) + +* Tue Nov 27 2007 Martin Stransky 1.9-0.beta1.3 +- export /etc/gre.d/gre.conf (it's used by python gecko applications) + +* Mon Nov 26 2007 Martin Stransky 1.9-0.beta1.2 +- added xulrunner/js include dir to xulrunner-js + +* Tue Nov 20 2007 Martin Stransky 1.9-0.beta1.1 +- update to beta 1 + +* Mon Nov 19 2007 Martin Stransky 1.9-0.alpha9.6 +- packed all gecko libraries (#389391) + +* Thu Nov 15 2007 Martin Stransky 1.9-0.alpha9.5 +- registered xulrunner libs system-wide +- added xulrunner-gtkmozembed.pc + +* Wed Nov 14 2007 Martin Stransky 1.9-0.alpha9.4 +- added proper nss/nspr dependencies + +* Wed Nov 14 2007 Martin Stransky 1.9-0.alpha9.3 +- more build fixes, use system nss libraries + +* Tue Nov 6 2007 Martin Stransky 1.9-0.alpha9.2 +- build fixes + +* Tue Oct 30 2007 Martin Stransky 1.9-0.alpha9.1 +- updated to the latest trunk + +* Thu Sep 20 2007 David Woodhouse 1.9-0.alpha7.4 +- build fixes for ppc/ppc64 + +* Tue Sep 20 2007 Martin Stransky 1.9-0.alpha7.3 +- removed conflicts with the current gecko-based apps +- added updated ppc64 patch + +* Tue Sep 18 2007 Martin Stransky 1.9-0.alpha7.2 +- build fixes + +* Wed Sep 5 2007 Christopher Aillon 1.9-0.alpha7.1 +- Initial cut at XULRunner 1.9 Alpha 7 +- Temporarily revert camellia 256 support since our nss doesn't support it yet