Catrope has uploaded a new change for review.
https://gerrit.wikimedia.org/r/120835
Change subject: Protect against invalid/absent <base> in ve.resolveUri()
......................................................................
Protect against invalid/absent <base> in ve.resolveUri()
If the document has no <base> and has nowhere to inherit a base URI from
(this is the case for documents created with real document creation functions
rather than the iframe trick), things like node.href will return empty string
(!!)
if the href is relative. This is crazy, so detect this case and return the
original value instead.
Change-Id: If1dd4421d1eb0e73e3b86821f4e0aa5a82c851a2
---
M modules/ve/ve.js
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor
refs/changes/35/120835/1
diff --git a/modules/ve/ve.js b/modules/ve/ve.js
index bccc9c1..fd12b74 100644
--- a/modules/ve/ve.js
+++ b/modules/ve/ve.js
@@ -794,7 +794,8 @@
node = doc.createElement( 'a' );
node.setAttribute( 'href', url );
- return node.href;
+ // If doc.baseURI isn't set, node.href won't be sane
+ return doc.baseURI ? node.href : url;
};
/**
--
To view, visit https://gerrit.wikimedia.org/r/120835
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If1dd4421d1eb0e73e3b86821f4e0aa5a82c851a2
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits