[ilovegom commit] r77 - in trunk/gom: idl include/xpgom src/xpgom

1 view
Skip to first unread message

codesite...@google.com

unread,
Aug 21, 2008, 3:24:31 AM8/21/08
to gom-c...@googlegroups.com
Author: ja...@87k.net
Date: Thu Aug 21 00:23:29 2008
New Revision: 77

Added:
trunk/gom/include/xpgom/xgDocShell.hh
trunk/gom/src/xpgom/xgDocShell.cc
trunk/gom/src/xpgom/xgDocShellUnimplemented.cc
trunk/gom/src/xpgom/xgWindowUnimplemented.cc
Modified:
trunk/gom/idl/Makefile.inc
trunk/gom/idl/xgIParser.idl
trunk/gom/idl/xgIWindow.idl
trunk/gom/include/xpgom/xgWindow.hh
trunk/gom/src/xpgom/xgParser.js
trunk/gom/src/xpgom/xgWindow.cc
trunk/gom/src/xpgom/xpgom.js

Log:
Add aborted work to implement nsIDocShell, nsIGlobalScriptObject


Modified: trunk/gom/idl/Makefile.inc
==============================================================================
--- trunk/gom/idl/Makefile.inc (original)
+++ trunk/gom/idl/Makefile.inc Thu Aug 21 00:23:29 2008
@@ -1,9 +1,8 @@
# -*- Makefile -*-

-dist_noinst_DATA += idl/xgPIWrapped.idl
-dist_noinst_DATA += idl/xgIParser.idl
-dist_noinst_DATA += idl/xgIWindow.idl
+idl_headers += idl/xgIParser.hh
+idl_headers += idl/xgIWindow.hh
+idl_headers += idl/xgPIWrapped.hh

-noinst_DATA += idl/xgPIWrapped.xpt
-noinst_DATA += idl/xgIParser.xpt
-noinst_DATA += idl/xgIWindow.xpt
+dist_noinst_DATA += $(idl_headers)
+noinst_DATA += $(idl_headers:.idl=.xpt)

Modified: trunk/gom/idl/xgIParser.idl
==============================================================================
--- trunk/gom/idl/xgIParser.idl (original)
+++ trunk/gom/idl/xgIParser.idl Thu Aug 21 00:23:29 2008
@@ -24,6 +24,8 @@
#include "nsISupports.idl"

interface nsIDOMDocument;
+interface nsIURI;
+interface nsIInputStream;

[scriptable, uuid(194C04B0-62FD-4594-822D-1CDB3596BB7C)]
interface xgIParserListener : nsISupports
@@ -34,5 +36,7 @@
[scriptable, uuid(5B251DFE-C380-4298-B547-11A006AB4784)]
interface xgIParser : nsISupports
{
- nsIDOMDocument parseURI (in DOMString aUri, in xgIParserListener
aListener);
+ nsIDOMDocument parse (in DOMString aUri, in xgIParserListener
aListener);
+ nsIDOMDocument parseStream (in nsIInputStream aStream, in
xgiparserlistener aListener);
+ nsIDOMDocument parseURI (in nsIURI aUri, in xgIParserListener
aListener);
};

Modified: trunk/gom/idl/xgIWindow.idl
==============================================================================
--- trunk/gom/idl/xgIWindow.idl (original)
+++ trunk/gom/idl/xgIWindow.idl Thu Aug 21 00:23:29 2008
@@ -23,42 +23,9 @@
*/
#include "nsISupports.idl"

-interface nsIDOMDocument;
-interface nsIDOMNavigator;
-interface nsIDOMLocation;
-
[scriptable, uuid(3F6DF635-B4FB-4145-A43F-2110FDDE6BBF)]
interface xgIWindow : nsISupports
{
- // cutom stuff
- void run ();
-
- // from nsIDOMWindowInternal.idl:
- readonly attribute xgIWindow window;
- readonly attribute nsIDOMDocument document;
- readonly attribute nsIDOMNavigator navigator;
- readonly attribute nsIDOMLocation location;
-
- void alert (in DOMString text);
- void close ();
-
- // from nsIDOMJSWindow.idl:
- void dump(in DOMString str);
-
- /**
- * These methods take typeless arguments and optional arguments, the
- * first argument is either a function or a string, the second
- * argument must be a number (ms) and the rest of the arguments (2
- * ... n) are passed to the callback function
- */
- long setTimeout();
- long setInterval();
-
- /**
- * These methods take one optional argument that's the timer ID to
- * clear. Often in existing code these methods are passed undefined,
- * which is a nop so we need to support that as well.
- */
- void clearTimeout();
- void clearInterval();
+ // gtk_main
+ void main ();
};

