-
Notifications
You must be signed in to change notification settings - Fork 711
Variable i gets reset to 0 #4065
Comments
Which user agent is this happening with? Could you please send us the result of "focus:about"? |
user agent: focus:about 8.0.4 (Build #323512256) Firefox Focus puts you in control. Use it as a private browser: Search and browse right in the app Second device (SGS8+): focus:about Firefox Focus puts you in control. Use it as a private browser: Search and browse right in the app |
You're right. This is our fault and it's limited to WebView. It's caused by inserted JS polluting the namespace. We're moving to GeckoView soon, so we need to decide if we should fix this directly or simply change engines to fix it. Don't worry, we're on it. focus-android/app/src/main/java/org/mozilla/focus/webview/FocusWebViewClient.java Line 100 in 9827c02
|
Can this bug be fixed by simply declaring This typo would cause an exception if this code used JS |
I had the same issue, I was using Using latest version of Firefox Klar |
To clarify - I am still having this issue on latest versions. |
JavaScript variable i is reset to 0 after incrementing it by 1 on an xmlhttp.onprogress (onerror) event. If it is given a different name, test for example, it is not reset to 0.
In Chrome 71.0.3578.99 for Android and Chrome, Firefox, Edge for Windows, variables are incremented regardless of the name.
Demo:
https://zznidar.github.io/bugreports/Firefox%20Focus/Variable%20i%20gets%20reset%20to%200/
Source code:
index.html: https://raw.githubusercontent.com/zznidar/bugreports/master/Firefox%20Focus/Variable%20i%20gets%20reset%20to%200/index.html
runtime.js: https://raw.githubusercontent.com/zznidar/bugreports/master/Firefox%20Focus/Variable%20i%20gets%20reset%20to%200/runtime.js
Steps to reproduce
Expected behavior
Each variable, regardless of its name, should be incremented when variable++ is executed in js-code. Thus, both i and test should be increased by 1 each time an alert pops up.
Actual behavior
Variable named i is reset to 0 each cycle, hence the alert always outputs it as 1. Variable test increments as expected.
Device information
Android device: pocophone f1, Android 8.1
Focus version: 8.0.4
Android device: Samsung Galaxy S8+, Android 8.0
Focus version: 7.0.13
The text was updated successfully, but these errors were encountered: