r96680 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96679‎ | r96680 | r96681 >
Date:18:43, 9 September 2011
Author:brion
Status:ok
Tags:
Comment:
Followup r87986: qunit test case for bug 30825

jQuery's $.append() and friends go through some funky code paths which sometimes manually load <script> node contents via AJAX and eval them. That failed entirely in IE 7 if given a protocol-relative link ($wgServer = '//commons.wikimedia.org').
The fix in r87986 bypasses that by using DOM append directly on a script node, and thus fixes bug 30825 without even knowing it. :)

This test serves as a regression test.
Modified paths:
  • /trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.test.bug30825.js (added) (history)
  • /trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.test.js (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.test.js
@@ -169,6 +169,23 @@
170170 });
171171 });
172172
 173+test( 'mw.loader.bug30825', function() {
 174+ // This bug was actually already fixed in 1.18 and later when discovered in 1.17.
 175+ // Test is for regressions!
 176+
 177+ expect(1);
 178+
 179+ // Confirm that mw.loader.load() works with protocol-relative URLs
 180+ var loc = window.location,
 181+ base = ('//' + loc.hostname + loc.pathname).replace(/\/[^\/]*$/, ''),
 182+ target = base + '/suites/resources/mediawiki/mediawiki.test.bug30825.js';
 183+
 184+ // Async! Include a timeout, as failure in this test leads to neither the
 185+ // success nor failure callbacks getting called.
 186+ stop(5000);
 187+ mw.loader.load( target );
 188+});
 189+
173190 test( 'mw.html', function() {
174191 expect(11);
175192
Index: trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.test.bug30825.js
@@ -0,0 +1,2 @@
 2+start();
 3+ok( true, "Bug 30825 -- protocol-relative URL script load via mw.loader.load");
Property changes on: trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.test.bug30825.js
___________________________________________________________________
Added: svn:eol-style
14 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r96699Provisional workaround for bug 30825 as it affects things run via $.ajax() us...brion22:03, 9 September 2011
r97404Move the mediawiki.test.bug30825.js helper script out of the /suites/ directo...krinkle04:50, 18 September 2011
r101356fix mediawiki.test wrong URL...hashar13:53, 31 October 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r87986(reverts r87985, and does what that was SUPPOSED to do!) Gerenalized code use...tparscal15:22, 13 May 2011
r96679MFT r87986 -- consolidation of addScript in mediawiki.loader, also fixes bug ...brion18:39, 9 September 2011

Status & tagging log