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

fix(ios): report script source urls using full file: uris #12725

Merged
merged 2 commits into from Apr 15, 2021

Conversation

sgtcoolguy
Copy link
Contributor

JIRA: https://jira.appcelerator.org/browse/TIMOB-28422

Description:
When we evaluate JS files we tell the JS engine the source URL for the script. We used to report file:// with the full path on device (or to the simulator app files). SDK 10.0.0 changed the internals of require and we ended up reporting invalid URIs with the file:// scheme but whose path was actually relative to the app root. That was intentional internally for require, but not for the debugger as it causes breakage in Studio. Specifically, Studio uses a regexp to set breakpoints for scripts in many cases and used the .app/ prefix to avoid the regex matching files deeper in the app source file tree.

So to give some examples, in SDK 9.3.2 we'd report:

  • app.js -> file:///Users/cwilliams/Library/Developer/CoreSimulator/Devices/4753950A-0B8D-4EA6-8BD5-5FCB01760D81/data/Containers/Bundle/Application/02857640-4389-400A-8CBE-4F10946EC376/ti-example.app/app.js
  • ti.main.js -> file:///Users/cwilliams/Library/Developer/CoreSimulator/Devices/4753950A-0B8D-4EA6-8BD5-5FCB01760D81/data/Containers/Bundle/Application/02857640-4389-400A-8CBE-4F10946EC376/ti-example.app/ti.main.js

Prior to this PR, we'd report:

  • app.js -> file:///app.js
  • ti.kernel.js -> file:///Users/cwilliams/Library/Developer/CoreSimulator/Devices/4753950A-0B8D-4EA6-8BD5-5FCB01760D81/data/Containers/Bundle/Application/02857640-4389-400A-8CBE-4F10946EC376/ti-example.app/ti.kernel.js
  • ti.main.js -> file:///ti.main.js

(Note that ti.kernel.js was using the right path because it's the first file we run and doesn't go through the new require code that aligns with Android)

make the full file:// uri based on app resource path

Fixes TIMOB-28422
@sgtcoolguy sgtcoolguy added ios bug backport 10_2_X when applied, PRs with this label will get an auto-generated backport to 10_2_X branch on merge labels Apr 15, 2021
Copy link
Collaborator

@ewanharris ewanharris left a comment

Choose a reason for hiding this comment

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

Changes look good to me, Studio and VS Code can both now hit breakpoints

@build
Copy link
Contributor

build commented Apr 15, 2021

Fails
🚫 Tests have failed, see below for more information.
🚫

🔬 There are library changes, but no changes to the unit tests. That's OK as long as you're refactoring existing code, but will require an admin to merge this PR. Please see README.md#unit-tests for docs on unit testing.

Messages
📖 ✊ The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.
📖 ❌ 3 tests have failed There are 3 tests failing and 960 skipped out of 15264 total tests.

Tests:

ClassnameNameTimeError
android.emulator.Titanium.UI.NavigationWindowbasic open/close navigation (5.0.2)10.011
Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)
android.emulator.Titanium.UI.TextField.properties.focused (5.0.2)2.013
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)
android.emulator.Titanium.UI.View"after each" hook for "getOrCreateView() should always return a View" (5.0.2)13.47
Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)

Generated by 🚫 dangerJS against e18544e

@lokeshchdhry
Copy link
Contributor

FR Passed.
Debugger now hits the breakpoint as expected on IOS.

@sgtcoolguy sgtcoolguy merged commit 989e3e3 into tidev:master Apr 15, 2021
@sgtcoolguy sgtcoolguy deleted the TIMOB-28422 branch April 15, 2021 22:05
@build build removed the backport 10_2_X when applied, PRs with this label will get an auto-generated backport to 10_2_X branch on merge label Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants