update for Firefox 23 on Linux

Change-Id: Ib0a10e0a48da0dd1e268572b14ac7e4c0145f675
diff --git a/xpcom/ExternalWrapper.cpp b/xpcom/ExternalWrapper.cpp
index 9bc40c8..d32f1fc 100644
--- a/xpcom/ExternalWrapper.cpp
+++ b/xpcom/ExternalWrapper.cpp
@@ -30,8 +30,12 @@
 #include "nsIDOMLocation.h"
 #include "nsXPCOMStrings.h"
 #include "nsICategoryManager.h"
+#if GECKO_VERSION <= 22000
 #include "nsIJSContextStack.h"
-#include "nsIScriptContext.h"
+#else
+#include "nsIXPConnect.h"
+#endif //GECKO_VERSION
+#include "nsIScriptContext.h" 
 #include "nsIScriptGlobalObject.h"
 #include "nsPIDOMWindow.h"
 #include "LoadModuleMessage.h"
@@ -91,6 +95,9 @@
  * @return true on success
  */
 static bool getWindowObject(nsIDOMWindow** win) {
+
+#if GECKO_VERSION <= 22000
+
   // Get JSContext from stack.
   nsCOMPtr<nsIJSContextStack> stack =
       do_GetService("@mozilla.org/js/xpc/ContextStack;1");
@@ -105,6 +112,26 @@
         << Debug::flush;
     return false;
   }
+
+#else
+
+  nsresult rv;
+  nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID(), &rv);
+  if (!NS_SUCCEEDED(rv)) {
+    Debug::log(Debug::Error) << "getWindowObject: no context stack"
+        << Debug::flush;
+    return false;
+  }
+
+  JSContext *cx = xpc->GetCurrentJSContext();
+  if (!cx) {
+    Debug::log(Debug::Error) << "getWindowObject: no context on stack"
+        << Debug::flush;
+    return false;
+  }
+
+#endif
+
   if (!(::JS_GetOptions(cx) & JSOPTION_PRIVATE_IS_NSISUPPORTS)) {
     Debug::log(Debug::Error)
         << "getWindowObject: context doesn't have nsISupports" << Debug::flush;
diff --git a/xpcom/FFSessionHandler.cpp b/xpcom/FFSessionHandler.cpp
index f966e92..609b8b0 100755
--- a/xpcom/FFSessionHandler.cpp
+++ b/xpcom/FFSessionHandler.cpp
@@ -29,7 +29,11 @@
 #include "jsapi.h"
 #include "nsCOMPtr.h"
 #include "nsStringAPI.h"
+#if GECKO_VERSION <= 22000
 #include "nsIJSContextStack.h"
+#else
+#include "nsIXPConnect.h"
+#endif //GECKO_VERSION
 #include "nsIPrincipal.h"
 #include "nsServiceManagerUtils.h"
 
@@ -47,6 +51,9 @@
 #endif
 
 static JSContext* getJSContext() {
+
+#if GECKO_VERSION <= 22000
+
   // Get JSContext from stack.
   nsCOMPtr<nsIJSContextStack> stack =
       do_GetService("@mozilla.org/js/xpc/ContextStack;1");
@@ -65,6 +72,26 @@
   }
 
   return cx;
+
+#else
+
+  nsresult rv;
+  nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID(), &rv);
+  if (!NS_SUCCEEDED(rv)) {
+    Debug::log(Debug::Error) << "getJSContext: no context stack"
+        << Debug::flush;
+    return NULL;
+  }
+
+  JSContext *cx = xpc->GetCurrentJSContext();
+  if (!cx) {
+    Debug::log(Debug::Error) << "getJSContext: Null JS context"
+        << Debug::flush;
+    return NULL;
+  }
+  return cx;
+
+#endif
 }
 
 FFSessionHandler::FFSessionHandler(HostChannel* channel)
diff --git a/xpcom/JavaObject.cpp b/xpcom/JavaObject.cpp
index 281b2e2..3847a3d 100644
--- a/xpcom/JavaObject.cpp
+++ b/xpcom/JavaObject.cpp
@@ -30,7 +30,11 @@
   JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_NEW_ENUMERATE, /* flags */
 
   JS_PropertyStub, /* add property */
+#if GECKO_VERSION <= 22000
   JS_PropertyStub, /* delete property */
+#else
+  JS_DeletePropertyStub,
+#endif
 #if GECKO_VERSION < 15000
   JavaObject::getProperty, /* get property */
   JavaObject::setProperty, /* set property */
diff --git a/xpcom/Makefile b/xpcom/Makefile
index 3fe83b0..5e69db4 100644
--- a/xpcom/Makefile
+++ b/xpcom/Makefile
@@ -206,6 +206,14 @@
 NSPR_DLLFLAGS = -lnss3
 endif
 else
+ifeq ($(BROWSER),ff230)
+GECKO_VERSION   = 23.0.0
+CFLAGS += -DGECKO_VERSION=23000
+GECKO_DLLFLAGS = -lxpcomglue_s
+ifeq ($(OS),mac)
+NSPR_DLLFLAGS = -lnss3
+endif
+else
 $(error Unrecognized BROWSER of $(BROWSER) - options are ff3, ff3+, ff35, ff36, ff40, ff50, ff60, ff70, ff80, ff90, ff100, ff110, ff120, ff130, ff140, ff150, ff160, ff170, ff180, ff190, ff200, ff210)
 endif
 endif
@@ -230,6 +238,7 @@
 endif
 endif
 endif
+endif
 
 CFLAGS += -fshort-wchar
 CXXFLAGS = $(CXXONLYFLAGS) $(CFLAGS)
diff --git a/xpcom/install-template.rdf b/xpcom/install-template.rdf
index 488d2cb..02b48f9 100644
--- a/xpcom/install-template.rdf
+++ b/xpcom/install-template.rdf
@@ -12,7 +12,7 @@
       <Description>
         <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
         <em:minVersion>3.0</em:minVersion>
-        <em:maxVersion>22.0.*</em:maxVersion>
+        <em:maxVersion>23.0.*</em:maxVersion>
       </Description>
 
     <!-- TODO: This seems to break Firefox 3.6. With this on, FF gets into a
diff --git a/xpcom/prebuilt/extension/chrome.manifest b/xpcom/prebuilt/extension/chrome.manifest
index 6abab4f..4203472 100644
--- a/xpcom/prebuilt/extension/chrome.manifest
+++ b/xpcom/prebuilt/extension/chrome.manifest
@@ -136,6 +136,9 @@
 binary-component lib/Darwin-gcc3/ff220/libgwt_dev_ff220.dylib ABI=Darwin_x86_64-gcc3 appversion<=22.0.*
 binary-component lib/Darwin-gcc3/ff220/libgwt_dev_ff220.dylib ABI=Darwin_x86-gcc3 appversion<=22.0.*
 
+# Firefox 23
+binary-component lib/Linux_x86_64-gcc3/ff230/libgwt_dev_ff230.so ABI=Linux_x86_64-gcc3 appversion<=23.0.*
+binary-component lib/Linux_x86-gcc3/ff230/libgwt_dev_ff230.so ABI=Linux_x86-gcc3 appversion<=23.0.*
 
 interfaces components/IOOPHM.xpt
 contract @gwt.google.com/ExternalWrapper;1 {028DD88B-6D65-401D-AAFD-17E497D15D09}
