Git Product home page Git Product logo

webloop's People

Contributors

andreeleuterio avatar attfarhan avatar beyang avatar dictav avatar elgohr avatar sqs avatar zachlatta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webloop's Issues

max stack exceeded

when run got following errors:

static: Rendering HTML for page at URL: http://zhanzhang.baidu.com/college/articleinfo?id=995
undefined: CONSOLE ERROR RangeError: Maximum call stack size exceeded.
undefined: CONSOLE ERROR RangeError: Maximum call stack size exceeded.
undefined: CONSOLE ERROR RangeError: Maximum call stack size exceeded.

code:

staticHandler := &webloop.StaticRenderer{
		TargetBaseURL: "http://zhanzhang.baidu.com",
		WaitTimeout:   time.Second * 3,
		Log:           log.New(os.Stderr, "static: ", 0),
	}
	http.Handle("/", staticHandler)

sys env:
alpine 3.5.2
go 1.8.1

Error: Package javascriptcoregtk-3.0 was not found in the pkg-config search path.

There's an error when package webkit2 is imported as follows. Could you kindly help with it? It seems that I need to install package javascriptcoregtk-3.0 for my windows 7 (64bit) , but I don't know how to do it.

Errors:

c:/go/bin/go.exe build [D:/Desktop/All_Projects/test]

pkg-config --cflags javascriptcoregtk-3.0

Package javascriptcoregtk-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `javascriptcoregtk-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'javascriptcoregtk-3.0' found
exit status 1

Can't install this on OS X 10.9

Jans-MacBook-Pro:~ janmochnak$ go get github.com/sourcegraph/webloop/
# runtime/cgo
clang: warning: argument unused during compilation: '-pthread'
# runtime/cgo
clang: error: no such file or directory: 'libgcc.a'

missing marshaler for type

I try to use a exapmle:

	gtk.Init(nil)
	go func() {
		runtime.LockOSThread()
		gtk.Main()
	}()

	ctx := webloop.New()
	view := ctx.NewView()
	defer view.Close()
	view.Open("http://google.com")
	err := view.Wait()      // error in runtime
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to load URL: %s", err)
		os.Exit(1)
	}
	res, err := view.EvaluateJavaScript("document.title")
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to run JavaScript: %s", err)
		os.Exit(1)
	}
	fmt.Printf("JavaScript returned: %q\n", res)

It compiles, but gives an error in runtime:
"warning: no suitable Go value from object for arg 0: missing marshaler for type"

go1.12.7 linux/amd64
Ubuntu 18.04.2 LTS

How to fix it?
Thnx

How to return read javascript arrays in Go?

I'm coming from the CasperJS world, so bare with me if the question doesn't make any sense.

in CasperJs if I do:

var links = this.evaluate(function(){
return document.querySelectorAll('a');
});

that's going to return the list of links within the headless browser, back to the casperjs environment.

I tried to do the same thing with webloop, but obviously didn't work as I was expecting it (Had the hunch it wouldn't, but wanted to give it a try anyways).

res, err := view.EvaluateJavaScript(var links = document.getElementsByTagName(\"a\"); for(var i = 0; i < links.length; ++i) { links[i].innerHTML }; ")

Just returns the innerHTML of the last element. I thought about building and object within javascript, and then stringify that object within the function, just for the string to be parsed by GoLang, but I'm not sure if that's the right way to go about this, or if there's a function provided within Webloop to accomplish this task.

Thanks

Cannot install

gtk 3.18 installed,

$ go install -v -tags gtk_3_18 -gcflags "-N -l" github.com/sourcegraph/webloop/...

Gives me this error:

github.com/sourcegraph/webloop/cmd/static-reverse-proxy
github.com/sourcegraph/webloop/examples/angular-static-seo
# github.com/sourcegraph/webloop/cmd/static-reverse-proxy
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/tmp/go-link-138544938/000009.o: In function `removeClosure':
/tmp/go-build/github.com/gotk3/gotk3/glib/_obj/_cgo_export.c:18: multiple definition of `removeClosure'
/tmp/go-link-138544938/000001.o:/tmp/go-build/github.com/conformal/gotk3/glib/_obj/_cgo_export.c:18: first defined here
/tmp/go-link-138544938/000009.o: In function `goMarshal':
/tmp/go-build/github.com/gotk3/gotk3/glib/_obj/_cgo_export.c:35: multiple definition of `goMarshal'
/tmp/go-link-138544938/000001.o:/tmp/go-build/github.com/conformal/gotk3/glib/_obj/_cgo_export.c:35: first defined here
collect2: error: ld returned 1 exit status

# github.com/sourcegraph/webloop/examples/angular-static-seo
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/tmp/go-link-378425330/000009.o: In function `removeClosure':
/tmp/go-build/github.com/gotk3/gotk3/glib/_obj/_cgo_export.c:18: multiple definition of `removeClosure'
/tmp/go-link-378425330/000001.o:/tmp/go-build/github.com/conformal/gotk3/glib/_obj/_cgo_export.c:18: first defined here
/tmp/go-link-378425330/000009.o: In function `goMarshal':
/tmp/go-build/github.com/gotk3/gotk3/glib/_obj/_cgo_export.c:35: multiple definition of `goMarshal'
/tmp/go-link-378425330/000001.o:/tmp/go-build/github.com/conformal/gotk3/glib/_obj/_cgo_export.c:35: first defined here
collect2: error: ld returned 1 exit status

How can I use web-loop in windows 7?

I tried and it come out an error as follows, please kindly help with this :

pkg-config --cflags javascriptcoregtk-3.0

Package javascriptcoregtk-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `javascriptcoregtk-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'javascriptcoregtk-3.0' found
exit status 1

github.com/sqs/gotk3/glib

cc1.exe: sorry, unimplemented: 64-bit mode not compiled in

Set up CI testing

There's a .travis.yml file in the travis-ci branch, but it doesn't work yet. The difficulty is that Travis-CI uses Ubuntu 12.04 LTS VMs, which don't have an easy way of installing WebKitGTK+ 2.

See also: sourcegraph/go-webkit2#1

Error: "Package javascriptcoregtk-4.0 was not found in the pkg-config search path."

os info:CentOS-7-x86_64

I have installed requirements

[root@localhost package]# rpm -qa | grep gtk
libwebkit2gtk-2.4.9-6.el7.x86_64
gtk3-devel-3.14.13-20.el7.x86_64
gtk3-3.14.13-20.el7.x86_64
gtk2-2.24.28-8.el7.x86_64
webkitgtk3-devel-2.4.9-6.el7.x86_64
webkitgtk3-2.4.9-6.el7.x86_64

When I do

go get github.com/sourcegraph/webloop

I get the following error message

[root@localhost package]# go get github.com/sourcegraph/webloop/
# pkg-config --cflags javascriptcoregtk-4.0
Package javascriptcoregtk-4.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `javascriptcoregtk-4.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'javascriptcoregtk-4.0' found
pkg-config: exit status 1
# github.com/gotk3/gotk3/gtk
could not determine kind of name for C.gtk_paned_get_wide_handle
could not determine kind of name for C.gtk_paned_set_wide_handle
could not determine kind of name for C.gtk_scrolled_window_get_overlay_scrolling
could not determine kind of name for C.gtk_scrolled_window_set_overlay_scrolling

package javascriptcoregtk-4.0 is not found

[root@localhost package]# find / -name "*javascriptcoregtk*"
/usr/lib64/pkgconfig/javascriptcoregtk-3.0.pc
/usr/lib64/libjavascriptcoregtk-3.0.so.0
/usr/lib64/libjavascriptcoregtk-3.0.so.0.16.17
/usr/lib64/libjavascriptcoregtk-3.0.so
[root@localhost package]# 

How to solve this problem?

Cannot build

I am running libgtk 3.12 in Ubuntu 14.04 and get the following when I do go get -tags gtk_3_12 github.com/sourcegraph/webloop/...

# github.com/sourcegraph/webloop/examples/angular-static-seo
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/tmp/go-link-587755410/000009.o: In function `removeClosure':
/tmp/go-build135241220/github.com/gotk3/gotk3/glib/_obj/_cgo_export.c:10: multiple definition of `removeClosure'
/tmp/go-link-587755410/000001.o:/tmp/go-build135241220/github.com/conformal/gotk3/glib/_obj/_cgo_export.c:10: first defined here
/tmp/go-link-587755410/000009.o: In function `goMarshal':
/tmp/go-build135241220/github.com/gotk3/gotk3/glib/_obj/_cgo_export.c:23: multiple definition of `goMarshal'
/tmp/go-link-587755410/000001.o:/tmp/go-build135241220/github.com/conformal/gotk3/glib/_obj/_cgo_export.c:23: first defined here
collect2: error: ld returned 1 exit status

# github.com/sourcegraph/webloop/cmd/static-reverse-proxy
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/tmp/go-link-852559976/000009.o: In function `removeClosure':
/tmp/go-build135241220/github.com/gotk3/gotk3/glib/_obj/_cgo_export.c:10: multiple definition of `removeClosure'
/tmp/go-link-852559976/000001.o:/tmp/go-build135241220/github.com/conformal/gotk3/glib/_obj/_cgo_export.c:10: first defined here
/tmp/go-link-852559976/000009.o: In function `goMarshal':
/tmp/go-build135241220/github.com/gotk3/gotk3/glib/_obj/_cgo_export.c:23: multiple definition of `goMarshal'
/tmp/go-link-852559976/000001.o:/tmp/go-build135241220/github.com/conformal/gotk3/glib/_obj/_cgo_export.c:23: first defined here
collect2: error: ld returned 1 exit status

Can't build

# github.com/sqs/gojs
In file included from _cgo_export.c:4:
cgo-gcc-export-header-prolog:51:99: error: redefinition of parameter '_'
cgo-gcc-export-header-prolog:51:90: note: previous definition of '_' with type 'void *'
_cgo_export.c:74:92: error: redefinition of parameter '_'
   74 | void* nativefunction_CallAsFunction_go(void* data_ptr, JSContextRef rawCtx, void* _, void* _, GoUint argumentCount, void* arguments, JSValueRef* exception)
      |                                                                                      ~~~~~~^
_cgo_export.c:74:83: note: previous definition of '_' with type 'void *'
   74 | void* nativefunction_CallAsFunction_go(void* data_ptr, JSContextRef rawCtx, void* _, void* _, GoUint argumentCount, void* arguments, JSValueRef* exception)
      |        

libwebkit2gtk41-2.42.5
go1.22.0 linux/amd64

get javascript errors?

Hi there,

Is there any way to get a list of javascript errors generated by webloop? If there is not, could this be added as a feature?

view.Wait()

is there a way to configure this to wait longer so yuo do not get the Error sending IPC message: Connection reset by peer error ?

Build error

github.com/sourcegraph/webloop/cmd/static-reverse-proxy

/home/ybin/apps/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/tmp/go-link-470351107/000009.o:in function ‘removeClosure’中:
/tmp/go-build851580455/github.com/gotk3/gotk3/glib/_obj/_cgo_export.c:10: multiple definition of removeClosure' /tmp/go-link-470351107/000001.o:/tmp/go-build851580455/github.com/conformal/gotk3/glib/_obj/_cgo_export.c:10:first definition /tmp/go-link-470351107/000009.o:in function ‘goMarshal’中: /tmp/go-build851580455/github.com/gotk3/gotk3/glib/_obj/_cgo_export.c:23: multiple definition ofgoMarshal'
/tmp/go-link-470351107/000001.o:/tmp/go-build851580455/github.com/conformal/gotk3/glib/_obj/_cgo_export.c:23:first definition
collect2: error:ld return 1

Detect frontend redirects

WebLoop should redirect frontend redirects. That is, if (say) AngularJS redirects from /foo to /bar in JavaScript, WebLoop should probably return an HTTP redirect instead of rendering the page at /bar in response to a GET /foo.

Allow using multiple views in StaticRenderer in parallel

I was playing around with webloop for a bit and found out that the StaticRenderer.ServeHTTP method doesn't allow to be run by more than one thread at the same time due to the locking that takes place on viewLock. Is there a reason for this or would it be possible to instantiate a new view every time ServeHTTP is executed so we can render multiple pages in parallel?

I'm relatively new to Go and would be glad if you can point me in the right direction.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.