Re: Problems with javascript in embedded browser

2009-11-30 Thread Blaine Monkey
On 26 nov, 15:47, Blaine Monkey  wrote:
> On 26 nov, 11:50, Blaine Monkey  wrote:
>
>
>
> > I've a Linux C++ application with mozilla browser embedded.
> > The embedded browser shows the google page well.
> > I made a simple page with some javascript code, to do a test. The page has a
> > table with a text and the javascript changes the text with an image. If I
> > open the page with firefox it shows fine, but the embedded browser only
> > shows the text. Embedded browser supports javascript as firefox, in't it?
> > What's the problem?
>
> > Here is the source code:
>
> > 
> >  TESTING
> >     
> >  
> >     
> >       
> > TEXT 
>
> >     
> > 
>
> > // And this is the code of buildTable.js file:
> > function buildTable(){
> >  var build = ' > height="100">';
> >     document.all.myTable.innerHTML=build;
>
> > }
>
> This is the application code:
>
> int main(int argc, char** argv) {
>         GtkWidget *window;
>         nsCOMPtr baseWindow;
>         nsCOMPtr webBrowser;
>         nsCOMPtr libxul;
>         nsCOMPtr webNavigation;
>         nsCOMPtr browserSetup;
>         nsCOMPtr browserchrome;
>
>         nsDynamicFunctionLoad nsFuncs[] = {
>                 {"XRE_InitEmbedding", (NSFuncPtr*)&XRE_InitEmbedding},
>                 {"XRE_TermEmbedding", (NSFuncPtr*)&XRE_TermEmbedding},
>                 {0, 0}
>         };
>
>         nsresult rv;
>         gtk_init (&argc, &argv);
>         window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
>         gtk_widget_show(window);
>
>         rv = XPCOMGlueStartup("/usr/lib/xulrunner-1.9/libxpcom.so");
>
>         if (NS_FAILED(rv)) {
>                 printf("XPCOMGlueStartup\n");
>         }
>
>         rv = XPCOMGlueLoadXULFunctions(nsFuncs);
>         if (NS_FAILED(rv)) {
>                 printf("XPCOMGlueLoadXULFunctions\n");
>         }
>
>         rv = NS_NewNativeLocalFile(nsEmbedCString("/usr/lib/
> xulrunner-1.9"), PR_FALSE, getter_AddRefs(libxul));
>         if (NS_FAILED(rv)) {
>                 printf("NS_NewNativeLocalFile\n");
>         }
>
>         rv = XRE_InitEmbedding(libxul, 0, 0, 0, 0);
>
>         if (NS_FAILED(rv)) {
>                         printf("Error XRE_InitEmbedding %d\n",rv);
>                 return -1;
>         }
>
>         webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID, &rv);
>         if (NS_FAILED(rv)) {
>                         printf("do_CreateInstance webBrowser\n");
>         }
>
>         browserSetup =  do_QueryInterface(webBrowser,&rv);
>                 if (NS_FAILED(rv)) {
>                   printf("do_QueryInterface browserSetup\n");
>                 }
>
>                 browserSetup->SetProperty
> (nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS,PR_TRUE);
>                 browserSetup->SetProperty
> (nsIWebBrowserSetup::SETUP_ALLOW_JAVASCRIPT,PR_TRUE);
>                 browserSetup->SetProperty
> (nsIWebBrowserSetup::SETUP_ALLOW_IMAGES,PR_TRUE);
>                 browserSetup->SetProperty
> (nsIWebBrowserSetup::SETUP_ALLOW_META_REDIRECTS,PR_TRUE);
>                 browserSetup->SetProperty
> (nsIWebBrowserSetup::SETUP_ALLOW_SUBFRAMES,PR_TRUE);
>                 browserSetup->SetProperty
> (nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER,PR_FALSE);
>
>         baseWindow = do_QueryInterface(webBrowser);
>
>         rv = baseWindow->InitWindow(window, 0, 0, 0, 1300, 700);
>         if (NS_FAILED(rv)) {
>                 printf("InitWindow\n");
>         }
>         rv = baseWindow->Create();
>         if (NS_FAILED(rv)) {
>                 printf("Create\n");
>         }
>         rv =baseWindow->SetVisibility(PR_TRUE);
>         if (NS_FAILED(rv)) {
>                 printf("SetVisibility\n");
>         }
>         webNavigation = do_QueryInterface(webBrowser);
>         rv = webNavigation->LoadURI(NS_ConvertASCIItoUTF16(argv[1]).get
> (),nsIWebNavigation::LOAD_FLAGS_NONE , 0, 0, 0);
>
>         if (NS_FAILED(rv)) {
>                 printf("LoadURI\n");
>         }
>         g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK
> (delete_event), 0);
>         gtk_main();
>         XRE_TermEmbedding();
>         XPCOMGlueShutdown();
>         exit(0);
>
> }

