{"action":"opened","issue":{"url":"https://api.github.com/repos/driftyco/ionic-cli/issues/248","labels_url":"https://api.github.com/repos/driftyco/ionic-cli/issues/248/labels{/name}","comments_url":"https://api.github.com/repos/driftyco/ionic-cli/issues/248/comments","events_url":"https://api.github.com/repos/driftyco/ionic-cli/issues/248/events","html_url":"https://github.com/driftyco/ionic-cli/issues/248","id":57069421,"number":248,"title":"bug: Bridge not enabled when using Crosswalk with livereload","user":{"login":"jbavari","id":1414692,"avatar_url":"https://avatars.githubusercontent.com/u/1414692?v=3","gravatar_id":"","url":"https://api.github.com/users/jbavari","html_url":"https://github.com/jbavari","followers_url":"https://api.github.com/users/jbavari/followers","following_url":"https://api.github.com/users/jbavari/following{/other_user}","gists_url":"https://api.github.com/users/jbavari/gists{/gist_id}","starred_url":"https://api.github.com/users/jbavari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbavari/subscriptions","organizations_url":"https://api.github.com/users/jbavari/orgs","repos_url":"https://api.github.com/users/jbavari/repos","events_url":"https://api.github.com/users/jbavari/events{/privacy}","received_events_url":"https://api.github.com/users/jbavari/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/driftyco/ionic-cli/labels/cli","name":"cli","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"jbavari","id":1414692,"avatar_url":"https://avatars.githubusercontent.com/u/1414692?v=3","gravatar_id":"","url":"https://api.github.com/users/jbavari","html_url":"https://github.com/jbavari","followers_url":"https://api.github.com/users/jbavari/followers","following_url":"https://api.github.com/users/jbavari/following{/other_user}","gists_url":"https://api.github.com/users/jbavari/gists{/gist_id}","starred_url":"https://api.github.com/users/jbavari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbavari/subscriptions","organizations_url":"https://api.github.com/users/jbavari/orgs","repos_url":"https://api.github.com/users/jbavari/repos","events_url":"https://api.github.com/users/jbavari/events{/privacy}","received_events_url":"https://api.github.com/users/jbavari/received_events","type":"User","site_admin":false},"milestone":null,"comments":0,"created_at":"2015-02-09T18:24:50Z","updated_at":"2015-02-09T18:24:50Z","closed_at":null,"body":"_From @ChrisLoer on January 28, 2015 18:0_\n\n**Type**: <span ionic-type>bug</span>\r\n\r\n**Platform**: <span ionic-platform>android</span> <span ionic-platform-version>4.4</span>  <span ionic-webview>webview</span>\r\n\r\n<span ionic-description>I tried updating my Ionic app to use Crosswalk, following the [instructions provided in the blog post][1], and it seems to be working fine when I simply run it with `ionic run android`. However, if I try to use the \"livereload\" feature by running `ionic run android -l`, plugins stop working within the app. If I break inside `cordova.js:androidExec`, I can see that there's a call to `nativeApiProvider.get().exec` that simply doesn't return anything when I'm running in livereload.\r\n\r\nIt looks to me like the reason the bridge isn't working is this code in CordovaBridge.promptOnJsPrompt():\r\n\r\n         if (origin.startsWith(\"file:\") ||\r\n             origin.startsWith(this.appContentUrlPrefix) ||\r\n             (origin.startsWith(\"http\") && loadedUrl.startsWith(origin))) {\r\n             // Enable the bridge\r\n             int bridgeMode = Integer.parseInt(defaultValue.substring(9));\r\n             jsMessageQueue.setBridgeMode(bridgeMode);\r\n             // Tell JS the bridge secret.\r\n             int secret = generateBridgeSecret();\r\n             return \"\"+secret;\r\n         } else {\r\n             Log.e(LOG_TAG, \"gap_init called from restricted origin: \" + origin);\r\n         }\r\n\r\nMy origin is `http://192.168.1.42:8100/`, while the loadedUrl is `http://192.168.1.42:8100`, so the bridge secret never gets generated.\r\n\r\nWithout Crosswalk, essentially the same code runs, but the loadedUrl is set to `http://192.168.1.42:8100/`. I haven't been able to figure out where in the code this happens, but as a workaround I've just added a trailing slash in the content src of my config.xml. I think it would be better to modify the CordovaBridge code to do something like:\r\n\r\n    URL originURL = new URL( origin );\r\n    URL loadedURL = new URL( loadedUrl );\r\n    if ( originURL.getProtocol().equals( \"http\" ) \r\n      && loadedURL.getProtocol().equals( \"http\" ) \r\n      && originURL.getAuthority().equals( loadedURL.getAuthority() )  )\r\n    // Enable the bridge\r\n\r\n  [1]: http://ionicframework.com/blog/crosswalk-comes-to-ionic/</span>\r\n\r\n<span is-issue-template></span>\r\n\n\n_Copied from original issue: driftyco/ionic#2999_"}}