Page MenuHomePhabricator

URLs to a WMF site get converted to local links, even when they're not, in Safari (but not Chrome or Firefox)
Closed, ResolvedPublic1 Estimated Story Points

Description

Good:

  • If you paste https://www.mediawiki.org/wiki/Editing into a page at mw.org, then it gets converted to [[Editing]]

Bad:

  • If you paste https://www.mediawiki.org/wiki/Editing into a page on office.wiki, then it gets converted to [[Editing]] instead of [[mw:Editing]].

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I cannot reproduce this. Is it still happening to you?

Well, to be fair, it still doesn't get turned into [[mw:Editing]], but it does become a valid external link.

Deskana added a subscriber: Deskana.

I tested this, and it seems to be working absolutely perfectly. Closing as invalid; please reopen if this is still happening for you.

Deskana changed the task status from Open to Stalled.Jun 9 2017, 2:43 PM

I'm still unable to reproduce this: attempt 1, attempt 2.

Please can you provide exact, specific steps to reproduce? I tried everything I could think of, but couldn't get it to behave the same way that you did.

  1. Go to https://www.mediawiki.org/wiki/Editor
  2. Copy the URL from the URL bar.
  3. Open any page at any other wiki (e.g., office.wiki or enwiki) in Safari (I can't reproduce in Firefox) in VisualEditor's visual mode.
  4. Paste (⌘-V) the URL into the page.

Okay, yeah, Safari-specific and I can reproduce it there. Doesn't happen in Chrome, so it's not just webkit-family stuff.

Further investigation reveals that it's a problem (sort of) with ve.dm.MWInternalLinkAnnotation.static.getTargetDataFromHref. In Safari it's being passed a document whose baseURI is about:blank. In other browsers it's https://office.wikimedia.org/wiki/. The former seems to result in us constructing a regexp for which basically anything which contains /wiki/ is considered an internal link.

I'm looking into what causes the difference in the document now.

Okay! The specific issue with the baseURI is because using DomParser doesn't propagate the parent document's URL. It looks like this was a webkit issue, which was fixed in Chromium browsers in March.

Even before then, we're only seeing it in Safari because Safari doesn't support DataTransfer.items, so pasting a URL takes a completely different path compared to other browsers. (This suggests that IE might exhibit the same problem, though I haven't checked its DomParser behavior to confirm.)

Further digging: the deepest cause of this seems to be that a number of our wikis have a protocol-relative URL configured. So the parsoid response includes <base href="//office.wikimedia.org/wiki/">. Spec is... ambiguous about permitting this. In practice, Safari freaks out, and its error behavior isn't something that our fixupBase method catches. So: patch for fixupBase incoming.

Change 358174 had a related patch set uploaded (by DLynch; owner: DLynch):
[VisualEditor/VisualEditor@master] ve.fixupBase: handle Safari behavior

https://gerrit.wikimedia.org/r/358174

Jdforrester-WMF renamed this task from URLs to a WMF site get converted to local links, even when they're not to URLs to a WMF site get converted to local links, even when they're not, in Safari (but not Chrome or Firefox).Jun 12 2017, 6:48 PM
Jdforrester-WMF changed the task status from Stalled to Open.

Change 358174 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] ve.fixupBase: handle Safari behavior

https://gerrit.wikimedia.org/r/358174

Change 358426 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (8b8bc2f70)

https://gerrit.wikimedia.org/r/358426

Jdforrester-WMF assigned this task to DLynch.
Jdforrester-WMF triaged this task as Medium priority.
Jdforrester-WMF set the point value for this task to 1.
Jdforrester-WMF moved this task from To Triage to TR1: Releases on the VisualEditor board.
Jdforrester-WMF removed a project: Patch-For-Review.

Change 358426 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (8b8bc2f70)

https://gerrit.wikimedia.org/r/358426