Firstly, sorry for repeat the same post many times, I thought there
was problems because the message didn't appear some time after send
it.
I resolve the javascript problem. I saw that nsIWebBrowserChrome is
the key.
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Problems with javascript in embedded browser

2009-11-26 Thread Blaine Monkey
On 26 nov, 11:50, Blaine Monkey  wrote:
> I've a Linux C++ application with mozilla browser embedded.
> The embedded browser shows the google page well.
> I made a simple page with some javascript code, to do a test. The page has a
> table with a text and the javascript changes the text with an image. If I
> open the page with firefox it shows fine, but the embedded browser only
> shows the text. Embedded browser supports javascript as firefox, in't it?
> What's the problem?
>
> Here is the source code:
>
> 
>  TESTING
>     
>  
>     
>       
> TEXT 
>
>     
> 
>
> // And this is the code of buildTable.js file:
> function buildTable(){
>  var build = ' height="100">';
>     document.all.myTable.innerHTML=build;
>
> }
This is the application code:
#define XPCOM_GLUE 1
#include 
#include 
#include 
#include 
#include "xpcom-config.h"
#include "nsXPCOMGlue.h"
#include "nsDebug.h"
#include "nsCOMPtr.h"
#include "widget/nsIBaseWindow.h"
#include "nsILocalFile.h"
#include "nsIWebBrowser.h"
#include "nsIWebBrowserSetup.h"
#include "docshell/nsIWebNavigation.h"
#include "nsEmbedCID.h"
#include "nsEmbedString.h"
#include "xulapp/nsXULAppAPI.h"
#include "nsComponentManagerUtils.h"

#include "nsIPrefService.h"

XRE_InitEmbeddingType XRE_InitEmbedding;
XRE_TermEmbeddingType XRE_TermEmbedding;

static gboolean delete_event( GtkWidget *widget, GdkEvent *event,
gpointer data ) {
gtk_main_quit();
return FALSE;

}

int main(int argc, char** argv) {
GtkWidget *window;
nsCOMPtr baseWindow;
nsCOMPtr webBrowser;
nsCOMPtr libxul;
nsCOMPtr webNavigation;
nsCOMPtr browserSetup;
nsDynamicFunctionLoad nsFuncs[] = {
{"XRE_InitEmbedding", (NSFuncPtr*)&XRE_InitEmbedding},
{"XRE_TermEmbedding", (NSFuncPtr*)&XRE_TermEmbedding},
{0, 0}
};

nsresult rv;
gtk_init (&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(window);

rv = XPCOMGlueStartup("/usr/lib/xulrunner-1.9/libxpcom.so");

if (NS_FAILED(rv)) {
printf("XPCOMGlueStartup\n");
}

rv = XPCOMGlueLoadXULFunctions(nsFuncs);
if (NS_FAILED(rv)) {
printf("XPCOMGlueLoadXULFunctions\n");
}

rv = NS_NewNativeLocalFile(nsEmbedCString("/usr/lib/
xulrunner-1.9"), PR_FALSE, getter_AddRefs(libxul));
if (NS_FAILED(rv)) {
printf("NS_NewNativeLocalFile\n");
}

rv = XRE_InitEmbedding(libxul, 0, 0, 0, 0);

if (NS_FAILED(rv)) {
printf("Error XRE_InitEmbedding %d\n",rv);
return -1;
}

webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
printf("do_CreateInstance webBrowser\n");
}

browserSetup =  do_QueryInterface(webBrowser,&rv);
if (NS_FAILED(rv)) {
  printf("do_QueryInterface browserSetup\n");
}

browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_JAVASCRIPT,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_IMAGES,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_META_REDIRECTS,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_SUBFRAMES,PR_TRUE);

baseWindow = do_QueryInterface(webBrowser);
rv = baseWindow->InitWindow(window, 0, 0, 0, 1300, 700);
if (NS_FAILED(rv)) {
printf("InitWindow\n");
}
rv = baseWindow->Create();
if (NS_FAILED(rv)) {
printf("Create\n");
}
rv =baseWindow->SetVisibility(PR_TRUE);
if (NS_FAILED(rv)) {
printf("SetVisibility\n");
}
webNavigation = do_QueryInterface(webBrowser);
//rv = webNavigation->LoadURI(NS_ConvertASCIItoUTF16("http://
www.google.com").get(),nsIWebNavigation::LOAD_FLAGS_MASK , 0, 0, 0);
rv = webNavigation->LoadURI(NS_ConvertASCIItoUTF16(argv[1]).get
(),nsIWebNavigation::LOAD_FLAGS_NONE , 0, 0, 0);

if (NS_FAILED(rv)) {
printf("LoadURI\n");
}
g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK
(delete_event), 0);
gtk_main();
XRE_TermEmbedding();
XPCOMGlueShutdown();
exit(0);
}
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Problems with javascript in embedded browser

