jenkins-bot has submitted this change and it was merged.

Change subject: (bug 43015) Make Parsoid use protocol relative URLs for images 
(http vs. https)
......................................................................


(bug 43015) Make Parsoid use protocol relative URLs for images (http vs. https)

gwicke: Also update parserTests.txt from core.

Change-Id: I253b9b7a9b463439e86d7cf7975cd92f9c851e70
---
M js/lib/ext.core.LinkHandler.js
M js/tests/fetch-parserTests.txt.js
M js/tests/parserTests.txt
3 files changed, 19 insertions(+), 18 deletions(-)

Approvals:
  GWicke: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/js/lib/ext.core.LinkHandler.js b/js/lib/ext.core.LinkHandler.js
index ff83dda..5a91fd0 100644
--- a/js/lib/ext.core.LinkHandler.js
+++ b/js/lib/ext.core.LinkHandler.js
@@ -592,17 +592,18 @@
  * Abstract way to get the path for an image given an info object
  *
  * @private
- * @param {string} path Your best guess for the path
  * @param {Object} info
  * @param {string/null} info.thumburl The URL for a thumbnail
  * @param {string} info.url The base URL for the image
  */
-function getPath( path, info ) {
+function getPath( info ) {
+       var path;
        if ( info.thumburl ) {
-               return info.thumburl;
+               path = info.thumburl;
        } else if ( info.url ) {
-               return info.url;
+               path = info.url;
        }
+       return path.replace(/^https?:\/\//, '//');
 }
 
 // It turns out that image captions can have unclosed block tags which
@@ -886,7 +887,7 @@
                // Update some already-defined nonsense based on response
                height = dims.h;
                width = dims.w;
-               path = getPath( path, info );
+               path = getPath( info );
 
                if ( oHash.alt ) {
                        img.addNormalizedAttribute( 'alt', oHash.alt, altBackup 
);
diff --git a/js/tests/fetch-parserTests.txt.js 
b/js/tests/fetch-parserTests.txt.js
index be469ec..98763cb 100755
--- a/js/tests/fetch-parserTests.txt.js
+++ b/js/tests/fetch-parserTests.txt.js
@@ -10,9 +10,9 @@
 //     and update these hashes automatically.
 //
 // You can use 'sha1sum -b tests/parser/parserTests.txt' to compute this value:
-var expectedSHA1 = "6dece70c05306b6b43cebba77ea3bd3d5d174686";
+var expectedSHA1 = "06f0168ac46884820e45c27f0d33b1c948127561";
 // git log --pretty=oneline -1 tests/parser/parserTests.txt
-var latestCommit = "11b306fe5fd7d9d75731d37d069612bb6a3d9968";
+var latestCommit = "e92342be637fd8663c08521a814f820d3f901c37";
 
 var fs = require('fs'),
        path = require('path'),
diff --git a/js/tests/parserTests.txt b/js/tests/parserTests.txt
index e03ac58..b720ab2 100644
--- a/js/tests/parserTests.txt
+++ b/js/tests/parserTests.txt
@@ -8043,7 +8043,7 @@
 <p>
 <span class="mw-default-size" typeof="mw:Image">
 <a href="File:Foobar.jpg">
-<img resource="./File:Foobar.jpg" 
src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg"; 
height="220" width="1941">
+<img resource="./File:Foobar.jpg" 
src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" 
width="1941">
 </a>
 </span>
 </p>
@@ -8059,7 +8059,7 @@
 <p>
 <span class="mw-default-size" typeof="mw:Image">
 <span>
-<img resource="./File:Foobar.jpg" 
src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg"; 
height="220" width="1941">
+<img resource="./File:Foobar.jpg" 
src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" 
width="1941">
 </span>
 </span>
 </p>
@@ -8075,7 +8075,7 @@
 <p>
 <span class="mw-default-size" typeof="mw:Image">
 <a href="Main_Page">
-<img resource="./File:Foobar.jpg" 
src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg"; 
height="220" width="1941">
+<img resource="./File:Foobar.jpg" 
src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" 
width="1941">
 </a>
 </span>
 </p>
@@ -8091,7 +8091,7 @@
 <p>
 <span class="mw-valign-middle" typeof="mw:Image">
 <a href="File:Foobar.jpg">
-<img resource="./File:Foobar.jpg" 
src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg";
 height="6" width="50">
+<img resource="./File:Foobar.jpg" 
src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" 
height="6" width="50">
 </a>
 </span>
 </p>
@@ -8107,7 +8107,7 @@
 <p>
 <span class="mw-valign-baseline" typeof="mw:Image" 
data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
 <a href="File:Foobar.jpg">
-<img resource="./File:Foobar.jpg" 
src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg";
 height="10" width="89">
+<img resource="./File:Foobar.jpg" 
src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" 
height="10" width="89">
 </a>
 </span>
 </p>
@@ -8123,7 +8123,7 @@
 <p>
 <span class="mw-image-border" typeof="mw:Image" 
data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
 <a href="File:Foobar.jpg">
-<img resource="./File:Foobar.jpg" 
src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg";
 height="6" width="50">
+<img resource="./File:Foobar.jpg" 
src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" 
height="6" width="50">
 </a>
 </span>
 </p>
@@ -8138,7 +8138,7 @@
 !! result
 <figure class="mw-default-size mw-halign-left mw-valign-baseline" 
typeof="mw:Image/Thumb">
 <a href="File:Foobar.jpg">
-<img resource="./File:Foobar.jpg" 
src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg";
 height="21" width="180" />
+<img resource="./File:Foobar.jpg" 
src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" 
height="21" width="180" />
 </a>
 <figcaption class="mw-figcaption">caption content</figcaption>
 </figure>
@@ -8153,7 +8153,7 @@
 !! result
 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
 <a href="File:Foobar.jpg">
-<img resource="./File:Foobar.jpg" 
src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg";
 height="6" width="50" />
+<img resource="./File:Foobar.jpg" 
src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" 
height="6" width="50" />
 </a>
 <figcaption class="mw-figcaption">caption</figcaption>
 </figure>
@@ -8168,7 +8168,7 @@
 !! result
 <figure typeof="mw:Image/Frame">
 <a href="File:Foobar.jpg">
-<img resource="./File:Foobar.jpg" 
src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg";
 height="50" width="442" />
+<img resource="./File:Foobar.jpg" 
src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" 
height="50" width="442" />
 </a>
 <figcaption class="mw-figcaption">caption</figcaption>
 </figure>
@@ -8183,7 +8183,7 @@
 !! result
 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
 <a href="File:Foobar.jpg">
-<img resource="./File:Foobar.jpg" 
src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg";
 height="50" width="442" />
+<img resource="./File:Foobar.jpg" 
src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" 
height="50" width="442" />
 </a>
 <figcaption class="mw-figcaption">caption</figcaption>
 </figure>
@@ -8199,7 +8199,7 @@
 <p>
 <span class="mw-image-border" typeof="mw:Image/Frameless" 
data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
 <a href="File:Foobar.jpg">
-<img resource="./File:Foobar.jpg" 
src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg";
 height="50" width="442" />
+<img resource="./File:Foobar.jpg" 
src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" 
height="50" width="442" />
 </a>
 </p>
 !! end

-- 
To view, visit https://gerrit.wikimedia.org/r/70344
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I253b9b7a9b463439e86d7cf7975cd92f9c851e70
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Inez <i...@wikia-inc.com>
Gerrit-Reviewer: GWicke <gwi...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to