From a88f609b8ab1e20eb2564d47605985d6b8f593e8 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Wed, 28 Jan 2015 10:22:37 -0600 Subject: [PATCH 01/10] Use custom Send methods --- rpc/ws/server.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/rpc/ws/server.go b/rpc/ws/server.go index 248ebc585..e2b918430 100644 --- a/rpc/ws/server.go +++ b/rpc/ws/server.go @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with go-ethereum. If not, see . */ -package ws +package rpcws import ( "fmt" @@ -30,6 +30,7 @@ import ( ) var wslogger = logger.NewLogger("RPC-WS") +var JSON rpc.JsonWrapper type WebSocketServer struct { eth *eth.Ethereum @@ -98,25 +99,28 @@ func (s *WebSocketServer) apiHandler(api *rpc.EthereumApi) http.Handler { func sockHandler(api *rpc.EthereumApi) websocket.Handler { fn := func(conn *websocket.Conn) { for { - wslogger.Debugln("Handling request") + wslogger.Debugln("Handling connection") var reqParsed rpc.RpcRequest + // reqParsed, reqerr := JSON.ParseRequestBody(conn.Request()) if err := websocket.JSON.Receive(conn, &reqParsed); err != nil { - wslogger.Debugln(rpc.ErrorParseRequest) - websocket.JSON.Send(conn, rpc.RpcErrorResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: true, ErrorText: rpc.ErrorParseRequest}) + // if reqerr != nil { + JSON.Send(conn, &rpc.RpcErrorResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: true, ErrorText: rpc.ErrorParseRequest}) + // websocket.JSON.Send(conn, rpc.RpcErrorResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: true, ErrorText: rpc.ErrorParseRequest}) continue } var response interface{} reserr := api.GetRequestReply(&reqParsed, &response) if reserr != nil { - wslogger.Errorln(reserr) - websocket.JSON.Send(conn, rpc.RpcErrorResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: true, ErrorText: reserr.Error()}) + // websocket.JSON.Send(conn, &rpc.RpcErrorResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: true, ErrorText: reserr.Error()}) + JSON.Send(conn, &rpc.RpcErrorResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: true, ErrorText: reserr.Error()}) continue } wslogger.Debugf("Generated response: %T %s", response, response) - websocket.JSON.Send(conn, rpc.RpcSuccessResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: false, Result: response}) + JSON.Send(conn, &rpc.RpcSuccessResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: false, Result: response}) + // websocket.JSON.Send(conn, rpc.RpcSuccessResponse{JsonRpc: reqParsed.JsonRpc, ID: reqParsed.ID, Error: false, Result: response}) } } return websocket.Handler(fn) From f3ac378ca4f670a6504d5138278bb33104eade0a Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Thu, 5 Feb 2015 17:13:51 -0600 Subject: [PATCH 02/10] No long use v1 branch of qml repo --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4659503e9..1a7e69ecb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,7 @@ install: # - go get golang.org/x/tools/cmd/vet - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi - go get github.com/mattn/goveralls - - go get -d github.com/obscuren/qml && cd $HOME/gopath/src/github.com/obscuren/qml && git checkout v1 && cd $TRAVIS_BUILD_DIR - - ETH_DEPS=$(go list -f '{{.Imports}} {{.TestImports}} {{.XTestImports}}' github.com/ethereum/go-ethereum/... | sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/C //g'); if [ "$ETH_DEPS" ]; then go get -d $ETH_DEPS; fi + - ETH_DEPS=$(go list -f '{{.Imports}} {{.TestImports}} {{.XTestImports}}' github.com/ethereum/go-ethereum/... | sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/C //g'); if [ "$ETH_DEPS" ]; then go get -d -v $ETH_DEPS; fi before_script: - gofmt -l -w . - goimports -l -w . From b58b6b9bac156035d416b5c837b49baa769b2db3 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Thu, 5 Feb 2015 17:23:22 -0600 Subject: [PATCH 03/10] Use after_success build step --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1a7e69ecb..f51f2cfbd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,9 @@ before_script: # - go vet ./... # - go test -race ./... script: - - ./gocoverage.sh && if [ "$COVERALLS_TOKEN" ]; then goveralls -coverprofile=profile.cov -service=travis-ci -repotoken $COVERALLS_TOKEN; fi + - ./gocoverage.sh +after_success: + - if [ "$COVERALLS_TOKEN" ]; then goveralls -coverprofile=profile.cov -service=travis-ci -repotoken $COVERALLS_TOKEN; fi env: global: - PKG_CONFIG_PATH=/opt/qt54/lib/pkgconfig From 5e0b2b260c9e6fb27826ca16e9d49f370df56b78 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Thu, 5 Feb 2015 17:49:44 -0600 Subject: [PATCH 04/10] Updated go list command --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f51f2cfbd..e8716ee68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ install: # - go get golang.org/x/tools/cmd/vet - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi - go get github.com/mattn/goveralls - - ETH_DEPS=$(go list -f '{{.Imports}} {{.TestImports}} {{.XTestImports}}' github.com/ethereum/go-ethereum/... | sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/C //g'); if [ "$ETH_DEPS" ]; then go get -d -v $ETH_DEPS; fi + - DEPS=$(go list -f '{{.Imports}}' ./... | sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/C //g'); if [ "$DEPS" ]; then go get -d -v $DEPS; fi before_script: - gofmt -l -w . - goimports -l -w . From e4bb419707ae0cde8a19f79154d5715d0ce1d6df Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Thu, 5 Feb 2015 18:11:31 -0600 Subject: [PATCH 05/10] Add go check to prefetched test dependencies --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e8716ee68..0084bf9c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ install: # - go get golang.org/x/tools/cmd/vet - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi - go get github.com/mattn/goveralls + - go get gopkg.in/check.v1 - DEPS=$(go list -f '{{.Imports}}' ./... | sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/C //g'); if [ "$DEPS" ]; then go get -d -v $DEPS; fi before_script: - gofmt -l -w . From 70e2df3904acf61db0d9c6805dda81c5e7fc2529 Mon Sep 17 00:00:00 2001 From: sveneh Date: Mon, 9 Feb 2015 16:27:49 +0100 Subject: [PATCH 06/10] Dockerfile creation speed-up by not running go tests, added a workaround so that docker's cache is invalidated whenever th git repo is updated. --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 771d19746..d2c03e7e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ RUN apt-get install -y qt54quickcontrols qt54webengine ## Build and install latest Go RUN git clone https://go.googlesource.com/go golang RUN cd golang && git checkout go1.4.1 -RUN cd golang/src && ./all.bash && go version +RUN cd golang/src && ./make.bash && go version ## Fetch and install QML RUN go get -u -v -d github.com/obscuren/qml @@ -29,6 +29,9 @@ WORKDIR $GOPATH/src/github.com/obscuren/qml RUN git checkout v1 RUN go install -v +# this is a workaround, to make sure that docker's cache is invalidated whenever the git repo changes +ADD https://api.github.com/repos/ethereum/go-ethereum/git/refs/heads/develop file_does_not_exist + ## Fetch and install go-ethereum RUN go get -u -v -d github.com/ethereum/go-ethereum/... WORKDIR $GOPATH/src/github.com/ethereum/go-ethereum From c6af5f0a275608ea6c797ef826e6090885f24eac Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Wed, 11 Feb 2015 11:30:36 +0100 Subject: [PATCH 07/10] No longer switch branches for go-qml dep --- Dockerfile | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index d2c03e7e0..6e29a638d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,12 +23,6 @@ RUN git clone https://go.googlesource.com/go golang RUN cd golang && git checkout go1.4.1 RUN cd golang/src && ./make.bash && go version -## Fetch and install QML -RUN go get -u -v -d github.com/obscuren/qml -WORKDIR $GOPATH/src/github.com/obscuren/qml -RUN git checkout v1 -RUN go install -v - # this is a workaround, to make sure that docker's cache is invalidated whenever the git repo changes ADD https://api.github.com/repos/ethereum/go-ethereum/git/refs/heads/develop file_does_not_exist From d613bf69bf3fd0cfbe28a2f68c87421f7d5bccf9 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Wed, 11 Feb 2015 11:56:29 +0100 Subject: [PATCH 08/10] #295 Allow RPC ID to be string --- rpc/http/server.go | 2 +- rpc/message.go | 6 +++--- rpc/util.go | 2 +- rpc/ws/server.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rpc/http/server.go b/rpc/http/server.go index a34400a77..10c8fa813 100644 --- a/rpc/http/server.go +++ b/rpc/http/server.go @@ -102,7 +102,7 @@ func (s *RpcHttpServer) apiHandler(api *rpc.EthereumApi) http.Handler { if reserr != nil { rpchttplogger.Warnln(reserr) jsonerr := &rpc.RpcErrorObject{-32603, reserr.Error()} - JSON.Send(w, &rpc.RpcErrorResponse{JsonRpc: jsonrpcver, ID: &reqParsed.ID, Error: jsonerr}) + JSON.Send(w, &rpc.RpcErrorResponse{JsonRpc: jsonrpcver, ID: reqParsed.ID, Error: jsonerr}) return } diff --git a/rpc/message.go b/rpc/message.go index 78dc6e2ff..7983e003d 100644 --- a/rpc/message.go +++ b/rpc/message.go @@ -34,20 +34,20 @@ const ( ) type RpcRequest struct { + ID interface{} `json:"id"` JsonRpc string `json:"jsonrpc"` - ID int `json:"id"` Method string `json:"method"` Params []json.RawMessage `json:"params"` } type RpcSuccessResponse struct { - ID int `json:"id"` + ID interface{} `json:"id"` JsonRpc string `json:"jsonrpc"` Result interface{} `json:"result"` } type RpcErrorResponse struct { - ID *int `json:"id"` + ID interface{} `json:"id"` JsonRpc string `json:"jsonrpc"` Error *RpcErrorObject `json:"error"` } diff --git a/rpc/util.go b/rpc/util.go index 509d9a17d..679d83754 100644 --- a/rpc/util.go +++ b/rpc/util.go @@ -47,7 +47,6 @@ func (self JsonWrapper) ParseRequestBody(req *http.Request) (RpcRequest, error) // Convert JSON to native types d := json.NewDecoder(req.Body) - // d.UseNumber() defer req.Body.Close() err := d.Decode(&reqParsed) @@ -55,6 +54,7 @@ func (self JsonWrapper) ParseRequestBody(req *http.Request) (RpcRequest, error) rpclogger.Errorln("Error decoding JSON: ", err) return reqParsed, err } + rpclogger.DebugDetailf("Parsed request: %s", reqParsed) return reqParsed, nil diff --git a/rpc/ws/server.go b/rpc/ws/server.go index fe6af042f..100713c10 100644 --- a/rpc/ws/server.go +++ b/rpc/ws/server.go @@ -109,7 +109,7 @@ func sockHandler(api *rpc.EthereumApi) websocket.Handler { if reserr != nil { wslogger.Warnln(reserr) jsonerr := &rpc.RpcErrorObject{-32603, reserr.Error()} - JSON.Send(conn, &rpc.RpcErrorResponse{JsonRpc: jsonrpcver, ID: &reqParsed.ID, Error: jsonerr}) + JSON.Send(conn, &rpc.RpcErrorResponse{JsonRpc: jsonrpcver, ID: reqParsed.ID, Error: jsonerr}) continue } From 3c40eb9e5ad164ae1d199623b3f4cfffc83e3dc6 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Wed, 11 Feb 2015 13:47:03 +0100 Subject: [PATCH 09/10] Temporarily skip broken TestVerifyPoW --- eth/block_pool_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/eth/block_pool_test.go b/eth/block_pool_test.go index 94c3b43d2..331dbe504 100644 --- a/eth/block_pool_test.go +++ b/eth/block_pool_test.go @@ -613,6 +613,7 @@ func TestInvalidBlock(t *testing.T) { } func TestVerifyPoW(t *testing.T) { + t.Skip("***FIX*** This test is broken") logInit() _, blockPool, blockPoolTester := newTestBlockPool(t) blockPoolTester.blockChain[0] = nil From 6221b282d40c18c5c79c459e3b6218cd565a20b1 Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Wed, 11 Feb 2015 19:16:35 +0100 Subject: [PATCH 10/10] Catalog Page Behaviour --- cmd/mist/assets/qml/main.qml | 54 +++++++--- cmd/mist/assets/qml/views/browser.qml | 19 ++-- cmd/mist/assets/qml/views/catalog.qml | 142 ++++++++------------------ 3 files changed, 96 insertions(+), 119 deletions(-) diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index e169f54ec..d03ef43d9 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -39,7 +39,7 @@ ApplicationWindow { // Takes care of loading all default plugins Component.onCompleted: { - addPlugin("./views/catalog.qml", {noAdd: true, close: false, section: "begin"}); + var catalog = addPlugin("./views/catalog.qml", {noAdd: true, close: false, section: "begin"}); var wallet = addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "ethereum", active: true}); addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: true}); @@ -49,9 +49,9 @@ ApplicationWindow { addPlugin("./views/pending_tx.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/info.qml", {noAdd: true, close: false, section: "legacy"}); - mainSplit.setView(wallet.view, wallet.menuItem); + mainSplit.setView(catalog.view, catalog.menuItem); - newBrowserTab("http://ethereum-dapp-whisper-client.meteor.com/chat/amsteam"); + //newBrowserTab("http://ethereum-dapp-catalog.meteor.com"); // Command setup gui.sendCommand(0) @@ -114,10 +114,33 @@ ApplicationWindow { } function newBrowserTab(url) { - var window = addPlugin("./views/browser.qml", {noAdd: true, close: true, section: "apps", active: true}); - window.view.url = url; - window.menuItem.title = "Mist"; - activeView(window.view, window.menuItem); + + var urlMatches = url.toString().match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); + var requestedDomain = urlMatches && urlMatches[1]; + + var domainAlreadyOpen = false; + + console.log("requested: " + requestedDomain ) + + for(var i = 0; i < mainSplit.views.length; i++) { + if (mainSplit.views[i].view.url) { + var matches = mainSplit.views[i].view.url.toString().match(/^[a-z]*\:\/\/(?:www\.)?([^\/?#]+)(?:[\/?#]|$)/i); + var existingDomain = matches && matches[1]; + console.log("exists: " + existingDomain); + if (requestedDomain == existingDomain) { + domainAlreadyOpen = true; + mainSplit.views[i].view.url = url; + activeView(mainSplit.views[i].view, mainSplit.views[i].menuItem); + } + } + } + + if (!domainAlreadyOpen) { + var window = addPlugin("./views/browser.qml", {noAdd: true, close: true, section: "apps", active: true}); + window.view.url = url; + window.menuItem.title = "Mist"; + activeView(window.view, window.menuItem); + } } @@ -332,8 +355,9 @@ ApplicationWindow { id: mainSplit anchors.fill: parent - resizing: false + //resizing: false // this is NOT where we remove that damning resizing handle.. handleDelegate: Item { + //This handle is a way to remove the line between the split views Rectangle { anchors.fill: parent } @@ -497,7 +521,7 @@ ApplicationWindow { anchors.fill: parent border.width: 0 radius: 5 - color: "#FFFFFFFF" + color: "#FAFAFA" } Rectangle { anchors { @@ -506,7 +530,7 @@ ApplicationWindow { right: r.right } width: 10 - color: "#FFFFFFFF" + color: "#FAFAFA" border.width:0 Rectangle { @@ -517,7 +541,7 @@ ApplicationWindow { top: parent.top } height: 1 - color: "#FFFFFF" + color: "#FAFAFA" } Rectangle { @@ -528,7 +552,7 @@ ApplicationWindow { bottom: parent.bottom } height: 1 - color: "#FFFFFF" + color: "#FAFAFA" } } } @@ -800,7 +824,7 @@ ApplicationWindow { anchors.top: parent.top color: "#00000000" - Rectangle { + /*Rectangle { id: urlPane height: 40 color: "#00000000" @@ -847,7 +871,7 @@ ApplicationWindow { z: -1 height: 1 color: "#CCCCCC" - } + }*/ Rectangle { id: mainView @@ -855,7 +879,7 @@ ApplicationWindow { anchors.right: parent.right anchors.left: parent.left anchors.bottom: parent.bottom - anchors.top: divider.bottom + anchors.top: parent.top function createView(component) { var view = component.createObject(mainView) diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index db89c6837..04b2229ec 100644 --- a/cmd/mist/assets/qml/views/browser.qml +++ b/cmd/mist/assets/qml/views/browser.qml @@ -345,14 +345,21 @@ Rectangle { if (topBarStyle=="transparent") { // Adjust for a transparent sidebar Dapp - navBarBackground.visible = false; - back.visible = false; - appInfoPane.anchors.leftMargin = -16; - appInfoPaneShadow.anchors.leftMargin = -16; - webview.anchors.topMargin = -74; + navBarBackground.visible = false; + back.visible = false; + appInfoPane.anchors.leftMargin = -16; + appInfoPaneShadow.anchors.leftMargin = -16; + webview.anchors.topMargin = -74; webview.runJavaScript("document.querySelector('body').classList.add('ethereum-dapp-url-bar-style-transparent')") - }; + } else { + navBarBackground.visible = true; + back.visible = true; + appInfoPane.anchors.leftMargin = 0; + appInfoPaneShadow.anchors.leftMargin = 0; + webview.anchors.topMargin = 0; + + }; }); diff --git a/cmd/mist/assets/qml/views/catalog.qml b/cmd/mist/assets/qml/views/catalog.qml index 7f42c25dc..a7832e9fa 100644 --- a/cmd/mist/assets/qml/views/catalog.qml +++ b/cmd/mist/assets/qml/views/catalog.qml @@ -12,7 +12,7 @@ Rectangle { anchors.fill: parent color: "#00000000" - property var title: "" + property var title: "Catalog" property var iconSource: "" property var menuItem property var hideUrl: true @@ -75,111 +75,57 @@ Rectangle { anchors.fill: parent state: "inspectorShown" - RowLayout { - id: navBar - height: 184 - z: 20 - - anchors { - left: parent.left - right: parent.right - } - - Rectangle { - id: appInfoPane - height: 28 - color: "#efefef" - radius: 6 - z:25 - - MouseArea { - anchors.fill: parent - z: 10 - hoverEnabled: true - onEntered: { - uriNav.visible = true - appTitle.visible = false - appDomain.visible = false - } - } - - anchors { - left: parent.left - right: parent.right - leftMargin: 10 - rightMargin: 10 - top: parent.verticalCenter - topMargin: 23 - } - - TextField { - id: uriNav - anchors { - left: parent.left - right: parent.right - leftMargin: 16 - top: parent.verticalCenter - topMargin: -10 - } - - horizontalAlignment: Text.AlignHCenter - - style: TextFieldStyle { - textColor: "#928484" - background: Rectangle { - border.width: 0 - color: "transparent" - } - } - text: "Type the address of a new Dapp"; - y: parent.height / 2 - this.height / 2 - z: 30 - activeFocusOnPress: true - Keys.onReturnPressed: { - newBrowserTab(this.text); - this.text = "Type the address of a new Dapp"; - } - - } - } - - Rectangle { - id: appInfoPaneShadow - width: 10 - height: 30 - color: "#BDB6B6" - radius: 6 - z: 15 - - anchors { - left: parent.left - right: parent.right - leftMargin:10 - rightMargin:10 - top: parent.verticalCenter - topMargin: 23 - } - - - } - - } - - WebEngineView { objectName: "webView" id: webview anchors.fill: parent - onLoadingChanged: { - if (loadRequest.status == WebEngineView.LoadSucceededStatus) { - webview.runJavaScript(eth.readFile("bignumber.min.js")); - webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js")); - } - } + property var protocol: "http://" + //property var domain: "localhost:3000" + property var domain: "ethereum-dapp-catalog.meteor.com" + url: protocol + domain + + //navigationRequest: WebEngineView.IgnoreRequest + // onLoadingChanged: { + // if (loadRequest.status == WebEngineView.LoadSucceededStatus) { + // webview.runJavaScript(eth.readFile("bignumber.min.js")); + // webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js")); + // } + // } + + //onNavigationRequested: { + // detect URL scheme prefix, most likely an external link + //var schemaRE = /^\w+:/; + //if (schemaRE.test(request.url)) { + // request.action = WebView.AcceptRequest; + //} else { + //request.action = WebView.IgnoreRequest; + // delegate request.url here + //} + //} + onJavaScriptConsoleMessage: { console.log(sourceID + ":" + lineNumber + ":" + JSON.stringify(message)); } + + onNavigationRequested: { + var cleanTitle = request.url.toString() + var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); + var requestedDomain = matches && matches[1]; + + console.debug ("NavigationRequested: " + request.url + " navigationType=" + request.navigationType) + + if(request.navigationType==0){ + + if (requestedDomain === this.domain){ + request.action = WebEngineView.AcceptRequest; + } else { + request.action = WebEngineView.IgnoreRequest; + newBrowserTab(request.url); + } + + } + } }