Profiler in react-native broken (V8 and systrace) - javascript

I would like to see, which function is keeping my JS thread the most busy. But in any profiling option I just cant see any JS related stuff.
1) Profiling
The most useful would be the V8 profiler, which is accessible in debug mode (in Chrome DevTools or React Native Debugger). Somebody here suggests to look for debuggerWorker.js, but in my Profiling session this thread is missing.
2) Systrace
I found the JS thread (mqt_js), but it is collapsed and cant be drilled into. Any ideas?
I run systrace.py --time=20 -o trace.html sched gfx view -a com.my.rnapp
3) RN "Enable Sampling Profiler"
I even tried the (undocumented) "Enable Sampling Profiler" option in RN debug menu, it seems working, and shows a message with trace location, but file is unfortunately empty everytime. (eg. /data/user/0/com.my.rnapp/cache/sampling-profiler-trace119834863.cpuprofile). Checked using adb shell and ls -la.
Other info:
tested both dev/prod versions, local metro bundler/bundled app
React Native 0.61.1
Emulator with Android API 25 (physical device as well)
macOS 10.14

ad (1) ok - it seems you have to hit "Run profiling", and then reload the APP (rr). Only then RNDebuggerWorker.js appears. Wicked. 😎

Related

Chrome Offlining with workbox deletes cache on system restart

I have tried to create a webpage that I want to cache (contains heavy assets like lengthy videos and images). I followed the workbox guides to the point and the offlined app works as intended. However on system restart, when I open the app, the cache no longer exists and the app makes network calls to get the data. I would understand if the app reset its cache via a code, however, the moment I open the app, the cache simply isn't there.
My guess is that there is a flag/setting on the Cache API that I am missing or some system-level setting on my chrome that is triggering this behavior.
Any help on this is greatly appreciated.
Chrome Version: Version 79.0.3945.88 (Official Build) (64-bit)
OS:
NAME="Linux Mint"
VERSION="19.2 (Tina)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 19.2"
VERSION_ID="19.2"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.ubuntu.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=tina
UBUNTU_CODENAME=bionic
Note: Tried this on Windows, same behavior occurs

How to view Visual Studio 2015 Javascript Console after debugging mode stops?

My Javascript Apache Cordova app builds fine but doesn't behave debugging on the emulator or real device.
I see a bunch of messages rush by in the Visual Studio Javascript Console but the app then immediately crashes and the Javascript Console becomes unavailable.
I've tried setting breakpoints to pause the app which doesn't work.
How can I view these Javascript Console logs after the debugger stops ?
EDIT: this if for Windows Phone (Universal) with plugins for Windows Phone and not debuggable in the browser
this is the only way i've figured ;
Ensure JS console button "Clear on navigate" is not set
Start the app so that the errors appear albeit momentarily
Remove plugins and associated code one by one until your app doesn't crash
View original error messages in the JS console from previous sessions
This doesn't answer your question but it may help to check the exception settings via:
Debug -> Windows -> Exception Settings
They determine whether or not the debugger will break when exceptions are thrown.

IoT/WinJS/VS - Failed to create the web diagnostics object

I have successfully installed Windows 10 Insider Preview and Visual Studio 2015 RC on my PC, and Windows IOT Core on my Pi.
I have created a new JavaScript Windows Universal App solution in Visual Studio, and tried to deploy as-is, i.e. the project as supplied in the template. When trying to run the program on the remote machine, in either debug or release modes, the project deploys and runs successfully, however Visual Studio advises with a modal dialog box during the deployment process:
"Failed to create the web diagnostics object. The JavaScript Console and DOM Explorer may not work. Repairing the remote debugger installation may help".
Firstly, can I expect these tools to work on the Pi for a JavaScript Windows Universal App?
Secondly, I don't know how to repair or even access the remote debugger software. It seems to run automatically (msvsmon.exe, twice). Is here something to configure properly to get it to run?
Regards,
Paul
It indicates that you don't have admin access to remote machine, which is natural assuming that you didn't have activated developer mode in BOTH machines.
otherwise, I could say that this could be a bug(but only if you can see the DOM in explorer) you can't disable DOM explorer in V.S either so if this didn't fix the issue and it's annoying, then you will have to wait for update 1 unfortunately.
The only workaround I found was to install Windows 10 on my Dev computer. It appears like this does indeed not work with Windows 8.

Can one debug javascript on a samsung tablet's native browser

I am currently working on a HTML/JS application that will be embedded in an iOS and an Android app. Because the android app is not yet finished I am testing this on the chrome browser in Android. I fixed all issues there but when I open the same web app in the native browser nothing really works as expected.
So my question is : Is there a way to debug in a native browser on an android device?
In chrome this was pretty easy with remote debugging.
(Please do not advice me to use 'log' statements for debugging because that's not what I am looking for here)
And just to spill my guts : the Samsung Tablet's native browser is the only device that's causing me a headache!
Typing about:debug in the address bar of the native browser will toggle the 'Debug' options in the settings menu.
The 'Show JavaScript Console' option will allow you to see JavaScript errors in your webpage.
NB I believe the JavaScript Console will only be displayed if there is an error.
HTH
Nick.
The new Samsung Internet browser (I think you meant this browser with "Samsung Tablet's native browser") is now based on the Chromium browser and thus supports its remote debugging interface.
Enable USB debugging on your device as described here.
Then connect your device via USB (Oh, surprise!).
Visit chrome://inspect on your computers Google Chrome browser and you will be guided to create the connection:
Then you just have to click on the devices inspect link and an developer tools window will pop up.
More info like why there is an Samsung Internet Browser at all can be found here.
You can easily debug your web application with Web Inspector Remote (weinre).
Look at this post in order to find out how to install and use weinre.
I hope it will help you if this question is still actual.
If you have updated your device you can go to settings -> Debug -> 'Remote Debug Enable'
Once enabled you can debug the native browser just like you can debug chrome.
You can try vorlon solution too, it has a nice web interface & very easy to install
& It's free
But if you can't see clear console errors with volron, you probably want to use #Nick's solution, sometimes complex errors prevents even vorlon or weiner from catching them. So once you fix blocking these issues, probably volron will start catching them properly

How to inject javascript code with ADB in a browser open tab?

I'm in the process of creating an Android test farm system, and while at it, I'm trying to find a way to inject javascript in an already open tab in the default browser.
I'm trying with
adb shell am start -a android.intent.action.VIEW -d "javascript:alert('Hello world!');" -n com.android.browser/com.android.browser.BrowserActivity
and while it works, it opens in a new tab.
Is there any way to do it in the current tab?
If you're cool with using Chrome, which is the default browser for newer versions of Android, you can use Chrome's remote debugging.
Once you've enabled this on the device (enable usb debugging + web debugging), you can connect by executing:
adb forward tcp:9222 localabstract:chrome_devtools_remote
If you hit localhost:9222 from your browser, you'll see the chrome dev tools for each one of your tabs. From here, you can do anything you could usually do in the desktop chrome inspector, including executing JavaScript from the console.
If this is not automated enough, you can write an app that uses a WebView, configure it to handle an intent where you provide arbitrary JavaScript, and use webview.loadUrl(js) to execute it.

Categories

Resources