2009-11-26 Thread Blaine Monkey
This is the code of the application:

#define XPCOM_GLUE 1
#include 
#include 
#include 
#include 
#include "xpcom-config.h"
#include "nsXPCOMGlue.h"
#include "nsDebug.h"
#include "nsCOMPtr.h"
#include "widget/nsIBaseWindow.h"
#include "nsILocalFile.h"
#include "nsIWebBrowser.h"
#include "nsIWebBrowserSetup.h"
#include "docshell/nsIWebNavigation.h"
#include "nsEmbedCID.h"
#include "nsEmbedString.h"
#include "xulapp/nsXULAppAPI.h"
#include "nsComponentManagerUtils.h"

#include "nsIPrefService.h"

XRE_InitEmbeddingType XRE_InitEmbedding;
XRE_TermEmbeddingType XRE_TermEmbedding;

static gboolean delete_event( GtkWidget *widget, GdkEvent *event,
gpointer data ) {
gtk_main_quit();
return FALSE;

}

int main(int argc, char** argv) {
GtkWidget *window;
nsCOMPtr baseWindow;
nsCOMPtr webBrowser;
nsCOMPtr libxul;
nsCOMPtr webNavigation;
nsCOMPtr browserSetup;
nsDynamicFunctionLoad nsFuncs[] = {
{"XRE_InitEmbedding", (NSFuncPtr*)&XRE_InitEmbedding},
{"XRE_TermEmbedding", (NSFuncPtr*)&XRE_TermEmbedding},
{0, 0}
};

nsresult rv;
gtk_init (&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 gtk_widget_show(window);

rv = XPCOMGlueStartup("/usr/lib/xulrunner-1.9/libxpcom.so");

if (NS_FAILED(rv)) {
printf("XPCOMGlueStartup\n");
}

rv = XPCOMGlueLoadXULFunctions(nsFuncs);
if (NS_FAILED(rv)) {
printf("XPCOMGlueLoadXULFunctions\n");
}

rv = NS_NewNativeLocalFile(nsEmbedCString("/usr/lib/
xulrunner-1.9"), PR_FALSE, getter_AddRefs(libxul));
if (NS_FAILED(rv)) {
printf("NS_NewNativeLocalFile\n");
}

rv = XRE_InitEmbedding(libxul, 0, 0, 0, 0);

if (NS_FAILED(rv)) {
printf("Error XRE_InitEmbedding %d\n",rv);
return -1;
}

webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
printf("do_CreateInstance webBrowser\n");
}


browserSetup =  do_QueryInterface(webBrowser,&rv);
if (NS_FAILED(rv)) {
  printf("do_QueryInterface browserSetup\n");
}

browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_JAVASCRIPT,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_IMAGES,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_META_REDIRECTS,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_SUBFRAMES,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER,PR_FALSE);

//browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_IMAGES,PR_TRUE);

baseWindow = do_QueryInterface(webBrowser);

rv = baseWindow->InitWindow(window, 0, 0, 0, 1300, 700);
if (NS_FAILED(rv)) {
printf("InitWindow\n");
}
rv = baseWindow->Create();
if (NS_FAILED(rv)) {
printf("Create\n");
}
rv =baseWindow->SetVisibility(PR_TRUE);
if (NS_FAILED(rv)) {
printf("SetVisibility\n");
}
webNavigation = do_QueryInterface(webBrowser);
//rv = webNavigation->LoadURI(NS_ConvertASCIItoUTF16("http://
www.google.com").get(),nsIWebNavigation::LOAD_FLAGS_MASK , 0, 0, 0);
rv = webNavigation->LoadURI(NS_ConvertASCIItoUTF16(argv[1]).get
(),nsIWebNavigation::LOAD_FLAGS_NONE , 0, 0, 0);

if (NS_FAILED(rv)) {
printf("LoadURI\n");
}
g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK
(delete_event), 0);
gtk_main();
XRE_TermEmbedding();
XPCOMGlueShutdown();
exit(0);
}
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Problems with javascript in embedded browser

2009-11-26 Thread Blaine Monkey
On 26 nov, 11:50, Blaine Monkey  wrote:
> I've a Linux C++ application with mozilla browser embedded.
> The embedded browser shows the google page well.
> I made a simple page with some javascript code, to do a test. The page has a
> table with a text and the javascript changes the text with an image. If I
> open the page with firefox it shows fine, but the embedded browser only
> shows the text. Embedded browser supports javascript as firefox, in't it?
> What's the problem?
>
> Here is the source code:
>
> 
>  TESTING
>     
>  
>     
>       
> TEXT 
>
>     
> 
>
> // And this is the code of buildTable.js file:
> function buildTable(){
>  var build = ' height="100">';
>     document.all.myTable.innerHTML=build;
>
> }

This is the Application Code:

#define XPCOM_GLUE 1
#include 
#include 
#include 
#include 
#include "xpcom-config.h"
#include "nsXPCOMGlue.h"
#include "nsDebug.h"
#include "nsCOMPtr.h"
#include "widget/nsIBaseWindow.h"
#include "nsILocalFile.h"
#include "nsIWebBrowser.h"
#include "nsIWebBrowserSetup.h"
#include "docshell/nsIWebNavigation.h"
#include "nsEmbedCID.h"
#include "nsEmbedString.h"
#include "xulapp/nsXULAppAPI.h"
#include "nsComponentManagerUtils.h"

#include "nsIPrefService.h"

XRE_InitEmbeddingType XRE_InitEmbedding;
XRE_TermEmbeddingType XRE_TermEmbedding;

static gboolean delete_event( GtkWidget *widget, GdkEvent *event,
gpointer data ) {
gtk_main_quit();
return FALSE;

}

int main(int argc, char** argv) {
GtkWidget *window;
nsCOMPtr baseWindow;
nsCOMPtr webBrowser;
nsCOMPtr libxul;
nsCOMPtr webNavigation;
nsCOMPtr browserSetup;
nsDynamicFunctionLoad nsFuncs[] = {
{"XRE_InitEmbedding", (NSFuncPtr*)&XRE_InitEmbedding},
{"XRE_TermEmbedding", (NSFuncPtr*)&XRE_TermEmbedding},
{0, 0}
};

nsresult rv;
gtk_init (&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(window);

rv = XPCOMGlueStartup("/usr/lib/xulrunner-1.9/libxpcom.so");

if (NS_FAILED(rv)) {
printf("XPCOMGlueStartup\n");
}

rv = XPCOMGlueLoadXULFunctions(nsFuncs);
if (NS_FAILED(rv)) {
printf("XPCOMGlueLoadXULFunctions\n");
}

rv = NS_NewNativeLocalFile(nsEmbedCString("/usr/lib/
xulrunner-1.9"), PR_FALSE, getter_AddRefs(libxul));
if (NS_FAILED(rv)) {
printf("NS_NewNativeLocalFile\n");
}

rv = XRE_InitEmbedding(libxul, 0, 0, 0, 0);

if (NS_FAILED(rv)) {
printf("Error XRE_InitEmbedding %d\n",rv);
return -1;
}

webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
printf("do_CreateInstance webBrowser\n");
}

browserSetup =  do_QueryInterface(webBrowser,&rv);
if (NS_FAILED(rv)) {
  printf("do_QueryInterface browserSetup\n");
}

browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_JAVASCRIPT,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_IMAGES,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_META_REDIRECTS,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_SUBFRAMES,PR_TRUE);
//browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_IMAGES,PR_TRUE);

baseWindow = do_QueryInterface(webBrowser);
rv = baseWindow->InitWindow(window, 0, 0, 0, 1300, 700);
if (NS_FAILED(rv)) {
printf("InitWindow\n");
}
rv = baseWindow->Create();
if (NS_FAILED(rv)) {
printf("Create\n");
}
rv =baseWindow->SetVisibility(PR_TRUE);
if (NS_FAILED(rv)) {
printf("SetVisibility\n");
}
webNavigation = do_QueryInterface(webBrowser);
//rv = webNavigation->LoadURI(NS_ConvertASCIItoUTF16("http://
www.google.com").get(),nsIWebNavigation::LOAD_FLAGS_NONE , 0, 0, 0);
rv = webNavigation->LoadURI(NS_ConvertASCIItoUTF16(argv[1]).get
(),nsIWebNavigation::LOAD_FLAGS_NONE , 0, 0, 0);

if (NS_FAILED(rv)) {
printf("LoadURI\n");
}
g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK
(delete_event), 0);
gtk_main();
XRE_TermEmbedding();
XPCOMGlueShutdown();
exit(0);
}
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Problems with javascript in embedded browser

2009-11-26 Thread Blaine Monkey
On 26 nov, 11:50, Blaine Monkey  wrote:
> I've a Linux C++ application with mozilla browser embedded.
> The embedded browser shows the google page well.
> I made a simple page with some javascript code, to do a test. The page has a
> table with a text and the javascript changes the text with an image. If I
> open the page with firefox it shows fine, but the embedded browser only
> shows the text. Embedded browser supports javascript as firefox, in't it?
> What's the problem?
>
> Here is the source code:
>
> 
>  TESTING
>     
>  
>     
>       
> TEXT 
>
>     
> 
>
> // And this is the code of buildTable.js file:
> function buildTable(){
>  var build = ' height="100">';
>     document.all.myTable.innerHTML=build;
>
> }

I set the SETUP_ALLOW_JAVASCRIPT property to true but doesn't work.

webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
printf("do_CreateInstance webBrowser\n");
}

browserSetup =  do_QueryInterface(webBrowser,&rv);
if (NS_FAILED(rv)) {
  printf("do_QueryInterface browserSetup\n");
}

browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_JAVASCRIPT,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_IMAGES,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_META_REDIRECTS,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_SUBFRAMES,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER,PR_FALSE);



baseWindow = do_QueryInterface(webBrowser);

rv = baseWindow->InitWindow(window, 0, 0, 0, 1300, 700);
if (NS_FAILED(rv)) {
printf("InitWindow\n");
}
rv = baseWindow->Create();
if (NS_FAILED(rv)) {
printf("Create\n");
}
rv =baseWindow->SetVisibility(PR_TRUE);
if (NS_FAILED(rv)) {
printf("SetVisibility\n");
}
webNavigation = do_QueryInterface(webBrowser);
rv = webNavigation->LoadURI(NS_ConvertASCIItoUTF16(argv[1]).get
(),nsIWebNavigation::LOAD_FLAGS_NONE , 0, 0, 0);

if (NS_FAILED(rv)) {
printf("LoadURI\n");
}
g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK
(delete_event), 0);
gtk_main();
XRE_TermEmbedding();
XPCOMGlueShutdown();
exit(0);

___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Problems with javascript in embedded browser

2009-11-26 Thread Blaine Monkey
On 26 nov, 11:50, Blaine Monkey  wrote:
> I've a Linux C++ application with mozilla browser embedded.
> The embedded browser shows the google page well.
> I made a simple page with some javascript code, to do a test. The page has a
> table with a text and the javascript changes the text with an image. If I
> open the page with firefox it shows fine, but the embedded browser only
> shows the text. Embedded browser supports javascript as firefox, in't it?
> What's the problem?
>
> Here is the source code:
>
> 
>  TESTING
>     
>  
>     
>       
> TEXT 
>
>     
> 
>
> // And this is the code of buildTable.js file:
> function buildTable(){
>  var build = ' height="100">';
>     document.all.myTable.innerHTML=build;
>
> }

This is the application code:

int main(int argc, char** argv) {
GtkWidget *window;
nsCOMPtr baseWindow;
nsCOMPtr webBrowser;
nsCOMPtr libxul;
nsCOMPtr webNavigation;
nsCOMPtr browserSetup;
nsCOMPtr browserchrome;

nsDynamicFunctionLoad nsFuncs[] = {
{"XRE_InitEmbedding", (NSFuncPtr*)&XRE_InitEmbedding},
{"XRE_TermEmbedding", (NSFuncPtr*)&XRE_TermEmbedding},
{0, 0}
};

nsresult rv;
gtk_init (&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(window);

rv = XPCOMGlueStartup("/usr/lib/xulrunner-1.9/libxpcom.so");

if (NS_FAILED(rv)) {
printf("XPCOMGlueStartup\n");
}

rv = XPCOMGlueLoadXULFunctions(nsFuncs);
if (NS_FAILED(rv)) {
printf("XPCOMGlueLoadXULFunctions\n");
}

rv = NS_NewNativeLocalFile(nsEmbedCString("/usr/lib/
xulrunner-1.9"), PR_FALSE, getter_AddRefs(libxul));
if (NS_FAILED(rv)) {
printf("NS_NewNativeLocalFile\n");
}

rv = XRE_InitEmbedding(libxul, 0, 0, 0, 0);

if (NS_FAILED(rv)) {
printf("Error XRE_InitEmbedding %d\n",rv);
return -1;
}

webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
printf("do_CreateInstance webBrowser\n");
}

browserSetup =  do_QueryInterface(webBrowser,&rv);
if (NS_FAILED(rv)) {
  printf("do_QueryInterface browserSetup\n");
}

browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_JAVASCRIPT,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_IMAGES,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_META_REDIRECTS,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_ALLOW_SUBFRAMES,PR_TRUE);
browserSetup->SetProperty
(nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER,PR_FALSE);



baseWindow = do_QueryInterface(webBrowser);

rv = baseWindow->InitWindow(window, 0, 0, 0, 1300, 700);
if (NS_FAILED(rv)) {
printf("InitWindow\n");
}
rv = baseWindow->Create();
if (NS_FAILED(rv)) {
printf("Create\n");
}
rv =baseWindow->SetVisibility(PR_TRUE);
if (NS_FAILED(rv)) {
printf("SetVisibility\n");
}
webNavigation = do_QueryInterface(webBrowser);
rv = webNavigation->LoadURI(NS_ConvertASCIItoUTF16(argv[1]).get
(),nsIWebNavigation::LOAD_FLAGS_NONE , 0, 0, 0);

if (NS_FAILED(rv)) {
printf("LoadURI\n");
}
g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK
(delete_event), 0);
gtk_main();
XRE_TermEmbedding();
XPCOMGlueShutdown();
exit(0);
}
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: Problems with javascript in embedded browser

2009-11-26 Thread Blaine Monkey
On 26 nov, 11:50, Blaine Monkey  wrote:
> I've a Linux C++ application with mozilla browser embedded.
> The embedded browser shows the google page well.
> I made a simple page with some javascript code, to do a test. The page has a
> table with a text and the javascript changes the text with an image. If I
> open the page with firefox it shows fine, but the embedded browser only
> shows the text. Embedded browser supports javascript as firefox, in't it?
> What's the problem?
>
> Here is the source code:
>
> 
>  TESTING
>     
>  
>     
>       
> TEXT 
>
>     
> 
>
> // And this is the code of buildTable.js file:
> function buildTable(){
>  var build = ' height="100">';
>     document.all.myTable.innerHTML=build;
>
> }

___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding