testTransformHtml currently passes just because the previous test
(testGetPageHtml) calls getExistingTestPage for the same page, but it
fails when run on its own because the page doesn't exist. Make it use
getExistingTestPage consistently to fix that.
This is also needed by core change Ie2f1809d, after which all tables
will be reset between tests.
Change-Id: Id4cb4803fae0d62c695ff1d1051056062c54da82
After catching the REST exception, just throw an API exception.
Remove the step inbetween where we built a response array.
Bonus:
* Remove tests that only tested this array building.
* Remove the unused 'code' from successful responses, and update
documentation of return value shapes.
* Remove impossible check for `$ex instanceof LocalizedException`.
After moving the code into one place, it's obvious that it can't
happen, since LocalizedException doesn't inherit from HttpException.
Bug: T341613
Change-Id: I31370efeed9d5283b53eafca102b2f1efc811d27
- The code in the hook handler is more related to the hook and the
structure of the $links array as to the special page.
- Loading another class to process the hook is not necessary.
- Allows better migration to new hook handlers (special page classes and
hook handler should be separated).
- Replace SpecialCollabPad::getSubPage with
SpecialPageFactory::resolveAlias.
- The local url to Special:CollabPad is now in the content language
(only relevant for non-english wikis).
Change-Id: I82985a8ba129b4e336cee337af31452e804090b3
I've verified that no other extension uses this code apart from VE
and locally tested that with this patch, VE still works and nothing
explodes.
There parent patch takes care of making sure the mode is no longer
injected and we now have just etags with no hacked in modes because
we now use direct mode always.
Bug: T341612
Change-Id: Ib1756bf60104467a3a34be9bbb06d8f63537e550
In order not to break clients who already have VE open with etag
that injects the "mode:direct..." in their etag, let's first stop
injecting the direct mode to subsequent VE sessions (for edits)
and wait for 24hrs+ so that we're sure we've processed all sessions
with the direct mode etag.
After 24hrs of this patch merged and going live, we'll then remove
the DualParsoidClient entirely as the p.2 of this cleanup.
Bug: T341612
Change-Id: Ie4f43089ee6f94f51fc0398e84604a17bc5bebcf
This patch makes the following assumptions:
1. There is no class outside of this codebase that implements the
ParsoidClient interface. According to CodeSearch this appears to be
correct.
2. It is fine to use the Bcp47Code instead of the internal MediaWiki
language code in the "Accept-Language" HTTP header. As far as I
understand this might even qualify as a bugfix.
Depends-On: If059674597e261039df7f4613a89cb08120c3262
Change-Id: Icd160da2d5555891b9a91a0cb966bd36a55f6fdd
This follows the event of VE no longer using RESTBase anything. All
actions related to stashing and Parsoid and now handled in MW core.
Bug: T339227
Change-Id: I50b20ed5abb721a6ac8987cac37a6f395a4816dc
The popup contains three buttons, one of which already exists
in core as a tool. By converting them all to tools we can reduce
some duplication, and better integrate with other features
that use the tool factory, such as HelpCompletionAction.
Bug: T339153
Change-Id: I81d217bc1ab9a1a6a9bf7c7ad588c2a3216b10db
Especially useful to reduce the job runtime here because the VE
tests are executed in a couple of CI selenium jobs of other
extensions.
Bug: T226869
Change-Id: I8a8eae8cf2d548b7c905f00e748974bc5a88d337
Use MediaWiki core helpers to provide intro messages (including edit
notices), initial page content, and CSS classes for the edit area.
The following intro messages were previously unimplemented,
and will be shown now:
* 'sharedupload-desc-create'
* 'sharedupload-desc-edit'
The following intro messages were previously unimplemented,
but they only apply to pages where VE should never be available,
and will be shown now when editing those pages with 2017WTE:
* 'code-editing-intro'
* 'talkpagetext'
The following intro messages were previously unimplemented,
and are now explicitly skipped:
* 'editpage-head-copy-warn'
The following intro messages were previously unimplemented,
but they only apply to pages where neither VE nor 2017WTE should
ever be available:
* 'userinvalidconfigtitle'
* 'usercssyoucanpreview'
* 'userjsonyoucanpreview'
* 'userjsyoucanpreview'
Depends-On: If0b05710cb52a977bf4e85947d72d68683a0a29e
Bug: T201613
Change-Id: If26e39e383b983f7ee834ed6dd73b80e0545b068
We're trying to avoid passing raw strings around, since they can be
ambiguous specifiers of language. This patch makes VE compatible
with I982e0df706a633b05dcc02b5220b737c19adc401, with a backward
compatibility workaround which can be removed after
I982e0df706a633b05dcc02b5220b737c19adc401 merges.
The new code also uses slightly more methods of the Language object,
which need to be mocked in a unit test.
Change-Id: I830867d58f8962d6a57be16ce3735e8384f9ac1c
Helper classes have been moved to a dedicated namespace
of their own, this patch references the new namespace.
Depends-On: Ieeb7a0a706a4cb38778f312bfbfe781a1f366d14
Change-Id: I5a2792a3536f6d953905561410f0e4966254ccbe
Catch HttpException from REST helpers, even when they are triggered
already during initialization. This will happen e.g. when the request is
asking for a render key for which the stashed rendering has expired.
Bug: T325310
Change-Id: I9e622b5bb253f5e40fe2b50ff08471beddac9acf
logLevel from info is very verbose. It is no longer needed. The default
error logLevel should be enough.
Bug: T296187
Change-Id: I1bde5b57f64df2d6c00b4a7b8e24f9887a865bb6
This reverts commit 9b9304b13f.
Reason for revert: Selenium tests occasionally fail for many different
reasons. We should use the default specFileRetries, so that a single
failure doesn't cause ~20 minutes of delay when someone is backporting
a change. See also e.g. T324544
Bug: T324544
Change-Id: I043eb5e57bec13a16efb35bbdffda6d3ea65b8e9
This isolates this extension from knowledge about the constructor
signature of the helper classes. Constructore signatures are not stable
interfaces.
Needed-By: Ie430acd0753880d88370bb9f22bb40a0f9ded917
Depends-On: I10af85b2da96568cfffd03867d1cb299645fb371
Change-Id: If1914dbfbefc3501b4d4cef4beb1fae307c36455
* Rename imported classes in VE that will be renamed in core
* Re-enable tests that would fail when the core patch is merged
Depends-On: I506f3303ae8f9e4db17299211366bef1558f142c
Change-Id: I59ebeb24fa0de5f10d1501cc0830c7e4805e1003
HTMLTransform is being renamed at I506f3303ae8f9e4db17299211366bef1558f142c.
This is a temporary measure to allow CI to succeed in the core patch
Change-Id: Id11068e34d4b3ed6ccc210c91e449656e74138a2
When receiving HTML from a VE session, process it with the same kind of
ParsoidClient that was originally used to generate the HTML. If we were
to use a different implementation, the ETag wouldn't match, so we would
fail to find the stashed data-parsoid map, and the edit would fail.
Bug: T320704
Change-Id: I3b73431fccacecb4ad88b82f8f5675b1042e03ce
AutoConfig was used to set VE to call internal REST API endpoints exposed by the parsoid extension.
With DirectParsoidClient available, this is no longer needed.
NOTE: this causes all wikis that do not have a RESTbase backend
configured to start using DirectParsoidClient. This is true in
particular for officewiki and labswiki.
Bug: T320704
Change-Id: Ia4c6184dd75a653c3202ea160b6605335f36f6eb
If VE is configured to call parsoid directly in PHP, the client
should not try to fetch HTML from restbase. Doing so will
lead to inconsistencies, and may cause edits to fail.
Bug: T320704
Bug: T320703
Change-Id: I98bfdd305dcd188d91db6a8fe5885156cdeca7db