backport mozilla 1.9.1 support to 3.4 maintenance stream (post-3.4.2 release)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/carbon/org/eclipse/swt/browser/MozillaDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/carbon/org/eclipse/swt/browser/MozillaDelegate.java
index f685390..ad94e4c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/carbon/org/eclipse/swt/browser/MozillaDelegate.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/carbon/org/eclipse/swt/browser/MozillaDelegate.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * Copyright (c) 2003, 2009 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -17,6 +17,7 @@
 import org.eclipse.swt.internal.*;
 import org.eclipse.swt.internal.carbon.*;
 import org.eclipse.swt.internal.cocoa.*;
+import org.eclipse.swt.internal.mozilla.*;
 import org.eclipse.swt.widgets.*;
 
 class MozillaDelegate {
@@ -104,6 +105,24 @@
 	return OS.eventNotHandledErr;
 }
 
+void addWindowSubclass () {
+}
+
+int createBaseWindow (nsIBaseWindow baseWindow) {
+	/*
+	* Feature of Mozilla on OSX.  Mozilla replaces the OSX application menu whenever
+	* a browser's base window is created.  The workaround is to restore the previous
+	* menu after creating the base window. 
+	*/
+	int application = Cocoa.objc_msgSend (Cocoa.C_NSApplication, Cocoa.S_sharedApplication);
+	int mainMenu = Cocoa.objc_msgSend (application, Cocoa.S_mainMenu);
+	Cocoa.objc_msgSend (mainMenu, Cocoa.S_retain);
+	int rc = baseWindow.Create ();
+	Cocoa.objc_msgSend (application, Cocoa.S_setMainMenu, mainMenu);
+	Cocoa.objc_msgSend (mainMenu, Cocoa.S_release);
+	return rc;
+}
+
 int getHandle () {
     int embedHandle = Cocoa.objc_msgSend (Cocoa.C_NSImageView, Cocoa.S_alloc);
 	if (embedHandle == 0) {
@@ -175,6 +194,10 @@
 	return embedHandle;
 }
 
+String getJSLibraryName () {
+	return "libmozjs.dylib"; //$NON-NLS-1$
+}
+
 String getLibraryName () {
 	return "libxpcom.dylib"; //$NON-NLS-1$
 }
@@ -227,6 +250,9 @@
 	browser = null;
 }
 
+void removeWindowSubclass () {
+}
+
 void setSize (int embedHandle, int width, int height) {
 	// TODO
 }
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/Platform.java b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/Platform.java
index c3534f7..50a440f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/Platform.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/Platform.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -13,5 +13,6 @@
 public class Platform {
 	
 public static final String PLATFORM = "carbon"; //$NON-NLS-1$
+public static final Lock lock = new Lock ();
 
 }
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/cocoa/Cocoa.java b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/cocoa/Cocoa.java
index de78785..202f3b2 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/cocoa/Cocoa.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/cocoa/Cocoa.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * Copyright (c) 2003, 2009 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -32,6 +32,7 @@
 public static final int C_NSImage = Cocoa.objc_getClass("NSImage"); //$NON-NLS-1$
 public static final int C_NSGraphicsContext = Cocoa.objc_getClass("NSGraphicsContext"); //$NON-NLS-1$
 public static final int C_NSStatusItemImageView = Cocoa.objc_getClass("NSStatusItemImageView"); //$NON-NLS-1$
+public static final int C_NSApplication = Cocoa.objc_getClass("NSApplication"); //$NON-NLS-1$
 public static final int C_NSCursor = Cocoa.objc_getClass("NSCursor"); //$NON-NLS-1$
 public static final int C_NSWindow = Cocoa.objc_getClass("NSWindow"); //$NON-NLS-1$
 public static final int C_NSBitmapImageRep = Cocoa.objc_getClass("NSBitmapImageRep"); //$NON-NLS-1$
@@ -70,6 +71,7 @@
 public static final int S_loadHTMLStringbaseURL = Cocoa.sel_registerName("loadHTMLString:baseURL:"); //$NON-NLS-1$
 public static final int S_loadRequest = Cocoa.sel_registerName("loadRequest:"); //$NON-NLS-1$
 public static final int S_mainFrame = Cocoa.sel_registerName("mainFrame"); //$NON-NLS-1$
+public static final int S_mainMenu = Cocoa.sel_registerName("mainMenu"); //$NON-NLS-1$
 public static final int S_name = Cocoa.sel_registerName("name"); //$NON-NLS-1$
 public static final int S_numberWithInt = Cocoa.sel_registerName("numberWithInt:"); //$NON-NLS-1$
 public static final int S_objectAtIndex = Cocoa.sel_registerName("objectAtIndex:"); //$NON-NLS-1$
@@ -91,10 +93,12 @@
 public static final int S_setFrameLoadDelegate = Cocoa.sel_registerName("setFrameLoadDelegate:"); //$NON-NLS-1$
 public static final int S_setGroupName = Cocoa.sel_registerName("setGroupName:"); //$NON-NLS-1$
 public static final int S_setJavaEnabled = Cocoa.sel_registerName("setJavaEnabled:"); //$NON-NLS-1$
+public static final int S_setMainMenu = Cocoa.sel_registerName("setMainMenu:"); //$NON-NLS-1$
 public static final int S_setPolicyDelegate = Cocoa.sel_registerName("setPolicyDelegate:"); //$NON-NLS-1$
 public static final int S_setResourceLoadDelegate = Cocoa.sel_registerName("setResourceLoadDelegate:"); //$NON-NLS-1$
 public static final int S_setStatusText = Cocoa.sel_registerName("setStatusText:"); //$NON-NLS-1$
 public static final int S_setUIDelegate = Cocoa.sel_registerName("setUIDelegate:"); //$NON-NLS-1$
+public static final int S_sharedApplication = Cocoa.sel_registerName("sharedApplication"); //$NON-NLS-1$
 public static final int S_sharedHTTPCookieStorage = Cocoa.sel_registerName("sharedHTTPCookieStorage"); //$NON-NLS-1$
 public static final int S_standardPreferences = Cocoa.sel_registerName("standardPreferences"); //$NON-NLS-1$
 public static final int S_stopLoading = Cocoa.sel_registerName("stopLoading:"); //$NON-NLS-1$