Bug 679320 - Add currentURI as a property to the xul:editor element r=ehsan

This commit is contained in:
Ian Neal 2011-08-18 00:15:29 +01:00
Родитель b4ea8dc43d
Коммит 01ba709913
3 изменённых файлов: 51 добавлений и 0 удалений

Просмотреть файл

@ -77,6 +77,10 @@ _TEST_FILES = \
videomask.css \
$(NULL)
_CHROME_TEST_FILES = \
test_editor_currentURI.xul \
$(NULL)
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
_TEST_FILES += test_menubar.xul \
window_menubar.xul
@ -87,3 +91,7 @@ libs:: $(_CHROME_FILES)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
libs:: $(_CHROME_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)

Просмотреть файл

@ -0,0 +1,40 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin"
type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Editor currentURI Tests" onload="runTest();">
<title>Editor currentURI Tests</title>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<body xmlns="http://www.w3.org/1999/xhtml">
<p/>
<editor xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="editor"
type="content"
editortype="html"
style="width: 400px; height: 100px;"/>
<p/>
<pre id="test">
</pre>
</body>
<script class="testbody" type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
function runTest() {
var editor = document.getElementById("editor");
// Check that currentURI is a property of editor.
var result = "currentURI" in editor;
is(result, true, "currentURI is a property of editor");
is(editor.currentURI.spec, "about:blank", "currentURI.spec is about:blank");
SimpleTest.finish();
}
]]>
</script>
</window>

Просмотреть файл

@ -102,6 +102,9 @@
<property name="docShell"
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell;"
readonly="true"/>
<property name="currentURI"
readonly="true"
onget="return this.webNavigation.currentURI;"/>
<property name="contentWindow"
readonly="true"
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>