Commit Graph

2172 Commits

Author SHA1 Message Date
sleepycatcoding 486c0ca149 web, tests: Ignore timeout parameter 2023-07-23 09:13:01 +02:00
sleepycatcoding 0699c34881 chore: Fmt 2023-07-23 09:13:01 +02:00
sleepycatcoding e59dd9a8ef web, tests: fix connect_socket stubs 2023-07-23 09:13:01 +02:00
sleepycatcoding ff1a9bb083 web: Stub connect_socket() 2023-07-23 09:13:01 +02:00
Nathan Adams e610c9a9ce web: Readd warnOnUnsupportedContent for backwards compatibility, but mark it deprecated and unused 2023-07-22 23:08:42 +02:00
Nathan Adams 586c3bebf6 core: Remove unsupported content warning 2023-07-22 23:08:42 +02:00
Daniel Jacobs 46a726efc6 chore: formatting 2023-07-21 23:34:43 +02:00
Daniel Jacobs e99d7f63dc extension: Don't throw error when Firefox add-on is in review 2023-07-21 23:34:43 +02:00
Nathan Adams 3447b8bfdd chore: npm run format 2023-07-20 14:00:04 +02:00
renovate[bot] 0cbfda22db chore(deps): update node.js dependencies 2023-07-20 14:00:04 +02:00
Crowdin Bot b2afcbaf3e chore: Update translations from Crowdin 2023-07-20 13:41:04 +02:00
Daniel Jacobs affff425c5 web: Fix typo in build_wasm.js 2023-07-19 11:37:15 -04:00
Kornelius Rohrschneider a0d0b8e638 core: Refactor & improve NavigatorBackend implementations
All NavigatorBackend implementations have been refactored, resulting in
improved code quality, less duplicated code, more consistent and easier
to understand procedures, additional error handling and better error
messages.

A resolve_url method has been added to the NavigatorBackend trait. It
takes a URL and and resolves it to the actual URL from which a file can
be fetched (including handling of relative links and pre-processing). It
has been implemented in each NavigatorBackend implementation.

Duplicated code has been put into new public functions in
core/src/backend/navigator.rs which are called by all NavigatorBackend
implementations.

ExternalNavigatorBackend:
- The navigate_to_url and fetch methods have been adapted to use
  resolve_url, removing redundant code.
- Error handling has been added in case that the URL can't be converted
  to a PathBuf.
- A TODO about differences between the flash player fetch and the
  Ruffle fetch implementation has been added.

WebNavigatorBackend:
- The previous resolve_url method exclusively to the WebNavigatorBackend
  has been replaced by the new resolve_url method. It is used by
  navigate_to_url and fetch.
- resolve_url now always pre-processes the URL if it's valid (even if no
  base_url exists) and explicitly returns whether the URL can be parsed.
- navigate_to_url now traces an explanatory error each if the URL can't
  be parsed or is local.
- fetch now returns an explanatory error each if the URL can't be parsed
  or is local (previously, a vague "Got JS error" has been returned).

TestNavigatorBackend & NullNavigatorBackend:
- fetch pre-processes the URL now (using the resolve_url implementation).
- If the URL isn't local, an explanatory error is returned (previously,
  it was just an "Invalid URL" error).
- If the URL can't be parsed, an explanatory error with the reason is
  returned (previously, it was just an "Invalid URL" error).

Additionally, error messages in all NavigatorBackend implementations
have been improved and made more consistent, e.g. if a local file can't
be read.
2023-07-17 00:08:02 +02:00
Kornelius Rohrschneider 687c0e7516 core: Complete MovieClip error state & Change uncompressed_len to i32
Previously, the MovieClip error state contained one TODO in order to be
completely implemented: The HeaderExt variable uncompressed_len needs to
be -1 in the error state, but its type has been u32.
The type has now been changed to i32, and the variable is set to -1 in
the default_error_header function. Therefore, the MovieClip error state
is now fully implemented.

Other connected functions and variables like SwfMovie::uncompressed_len
or MovieClip::total_bytes have been adjusted to this type change. Code
has been adjusted if needed where this value is used.
2023-07-17 00:08:02 +02:00
Kornelius Rohrschneider 893052c2a6 core: Add MovieClip error state
A load_error_swf function has been added to the Loader. It makes the
MovieClip enter the error state in which some attributes have certain
error values to signal that no valid file could be loaded. This happens
if no file could be loaded or if the loaded content is no valid
supported content.
The function creates an error state movie stub using the new
SwfMovie::error_movie function (which uses a new default_error_header
function) and configures remaining variables with the
movie_not_available method.
One TODO in order for the error state to be completely implemented has
been added.

Since the error state of the MovieClip includes the final URL of the SWF
file obtained after any redirects, the load_error_swf and
movie_loader_error functions (now) take an swf_url attribute.
To get this URL in case no file could be loaded, the
NavigatorBackend::fetch method has been changed to return an
ErrorResponse struct (including the url and the actual error) in the
error case. The Response struct returned in the success case has been
renamed to SuccessResponse.
All fetch implementations have been adapted accordingly. Code has been
adjusted to return the actual error where that's needed.

Documentation has been added and improved.
2023-07-17 00:08:02 +02:00
Nathan Adams 34c0d41fca web: Remove no longer needed depencency 'shx' 2023-07-15 23:48:04 +02:00
Nathan Adams be48ff357f web: Add build_wasm.js script to replace chained npm scripts 2023-07-15 23:48:04 +02:00
nosamu 48e37914cf web: Make isTouch indicate the source of the last PointerEvent
This allows the behavior of the context menu to change depending
on whether it was triggered by a touch or right-click.
2023-07-15 19:14:13 +02:00
nosamu e7689ac883 Revert "web: Make isTouch locally scoped to showContextMenu"
This completely broke touch detection
2023-07-15 19:14:13 +02:00
renovate[bot] f0607d6a1f chore(deps): lock file maintenance rust dependencies 2023-07-11 22:42:51 +02:00
dependabot[bot] fe4b02fe2a build(deps-dev): bump stylelint from 15.9.0 to 15.10.1 in /web
Bumps [stylelint](https://github.com/stylelint/stylelint) from 15.9.0 to 15.10.1.
- [Release notes](https://github.com/stylelint/stylelint/releases)
- [Changelog](https://github.com/stylelint/stylelint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/stylelint/stylelint/compare/15.9.0...15.10.1)

---
updated-dependencies:
- dependency-name: stylelint
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-10 08:28:22 +02:00
Aaron Hill 009fab1889 core: Expose `LoaderInfo.parameters` and fix other properties
When using a 'Loader', properties on the 'contentLoaderInfo' become
set during specific events in the load sequence. In particular,
'LoaderInfo.bytesTotal' becomes available during the first 'progress'
event.

Also, 'LoaderInfo.parameters' is now properly set from the URL query
parameters. In Flash player, this work even with filesystem urls
(e.g. 'file:///some/path/to/file.txt?paramOne=valOne' will load
a file named 'file.txt', setting and expose the parameter 'paramOne'
with value 'valOne' in `LoaderInfo.parameters`). This required some
cleanup to the desktop and test NavigatorBackend impls to strip
out query parameters when loading a parameter from disk.

Previously, we would set `SwfMovie.parameters` manually from the url.
Now, the various `SwfMovie` constructors automatically extract
query parameters from the provided url. Outside of `SwfMovie`,
we only append *extra* parameters (e.g. those set from `flashvars`).

This makes CPMStar ads work, since the loaded SWF needs to access
`LoaderInfo.parameters`
2023-07-05 19:47:16 -04:00
Aaron Hill 3401971729 web: Use Rc, Cell, and RefCell for non-thread-safe types 2023-07-04 20:50:46 +02:00
TÖRÖK Attila 0fe8469d24 chore: Run `npm update --save` in `web`
Also `npm install` to make sure `package-lock.json` is clean.
2023-07-02 13:55:24 +02:00
Crowdin Bot 80588d614d chore: Update translations from Crowdin 2023-07-02 11:41:18 +02:00
renovate[bot] 898b2c8948 chore(deps): lock file maintenance node.js dependencies 2023-07-01 12:20:10 +03:00
Crowdin Bot 29a5c6a4cd chore: Update translations from Crowdin 2023-07-01 00:47:31 +02:00
Crowdin Bot 1430e98851 chore: Update translations from Crowdin 2023-06-28 23:19:47 +02:00
relrelb f4c9142399 web: Assign `isExtension` only if `currentScriptURL` is available 2023-06-25 08:09:24 +03:00
relrelb e4bb8a60fa web: Don't report extension URL on error 2023-06-25 08:09:24 +03:00
Crowdin Bot 9e066bc14f chore: Update translations from Crowdin 2023-06-24 19:58:34 +02:00
Daniel Jacobs 9a093d20be
web: Don't auto-panic on browsers without ReadableStream (#11699)
* web: Don't auto-panic on browsers without ReadableStream

* web: Add comment explaining Pale Moon issue

* web: Simplify ReadableStream check
2023-06-24 15:10:19 +00:00
Crowdin Bot b1149cd267 chore: Update translations from Crowdin 2023-06-23 11:49:47 +02:00
nosamu 58780b3a4e extension: Ignore publicPath config 2023-06-23 09:05:37 +03:00
nosamu 99ed30f6e7 web: Set isExtension var using current script URL 2023-06-23 09:05:37 +03:00
Crowdin Bot 67a5a2923f chore: Update translations from Crowdin 2023-06-20 23:52:03 +02:00
nosamu 700f765f91 web: Use for..of instead of for..in loops 2023-06-18 22:09:20 +02:00
Toad06 31bb117325 web: Allow setting `allowScriptAccess` on global config 2023-06-18 08:18:52 +03:00
Crowdin Bot 73482c6e72 chore: Update translations from Crowdin 2023-06-18 01:02:34 +02:00
Crowdin Bot ca549e482c chore: Update translations from Crowdin 2023-06-17 19:25:33 +02:00
Toad06 5e6366d14a web: Disabling `allowScriptAccess` also prevents opening URLs in the same tab 2023-06-16 18:49:04 +03:00
renovate[bot] f33b9eea3c chore(deps): lock file maintenance node.js dependencies 2023-06-16 01:03:29 +03:00
Nathan Adams 23352db39f chore: Update wasm-bindgen from 0.2.86 -> 0.2.87 2023-06-15 20:50:04 +02:00
renovate[bot] fc933f485f fix(deps): update wasm-bindgen 2023-06-15 20:50:04 +02:00
renovate[bot] 23d7e8e5ab chore(deps): update dependency chromedriver to v114 2023-06-15 20:09:03 +02:00
Crowdin Bot 56a87dec50 chore: Update translations from Crowdin 2023-06-15 13:10:16 +02:00
Aaron Hill cd2c7f6f2f tests: Enable tracing_subscriber in tests
Previously, we weren't displaying any Ruffle logs when running tests.
2023-06-14 17:15:31 -05:00
nosamu 202fe2f1bb core: Add options to set and force the stage alignment 2023-06-14 16:04:14 +02:00
Daniel Jacobs 0c1cd6aa4f selfhosted: Add a config option to enable Ruffle even on Flash browsers 2023-06-14 14:31:44 +02:00
Daniel Jacobs a666d35161 web: Stop error if Fetch response lacks headers 2023-06-13 08:52:58 +03:00