48533 Commits

Author SHA1 Message Date
Pascal Birchler
9d1c581bf6 Build/Test Tools: Do not round percentages when comparing performance test results.
Props joemcgill.
See #59517.

git-svn-id: https://develop.svn.wordpress.org/trunk@56934 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-13 20:03:07 +00:00
Weston Ruter
c2409fe804 Script Loader: Move delayed head script to footer when there is a blocking footer dependent.
This prevents a performance regression when a blocking script is enqueued in the footer which depends on a delayed script in the `head` (with `async` or `defer`). In order to preserve the execution order, a delayed dependency must fall back to blocking when there is a blocking dependent. But since it was originally delayed (and thus executes similarly to a footer script), it does not need to be in the head and can be moved to the footer. This prevents blocking the critical rendering path.

Props adamsilverstein, westonruter, flixos90.
Fixes #59599.
See #12009.


git-svn-id: https://develop.svn.wordpress.org/trunk@56933 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-13 18:44:12 +00:00
Weston Ruter
cd3e528f93 Script Loader: Enqueue inline style for block template skip link in head instead of footer.
* Introduce `wp_enqueue_block_template_skip_link()` to replace `the_block_template_skip_link()`. Add to `wp_enqueue_scripts` action instead of `wp_footer`.
* Keep inline script for skip link in footer.
* Restore original `the_block_template_skip_link()` from 6.3 and move to `deprecated.php`.
* Preserve back-compat for unhooking skip-link by removing `the_block_template_skip_link` from `wp_footer` action.

Follow-up to [56682] and [56687].

Props sabernhardt, plugindevs, westonruter, spacedmonkey.
Fixes #59505.
See #58775.
See #58664.


git-svn-id: https://develop.svn.wordpress.org/trunk@56932 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-13 17:19:31 +00:00
Felix Arntz
8382683459 Themes: Clear existing pattern cache when in theme development mode and prevent PHP warning due to missing file.
Follow up to [56765].

Props spacedmonkey, afercia, jrf, flixos90.
Fixes #59591.
See #59490.


git-svn-id: https://develop.svn.wordpress.org/trunk@56931 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-13 16:44:09 +00:00
Pascal Birchler
93782b5177 Build/Test Tools: Fix path check when comparing performance test results.
This is a follow-up to r56926, r56927, r56928.

See #59517.

git-svn-id: https://develop.svn.wordpress.org/trunk@56930 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-13 12:32:28 +00:00
Sergey Biryukov
e9375e0679 Media: Consistently call the wp_create_file_in_uploads hook as a filter.
The filter was initially introduced for file replication purposes. Since the returned value is not always used directly, some instances were later converted to an action as part of removing unused variables, and the hook was documented as an action while still being called as a filter in other instances.

This commit aims to correct the discrepancy between the code and the documentation.

Follow-up to [4673], [4817], [4818], [6363], [6551], [13041], [25821], [33154], [33280].

Props Howdy_McGee, nicolefurlan, johnbillion, mhshujon, SergeyBiryukov.
Fixes #57775.

git-svn-id: https://develop.svn.wordpress.org/trunk@56929 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-13 12:18:19 +00:00
Pascal Birchler
cadf7128e9 Build/Test Tools: Fix file prefix handling in performance test results.
This is a follow-up to r56926.

See #59517.

git-svn-id: https://develop.svn.wordpress.org/trunk@56928 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-13 11:28:16 +00:00
Pascal Birchler
64190e8c3e Build/Test Tools: Revert accidental change to Gruntfile.js
This is a follow-up to r56926.

See #59517.

git-svn-id: https://develop.svn.wordpress.org/trunk@56927 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-13 08:13:58 +00:00
Pascal Birchler
5a838d1bb7 Build/Test Tools: Migrate Puppeteer tests to Playwright.
As per the migration plan shared last year, this migrates all browser-based tests in WordPress core to use Playwright.
This includes end-to-end, performance, and visual regression tests.

Props swissspidy, mamaduka, kevin940726, bartkalisz, desrosj, adamsilverstein.
Fixes #59517.

git-svn-id: https://develop.svn.wordpress.org/trunk@56926 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-13 08:11:41 +00:00
Peter Wilson
ac0bae2359 Query: Cache post parent IDs in posts group.
Move the cache of post parent IDs from the dedicated group `post_parents` to `posts`. This maintains backward compatibility for clearing all post object related data by calling `wp_cache_flush_group( 'posts' )`.

Post parent IDs are now cached with with the prefix `post_parent:` in the `posts` group.

Follow up to [56763].

Props spacedmonkey, joemcgill, peterwilsoncc.
See #59188.


git-svn-id: https://develop.svn.wordpress.org/trunk@56925 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 23:39:05 +00:00
Aaron Jorbin
9fb592eaa1 Post WordPress 6.4 Beta 4 version bump.
git-svn-id: https://develop.svn.wordpress.org/trunk@56923 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 20:47:06 +00:00
Aaron Jorbin
5e7eec3320 WordPress 6.4 Beta 4.
git-svn-id: https://develop.svn.wordpress.org/trunk@56922 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 20:25:24 +00:00
Bernie Reiter
33870e1924 Patterns: Don't inject theme attribute on frontend.
Having the patterns registry inject the `theme` attribute into all Template Part blocks inside every pattern was found to negatively impact performance. It turns out that it's only required for the editor (i.e. in the REST API) but not on the frontend; there, it's instead possible to fall back to the currently active theme.

The latter change was made to the Pattern and Template Part blocks in https://github.com/WordPress/gutenberg/pull/55217, which was sync'ed to Core in [56849]. Consequently, this changeset removes `theme` attribute insertion from the frontend.

Props flixos90, gziolo, dmsnell, hellofromtonya.
Fixes #59583.

git-svn-id: https://develop.svn.wordpress.org/trunk@56896 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 16:39:27 +00:00
Tonya Mork
871a496fb4 Editor: Update npm packages ahead of 6.4 RC1.
Updates the npm packages and code for:

* [https://github.com/WordPress/gutenberg/pull/55121 List: fix forward merging of nested list]

* [https://github.com/WordPress/gutenberg/pull/55182 Update consent string for using private APIs.]

* [https://github.com/WordPress/gutenberg/pull/55204 useBlockSettings: add missing useMemo dependencies]

* [https://github.com/WordPress/gutenberg/pull/55120 Remove the lightbox filter and view file when the lightbox setting is disabled.]

* [https://github.com/WordPress/gutenberg/pull/55245 Patterns: Remove the version enforcement for npm in engines field]

* [https://github.com/WordPress/gutenberg/pull/55237 Remove `@return void` from PHP function docs]

* [https://github.com/WordPress/gutenberg/pull/55141 Image: Disable lightbox editor UI for linked images]

* [https://github.com/WordPress/gutenberg/pull/55269 Image: Stop crashing with Lightbox on image blocks without an image]

* [https://github.com/WordPress/gutenberg/pull/55021 Update fullscreen icon]

* [https://github.com/WordPress/gutenberg/pull/55217 Template Part block: Fall back to current theme if no theme attribute is given.] This change is part of fix for a performance regression re-introduced by [56818].

References:
* [https://github.com/WordPress/gutenberg/pull/55298 Gutenberg PR 55298] Cherry-pick commits

Follow-up to [56818], [56816].

Props ellatrix, peterwilsoncc, jsnajdr, afercia, gziolo, isabel_brison, artemiosans, richtabor, bernhard-reiter, flixos90, mikachan, spacedmonkey, hellofromTonya.
See #59583, #59411.

git-svn-id: https://develop.svn.wordpress.org/trunk@56849 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 13:55:27 +00:00
Jonathan Desrosiers
048c80951f Editor: Move footnotes block hooks to default-filters.php
Follow up to [56839].

git-svn-id: https://develop.svn.wordpress.org/trunk@56845 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 13:25:48 +00:00
Aaron Jorbin
4846ed69d4 Editor: Harden the display of footnotes.
Props: jorgefilipecosta, peterwilsoncc, costdev, xknown, jorbin.


git-svn-id: https://develop.svn.wordpress.org/trunk@56839 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 12:56:38 +00:00
Jb Audras
1077af7544 Shortcodes: Restrict ajax handler for media shortcode.
Props tykoted, xknown, peterwilsoncc, antpb, jorbin.





git-svn-id: https://develop.svn.wordpress.org/trunk@56838 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 12:45:49 +00:00
Aaron Jorbin
ffba0d12a3 Application Passwords: Prevent the use of some pseudo protocols in application passwords.
Props tykoted, xknown, peterwilsoncc, jorbin, timothyblynjacobs, martinkrcho, paulkevan, dd32, ehtis.


git-svn-id: https://develop.svn.wordpress.org/trunk@56837 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 12:39:18 +00:00
Jb Audras
c445b80b58 Comments: Prevent users who can not see a post from seeing comments on it.
Props peterwilsoncc, jorbin, audrasjb.





git-svn-id: https://develop.svn.wordpress.org/trunk@56836 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 12:36:29 +00:00
Aaron Jorbin
ed821528ee Prevent unintended behavior when certain objects are unserialized.
Props ehtis, xknown.


git-svn-id: https://develop.svn.wordpress.org/trunk@56835 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 12:32:43 +00:00
Aaron Jorbin
60c3fe8534 REST API: Ensure no-cache headers are sent when methods are ovverriden.
Props tykoted, xknown, ehtis, timothyblynjacobs, peterwilsoncc, rmccue, jorbin.


git-svn-id: https://develop.svn.wordpress.org/trunk@56834 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 12:29:18 +00:00
Jb Audras
26007fbc48 REST API: Limit search_columns for users without list_users.
Props Vortfu, jorbin, joehoyle, timothyblynjacobs, peterwilsoncc, ehtis.





git-svn-id: https://develop.svn.wordpress.org/trunk@56833 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 12:28:57 +00:00
Sergey Biryukov
698880552f Twenty Nineteen: Add margins to editor iframe content.
At screen widths of at least 768px (tablet size), Twenty Nineteen should have a `max-width` and side margins for content in the post editor.

This commit applies that style to the new `.block-editor-iframe__body` class, resolving an issue where full-width blocks had a horizontal scrollbar in the editor iframe.

Props sabernhardt, smit08, nidhidhandhukiya, mukesh27, darshitrajyaguru97, oglekler, poena, shailu25, nicolefurlan.
Fixes #59449.

git-svn-id: https://develop.svn.wordpress.org/trunk@56832 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 10:15:36 +00:00
Jonathan Desrosiers
a8d53284d3 Build/Test Tools: Remove hardcoded PHPUnit config files.
The configuration file passed to the callable workflow contains the correct one to use.

See #58955.

git-svn-id: https://develop.svn.wordpress.org/trunk@56831 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-11 18:07:45 +00:00
Jonathan Desrosiers
0ee1aebea6 Build/Test Tools: Increase the timeout for the failed workflow.
Following [56829], the previous `timeout-minutes` value of `5` is insufficient when approaching 10 retries.

See #58867.

git-svn-id: https://develop.svn.wordpress.org/trunk@56830 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-11 17:13:12 +00:00
Jonathan Desrosiers
0b99e283b2 Build/Test Tools: Increase the number of retries when restarting a workflow.
This increases the number of times to retry restarting a workflow from 2 to 10. Retries use exponential backoff to space out retries.

In most cases, only 2 retries was sufficient. However, there are occasionally scenarios where the original workflow is still running and cannot be restarted, resulting in an error. This typically happens during periods of ongoing service degradation, or workflows with a significant number of jobs (GitHub Actions is sometimes very slow to mark these as finished).

See #58867.

git-svn-id: https://develop.svn.wordpress.org/trunk@56829 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-11 15:54:52 +00:00
Felix Arntz
bb4ab816b5 Editor: Add further test coverage for wp_render_elements_support().
Props dmsnell, aaronrobertshaw.
Fixes #59578.


git-svn-id: https://develop.svn.wordpress.org/trunk@56828 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-11 15:14:01 +00:00
Jonathan Desrosiers
ce8aed4698 Build/Test Tools: Don’t send Slack notification for workflow retries.
[56780] changed Slack failure notifications to not send a failure notification during the first run of a workflow. Because workflows automatically restart once, a failure during the first run can be ignored.

This adjusts the workflow to also not send a “fixed” notification when the second run of a workflow succeeds after a failure. Because the original failure is no longer reported, these notifications are unnecessary.

See #58867.

git-svn-id: https://develop.svn.wordpress.org/trunk@56827 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-11 12:15:18 +00:00
Sergey Biryukov
80931f0c2d Help/About: Ensure that focus outline on the Credits screen is not cut off.
Props ivanzhuck, oglekler, wildworks, dhrumilk, audrasjb, tejadev, ankit-k-gupta, sumitbagthariya16, mukesh27, marybaum.
Fixes #59033.

git-svn-id: https://develop.svn.wordpress.org/trunk@56826 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-11 10:41:50 +00:00
Colin Stewart
d95c0e1c79 Docs: Use US spelling and correct a typing mistake.
This changes two inline comments and a docblock so that they use US spelling as advised by the Core Handbook's Best Practices. A typing mistake is also corrected.

Reference:
- [https://make.wordpress.org/core/handbook/best-practices/spelling/ Core Handbook - Best Practices - Spelling].

Follow-up to [18632], [38120], [44954].

Props kebbet, mukesh27.
See #58833.

git-svn-id: https://develop.svn.wordpress.org/trunk@56825 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-11 07:03:04 +00:00
Colin Stewart
9cccbc592b Plugins: Fix broken sprintf() call in plugins list table.
In [56599], a `sprintf()` call was modified which resulted in an insufficient number of arguments.
This caused a Fatal Error when an incompatible plugin notice was displayed.

This fixes the `sprintf()` call.

Follow-up to [56599].

Props petitphp, TobiasBg, sabernhardt, mukesh27.
Fixes #59590. See #57791.

git-svn-id: https://develop.svn.wordpress.org/trunk@56824 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-11 04:32:00 +00:00
Jonathan Desrosiers
f19b20e5b6 Build/Test Tools: Correct variable typo.
This was causing the version of WordPress being tested to be listed as `latest` even when that is not the case.

Props davidbaumwald.
See #58977.

git-svn-id: https://develop.svn.wordpress.org/trunk@56823 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-10 17:30:13 +00:00
Tammie Lister
537dd8d44f Post WordPress 6.4 Beta 3 version bump.
git-svn-id: https://develop.svn.wordpress.org/trunk@56822 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-10 16:34:07 +00:00
Tammie Lister
efabd4cef8 WordPress 6.4 Beta 3.
git-svn-id: https://develop.svn.wordpress.org/trunk@56821 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-10 16:12:04 +00:00
Tonya Mork
75532c3050 Update/Install: Deactivate Gutenberg plugin version older than 16.5.
This commit changes the Gutenberg minimum compatible version number from 14.1 (introduced in [54790]) to 16.5. For versions older than 16.5, the plugin will deactivate when upgrading WordPress to 6.4-beta3 or newer.

Changes are done within Core's `_upgrade_core_deactivate_incompatible_plugins()` which is invoked during WordPress' upgrade process.

Follow-up to [54790].

Props hellofromTonya, spacedmonkey.
Fixes #59584.

git-svn-id: https://develop.svn.wordpress.org/trunk@56820 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-10 15:05:34 +00:00
Jonny Harris
1f51e1f4f6 REST API: Fix issue with Template and Template Part Revision/Autosave REST API controllers.
The Template and Template Part REST API controllers have unique characteristics compared to other post type REST API controllers. They do not rely on integer IDs to reference objects; instead, they use a combination of the theme name and slug of the template, like 'twentytwentyfour//home.' Consequently, when the post types template and template part were introduced in [52062], it led to the registration of REST API endpoints for autosaves and revisions with invalid URL structures.

In this commit, we introduce new functionality to enable custom autosave and revisions endpoints to be registered at the post type level. Similar to the 'rest_controller_class' parameter, developers can now define 'revisions_rest_controller' and 'autosave_rest_controller.' This empowers developers to create custom controllers for these functionalities. Additionally, we introduce a 'late_route_registration' parameter, which proves helpful when dealing with custom URL patterns and regex pattern matching issues.
This commit registers new classes for template and template part autosave and revisions controllers, differentiating them from standard controllers in the following ways:
* The response shape now matches that of the template controller.
* Permission checks align with the template controller.
* A custom URL pattern is introduced to support slug-based identification of templates.

Furthermore, we've updated the utility function '_build_block_template_result_from_post' to support passing revision post objects. This enhancement ensures compatibility with the custom revisions controller.

Props spacedmonkey, revgeorge, andraganescu, hellofromTonya, antonvlasenko, kadamwhite, ironprogrammer, costdev, mukesh27, timothyblynjacobs, adamsilverstein. 
Fixes 56922.

git-svn-id: https://develop.svn.wordpress.org/trunk@56819 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-10 14:03:03 +00:00
Bernie Reiter
a9bb470f8b Patterns: Inject theme attribute into Template Part blocks.
[56805] introduced a regression: The `theme` attribute was no longer injected into Template Part blocks inside of patterns. This caused errors on the frontend, where instead of a given template part, an error message such as `Template part has been deleted or is unavailable: header` was seen.

This changeset rectifies that problem, and adds unit test coverage to guard against future regressions.

Follow-up to [56805].
Props scruffian, gziolo.
Fixes #59583.

git-svn-id: https://develop.svn.wordpress.org/trunk@56818 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-10 13:19:42 +00:00
Tonya Mork
4984081ef6 Options, Meta APIs: Check setting group exists before search in unregister_setting().
Checks if the given `$option_group` exists before searching for the `$option_name`. Sets the `$pos` to `false`, as `array_search()` returns `false` if the option name (needle) does not exist.

This changeset fixes 2 different PHP Warning|Notice scenarios:
1. When the global `$new_allowed_options` is `null`, fixes raising `Trying to access array offset on value of type null` PHP Notice (PHP 7.4) | Warning (on PHP 8).

2. When the global `$new_allowed_options` is an `array` and the setting group key does not exist, fixes raising "Undefined index: unknown_setting_group" PHP Notice (PHP 7) | Warning (on PHP 8).

For both scenarios, the `array_search()` is skipped and the `$pos` is set to a default of `false`, i.e. which is the value returned when `array_search()` is unsuccessful.

Props xknown, hellofromTonya, nicolefurlan, oglekler, SergeyBiryukov, shailu25.
Fixes #57674.

git-svn-id: https://develop.svn.wordpress.org/trunk@56817 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-10 12:50:19 +00:00
Tammie Lister
33d1242992 Update editor related npm packages for beta 3 second part.
The npm packages needed a second part to the update for beta 3 in preparation for 6.4.

Props talldan, ellatrix, santosguillamot, ramonopoly, andrewserong, artemiosans, isabel_brison, mikachan.

See #59411.


git-svn-id: https://develop.svn.wordpress.org/trunk@56816 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-10 11:27:50 +00:00
Sergey Biryukov
8c146ecb33 Query: Ensure that the page parameter is scalar in WP_Query::get_posts().
The `page` query var only accepts a scalar value and passes the value through functions that assume a scalar value.

Adding an extra guard condition does not affect its functionality but does avoid a PHP fatal error for `trim()` when a non-scalar value such as an array is passed.

Follow-up to [2535], [53891].

Props brookedot, rlmc, mukesh27, SergeyBiryukov.
Fixes #56558.

git-svn-id: https://develop.svn.wordpress.org/trunk@56815 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-10 11:20:28 +00:00
Jonny Harris
94d2f4e68b Options, Meta APIs: Prevent unnecessary database updates caused by strict comparisons in update_network_option.
Previously, in the update_network_option function, strict comparisons between old and new values could erroneously trigger updates in cases where there was no actual change in values. Building upon the groundwork laid in #22192, this commit introduces the use of the _is_equal_database_value function to accurately compare values before initiating any database updates. This change ensures consistency between the behaviors of `update_option` and `update_network_option`.

Furthermore, we have incorporated similar workarounds that were previously implemented in [56717]. These changes ensure that the raw version of network option values is considered in the comparisons, enhancing the overall reliability of the update process.

Props mukesh27, flixos90, joemcgill, costdev, spacedmonkey.
Fixes #59360.

git-svn-id: https://develop.svn.wordpress.org/trunk@56814 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-10 09:35:09 +00:00
Tammie Lister
c300c89f54 Changes to TT4 for beta 3.
Updates TT4 with additional changes ready for beta 3.

Props jessplease, pbwebd, poena, afercia, luminuu, beafialho, onemaggie, mhkuu,  richtabor,  benoitchantre.

Close #59575.


git-svn-id: https://develop.svn.wordpress.org/trunk@56813 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-10 09:01:25 +00:00
Isabel Brison
e3b7ab1897 Editor: fix incorrect block custom CSS output.
Fixes output of block custom CSS when multiple rules require a descendant selector.

Props wildworks, mikachan.
Fixes #59499.


git-svn-id: https://develop.svn.wordpress.org/trunk@56812 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-10 03:41:38 +00:00
Peter Wilson
33b32ebc4e Query: Rename _prime_post_parents_caches() for clarity.
Change the name of `_prime_post_parents_caches()` to `_prime_post_parent_id_caches()` to make it clearer only the parent post ID is cached rather than the entire post parent object.

Follow up to [56763].

Props spacedmonkey, joemcgill, peterwilsoncc.
See #59188.


git-svn-id: https://develop.svn.wordpress.org/trunk@56811 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-09 23:01:15 +00:00
Joe Dolson
93cc3b17a0 Administration: Fix unusable mobile admin menu in Safari.
Replace the `focusout` event handler added in [55326] with a combination of `blur` and `keyup` handler. This change handles Safari not setting focus on clicked elements.

Props afercia, joedolson, travel_girl, oglekler, rajinsharwar, marybaum, rcorrales, binsaifullah, shubhamsedani, ashikur698.
Fixes #58912.

git-svn-id: https://develop.svn.wordpress.org/trunk@56810 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-09 23:00:11 +00:00
Weston Ruter
fbe3732917 Administration: Remove deprecated unload event handlers and use pagehide (and pageshow) when appropriate.
Use `pagehide` event instead of `unload` in the following cases:

* For classic editor to release the post lock.
* In Text widget to rebuild editor after dragging widget to new location in classic widgets interface.
* To clear out the `window.name` when navigating away from a post preview.
* To suspend heartbeat, while also using `pageshow` event to resume as if it had been a focused tab in case page restored from bfcache. 

Also:

* Remove obsolete mobile cleanup code in `js/_enqueues/lib/gallery.js` (introduced in [9894]). Do same for `src/js/_enqueues/wp/media/models.js` (introduced in [22872]). See #22552.
* Remove obsolete Firefox-specific workaround in `js/_enqueues/wp/mce-view.js` from [39282]. See #38511.

Fixes #55491.
Props spenserhale, westonruter, adamsilverstein, azaozz, shawfactor, peterwilsoncc, swissspidy.

git-svn-id: https://develop.svn.wordpress.org/trunk@56809 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-09 21:29:42 +00:00
Tammie Lister
9ec564607c Update npm packages to latest versions for 6.4 beta 3.
The npm packages needed a further update for beta 3 in preparation for 6.4.

Props @richtabor, @mmaattiiaass, @tellthemachines, @mamaduka, @swissspidy, @scruffian, @andraganescu, @andrewserong, @mujuonly, @get_dave, @ntsekouras, @carlosgprim, @ramonopoly, @jameskoster, @wildworks, @aaronrobertshaw, @czapla, @santosguillamot, @artemiosans, @afercia, @glendaviesnz, @kevin940726, @mikachan, @siobhyb.

See #59411.


git-svn-id: https://develop.svn.wordpress.org/trunk@56808 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-09 17:21:30 +00:00
Felix Arntz
41cf9f0a38 Editor: Improve performance of wp_render_elements_support().
By skipping iterations in block supports when not necessary, this changeset improves performance of the function notably.

The performance enhancement leads to even a notable improvement for overall page load time: For example, the Twenty Twenty-Four home page loads ~2% faster with this changeset.

Props dmsnell, spacedmonkey, costdev, hellofromTonya, aaronrobertshaw.
Fixes #59544.


git-svn-id: https://develop.svn.wordpress.org/trunk@56807 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-09 17:05:31 +00:00
Felix Arntz
4d5859bece Editor: Add additional unit tests for elements block support.
Props aaronrobertshaw, costdev.
Fixes #59555.
See #59544.


git-svn-id: https://develop.svn.wordpress.org/trunk@56806 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-09 16:38:26 +00:00
Bernie Reiter
9d039e6c91 Blocks: Call get_hooked_blocks only once per template/part/pattern.
Prior to this changeset, `get_hooked_blocks` was called four times ''for every parsed block'' in each template, template part, and pattern. With this changeset applied, `get_hooked_blocks` is called only once per template, template part, or pattern.

Additionally, `get_hooked_blocks` is called only once when returning the list of all registered patterns. (The latter modification brings the implementation closer to its state prior to Block Hooks.)

Finally, when there are no registered hooked blocks or `hooked_block_types` filters, parsing, hooked block insertion, and re-serializing is skipped altogether.

Props gziolo, flixos90, joemcgill, dmsnell, spacedmonkey, hellofromtonya.
Fixes #59383.

git-svn-id: https://develop.svn.wordpress.org/trunk@56805 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-09 16:38:25 +00:00