Added: trunk/gom/include/xpgom/xgDocShell.hh
==============================================================================
--- (empty file)
+++ trunk/gom/include/xpgom/xgDocShell.hh Thu Aug 21 00:23:29 2008
@@ -0,0 +1,70 @@
+/*
+The MIT License
+
+Copyright (c) 2008 jacob berkman <ja...@ilovegom.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a
copy
+of this software and associated documentation files (the "Software"), to
deal
+in the Software without restriction, including without limitation the
rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+#ifndef XG_DOC_SHELL_HH
+#define XG_DOC_SHELL_HH
+
+#include <nsCOMPtr.h>
+#include <nsDocLoader.h>
+#include <nsIDOMDocument.h>
+#include <nsIDocShell.h>
+#include <nsIDocShellTreeItem.h>
+#include <nsIPrompt.h>
+#include <nsIScriptGlobalObjectOwner.h>
+#include <nsIWebProgressListener.h>
+#include <nsIURI.h>
+
+#define XG_DOCSHELL_CID_STR "4B7979EF-8B9D-4A69-84A7-ADE48EE510DD"
+#define XG_DOCSHELL_CID \
+ { 0x4B7979EF, 0x8B9D, 0x4A69, { 0x84, 0xA7, 0xAD, 0xE4, 0x8E, 0xE5,
0x10, 0xDD } }
+#define XG_DOCSHELL_CONTRACTID "@ilovegom.org/shell;1"
+
+class xgDocShell : public nsDocLoader,
+ public nsIDocShell,
+ public nsIDocShellTreeItem,
+ public nsIScriptGlobalObjectOwner,
+ public nsIPrompt,
+ public nsIWebProgressListener
+{
+public:
+ NS_DECL_ISUPPORTS_INHERITED
+ NS_DECL_NSIDOCSHELL
+ NS_DECL_NSIDOCSHELLTREENODE
+ NS_DECL_NSIDOCSHELLTREEITEM
+ // nsIScriptGlobalObjectOwner methods
+ virtual nsIScriptGlobalObject* GetScriptGlobalObject();
+ NS_DECL_NSIPROMPT
+ NS_DECL_NSIWEBPROGRESSLISTENER
+
+ xgDocShell();
+
+private:
+ ~xgDocShell();
+
+protected:
+ nsCOMPtr<nsIURI> mUri;
+ nsCOMPtr<nsIScriptGlobalObject> mGlobal;
+ nsCOMPtr<nsIDOMDocument> mDocument;
+};
+
+#endif // XG_DOC_SHELL_HH

Modified: trunk/gom/include/xpgom/xgWindow.hh
==============================================================================
--- trunk/gom/include/xpgom/xgWindow.hh (original)
+++ trunk/gom/include/xpgom/xgWindow.hh Thu Aug 21 00:23:29 2008
@@ -25,21 +25,35 @@
#define XG_WINDOW_HH

#include <xgIWindow.hh>
+#include <xgIParser.hh>

+#include <nsIDOMJSWindow.h>
+#include <nsIDOMWindowInternal.h>
#include <nsIScriptGlobalObject.h>
+#include <nsWeakReference.h>
+
#include <nsCOMPtr.h>
-#include <jsapi.h>

#define XG_WINDOW_CID_STR "86BACE85-5414-4A67-A5E2-825EAE4169CB"
#define XG_WINDOW_CID \
{ 0x86BACE85, 0x5414, 0x4A67, { 0xA5, 0xE2, 0x82, 0x5E, 0xAE, 0x41,
0x69, 0xCB } }
#define XG_WINDOW_CONTRACTID "@ilovegom.org/window;1"

-class xgWindow : public nsIScriptGlobalObject,
- public xgIWindow
+class xgWindow : public xgIWindow,
+ public nsIDOMWindowInternal,
+ public nsIDOMJSWindow,
+ public nsIScriptGlobalObject,
+ public nsSupportsWeakReference
{
+ friend class xgLocation;
+ friend class xgWindowParserListener;
+
public:
NS_DECL_ISUPPORTS
+ NS_DECL_NSIDOMWINDOW
+ NS_DECL_NSIDOMWINDOW2
+ NS_DECL_NSIDOMWINDOWINTERNAL
+ NS_DECL_NSIDOMJSWINDOW
NS_DECL_XGIWINDOW

// nsIScriptGlobalObject
@@ -56,23 +70,22 @@
xgWindow();
nsresult Init ();

- // oh well
- nsresult SetDocument (nsIDOMDocument *aDocument);
-
private:
~xgWindow();

protected:
+ nsresult DidSetDocument ();

// xgIWindow
nsCOMPtr<nsIDOMDocument> mDocument;
nsCOMPtr<nsIDOMNavigator> mNavigator;
- nsCOMPtr<nsIDOMLocation> mLocation;
+ nsCOMPtr<xgLocation> mLocation;
+ nsCOMPtr<xgIParserListener> mListener;
+ nsCOMPtr<xgIParser> mParser;

// nsIScriptGlobalObject
nsCOMPtr<nsIScriptContext> mContext[NS_STID_ARRAY_UBOUND];
void *mGlobal[NS_STID_ARRAY_UBOUND];
};
-

#endif // XG_WINDOW_HH

Added: trunk/gom/src/xpgom/xgDocShell.cc
==============================================================================
--- (empty file)
+++ trunk/gom/src/xpgom/xgDocShell.cc Thu Aug 21 00:23:29 2008
@@ -0,0 +1,175 @@
+/*
+The MIT License
+
+Copyright (c) 2008 jacob berkman <ja...@ilovegom.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a
copy
+of this software and associated documentation files (the "Software"), to
deal
+in the Software without restriction, including without limitation the
rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+#include "config.h"
+
+#include "xpgom/xgDocShell.hh"
+
+#include <nsComponentManagerUtils.h>
+#include <nsDOMCID.h>
+#include <nsIChannel.h>
+#include <nsIDOMScriptObjectFactory.h>
+#include <nsIDOMXMLDocument.h>
+#include <nsIDocument.h>
+#include <nsIIOService.h>
+#include <nsIPrincipal.h>
+#include <nsIScriptGlobalObject.h>
+#include <nsIStreamListener.h>
+#include <nsIThread.h>
+#include <nsIThreadManager.h>
+#include <nsMemory.h>
+#include <nsPIDOMWindow.h>
+#include <nsServiceManagerUtils.h>
+#include <nsThreadUtils.h>
+
+#include <glib/gmessages.h>
+
+#include "gommacros.h"
+
+static NS_DEFINE_CID(kDOMScriptObjectFactoryCID,
NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
+
+xgDocShell::xgDocShell()
+{
+}
+
+xgDocShell::~xgDocShell()
+{
+}
+
+NS_IMPL_ADDREF_INHERITED(xgDocShell, nsDocLoader)
+NS_IMPL_RELEASE_INHERITED(xgDocShell, nsDocLoader)
+
+NS_INTERFACE_MAP_BEGIN(xgDocShell)
+NS_INTERFACE_MAP_ENTRY(nsIDocShell)
+NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeItem)
+NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeNode)
+NS_INTERFACE_MAP_ENTRY(nsIPrompt)
+NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObjectOwner)
+NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
+#if 0
+NS_IMPL_QUERY_CLASSINFO(xgDocShell)
+#endif
+NS_INTERFACE_MAP_END_INHERITING(nsDocLoader)
+
+#if 0
+NS_CLASSINFO_HELPER_BEGIN
+NS_CLASSINFO_HELPER_ENTRY(nsIRequestObserver)
+NS_CLASSINFO_HELPER_ENTRY(nsIDocumentLoader)
+NS_CLASSINFO_HELPER_ENTRY(nsIWebProgress)
+NS_CLASSINFO_HELPER_ENTRY(nsIProgressEventSink)
+NS_CLASSINFO_HELPER_ENTRY(nsIInterfaceRequestor)
+NS_CLASSINFO_HELPER_ENTRY(nsIChannelEventSink)
+NS_CLASSINFO_HELPER_ENTRY(nsISecurityEventSink)
+NS_CLASSINFO_HELPER_ENTRY(nsISupportsPriority)
+
+
+
+NS_IMPL_CI_INTERFACE_GETTER6(xgDocShell, nsIDocShell, nsIDocShellTreeNode,
nsIDocShellTreeItem, nsIScriptGlobalObjectOwner, nsIPrompt)
+#endif
+
+// nsIScriptGlobalObjectOwner methods
+nsIScriptGlobalObject *
+xgDocShell::GetScriptGlobalObject ()
+{
+ if (!mGlobal) {
+ nsresult rv;
+ nsCOMPtr<nsIDOMScriptObjectFactory> factory (do_GetService
(kDOMScriptObjectFactoryCID, &rv));
+ NS_ENSURE_SUCCESS (rv, NULL);
+
+ nsCOMPtr<nsIScriptGlobalObject> global;
+ rv = factory->NewScriptGlobalObject (true, false, getter_AddRefs
(global));
+ NS_ENSURE_SUCCESS (rv, NULL);
+
+ // you'd think it'd be able to figure this one out on its own...
+ rv = global->EnsureScriptEnvironment (nsIProgrammingLanguage::JAVASCRIPT);
+ NS_ENSURE_SUCCESS (rv, NULL);
+
+ nsCOMPtr<nsPIDOMWindow> win (do_QueryInterface (global, &rv));
+ NS_ENSURE_SUCCESS (rv, NULL);
+
+ win->SetDocShell (this);
+
+ mGlobal = global;
+ }
+ return mGlobal;
+}
+
+/* [noscript] void loadURI (in nsIURI uri, in nsIDocShellLoadInfo
loadInfo, in unsigned long aLoadFlags, in boolean firstParty); */
+NS_IMETHODIMP
+xgDocShell::LoadURI (nsIURI *uri, nsIDocShellLoadInfo *loadInfo, PRUint32
aLoadFlags, PRBool firstParty)
+{
+ nsresult rv;
+
+ rv = uri->Clone (getter_AddRefs (mUri));
+ NS_ENSURE_SUCCESS (rv, rv);
+
+ FireOnLocationChange (this, NULL, mUri);
+
+ nsCOMPtr<nsIThread> thread = do_GetCurrentThread();
+ while (true) {
+ if (!NS_ProcessNextEvent(thread))
+ break;
+ }
+
+#if 0
+ // We set return to true unless there was a parsing error
+ nsCOMPtr<nsIDOMNode> node = do_QueryInterface(GetRootContent());
+ if (node) {
+ nsAutoString name, ns;
+ if (NS_SUCCEEDED(node->GetLocalName(name)) &&
+ name.EqualsLiteral("parsererror") &&
+ NS_SUCCEEDED(node->GetNamespaceURI(ns)) &&
+
ns.EqualsLiteral("http://www.mozilla.org/newlayout/xml/parsererror.xml")) {
+ //return is already false
+ } else {
+ *aReturn = PR_TRUE;
+ }
+ }
+#endif
+ return NS_OK;
+}
+
+/* void setCurrentURI (in nsIURI aURI); */
+NS_IMETHODIMP
+xgDocShell::SetCurrentURI (nsIURI *aURI)
+{
+ return LoadURI (aURI, NULL, 0, false);
+}
+
+/* attribute boolean allowJavascript; */
+NS_IMETHODIMP
+xgDocShell::GetAllowJavascript (PRBool *aAllowJavascript)
+{
+ *aAllowJavascript = true;
+ return NS_OK;
+}
+
+/* readonly attribute long childCount; */
+NS_IMETHODIMP
+xgDocShell::GetChildCount (PRInt32 *aChildCount)
+{
+ *aChildCount = 0;
+ return NS_OK;
+}
+
+#include "xgDocShellUnimplemented.cc"

Added: trunk/gom/src/xpgom/xgDocShellUnimplemented.cc
==============================================================================
--- (empty file)
+++ trunk/gom/src/xpgom/xgDocShellUnimplemented.cc Thu Aug 21 00:23:29 2008
@@ -0,0 +1,557 @@
+/*
+The MIT License
+
+Copyright (c) 2008 jacob berkman <ja...@ilovegom.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a
copy
+of this software and associated documentation files (the "Software"), to
deal
+in the Software without restriction, including without limitation the
rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+/* [noscript] void loadStream (in nsIInputStream aStream, in nsIURI aURI,
in ACString aContentType, in ACString aContentCharset, in
nsIDocShellLoadInfo aLoadInfo); */
+NS_IMETHODIMP xgDocShell::LoadStream(nsIInputStream *aStream, nsIURI
*aURI, const nsACString & aContentType, const nsACString & aContentCharset,
nsIDocShellLoadInfo *aLoadInfo)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [noscript] void internalLoad (in nsIURI aURI, in nsIURI aReferrer, in
nsISupports aOwner, in PRUint32 aFlags, in wstring aWindowTarget, in string
aTypeHint, in nsIInputStream aPostDataStream, in nsIInputStream
aHeadersStream, in unsigned long aLoadFlags, in nsISHEntry aSHEntry, in
boolean firstParty, out nsIDocShell aDocShell, out nsIRequest aRequest); */
+NS_IMETHODIMP xgDocShell::InternalLoad(nsIURI *aURI, nsIURI *aReferrer,
nsISupports *aOwner, PRUint32 aFlags, const PRUnichar *aWindowTarget, const
char *aTypeHint, nsIInputStream *aPostDataStream, nsIInputStream
*aHeadersStream, PRUint32 aLoadFlags, nsISHEntry *aSHEntry, PRBool
firstParty, nsIDocShell **aDocShell, nsIRequest **aRequest)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void createLoadInfo (out nsIDocShellLoadInfo loadInfo); */
+NS_IMETHODIMP xgDocShell::CreateLoadInfo(nsIDocShellLoadInfo **loadInfo)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void prepareForNewContentModel (); */
+NS_IMETHODIMP xgDocShell::PrepareForNewContentModel()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [noscript] void firePageHideNotification (in boolean isUnload); */
+NS_IMETHODIMP xgDocShell::FirePageHideNotification(PRBool isUnload)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [noscript] readonly attribute nsPresContext presContext; */
+NS_IMETHODIMP xgDocShell::GetPresContext(nsPresContext * *aPresContext)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [noscript] readonly attribute nsIPresShell presShell; */
+NS_IMETHODIMP xgDocShell::GetPresShell(nsIPresShell * *aPresShell)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [noscript] readonly attribute nsIPresShell eldestPresShell; */
+NS_IMETHODIMP xgDocShell::GetEldestPresShell(nsIPresShell *
*aEldestPresShell)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIContentViewer contentViewer; */
+NS_IMETHODIMP xgDocShell::GetContentViewer(nsIContentViewer *
*aContentViewer)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute nsIDOMEventTarget chromeEventHandler; */
+NS_IMETHODIMP xgDocShell::GetChromeEventHandler(nsIDOMEventTarget *
*aChromeEventHandler)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetChromeEventHandler(nsIDOMEventTarget *
aChromeEventHandler)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute nsIDocumentCharsetInfo documentCharsetInfo; */
+NS_IMETHODIMP xgDocShell::GetDocumentCharsetInfo(nsIDocumentCharsetInfo *
*aDocumentCharsetInfo)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetDocumentCharsetInfo(nsIDocumentCharsetInfo *
aDocumentCharsetInfo)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute boolean allowPlugins; */
+NS_IMETHODIMP xgDocShell::GetAllowPlugins(PRBool *aAllowPlugins)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetAllowPlugins(PRBool aAllowPlugins)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute boolean allowJavascript; */
+NS_IMETHODIMP xgDocShell::SetAllowJavascript(PRBool aAllowJavascript)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute boolean allowMetaRedirects; */
+NS_IMETHODIMP xgDocShell::GetAllowMetaRedirects(PRBool
*aAllowMetaRedirects)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetAllowMetaRedirects(PRBool aAllowMetaRedirects)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute boolean allowSubframes; */
+NS_IMETHODIMP xgDocShell::GetAllowSubframes(PRBool *aAllowSubframes)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetAllowSubframes(PRBool aAllowSubframes)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute boolean allowImages; */
+NS_IMETHODIMP xgDocShell::GetAllowImages(PRBool *aAllowImages)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetAllowImages(PRBool aAllowImages)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* nsISimpleEnumerator getDocShellEnumerator (in long aItemType, in long
aDirection); */
+NS_IMETHODIMP xgDocShell::GetDocShellEnumerator(PRInt32 aItemType, PRInt32
aDirection, nsISimpleEnumerator **_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute unsigned long appType; */
+NS_IMETHODIMP xgDocShell::GetAppType(PRUint32 *aAppType)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetAppType(PRUint32 aAppType)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute boolean allowAuth; */
+NS_IMETHODIMP xgDocShell::GetAllowAuth(PRBool *aAllowAuth)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetAllowAuth(PRBool aAllowAuth)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute float zoom; */
+NS_IMETHODIMP xgDocShell::GetZoom(float *aZoom)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetZoom(float aZoom)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute long marginWidth; */
+NS_IMETHODIMP xgDocShell::GetMarginWidth(PRInt32 *aMarginWidth)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetMarginWidth(PRInt32 aMarginWidth)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute long marginHeight; */
+NS_IMETHODIMP xgDocShell::GetMarginHeight(PRInt32 *aMarginHeight)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetMarginHeight(PRInt32 aMarginHeight)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute boolean hasFocus; */
+NS_IMETHODIMP xgDocShell::GetHasFocus(PRBool *aHasFocus)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetHasFocus(PRBool aHasFocus)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute boolean canvasHasFocus; */
+NS_IMETHODIMP xgDocShell::GetCanvasHasFocus(PRBool *aCanvasHasFocus)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetCanvasHasFocus(PRBool aCanvasHasFocus)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void tabToTreeOwner (in boolean forward, out boolean tookFocus); */
+NS_IMETHODIMP xgDocShell::TabToTreeOwner(PRBool forward, PRBool *tookFocus)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute unsigned long busyFlags; */
+NS_IMETHODIMP xgDocShell::GetBusyFlags(PRUint32 *aBusyFlags)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute unsigned long loadType; */
+NS_IMETHODIMP xgDocShell::GetLoadType(PRUint32 *aLoadType)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetLoadType(PRUint32 aLoadType)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* boolean isBeingDestroyed (); */
+NS_IMETHODIMP xgDocShell::IsBeingDestroyed(PRBool *_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute boolean isExecutingOnLoadHandler; */
+NS_IMETHODIMP xgDocShell::GetIsExecutingOnLoadHandler(PRBool
*aIsExecutingOnLoadHandler)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute nsILayoutHistoryState layoutHistoryState; */
+NS_IMETHODIMP xgDocShell::GetLayoutHistoryState(nsILayoutHistoryState *
*aLayoutHistoryState)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetLayoutHistoryState(nsILayoutHistoryState *
aLayoutHistoryState)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute boolean shouldSaveLayoutState; */
+NS_IMETHODIMP xgDocShell::GetShouldSaveLayoutState(PRBool
*aShouldSaveLayoutState)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute nsISecureBrowserUI securityUI; */
+NS_IMETHODIMP xgDocShell::GetSecurityUI(nsISecureBrowserUI * *aSecurityUI)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetSecurityUI(nsISecureBrowserUI * aSecurityUI)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void suspendRefreshURIs (); */
+NS_IMETHODIMP xgDocShell::SuspendRefreshURIs()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void resumeRefreshURIs (); */
+NS_IMETHODIMP xgDocShell::ResumeRefreshURIs()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void beginRestore (in nsIContentViewer viewer, in boolean top); */
+NS_IMETHODIMP xgDocShell::BeginRestore(nsIContentViewer *viewer, PRBool
top)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void finishRestore (); */
+NS_IMETHODIMP xgDocShell::FinishRestore()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute boolean restoringDocument; */
+NS_IMETHODIMP xgDocShell::GetRestoringDocument(PRBool *aRestoringDocument)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute boolean useErrorPages; */
+NS_IMETHODIMP xgDocShell::GetUseErrorPages(PRBool *aUseErrorPages)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetUseErrorPages(PRBool aUseErrorPages)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute long previousTransIndex; */
+NS_IMETHODIMP xgDocShell::GetPreviousTransIndex(PRInt32
*aPreviousTransIndex)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute long loadedTransIndex; */
+NS_IMETHODIMP xgDocShell::GetLoadedTransIndex(PRInt32 *aLoadedTransIndex)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void historyPurged (in long numEntries); */
+NS_IMETHODIMP xgDocShell::HistoryPurged(PRInt32 numEntries)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* nsIDOMStorage getSessionStorageForURI (in nsIURI uri); */
+NS_IMETHODIMP xgDocShell::GetSessionStorageForURI(nsIURI *uri,
nsIDOMStorage **_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void addSessionStorage (in ACString aDomain, in nsIDOMStorage storage);
*/
+NS_IMETHODIMP xgDocShell::AddSessionStorage(const nsACString & aDomain,
nsIDOMStorage *storage)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIChannel currentDocumentChannel; */
+NS_IMETHODIMP xgDocShell::GetCurrentDocumentChannel(nsIChannel *
*aCurrentDocumentChannel)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [noscript] void setChildOffset (in unsigned long offset); */
+NS_IMETHODIMP xgDocShell::SetChildOffset(PRUint32 offset)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute boolean isInUnload; */
+NS_IMETHODIMP xgDocShell::GetIsInUnload(PRBool *aIsInUnload)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute boolean channelIsUnsafe; */
+NS_IMETHODIMP xgDocShell::GetChannelIsUnsafe(PRBool *aChannelIsUnsafe)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [noscript, notxpcom] void DetachEditorFromWindow (); */
+NS_IMETHODIMP_(void) xgDocShell::DetachEditorFromWindow()
+{
+ GOM_NOT_IMPLEMENTED;
+}
+
+/* void alert (in wstring dialogTitle, in wstring text); */
+NS_IMETHODIMP xgDocShell::Alert(const PRUnichar *dialogTitle, const
PRUnichar *text)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void alertCheck (in wstring dialogTitle, in wstring text, in wstring
checkMsg, inout boolean checkValue); */
+NS_IMETHODIMP xgDocShell::AlertCheck(const PRUnichar *dialogTitle, const
PRUnichar *text, const PRUnichar *checkMsg, PRBool *checkValue)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* boolean confirm (in wstring dialogTitle, in wstring text); */
+NS_IMETHODIMP xgDocShell::Confirm(const PRUnichar *dialogTitle, const
PRUnichar *text, PRBool *_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* boolean confirmCheck (in wstring dialogTitle, in wstring text, in
wstring checkMsg, inout boolean checkValue); */
+NS_IMETHODIMP xgDocShell::ConfirmCheck(const PRUnichar *dialogTitle, const
PRUnichar *text, const PRUnichar *checkMsg, PRBool *checkValue, PRBool
*_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* PRInt32 confirmEx (in wstring dialogTitle, in wstring text, in unsigned
long buttonFlags, in wstring button0Title, in wstring button1Title, in
wstring button2Title, in wstring checkMsg, inout boolean checkValue); */
+NS_IMETHODIMP xgDocShell::ConfirmEx(const PRUnichar *dialogTitle, const
PRUnichar *text, PRUint32 buttonFlags, const PRUnichar *button0Title, const
PRUnichar *button1Title, const PRUnichar *button2Title, const PRUnichar
*checkMsg, PRBool *checkValue, PRInt32 *_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* boolean prompt (in wstring dialogTitle, in wstring text, inout wstring
value, in wstring checkMsg, inout boolean checkValue); */
+NS_IMETHODIMP xgDocShell::Prompt(const PRUnichar *dialogTitle, const
PRUnichar *text, PRUnichar **value, const PRUnichar *checkMsg, PRBool
*checkValue, PRBool *_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* boolean promptPassword (in wstring dialogTitle, in wstring text, inout
wstring password, in wstring checkMsg, inout boolean checkValue); */
+NS_IMETHODIMP xgDocShell::PromptPassword(const PRUnichar *dialogTitle,
const PRUnichar *text, PRUnichar **password, const PRUnichar *checkMsg,
PRBool *checkValue, PRBool *_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* boolean promptUsernameAndPassword (in wstring dialogTitle, in wstring
text, inout wstring username, inout wstring password, in wstring checkMsg,
inout boolean checkValue); */
+NS_IMETHODIMP xgDocShell::PromptUsernameAndPassword(const PRUnichar
*dialogTitle, const PRUnichar *text, PRUnichar **username, PRUnichar
**password, const PRUnichar *checkMsg, PRBool *checkValue, PRBool *_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* boolean select (in wstring dialogTitle, in wstring text, in PRUint32
count, [array, size_is (count)] in wstring selectList, out long
outSelection); */
+NS_IMETHODIMP xgDocShell::Select(const PRUnichar *dialogTitle, const
PRUnichar *text, PRUint32 count, const PRUnichar **selectList, PRInt32
*outSelection, PRBool *_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* nsIDocShellTreeItem */
+/* attribute wstring name; */
+NS_IMETHODIMP xgDocShell::GetName(PRUnichar * *aName)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetName(const PRUnichar * aName)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* boolean nameEquals (in wstring name); */
+NS_IMETHODIMP xgDocShell::NameEquals(const PRUnichar *name, PRBool
*_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute long itemType; */
+NS_IMETHODIMP xgDocShell::GetItemType(PRInt32 *aItemType)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgDocShell::SetItemType(PRInt32 aItemType)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDocShellTreeItem parent; */
+NS_IMETHODIMP xgDocShell::GetParent(nsIDocShellTreeItem * *aParent)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDocShellTreeItem sameTypeParent; */
+NS_IMETHODIMP xgDocShell::GetSameTypeParent(nsIDocShellTreeItem *
*aSameTypeParent)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDocShellTreeItem rootTreeItem; */
+NS_IMETHODIMP xgDocShell::GetRootTreeItem(nsIDocShellTreeItem *
*aRootTreeItem)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDocShellTreeItem sameTypeRootTreeItem; */
+NS_IMETHODIMP xgDocShell::GetSameTypeRootTreeItem(nsIDocShellTreeItem *
*aSameTypeRootTreeItem)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* nsIDocShellTreeItem findItemWithName (in wstring name, in nsISupports
aRequestor, in nsIDocShellTreeItem aOriginalRequestor); */
+NS_IMETHODIMP xgDocShell::FindItemWithName(const PRUnichar *name,
nsISupports *aRequestor, nsIDocShellTreeItem *aOriginalRequestor,
nsIDocShellTreeItem **_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDocShellTreeOwner treeOwner; */
+NS_IMETHODIMP xgDocShell::GetTreeOwner(nsIDocShellTreeOwner * *aTreeOwner)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [noscript] void setTreeOwner (in nsIDocShellTreeOwner treeOwner); */
+NS_IMETHODIMP xgDocShell::SetTreeOwner(nsIDocShellTreeOwner *treeOwner)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* nsIDocShellTreeNode */
+/* void addChild (in nsIDocShellTreeItem child); */
+NS_IMETHODIMP xgDocShell::AddChild(nsIDocShellTreeItem *child)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void removeChild (in nsIDocShellTreeItem child); */
+NS_IMETHODIMP xgDocShell::RemoveChild(nsIDocShellTreeItem *child)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* nsIDocShellTreeItem getChildAt (in long index); */
+NS_IMETHODIMP xgDocShell::GetChildAt(PRInt32 index, nsIDocShellTreeItem
**_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* nsIDocShellTreeItem findChildWithName (in wstring aName, in boolean
aRecurse, in boolean aSameType, in nsIDocShellTreeItem aRequestor, in
nsIDocShellTreeItem aOriginalRequestor); */
+NS_IMETHODIMP xgDocShell::FindChildWithName(const PRUnichar *aName, PRBool
aRecurse, PRBool aSameType, nsIDocShellTreeItem *aRequestor,
nsIDocShellTreeItem *aOriginalRequestor, nsIDocShellTreeItem **_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest
aRequest, in unsigned long aStateFlags, in nsresult aStatus); */
+NS_IMETHODIMP xgDocShell::OnStateChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest
aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long
aCurTotalProgress, in long aMaxTotalProgress); */
+NS_IMETHODIMP xgDocShell::OnProgressChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress,
PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest
aRequest, in nsIURI aLocation); */
+NS_IMETHODIMP xgDocShell::OnLocationChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest, nsIURI *aLocation)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest
aRequest, in nsresult aStatus, in wstring aMessage); */
+NS_IMETHODIMP xgDocShell::OnStatusChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest
aRequest, in unsigned long aState); */
+NS_IMETHODIMP xgDocShell::OnSecurityChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest, PRUint32 aState)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}

Modified: trunk/gom/src/xpgom/xgParser.js
==============================================================================
--- trunk/gom/src/xpgom/xgParser.js (original)
+++ trunk/gom/src/xpgom/xgParser.js Thu Aug 21 00:23:29 2008
@@ -46,13 +46,17 @@

xgParser.prototype = {
// xgIGomParser
- parseURI: function (uri, listener) {
+ parse: function (uri, listener) {
var io = Cc['@mozilla.org/network/io-service;1'].getService
(Ci.nsIIOService);
- var uri = io.newURI (uri, null, null);
+ return this.parseURI (io.newURI (uri, NULL, NULL), listener);
+ },

- var chan = io.newChannelFromURI (uri);
- var stream = chan.open();
+ parseURI: function (uri, listener) {
+ var io = Cc['@mozilla.org/network/io-service;1'].getService
(Ci.nsIIOService);
+ return this.parseStream (io.newChannelFromURI (uri).open (), listener);
+ },

+ parseStream: function (stream, listener) {
var reader = Cc['@mozilla.org/saxparser/xmlreader;1'].createInstance
(Ci.nsISAXXMLReader);
var document = null;
reader.contentHandler = {
@@ -78,13 +82,23 @@
attributes.getValue (i));
}
this.elem = this.elem ? this.elem.appendChild (elem) : elem;
+ try {
+ this.elem.beginAddingChildren ();
+ } catch (e) { }
},

endElement: function(uri, localName, qName) {
+ try {
+ this.elem.doneAddingChildren ();
+ } catch (e) { }
this.elem = this.elem.parentNode;
},

- characters: function(value) { },
+ characters: function(value) {
+ if (this.elem) {
+ this.elem.appendChild (document.createTextNode (value));
+ }
+ },
processingInstruction: function(target, data) { },
ignorableWhitespace: function(whitespace) { },
startPrefixMapping: function(prefix, uri) { },

Modified: trunk/gom/src/xpgom/xgWindow.cc
==============================================================================
--- trunk/gom/src/xpgom/xgWindow.cc (original)
+++ trunk/gom/src/xpgom/xgWindow.cc Thu Aug 21 00:23:29 2008
@@ -23,13 +23,17 @@
*/
#include "config.h"

+#define NS_HandleScriptError XG_HandleScriptError
+
#include "xpgom/xgWindow.hh"
#include "xgIParser.hh"

#include <nsComponentManagerUtils.h>
#include <nsDOMCID.h>
#include <nsIClassInfoImpl.h>
+#include <nsIDocument.h>
#include <nsIDOMDocument.h>
+#include <nsIDOMElement.h>
#include <nsIDOMLocation.h>
#include <nsIDOMNavigator.h>
#include <nsIDOMScriptObjectFactory.h>
@@ -38,6 +42,8 @@
#include <nsMemory.h>
#include <nsServiceManagerUtils.h>
#include <nsStringAPI.h>
+#include <nsIURL.h>
+#include <nsIIOService.h>

#include <glib/gmacros.h>
#include <glib/gmessages.h>
@@ -47,31 +53,34 @@
#include "gommacros.h"

static NS_DEFINE_CID (kDOMScriptObjectFactoryCID,
NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
+
class xgLocation : public nsIDOMLocation
{
+ friend class xgWindow;
public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIDOMLOCATION
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIDOMLOCATION

- xgLocation (xgWindow *aWindow);
+ xgLocation (xgWindow *aWindow);

private:
- ~xgLocation();
+ ~xgLocation();

protected:
xgWindow *mWindow;
+ nsCOMPtr<nsIURI> mUri;
};

class xgWindowParserListener : public xgIParserListener
{
public:
- NS_DECL_ISUPPORTS
- NS_DECL_XGIPARSERLISTENER
+ NS_DECL_ISUPPORTS
+ NS_DECL_XGIPARSERLISTENER

- xgWindowParserListener(xgWindow *aWindow);
+ xgWindowParserListener(xgWindow *aWindow);

private:
- ~xgWindowParserListener();
+ ~xgWindowParserListener();

protected:
xgWindow *mWindow;
@@ -87,7 +96,14 @@
/* destructor code */
}

-NS_IMPL_ISUPPORTS2_CI (xgWindow, xgIWindow, nsIScriptGlobalObject)
+NS_IMPL_ISUPPORTS7_CI (xgWindow,
+ nsIScriptGlobalObject,
+ nsIDOMWindow,
+ nsIDOMWindow2,
+ nsIDOMJSWindow,
+ nsIDOMWindowInternal,
+ nsISupportsWeakReference,
+ xgIWindow)

nsresult
xgWindow::Init ()
@@ -98,46 +114,30 @@

mLocation = new xgLocation (this);
NS_ENSURE_TRUE (mLocation, NS_ERROR_OUT_OF_MEMORY);
- return NS_OK;
+
+ mParser = do_CreateInstance ("@ilovegom.org/parser;1", &rv);
+ NS_ENSURE_SUCCESS (rv, rv);
+
+ mListener = new xgWindowParserListener (this);
+ NS_ENSURE_TRUE (mListener, NS_ERROR_OUT_OF_MEMORY);
+
+ return mLocation->Assign (NS_LITERAL_STRING ("about:blank"));
}

-/* readonly attribute xgIWindow window; */
+// nsIDOMWindowInternal
+/* readonly attribute nsIDOMWindowInternal window; */
NS_IMETHODIMP
-xgWindow::GetWindow (xgIWindow **aWindow)
+xgWindow::GetWindow (nsIDOMWindowInternal **aWindow)
{
NS_ADDREF (*aWindow = this);
return NS_OK;
}

-/* readonly attribute nsIDOMDocument document; */
+/* readonly attribute nsIDOMWindowInternal self; */
NS_IMETHODIMP
-xgWindow::GetDocument (nsIDOMDocument **aDocument)
+xgWindow::GetSelf (nsIDOMWindowInternal **aSelf)
{
- NS_IF_ADDREF (*aDocument = mDocument);
- return NS_OK;
-}
-
-nsresult
-xgWindow::SetDocument (nsIDOMDocument *aDocument)
-{
- NS_ENSURE_TRUE (aDocument, NS_ERROR_INVALID_ARG);
-
- nsresult rv = Init ();
- NS_ENSURE_SUCCESS (rv, rv);
-
- mDocument = aDocument;
-
- PRUint32 lang;
- NS_STID_FOR_INDEX (lang) {
- nsIScriptContext *cx = mContext[lang];
- if (cx) {
- cx->WillInitializeContext ();
- cx->InitClasses (mGlobal[lang]);
- cx->DidInitializeContext ();
- cx->DidSetDocument (aDocument, mGlobal[lang]);
- }
- }
-
+ NS_ADDREF (*aSelf = this);
return NS_OK;
}

@@ -157,64 +157,39 @@
return NS_OK;
}

-/* void alert (in DOMString text); */
-NS_IMETHODIMP
-xgWindow::Alert (const nsAString &text)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
-
-/* void run (); */
+/* readonly attribute nsIDOMDocument document; */
NS_IMETHODIMP
-xgWindow::Run ()
+xgWindow::GetDocument (nsIDOMDocument **aDocument)
{
- gtk_main ();
+ NS_IF_ADDREF (*aDocument = mDocument);
return NS_OK;
}

/* void close (); */
NS_IMETHODIMP
-xgWindow::Close ()
+xgWindow::Close()
{
gtk_main_quit ();
+ mDocument = NULL;
return NS_OK;
}

+// nsIDOMJSWindow
/* void dump (in DOMString str); */
-NS_IMETHODIMP
-xgWindow::Dump (const nsAString &str)
+NS_IMETHODIMP xgWindow::Dump(const nsAString &str)
{
GOM_ASTRING_TO_GSTRING_RETURN (gstr, str, NS_ERROR_INVALID_ARG);
g_message ("JAVASCRIPT: %s\n", gstr);
return NS_OK;
}

-/* long setTimeout (); */
-NS_IMETHODIMP
-xgWindow::SetTimeout (PRInt32 *_retval)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
-
-/* long setInterval (); */
-NS_IMETHODIMP
-xgWindow::SetInterval (PRInt32 *_retval)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
-
-/* void clearTimeout (); */
+/* xgIWindow */
+/* void main (); */
NS_IMETHODIMP
-xgWindow::ClearTimeout ()
+xgWindow::Main ()
{
- XG_RETURN_NOT_IMPLEMENTED;
-}
-
-/* void clearInterval (); */
-NS_IMETHODIMP
-xgWindow::ClearInterval ()
-{
- XG_RETURN_NOT_IMPLEMENTED;
+ gtk_main ();
+ return NS_OK;
}

nsresult
@@ -259,12 +234,28 @@
xgWindow::SetScriptContext (PRUint32 lang, nsIScriptContext *aContext)
{
NS_ENSURE_TRUE (NS_STID_VALID (lang), NULL);
-
- mContext[NS_STID_INDEX (lang)] = aContext;
+ nsresult rv;
+ void * global = NULL;
if (aContext) {
- aContext->DidInitializeContext ();
+ aContext->WillInitializeContext ();
+ rv = aContext->InitContext (this);
+ NS_ENSURE_TRUE (rv, rv);
+
+ aContext->DidInitializeContext ();
+
+ global = aContext->GetNativeGlobal ();
+ NS_ENSURE_TRUE (global, NS_ERROR_FAILURE);
+
+ rv = aContext->InitClasses (global);
+ NS_ENSURE_TRUE (rv, rv);
+ }
+ PRUint32 lang_idx = NS_STID_INDEX (lang);
+ mContext[lang_idx] = aContext;
+ mGlobal[lang_idx] = global;
+
+ if (aContext && mDocument) {
+ aContext->DidSetDocument (mDocument, global);
}
- mGlobal[NS_STID_INDEX (lang)] = aContext ? aContext->GetNativeGlobal
() : NULL;

return NS_OK;
}
@@ -272,31 +263,40 @@
void
xgWindow::OnFinalize (PRUint32 aLangID, void *aScriptGlobal)
{
- if (!NS_STID_VALID (aLangID)) {
+ if (!NS_STID_VALID (aLangID) ||
+ mGlobal[NS_STID_INDEX (aLangID)] != aScriptGlobal) {
return;
}
mGlobal[NS_STID_INDEX (aLangID)] = NULL;
}

-void
-xgWindow::SetScriptsEnabled (PRBool aEnabled, PRBool aFireTimeouts)
-{
- GOM_NOT_IMPLEMENTED;
-}
-
nsresult
-xgWindow::SetNewArguments (nsIArray *aArguments)
+xgWindow::DidSetDocument ()
{
- XG_RETURN_NOT_IMPLEMENTED;
-}
+ NS_ENSURE_TRUE (mDocument, NS_ERROR_INVALID_ARG);

-nsresult
-xgWindow::HandleScriptError (nsScriptErrorEvent *aErrorEvent,
- nsEventStatus *aEventStatus)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
+ nsCOMPtr<nsIDocument> doc = do_QueryInterface (mDocument);
+ if (doc) {
+ doc->SetScriptGlobalObject (this);
+ doc->SetDocumentURI (mLocation->mUri);
+ } else {
+ g_warning (GOM_LOC ("mDocument does not support nsIDocument; things will
likely go awry"));
+ }

+ PRUint32 lang;
+ nsresult rv;
+ NS_STID_FOR_INDEX (lang) {
+ nsIScriptContext *cx = mContext[lang];
+ if (cx) {
+ rv = cx->InitClasses (mGlobal[lang]);
+ if (NS_SUCCEEDED (rv)) {
+ cx->DidSetDocument (mDocument, mGlobal[lang]);
+ }
+ }
+ }
+
+ return NS_OK;
+}

/*
* nsILocation implementation
@@ -314,160 +314,74 @@

NS_IMPL_ISUPPORTS1 (xgLocation, nsIDOMLocation)

-/* attribute DOMString hash; */
-NS_IMETHODIMP
-xgLocation::GetHash (nsAString &aHash)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
-NS_IMETHODIMP
-xgLocation::SetHash (const nsAString &aHash)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
-
-/* attribute DOMString host; */
-NS_IMETHODIMP
-xgLocation::GetHost (nsAString &aHost)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
-NS_IMETHODIMP
-xgLocation::SetHost (const nsAString &aHost)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
-
-/* attribute DOMString hostname; */
-NS_IMETHODIMP
-xgLocation::GetHostname (nsAString &aHostname)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
-NS_IMETHODIMP
-xgLocation::SetHostname (const nsAString &aHostname)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
-
-/* attribute DOMString href; */
-NS_IMETHODIMP
-xgLocation::GetHref (nsAString &aHref)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
+/* void assign (in DOMString url); */
NS_IMETHODIMP
-xgLocation::SetHref (const nsAString &aHref)
+xgLocation::Assign (const nsAString &url)
{
- XG_RETURN_NOT_IMPLEMENTED;
-}
+ nsresult rv;
+ nsCOMPtr<nsIIOService> io (do_GetService
("@mozilla.org/network/io-service;1", &rv));
+ NS_ENSURE_SUCCESS (rv, rv);

-/* attribute DOMString pathname; */
-NS_IMETHODIMP
-xgLocation::GetPathname (nsAString &aPathname)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
-NS_IMETHODIMP
-xgLocation::SetPathname (const nsAString &aPathname)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
+ g_message (GOM_LOC ("Setting URI to: %s"), NS_ConvertUTF16toUTF8
(url).get ());

-/* attribute DOMString port; */
-NS_IMETHODIMP
-xgLocation::GetPort (nsAString &aPort)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
-NS_IMETHODIMP
-xgLocation::SetPort (const nsAString &aPort)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
+ nsCOMPtr<nsIURI> uri;
+ rv = io->NewURI (NS_ConvertUTF16toUTF8 (url), "UTF-8", mUri,
getter_AddRefs (uri));
+ NS_ENSURE_SUCCESS (rv, rv);

-/* attribute DOMString protocol; */
-NS_IMETHODIMP
-xgLocation::GetProtocol (nsAString &aProtocol)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
-NS_IMETHODIMP
-xgLocation::SetProtocol (const nsAString &aProtocol)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
+ mUri = uri;

-/* attribute DOMString search; */
-NS_IMETHODIMP
-xgLocation::GetSearch (nsAString &aSearch)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
-NS_IMETHODIMP
-xgLocation::SetSearch (const nsAString &aSearch)
-{
- XG_RETURN_NOT_IMPLEMENTED;
-}
+ g_message (GOM_LOC ("mUri is now: %p"), mUri.get());

-/* [noscript] void reload (in boolean forceget); */
-NS_IMETHODIMP
-xgLocation::Reload (PRBool forceget)
-{
- XG_RETURN_NOT_IMPLEMENTED;
+ nsCOMPtr<nsIDOMDocument> doc;
+ return mWindow->mParser->ParseURI (url, mWindow->mListener,
getter_AddRefs (doc));
}

-/* void replace (in DOMString url); */
+/* DOMString toString (); */
NS_IMETHODIMP
-xgLocation::Replace (const nsAString &url)
+xgLocation::ToString (nsAString &_retval)
{
- XG_RETURN_NOT_IMPLEMENTED;
-}
+ NS_ENSURE_TRUE (mUri, NS_ERROR_FAILURE);

-/* void assign (in DOMString url); */
-NS_IMETHODIMP
-xgLocation::Assign (const nsAString &url)
-{
- nsCOMPtr<xgIParserListener> listener (new xgWindowParserListener
(mWindow));
- NS_ENSURE_TRUE (listener, NS_ERROR_OUT_OF_MEMORY);
+ g_message (GOM_LOC ("mUri is: %p"), mUri.get());

- nsresult rv;
- nsCOMPtr<xgIParser> parser (do_CreateInstance
("@ilovegom.org/parser;1", &rv));
+ nsCAutoString s;
+ nsresult rv = mUri->GetSpec (s);
NS_ENSURE_SUCCESS (rv, rv);

- nsCOMPtr<nsIDOMDocument> doc;
- return parser->ParseURI (url, listener, getter_AddRefs (doc));
-}
-
-/* DOMString toString (); */
-NS_IMETHODIMP
-xgLocation::ToString (nsAString &_retval)
-{
- XG_RETURN_NOT_IMPLEMENTED;
+ return NS_CStringToUTF16 (s, NS_CSTRING_ENCODING_UTF8, _retval);
}

/*
* an xgParserListener
*/

-xgWindowParserListener::xgWindowParserListener(xgWindow *aWindow)
+xgWindowParserListener::xgWindowParserListener (xgWindow *aWindow)
: mWindow (aWindow)
{
- NS_IF_ADDREF (mWindow);
}

-xgWindowParserListener::~xgWindowParserListener()
+xgWindowParserListener::~xgWindowParserListener ()
{
- NS_IF_RELEASE (mWindow);
}

/* Implementation file */
-NS_IMPL_ISUPPORTS1(xgWindowParserListener, xgIParserListener)
+NS_IMPL_ISUPPORTS1 (xgWindowParserListener, xgIParserListener)

/* void documentCreated (in nsIDOMDocument document); */
NS_IMETHODIMP
xgWindowParserListener::DocumentCreated (nsIDOMDocument *aDocument)
{
// friend access!
- return mWindow->SetDocument (aDocument);
+ mWindow->mDocument = aDocument;
+ return mWindow->DidSetDocument ();
}
+
+PRBool
+XG_HandleScriptError (nsIScriptGlobalObject *aScriptGlobal,
+ nsScriptErrorEvent *aErrorEvent,
+ nsEventStatus *aEventStatus)
+{
+ return PR_FALSE;
+}
+
+#include "xgWindowUnimplemented.cc"

Added: trunk/gom/src/xpgom/xgWindowUnimplemented.cc
==============================================================================
--- (empty file)
+++ trunk/gom/src/xpgom/xgWindowUnimplemented.cc Thu Aug 21 00:23:29 2008
@@ -0,0 +1,713 @@
+/*
+The MIT License
+
+Copyright (c) 2008 jacob berkman <ja...@ilovegom.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a
copy
+of this software and associated documentation files (the "Software"), to
deal
+in the Software without restriction, including without limitation the
rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+// nsIDOMWindowInternal
+
+/* readonly attribute nsIDOMScreen screen; */
+NS_IMETHODIMP xgWindow::GetScreen(nsIDOMScreen **aScreen)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMHistory history; */
+NS_IMETHODIMP xgWindow::GetHistory(nsIDOMHistory **aHistory)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMWindow content; */
+NS_IMETHODIMP xgWindow::GetContent(nsIDOMWindow **aContent)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [noscript] readonly attribute nsIPrompt prompter; */
+NS_IMETHODIMP xgWindow::GetPrompter(nsIPrompt **aPrompter)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMBarProp menubar; */
+NS_IMETHODIMP xgWindow::GetMenubar(nsIDOMBarProp **aMenubar)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMBarProp toolbar; */
+NS_IMETHODIMP xgWindow::GetToolbar(nsIDOMBarProp **aToolbar)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMBarProp locationbar; */
+NS_IMETHODIMP xgWindow::GetLocationbar(nsIDOMBarProp **aLocationbar)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMBarProp personalbar; */
+NS_IMETHODIMP xgWindow::GetPersonalbar(nsIDOMBarProp **aPersonalbar)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMBarProp statusbar; */
+NS_IMETHODIMP xgWindow::GetStatusbar(nsIDOMBarProp **aStatusbar)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMBarProp directories; */
+NS_IMETHODIMP xgWindow::GetDirectories(nsIDOMBarProp **aDirectories)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute boolean closed; */
+NS_IMETHODIMP xgWindow::GetClosed(PRBool *aClosed)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMCrypto crypto; */
+NS_IMETHODIMP xgWindow::GetCrypto(nsIDOMCrypto **aCrypto)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMPkcs11 pkcs11; */
+NS_IMETHODIMP xgWindow::GetPkcs11(nsIDOMPkcs11 **aPkcs11)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIControllers controllers; */
+NS_IMETHODIMP xgWindow::GetControllers(nsIControllers **aControllers)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute nsIDOMWindowInternal opener; */
+NS_IMETHODIMP xgWindow::GetOpener(nsIDOMWindowInternal **aOpener)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgWindow::SetOpener(nsIDOMWindowInternal * aOpener)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute DOMString status; */
+NS_IMETHODIMP xgWindow::GetStatus(nsAString &aStatus)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgWindow::SetStatus(const nsAString &aStatus)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute DOMString defaultStatus; */
+NS_IMETHODIMP xgWindow::GetDefaultStatus(nsAString &aDefaultStatus)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgWindow::SetDefaultStatus(const nsAString &aDefaultStatus)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute long innerWidth; */
+NS_IMETHODIMP xgWindow::GetInnerWidth(PRInt32 *aInnerWidth)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgWindow::SetInnerWidth(PRInt32 aInnerWidth)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute long innerHeight; */
+NS_IMETHODIMP xgWindow::GetInnerHeight(PRInt32 *aInnerHeight)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgWindow::SetInnerHeight(PRInt32 aInnerHeight)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute long outerWidth; */
+NS_IMETHODIMP xgWindow::GetOuterWidth(PRInt32 *aOuterWidth)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgWindow::SetOuterWidth(PRInt32 aOuterWidth)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute long outerHeight; */
+NS_IMETHODIMP xgWindow::GetOuterHeight(PRInt32 *aOuterHeight)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgWindow::SetOuterHeight(PRInt32 aOuterHeight)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute long screenX; */
+NS_IMETHODIMP xgWindow::GetScreenX(PRInt32 *aScreenX)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgWindow::SetScreenX(PRInt32 aScreenX)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute long screenY; */
+NS_IMETHODIMP xgWindow::GetScreenY(PRInt32 *aScreenY)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgWindow::SetScreenY(PRInt32 aScreenY)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute long pageXOffset; */
+NS_IMETHODIMP xgWindow::GetPageXOffset(PRInt32 *aPageXOffset)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute long pageYOffset; */
+NS_IMETHODIMP xgWindow::GetPageYOffset(PRInt32 *aPageYOffset)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute long scrollMaxX; */
+NS_IMETHODIMP xgWindow::GetScrollMaxX(PRInt32 *aScrollMaxX)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute long scrollMaxY; */
+NS_IMETHODIMP xgWindow::GetScrollMaxY(PRInt32 *aScrollMaxY)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute unsigned long length; */
+NS_IMETHODIMP xgWindow::GetLength(PRUint32 *aLength)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute boolean fullScreen; */
+NS_IMETHODIMP xgWindow::GetFullScreen(PRBool *aFullScreen)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgWindow::SetFullScreen(PRBool aFullScreen)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void alert (in DOMString text); */
+NS_IMETHODIMP xgWindow::Alert(const nsAString &text)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* boolean confirm (in DOMString text); */
+NS_IMETHODIMP xgWindow::Confirm(const nsAString &text, PRBool *_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* DOMString prompt (in DOMString aMessage, in DOMString aInitial, in
DOMString aTitle, in unsigned long aSavePassword); */
+NS_IMETHODIMP xgWindow::Prompt(const nsAString &aMessage, const nsAString
&aInitial, const nsAString &aTitle, PRUint32 aSavePassword, nsAString
&_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void focus (); */
+NS_IMETHODIMP xgWindow::Focus()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void blur (); */
+NS_IMETHODIMP xgWindow::Blur()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void back (); */
+NS_IMETHODIMP xgWindow::Back()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void forward (); */
+NS_IMETHODIMP xgWindow::Forward()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void home (); */
+NS_IMETHODIMP xgWindow::Home()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void stop (); */
+NS_IMETHODIMP xgWindow::Stop()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void print (); */
+NS_IMETHODIMP xgWindow::Print()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void moveTo (in long xPos, in long yPos); */
+NS_IMETHODIMP xgWindow::MoveTo(PRInt32 xPos, PRInt32 yPos)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void moveBy (in long xDif, in long yDif); */
+NS_IMETHODIMP xgWindow::MoveBy(PRInt32 xDif, PRInt32 yDif)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void resizeTo (in long width, in long height); */
+NS_IMETHODIMP xgWindow::ResizeTo(PRInt32 width, PRInt32 height)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void resizeBy (in long widthDif, in long heightDif); */
+NS_IMETHODIMP xgWindow::ResizeBy(PRInt32 widthDif, PRInt32 heightDif)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void scroll (in long xScroll, in long yScroll); */
+NS_IMETHODIMP xgWindow::Scroll(PRInt32 xScroll, PRInt32 yScroll)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [noscript] nsIDOMWindow open (in DOMString url, in DOMString name, in
DOMString options); */
+NS_IMETHODIMP xgWindow::Open(const nsAString &url, const nsAString &name,
const nsAString &options, nsIDOMWindow **_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [noscript] nsIDOMWindow openDialog (in DOMString url, in DOMString
name, in DOMString options, in nsISupports aExtraArgument); */
+NS_IMETHODIMP xgWindow::OpenDialog(const nsAString &url, const nsAString
&name, const nsAString &options, nsISupports *aExtraArgument, nsIDOMWindow
**_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void updateCommands (in DOMString action); */
+NS_IMETHODIMP xgWindow::UpdateCommands(const nsAString &action)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [noscript] boolean find (in DOMString str, in boolean caseSensitive, in
boolean backwards, in boolean wrapAround, in boolean wholeWord, in boolean
searchInFrames, in boolean showDialog); */
+NS_IMETHODIMP xgWindow::Find(const nsAString &str, PRBool caseSensitive,
PRBool backwards, PRBool wrapAround, PRBool wholeWord, PRBool
searchInFrames, PRBool showDialog, PRBool *_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* DOMString atob (in DOMString aAsciiString); */
+NS_IMETHODIMP xgWindow::Atob(const nsAString &aAsciiString, nsAString
&_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* DOMString btoa (in DOMString aBase64Data); */
+NS_IMETHODIMP xgWindow::Btoa(const nsAString &aBase64Data, nsAString
&_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMElement frameElement; */
+NS_IMETHODIMP xgWindow::GetFrameElement(nsIDOMElement **aFrameElement)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* nsIVariant showModalDialog (in DOMString aURI, [optional] in nsIVariant
aArgs, [optional] in DOMString aOptions); */
+NS_IMETHODIMP xgWindow::ShowModalDialog(const nsAString &aURI, nsIVariant
*aArgs, const nsAString &aOptions, nsIVariant **_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [binaryname (PostMessageMoz)] void postMessage (in DOMString message,
in DOMString targetOrigin); */
+NS_IMETHODIMP xgWindow::PostMessageMoz(const nsAString &message, const
nsAString &targetOrigin)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+// nsIDOMJSWindow
+
+/* long setTimeout (); */
+NS_IMETHODIMP xgWindow::SetTimeout(PRInt32 *_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* long setInterval (); */
+NS_IMETHODIMP xgWindow::SetInterval(PRInt32 *_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void clearTimeout (); */
+NS_IMETHODIMP xgWindow::ClearTimeout()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void clearInterval (); */
+NS_IMETHODIMP xgWindow::ClearInterval()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void setResizable (in boolean resizable); */
+NS_IMETHODIMP xgWindow::SetResizable(PRBool resizable)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void captureEvents (in long eventFlags); */
+NS_IMETHODIMP xgWindow::CaptureEvents(PRInt32 eventFlags)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void releaseEvents (in long eventFlags); */
+NS_IMETHODIMP xgWindow::ReleaseEvents(PRInt32 eventFlags)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void routeEvent (in nsIDOMEvent evt); */
+NS_IMETHODIMP xgWindow::RouteEvent(nsIDOMEvent *evt)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void enableExternalCapture (); */
+NS_IMETHODIMP xgWindow::EnableExternalCapture()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void disableExternalCapture (); */
+NS_IMETHODIMP xgWindow::DisableExternalCapture()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* DOMString prompt (); */
+NS_IMETHODIMP xgWindow::Prompt(nsAString &_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* nsIDOMWindow open (); */
+NS_IMETHODIMP xgWindow::Open(nsIDOMWindow **_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* nsIDOMWindow openDialog (); */
+NS_IMETHODIMP xgWindow::OpenDialog(nsIDOMWindow **_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMWindow frames; */
+NS_IMETHODIMP xgWindow::GetFrames(nsIDOMWindow **aFrames)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* boolean find (); */
+NS_IMETHODIMP xgWindow::Find(PRBool *_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMWindow parent; */
+NS_IMETHODIMP xgWindow::GetParent(nsIDOMWindow * *aParent)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMWindow top; */
+NS_IMETHODIMP xgWindow::GetTop(nsIDOMWindow * *aTop)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMBarProp scrollbars; */
+NS_IMETHODIMP xgWindow::GetScrollbars(nsIDOMBarProp * *aScrollbars)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [noscript] readonly attribute nsIDOMWindowCollection frames; */
+NS_IMETHODIMP xgWindow::GetFrames(nsIDOMWindowCollection * *aFrames)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute DOMString name; */
+NS_IMETHODIMP xgWindow::GetName(nsAString & aName)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgWindow::SetName(const nsAString & aName)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [noscript] attribute float textZoom; */
+NS_IMETHODIMP xgWindow::GetTextZoom(float *aTextZoom)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP xgWindow::SetTextZoom(float aTextZoom)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute long scrollX; */
+NS_IMETHODIMP xgWindow::GetScrollX(PRInt32 *aScrollX)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute long scrollY; */
+NS_IMETHODIMP xgWindow::GetScrollY(PRInt32 *aScrollY)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void scrollTo (in long xScroll, in long yScroll); */
+NS_IMETHODIMP xgWindow::ScrollTo(PRInt32 xScroll, PRInt32 yScroll)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void scrollBy (in long xScrollDif, in long yScrollDif); */
+NS_IMETHODIMP xgWindow::ScrollBy(PRInt32 xScrollDif, PRInt32 yScrollDif)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* nsISelection getSelection (); */
+NS_IMETHODIMP xgWindow::GetSelection(nsISelection **_retval)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void scrollByLines (in long numLines); */
+NS_IMETHODIMP xgWindow::ScrollByLines(PRInt32 numLines)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void scrollByPages (in long numPages); */
+NS_IMETHODIMP xgWindow::ScrollByPages(PRInt32 numPages)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void sizeToContent (); */
+NS_IMETHODIMP xgWindow::SizeToContent()
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* nsIDOMWindow2 */
+/* [noscript] readonly attribute nsIDOMEventTarget windowRoot; */
+NS_IMETHODIMP xgWindow::GetWindowRoot(nsIDOMEventTarget **aWindowRoot)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIDOMOfflineResourceList applicationCache; */
+NS_IMETHODIMP xgWindow::GetApplicationCache(nsIDOMOfflineResourceList
**aApplicationCache)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* nsIScriptGlobalObject */
+void
+xgWindow::SetScriptsEnabled (PRBool aEnabled, PRBool aFireTimeouts)
+{
+ GOM_NOT_IMPLEMENTED;
+}
+
+nsresult
+xgWindow::SetNewArguments (nsIArray *aArguments)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+nsresult
+xgWindow::HandleScriptError (nsScriptErrorEvent *aErrorEvent,
+ nsEventStatus *aEventStatus)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/*
+ * nsILocation implementation
+ */
+
+/* attribute DOMString hash; */
+NS_IMETHODIMP
+xgLocation::GetHash (nsAString &aHash)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP
+xgLocation::SetHash (const nsAString &aHash)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute DOMString host; */
+NS_IMETHODIMP
+xgLocation::GetHost (nsAString &aHost)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP
+xgLocation::SetHost (const nsAString &aHost)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute DOMString hostname; */
+NS_IMETHODIMP
+xgLocation::GetHostname (nsAString &aHostname)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP
+xgLocation::SetHostname (const nsAString &aHostname)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute DOMString href; */
+NS_IMETHODIMP
+xgLocation::GetHref (nsAString &aHref)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP
+xgLocation::SetHref (const nsAString &aHref)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute DOMString pathname; */
+NS_IMETHODIMP
+xgLocation::GetPathname (nsAString &aPathname)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP
+xgLocation::SetPathname (const nsAString &aPathname)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute DOMString port; */
+NS_IMETHODIMP
+xgLocation::GetPort (nsAString &aPort)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP
+xgLocation::SetPort (const nsAString &aPort)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute DOMString protocol; */
+NS_IMETHODIMP
+xgLocation::GetProtocol (nsAString &aProtocol)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP
+xgLocation::SetProtocol (const nsAString &aProtocol)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* attribute DOMString search; */
+NS_IMETHODIMP
+xgLocation::GetSearch (nsAString &aSearch)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP
+xgLocation::SetSearch (const nsAString &aSearch)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* [noscript] void reload (in boolean forceget); */
+NS_IMETHODIMP
+xgLocation::Reload (PRBool forceget)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}
+
+/* void replace (in DOMString url); */
+NS_IMETHODIMP
+xgLocation::Replace (const nsAString &url)
+{
+ XG_RETURN_NOT_IMPLEMENTED;
+}

Modified: trunk/gom/src/xpgom/xpgom.js
==============================================================================
--- trunk/gom/src/xpgom/xpgom.js (original)
+++ trunk/gom/src/xpgom/xpgom.js Thu Aug 21 00:23:29 2008
@@ -30,10 +30,19 @@

const Cc = Components.classes;
const Ci = Components.interfaces;
+var io = Cc['@mozilla.org/network/io-service;1'].getService
(Ci.nsIIOService);

-var gom = Cc['@ilovegom.org/window;1'].createInstance (Ci.xgIWindow);
-gom.dump ('userAgent: ' + gom.navigator.userAgent);
-gom.location.assign (args[0]);
-gom.run ();
+var gom = Cc['@ilovegom.org/shell;1'].createInstance (Ci.nsIDocShell);
+var uri = io.newURI (args[0], null, null);
+
+gom.setCurrentURI (uri);
+
+//gom.dump ('userAgent: ' + gom.navigator.userAgent);
+//gom.dump ('Location: ' + gom.location);
+//gom.dump ('XHR: ' + gom.XMLHttpRequest);
+//gom.dump (gom.document.documentURI);
+//gom.dump (gom.document.documentElement.tagName);
+
+//gom.run ();

//})(arguments);

Reply all
Reply to author
Forward
0 new messages