diff --git a/xpcom/prebuilt/extension/install.rdf b/xpcom/prebuilt/extension/install.rdf
new file mode 100644
index 0000000..cc37e71
--- /dev/null
+++ b/xpcom/prebuilt/extension/install.rdf
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+     xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+  <Description about="urn:mozilla:install-manifest">
+    <em:id>gwt-dev-plugin@google.com</em:id>
+    <em:name>Google Web Toolkit Developer Plugin for Firefox</em:name>
+    <em:version>1.23dev</em:version>
+    <em:type>2</em:type>
+    <em:unpack>true</em:unpack>
+    <em:targetApplication>
+      <Description>
+        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+        <em:minVersion>3.0</em:minVersion>
+        <em:maxVersion>23.0.*</em:maxVersion>
+      </Description>
+
+    <!-- TODO: This seems to break Firefox 3.6. With this on, FF gets into a
+               infinity loop of requiring to restart. I suspect it is a bug
+               in that version that was fixed in later version.
+    <em:strictCompatibility>true</em:strictCompatibility>
+    -->
+
+    </em:targetApplication>
+
+    <!-- Front End MetaData -->
+    <em:description>A plugin to support GWT development-mode in XPCOM-based browsers</em:description>
+    <em:creator>Google, Inc.</em:creator>
+    <em:homepageURL>http://code.google.com/webtoolkit/</em:homepageURL>
+    <em:iconURL>chrome://gwt-dev-plugin/skin/icon.png</em:iconURL>
+
+    <em:targetPlatform>Linux_x86-gcc3</em:targetPlatform>
+    <em:targetPlatform>Linux_x86_64-gcc3</em:targetPlatform>
+    <em:targetPlatform>WINNT_x86-msvc</em:targetPlatform>
+    <em:targetPlatform>Darwin_x86-gcc3</em:targetPlatform>
+    <em:targetPlatform>Darwin_x86_64-gcc3</em:targetPlatform>
+    <em:targetPlatform>Darwin_ppc-gcc3</em:targetPlatform>
+
+    <em:optionsURL>chrome://gwt-dev-plugin/content/options.xul</em:optionsURL>
+
+    <!-- updates, see http://developer.mozilla.org/en/docs/Extension_Versioning%2C_Update_and_Compatibility#Update_RDF_Format -->
+    <em:updateURL><![CDATA[https://dl-ssl.google.com/gwt/plugins/firefox/gwt-dev-plugin-updates.rdf?guid=%ITEM_ID%&version=%ITEM_VERSION%&application=%APP_ID%&appversion=%APP_VERSION%&locale=%APP_LOCALE%&os=%APP_OS%&abi=%APP_ABI%]]></em:updateURL>
+
+    <!-- TODO
+    # replace default about dialog
+    <em:aboutURL>chrome://gwt-dmp/content/about.xul</em:aboutURL>
+
+    # more platforms - any others?
+    <em:targetPlatform>SunOS_sparc-sunc</em:targetPlatform>
+    <em:targetPlatform>SunOS_x86-sunc</em:targetPlatform>
+    <em:targetPlatform>SunOS_x86_64-sunc</em:targetPlatform>
+    <em:targetPlatform>FreeBSD_x86-gcc3</em:targetPlatform>
+    <em:targetPlatform>FreeBSD_x86_64-gcc3</em:targetPlatform>
+    -->
+
+  </Description>
+</RDF>
diff --git a/xpcom/prebuilt/extension/lib/Linux_x86-gcc3/ff230/libgwt_dev_ff230.so b/xpcom/prebuilt/extension/lib/Linux_x86-gcc3/ff230/libgwt_dev_ff230.so
new file mode 100755
index 0000000..b273b84
--- /dev/null
+++ b/xpcom/prebuilt/extension/lib/Linux_x86-gcc3/ff230/libgwt_dev_ff230.so
Binary files differ
diff --git a/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3/ff230/libgwt_dev_ff230.so b/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3/ff230/libgwt_dev_ff230.so
new file mode 100755
index 0000000..1a3bff7
--- /dev/null
+++ b/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3/ff230/libgwt_dev_ff230.so
Binary files differ
diff --git a/xpcom/prebuilt/ff230/include/IOOPHM.h b/xpcom/prebuilt/ff230/include/IOOPHM.h
new file mode 100644
index 0000000..4a152ce
--- /dev/null
+++ b/xpcom/prebuilt/ff230/include/IOOPHM.h
@@ -0,0 +1,105 @@
+/*
+ * DO NOT EDIT.  THIS FILE IS GENERATED FROM IOOPHM.idl
+ */
+
+#ifndef __gen_IOOPHM_h__
+#define __gen_IOOPHM_h__
+
+
+#ifndef __gen_nsISupports_h__
+#include "nsISupports.h"
+#endif
+
+/* For IDL files that don't want to include root IDL files. */
+#ifndef NS_NO_VTABLE
+#define NS_NO_VTABLE
+#endif
+class nsIDOMWindow; /* forward declaration */
+
+
+/* starting interface:    IOOPHM */
+#define IOOPHM_IID_STR "90cef17b-c3fe-4251-af68-4381b3d938a0"
+
+#define IOOPHM_IID \
+  {0x90cef17b, 0xc3fe, 0x4251, \
+    { 0xaf, 0x68, 0x43, 0x81, 0xb3, 0xd9, 0x38, 0xa0 }}
+
+class NS_NO_VTABLE IOOPHM : public nsISupports {
+ public: 
+
+  NS_DECLARE_STATIC_IID_ACCESSOR(IOOPHM_IID)
+
+  /* boolean init (in nsIDOMWindow window); */
+  NS_IMETHOD Init(nsIDOMWindow *window, bool *_retval) = 0;
+
+  /* boolean connect (in ACString url, in ACString sessionKey, in ACString addr, in ACString moduleName, in ACString hostedHtmlVersion); */
+  NS_IMETHOD Connect(const nsACString & url, const nsACString & sessionKey, const nsACString & addr, const nsACString & moduleName, const nsACString & hostedHtmlVersion, bool *_retval) = 0;
+
+};
+
+  NS_DEFINE_STATIC_IID_ACCESSOR(IOOPHM, IOOPHM_IID)
+
+/* Use this macro when declaring classes that implement this interface. */
+#define NS_DECL_IOOPHM \
+  NS_IMETHOD Init(nsIDOMWindow *window, bool *_retval); \
+  NS_IMETHOD Connect(const nsACString & url, const nsACString & sessionKey, const nsACString & addr, const nsACString & moduleName, const nsACString & hostedHtmlVersion, bool *_retval); 
+
+/* Use this macro to declare functions that forward the behavior of this interface to another object. */
+#define NS_FORWARD_IOOPHM(_to) \
+  NS_IMETHOD Init(nsIDOMWindow *window, bool *_retval) { return _to Init(window, _retval); } \
+  NS_IMETHOD Connect(const nsACString & url, const nsACString & sessionKey, const nsACString & addr, const nsACString & moduleName, const nsACString & hostedHtmlVersion, bool *_retval) { return _to Connect(url, sessionKey, addr, moduleName, hostedHtmlVersion, _retval); } 
+
+/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
+#define NS_FORWARD_SAFE_IOOPHM(_to) \
+  NS_IMETHOD Init(nsIDOMWindow *window, bool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(window, _retval); } \
+  NS_IMETHOD Connect(const nsACString & url, const nsACString & sessionKey, const nsACString & addr, const nsACString & moduleName, const nsACString & hostedHtmlVersion, bool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Connect(url, sessionKey, addr, moduleName, hostedHtmlVersion, _retval); } 
+
+#if 0
+/* Use the code below as a template for the implementation class for this interface. */
+
+/* Header file */
+class _MYCLASS_ : public IOOPHM
+{
+public:
+  NS_DECL_ISUPPORTS
+  NS_DECL_IOOPHM
+
+  _MYCLASS_();
+
+private:
+  ~_MYCLASS_();
+
+protected:
+  /* additional members */
+};
+
+/* Implementation file */
+NS_IMPL_ISUPPORTS1(_MYCLASS_, IOOPHM)
+
+_MYCLASS_::_MYCLASS_()
+{
+  /* member initializers and constructor code */
+}
+
+_MYCLASS_::~_MYCLASS_()
+{
+  /* destructor code */
+}
+
+/* boolean init (in nsIDOMWindow window); */
+NS_IMETHODIMP _MYCLASS_::Init(nsIDOMWindow *window, bool *_retval)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* boolean connect (in ACString url, in ACString sessionKey, in ACString addr, in ACString moduleName, in ACString hostedHtmlVersion); */
+NS_IMETHODIMP _MYCLASS_::Connect(const nsACString & url, const nsACString & sessionKey, const nsACString & addr, const nsACString & moduleName, const nsACString & hostedHtmlVersion, bool *_retval)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* End of implementation class template. */
+#endif
+
+
+#endif /* __gen_IOOPHM_h__ */
diff --git a/xpcom/prebuilt/update.rdf b/xpcom/prebuilt/update.rdf
index 01219db..b6b3890 100644
--- a/xpcom/prebuilt/update.rdf
+++ b/xpcom/prebuilt/update.rdf
@@ -14,7 +14,7 @@
               <Description>
                 <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
                 <em:minVersion>3.0</em:minVersion>
-                <em:maxVersion>22.0.*</em:maxVersion>
+                <em:maxVersion>23.0.*</em:maxVersion>
                 <em:updateLink>https://dl-ssl.google.com/gwt/plugins/firefox/gwt-dev-plugin.xpi</em:updateLink>
                 <em:updateInfoURL>https://dl-ssl.google.com/gwt/plugins/firefox/gwt-dev-plugin-info.xhtml?locale=%APP_LOCALE%</em:updateInfoURL>