Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DevTools] Browser dev tools should open default browser #510

Closed

Conversation

iamdustan
Copy link

This changes the browser dev tools tunneling to open the default browser using *nix’s open command instead of applescript.

Benefits:

  • leave browser tooling decisions to the user.
  • linux support

Limitations:

  • Doesn’t detect whether the tab is already open and focus if so (like the Chrome applescript implementation did).

I think that limitation needs to be tackled before merging. I’m not really sure where to start to tackle that. I suspect this is low priority to your team, but is this something you’d be interested in?

Closes #492

@frantic
Copy link
Contributor

frantic commented Mar 30, 2015

One possible solution is to make the websocket-proxy smarter. Instead of just broadcasting incoming messages it should be able to detect browser connection and simulator connection and pair them. If there is incoming simulator connection without existing browser counterpart, proxy should open a new browser tab.

@iamdustan
Copy link
Author

Great idea, @frantic. I’ll explore that over the next day or two.

@iamdustan
Copy link
Author

@frantic this was a bit of a hack, but there is already a comment saying “this is hacky, refresh the browser window to reattach”.

Originally the chrome already open or not is happened in AppleScript. This just sets a local variable on initial browser connection and then bails out in the future.

I've tested it in chrome and fx dev edition on my bus ride and it was working well for me.

else {
var debuggerURL = 'http://localhost:' + options.port + '/debugger-ui';
console.log('Launching Dev Tools in default browser...');
connected = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this means it will open the tab only once per server session.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but that’s same as it is currently (as far as I could tell).

E.g. Once you open and attempt to close or refresh the browser tab it says, “if you do this you’ll break the bridge”

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But when you close the tab and disable debugging on simulator (via Cmd+Ctrl+Z) or restart the app in Xcode, it's important that the tool can connect to the debugger again.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the two use cases I’m currently missing are:

  1. Cmd+Ctrl+Z switches back to running js on the device. This should reset the connected state so future Cmd+D can reconnect to a browser tab.
  2. Restarting the simulator from XCode without closing the window should be able to reconnect.

Am I missing anything else?

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 7, 2015
@nicklockwood
Copy link
Contributor

This seems problematic because we use different executor implementations for Chrome/Safari (and don't support Firefox) - unless I'm missing something obvious?

@iamdustan
Copy link
Author

@nicklockwood is this something that has changed over the past month since I opened this? At the time simply having it open my default browser worked fine.

Still need to work in some time to come revisit this and finish it.

Ignore the [GH Review: review-needed] label and set it back to needs-revision. I’ve only rebased master, haven’t done any additional work yet.

@brentvatne
Copy link
Collaborator

@iamdustan - any interest in continuing work on this or should we close?

@brentvatne brentvatne changed the title (wip) Browser dev tools should open default browser [DevTools] Browser dev tools should open default browser Jun 1, 2015
@iamdustan
Copy link
Author

@brentvatne I am interested, but am currently on 3 projects at work so my time is a bit scarce. :/

Feel free to close for now to get it off the backlog and someday I’ll make it back around to this.

@sahrens
Copy link
Contributor

sahrens commented Jun 11, 2015

closing for now - feel free to re-open when it's ready for review - we'll need to make sure our full tool stack actually works in chrome, safari, and firebox before we enable something like this, though, otherwise it's just going to open in a broken environment.

@sahrens sahrens closed this Jun 11, 2015
elliottsj added a commit to elliottsj/react-native that referenced this pull request Aug 22, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isClientConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.
elliottsj added a commit to elliottsj/react-native that referenced this pull request Aug 22, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.
elliottsj added a commit to elliottsj/react-native that referenced this pull request Aug 22, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.
elliottsj added a commit to elliottsj/react-native that referenced this pull request Aug 22, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.

Add a '--dangerouslyDisableChromeDebuggerWebSecurity' flag to
packager.js to enable Chrome '--disable-web-security' flag.

This allows users to inspect network requests in Chrome by commenting
the xhr polyfill in InitializeJavaScriptAppEngine.js:
  facebook#934 (comment)

Usage:

    node packager.js --dangerouslyDisableChromeDebuggerWebSecurity

or:

    packager.sh --dangerouslyDisableChromeDebuggerWebSecurity
elliottsj added a commit to elliottsj/react-native that referenced this pull request Aug 22, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.

Add a '--dangerouslyDisableChromeDebuggerWebSecurity' flag to
packager.js to enable Chrome '--disable-web-security' flag.

This allows users to inspect network requests in Chrome by commenting
the xhr polyfill in InitializeJavaScriptAppEngine.js:
  facebook#934 (comment)

Usage:

    node packager.js --dangerouslyDisableChromeDebuggerWebSecurity

or:

    packager.sh --dangerouslyDisableChromeDebuggerWebSecurity
elliottsj added a commit to elliottsj/react-native that referenced this pull request Aug 23, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.

Add a '--dangerouslyDisableChromeDebuggerWebSecurity' flag to
packager.js to enable Chrome '--disable-web-security' flag.

This allows users to inspect network requests in Chrome by commenting
the xhr polyfill in InitializeJavaScriptAppEngine.js:
  facebook#934 (comment)

Usage:

    node packager.js --dangerouslyDisableChromeDebuggerWebSecurity

or:

    packager.sh --dangerouslyDisableChromeDebuggerWebSecurity
elliottsj added a commit to elliottsj/react-native that referenced this pull request Aug 23, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.

Add a '--dangerouslyDisableChromeDebuggerWebSecurity' flag to
packager.js to enable Chrome '--disable-web-security' flag.

This allows users to inspect network requests in Chrome by commenting
the xhr polyfill in InitializeJavaScriptAppEngine.js:
  facebook#934 (comment)

Usage:

    node packager.js --dangerouslyDisableChromeDebuggerWebSecurity

or:

    packager.sh --dangerouslyDisableChromeDebuggerWebSecurity
elliottsj added a commit to elliottsj/react-native that referenced this pull request Aug 23, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.

Add a '--dangerouslyDisableChromeDebuggerWebSecurity' flag to
packager.js to enable Chrome '--disable-web-security' flag.

This allows users to inspect network requests in Chrome by commenting
the xhr polyfill in InitializeJavaScriptAppEngine.js:
  facebook#934 (comment)

Usage:

    node packager.js --dangerouslyDisableChromeDebuggerWebSecurity

or:

    packager.sh --dangerouslyDisableChromeDebuggerWebSecurity
elliottsj added a commit to elliottsj/react-native that referenced this pull request Aug 25, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.

Add a '--dangerouslyDisableChromeDebuggerWebSecurity' flag to
packager.js to enable Chrome '--disable-web-security' flag.

This allows users to inspect network requests in Chrome by commenting
the xhr polyfill in InitializeJavaScriptAppEngine.js:
  facebook#934 (comment)

Usage:

    node packager.js --dangerouslyDisableChromeDebuggerWebSecurity

or:

    packager.sh --dangerouslyDisableChromeDebuggerWebSecurity
elliottsj added a commit to elliottsj/react-native that referenced this pull request Aug 26, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.

Add a '--dangerouslyDisableChromeDebuggerWebSecurity' flag to
packager.js to enable Chrome '--disable-web-security' flag.

This allows users to inspect network requests in Chrome by commenting
the xhr polyfill in InitializeJavaScriptAppEngine.js:
  facebook#934 (comment)

Usage:

    node packager.js --dangerouslyDisableChromeDebuggerWebSecurity

or:

    packager.sh --dangerouslyDisableChromeDebuggerWebSecurity
elliottsj added a commit to elliottsj/react-native that referenced this pull request Aug 29, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.

Add a '--dangerouslyDisableChromeDebuggerWebSecurity' flag to
packager.js to enable Chrome '--disable-web-security' flag.

This allows users to inspect network requests in Chrome by commenting
the xhr polyfill in InitializeJavaScriptAppEngine.js

Usage:

    node packager.js --dangerouslyDisableChromeDebuggerWebSecurity

or:

    packager.sh --dangerouslyDisableChromeDebuggerWebSecurity
elliottsj added a commit to elliottsj/react-native that referenced this pull request Sep 14, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.

Add a '--dangerouslyDisableChromeDebuggerWebSecurity' flag to
packager.js to enable Chrome '--disable-web-security' flag.

This allows users to inspect network requests in Chrome by commenting
the xhr polyfill in InitializeJavaScriptAppEngine.js:
  facebook#934 (comment)

Usage:

    node packager.js --dangerouslyDisableChromeDebuggerWebSecurity

or:

    packager.sh --dangerouslyDisableChromeDebuggerWebSecurity
elliottsj added a commit to elliottsj/react-native that referenced this pull request Sep 19, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.

Add a '--dangerouslyDisableChromeDebuggerWebSecurity' flag to
packager.js to enable Chrome '--disable-web-security' flag.

This allows users to inspect network requests in Chrome by commenting
the xhr polyfill in InitializeJavaScriptAppEngine.js:
  facebook#934 (comment)

Usage:

    node packager.js --dangerouslyDisableChromeDebuggerWebSecurity

or:

    packager.sh --dangerouslyDisableChromeDebuggerWebSecurity
elliottsj added a commit to elliottsj/react-native that referenced this pull request Sep 27, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.

Add a '--dangerouslyDisableChromeDebuggerWebSecurity' flag to
packager.js to enable Chrome '--disable-web-security' flag.

This allows users to inspect network requests in Chrome by commenting
the xhr polyfill in InitializeJavaScriptAppEngine.js:
  facebook#934 (comment)

Usage:

    node packager.js --dangerouslyDisableChromeDebuggerWebSecurity

or:

    packager.sh --dangerouslyDisableChromeDebuggerWebSecurity
elliottsj added a commit to elliottsj/react-native that referenced this pull request Sep 27, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.

Add a '--dangerouslyDisableChromeDebuggerWebSecurity' flag to
packager.js to enable Chrome '--disable-web-security' flag.

This allows users to inspect network requests in Chrome by commenting
the xhr polyfill in InitializeJavaScriptAppEngine.js:
  facebook#934 (comment)

Usage:

    node packager.js --dangerouslyDisableChromeDebuggerWebSecurity

or:

    packager.sh --dangerouslyDisableChromeDebuggerWebSecurity
elliottsj added a commit to elliottsj/react-native that referenced this pull request Oct 14, 2015
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.

Add a '--dangerouslyDisableChromeDebuggerWebSecurity' flag to
packager.js to enable Chrome '--disable-web-security' flag.

This allows users to inspect network requests in Chrome by commenting
the xhr polyfill in InitializeJavaScriptAppEngine.js:
  facebook#934 (comment)

Usage:

    node packager.js --dangerouslyDisableChromeDebuggerWebSecurity

or:

    packager.sh --dangerouslyDisableChromeDebuggerWebSecurity
elliottsj added a commit to elliottsj/react-native that referenced this pull request Oct 14, 2015
This allows opening the Chrome debugger on OS X, Linux, and Windows.

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.
elliottsj added a commit to elliottsj/react-native that referenced this pull request Oct 15, 2015
This allows opening the Chrome debugger on OS X, Linux, and Windows.

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.
elliottsj added a commit to elliottsj/react-native that referenced this pull request Oct 15, 2015
This allows opening the Chrome debugger on OS X, Linux, and Windows.

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.
elliottsj added a commit to elliottsj/react-native that referenced this pull request Oct 16, 2015
This allows opening the Chrome debugger on OS X, Linux, and Windows.

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.
elliottsj added a commit to elliottsj/react-native that referenced this pull request Oct 16, 2015
This allows opening the Chrome debugger on OS X, Linux, and Windows.

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.
jfrolich pushed a commit to jfrolich/react-native that referenced this pull request Apr 22, 2020
…tch (facebook#510)

* Add unsafeAddProp (like ReactDOMRe.Style) & unsafeTransform as escape hatch for fancy platforms

(and move array/list(Option) at the top - without huge comments)

This escape hatch are a necessity when using react-native-web (eg: position: fixed on the web - as you cannot always have 60fps sticky header with interpolation+translateY... Also RNW allows `translateZ`etc...)

* Replace with unsafeAddStyle, unsafeStyle & unsafeTransform

* Zero cost unsafeAddStyle 🤯
mganandraj pushed a commit to mganandraj/react-native that referenced this pull request Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

firefox devtools
8 participants