XForms Bug 284519 - Need preference for whitelisting submission, instance loading, etc.. r=allan/smaug a=mkaply

This commit is contained in:
doronr%us.ibm.com 2005-06-28 16:30:50 +00:00
Родитель 37d49aacab
Коммит 68cc429fd3
15 изменённых файлов: 886 добавлений и 87 удалений

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

@ -70,6 +70,7 @@ REQUIRES = \
transformiix \ transformiix \
schemavalidation \ schemavalidation \
intl \ intl \
pref \
$(NULL) $(NULL)
XPIDLSRCS = \ XPIDLSRCS = \

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

@ -1,6 +1,14 @@
xforms.jar: xforms.jar:
content/xforms/contents.rdf % overlay chrome://browser/content/preferences/preferences.xul chrome://xforms/content/xforms-prefs.xul
content/xforms/xforms.xml % content xforms %content/xforms/
* content/xforms/xforms.css % locale xforms en-US %locale/en-US/xforms/
content/xforms/contents.rdf (resources/content/contents.rdf)
* content/xforms/xforms.css (resources/content/xforms.css)
* content/xforms/xforms-prefs.xul (resources/content/xforms-prefs.xul)
* content/xforms/xforms-prefs-ui.xul (resources/content/xforms-prefs-ui.xul)
* content/xforms/xforms-prefs.js (resources/content/xforms-prefs.js)
content/xforms/xforms.xml (resources/content/xforms.xml)
* locale/en-US/xforms/contents.rdf (resources/locale/en-US/contents.rdf) * locale/en-US/xforms/contents.rdf (resources/locale/en-US/contents.rdf)
locale/en-US/xforms/xforms.properties (resources/locale/en-US/xforms.properties) locale/en-US/xforms/xforms.properties (resources/locale/en-US/xforms.properties)
locale/en-US/xforms/xforms.dtd (resources/locale/en-US/xforms.dtd)

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

@ -89,6 +89,9 @@
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsXFormsUtils.h" #include "nsXFormsUtils.h"
#include "nsIDOMNamedNodeMap.h" #include "nsIDOMNamedNodeMap.h"
#include "nsIPermissionManager.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
// namespace literals // namespace literals
#define NAMESPACE_XML_SCHEMA \ #define NAMESPACE_XML_SCHEMA \
@ -811,20 +814,70 @@ nsXFormsSubmissionElement::SerializeDataXML(nsIDOMNode *data,
PRBool PRBool
nsXFormsSubmissionElement::CheckSameOrigin(nsIURI *aBaseURI, nsIURI *aTestURI) nsXFormsSubmissionElement::CheckSameOrigin(nsIURI *aBaseURI, nsIURI *aTestURI)
{ {
PRBool result = PR_TRUE;
// We require same-origin for replace="instance" or XML submission // We require same-origin for replace="instance" or XML submission
if (mFormat & (ENCODING_XML | ENCODING_MULTIPART_RELATED) || mIsReplaceInstance) { if (mFormat & (ENCODING_XML | ENCODING_MULTIPART_RELATED) || mIsReplaceInstance) {
// if we don't replace the instance, we allow file:// to send the data // if we don't replace the instance, we allow file:// or sites whitelisted
PRBool schemeIsFile = PR_FALSE; // to submit data
if (!mIsReplaceInstance) { if (!mIsReplaceInstance) {
aBaseURI->SchemeIs("file", &schemeIsFile); aBaseURI->SchemeIs("file", &result);
// lets check the permission manager
if (!result) {
result = CheckPermissionManager(aBaseURI);
}
} }
if (!schemeIsFile) if (!result) {
return nsXFormsUtils::CheckSameOrigin(aBaseURI, aTestURI); result = nsXFormsUtils::CheckSameOrigin(aBaseURI, aTestURI);
} }
return PR_TRUE; }
return result;
}
PRBool
nsXFormsSubmissionElement::CheckPermissionManager(nsIURI *aBaseURI)
{
PRBool result = PR_FALSE;
nsresult rv;
nsCOMPtr<nsIPrefBranch> prefBranch =
do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
PRUint32 permission = nsIPermissionManager::UNKNOWN_ACTION;
if (NS_SUCCEEDED(rv) && prefBranch) {
// check if the user has enabled the xforms cross domain preference
PRBool checkPermission = PR_FALSE;
prefBranch->GetBoolPref("xforms.crossdomain.enabled", &checkPermission);
if (checkPermission) {
// if the user enabled the cross domain check, query the permission
// manager with the URI. It will return 1 if the URI was allowed by the
// user.
nsCOMPtr<nsIPermissionManager> permissionManager =
do_GetService("@mozilla.org/permissionmanager;1");
nsCOMPtr<nsIDOMDocument> domDoc;
mElement->GetOwnerDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
NS_ENSURE_STATE(doc);
permissionManager->TestPermission(doc->GetDocumentURI(),
"xforms-xd", &permission);
}
}
if (permission == nsIPermissionManager::ALLOW_ACTION) {
// not in the permission manager
result = PR_TRUE;
}
return result;
} }
nsresult nsresult

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

@ -126,6 +126,7 @@ private:
* there is no need for a same origin check. * there is no need for a same origin check.
*/ */
PRBool CheckSameOrigin(nsIURI *aBaseURI, nsIURI *aTestURI); PRBool CheckSameOrigin(nsIURI *aBaseURI, nsIURI *aTestURI);
PRBool CheckPermissionManager(nsIURI *aBaseURI);
nsresult AddNameSpaces(nsIDOMElement* aTarget, nsIDOMNode* aSource); nsresult AddNameSpaces(nsIDOMElement* aTarget, nsIDOMNode* aSource);
}; };

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

@ -1,77 +0,0 @@
# vim:set ts=8 sw=8 sts=8 noet:
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# IBM Corporation.
# Portions created by the Initial Developer are Copyright (C) 2004
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Brian Ryner <bryner@brianryner.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),WINNT)
PKGCP_PLATFORM = dos
PACKAGE_FILE = packages-win
else
PKGCP_PLATFORM=unix
ifeq ($(OS_ARCH),Darwin)
PACKAGE_FILE = packages-mac
else
PACKAGE_FILE = packages-unix
endif
endif
GARBAGE += xforms.js xforms.template
GARBAGE_DIRS += stage
PACKAGE_VERSION = 0.2
xpi:
@echo Copying files to staging area...
rm -rf stage
$(NSINSTALL) -D stage
$(PERL) $(topsrcdir)/xpinstall/packager/pkgcp.pl -o $(PKGCP_PLATFORM) -s $(DIST)/bin -d stage -f $(srcdir)/$(PACKAGE_FILE) -v
$(NSINSTALL) $(srcdir)/install.rdf stage/xforms
@echo Creating install.js...
rm -f xforms.js
$(PERL) $(topsrcdir)/toolkit/mozapps/installer/makejs.pl $(srcdir)/xforms.jst $(PACKAGE_VERSION) stage/xforms
if ! test -e "xforms.js"; then $(NSINSTALL) $(srcdir)/xforms.js .; fi
@echo Creating XPI...
$(PERL) $(topsrcdir)/toolkit/mozapps/installer/makexpi.pl xforms stage .

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

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

@ -0,0 +1,49 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Mozilla XForms code.
-
- The Initial Developer of the Original Code is
- IBM Corporation
- Portions created by the Initial Developer are Copyright (C) 2005
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<!-- list all the packages being supplied by this jar -->
<RDF:Seq about="urn:mozilla:package:root">
<RDF:li resource="urn:mozilla:package:xforms"/>
</RDF:Seq>
<!-- package information -->
<RDF:Description about="urn:mozilla:package:xforms"
chrome:name="xforms"/>
</RDF:RDF>

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

@ -0,0 +1,74 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Mozilla XForms Support.
-
- The Initial Developer of the Original Code is
- IBM Corportation.
- Portions created by the Initial Developer are Copyright (C) 2005
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<!DOCTYPE overlay [
<!ENTITY % xformsDTD SYSTEM "chrome://xforms/locale/xforms.dtd">
<!ENTITY % contentDTD SYSTEM "chrome://browser/locale/preferences/content.dtd">
%xformsDTD;
%contentDTD;
]>
<overlay id="XFormsContentPaneOverlayUI"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefwindow id="BrowserPreferences">
<prefpane id="paneContent">
<preferences id="contentPreferences">
<preference id="xforms.crossdomain.enabled" name="xforms.crossdomain.enabled" type="bool"/>
</preferences>
<groupbox id="contentGroupbox">
<grid id="contentGrid">
<rows id="contentRows-1">
<row insertafter="enableSoftwareInstallRow">
<vbox align="start">
<checkbox id="xformsCrossDomain" preference="xforms.crossdomain.enabled"
label="&xforms.crossdomain.ui.label;"
accesskey="&xforms.crossdomain.ui.accesskey;"
onpreferenceread="return gContentPane.updateButtons('xformsCrossDomainButton', 'xforms.crossdomain.enabled');"/>
</vbox>
<button id="xformsCrossDomainButton" label="&allowedSites.label;"
oncommand="loadXFormsPermission()"/>
</row>
</rows>
</grid>
</groupbox>
</prefpane>
</prefwindow>
</overlay>

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

@ -0,0 +1,87 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla XForms Support.
*
* The Initial Developer of the Original Code is
* IBM Corportation.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function loadXFormsPermission() {
var bundlePreferences = document.getElementById("bundlePreferences");
var params = {
blockVisible: false,
sessionVisible: false,
allowVisible: true,
prefilledHost: "",
permissionType: "xforms-xd"
};
// get the localized strings
var strbundle = document.getElementById("xforms-stringbundle");
params.windowTitle = strbundle.getString("xformsXDPermissionDialogTitle");
params.introText = strbundle.getString("xformsXDPermissionDialogIntro");
document.documentElement.openWindow("Browser:Permissions",
"chrome://browser/content/preferences/permissions.xul",
"", params);
}
var XFormsLoadObserver = {
observe: function (aSubject, aTopic, aData)
{
// overlay is loaded, initialize it
document.getElementById("xforms.crossdomain.enabled").updateElements();
}
}
function XFormsUIClass() {
}
XFormsUIClass.prototype.pageLoad = function(aEvent) {
var pane = document.getElementById("paneContent");
if (pane.loaded) {
xformsUI.loadOverlay();
} else {
pane.addEventListener("paneload", xformsUI.loadOverlay, false);
}
}
XFormsUIClass.prototype.loadOverlay = function() {
document.loadOverlay("chrome://xforms/content/xforms-prefs-ui.xul", XFormsLoadObserver);
}
var xformsUI = new XFormsUIClass();
window.addEventListener("load", xformsUI.pageLoad, false);

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

@ -0,0 +1,54 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Mozilla XForms Support.
-
- The Initial Developer of the Original Code is
- IBM Corportation.
- Portions created by the Initial Developer are Copyright (C) 2005
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<overlay id="XFormsContentPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefwindow id="BrowserPreferences">
<prefpane id="paneContent">
<preferences id="contentPreferences">
<preference id="xforms.crossdomain.enabled" name="xforms.crossdomain.enabled" type="bool"/>
</preferences>
<stringbundle id="xforms-stringbundle" src="chrome://xforms/locale/xforms.properties"/>
<script type="application/x-javascript" src="chrome://xforms/content/xforms-prefs.js"/>
</prefpane>
</prefwindow>
</overlay>

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

@ -0,0 +1,96 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla XForms support.
#
# The Initial Developer of the Original Code is
# IBM Corporation.
# Portions created by the Initial Developer are Copyright (C) 2005
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
@namespace url(http://www.w3.org/2002/xforms);
@namespace mozType url(http://www.mozilla.org/projects/xforms/2005/type);
repeat,
repeatitem,
contextcontainer,
group,
switch,
case {
display: block;
}
message[level="ephemeral"], hint {
background-color: InfoBackground;
color: InfoText;
padding: 2px 3px;
font: message-box;
border: 1px black solid;
visibility: hidden !important;
position: absolute !important;
}
alert {
display: none;
}
output {
-moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-output');
}
input {
-moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-input');
}
input[mozType|type="http://www.w3.org/2001/XMLSchema#boolean"] {
-moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-input-boolean');
}
secret {
-moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-secret');
}
textarea {
-moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-textarea');
}
trigger, submit {
-moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-trigger');
}
trigger[appearance="minimal"], submit[appearance="minimal"] {
-moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-trigger-minimal');
}
trigger[appearance="minimal"]:hover, submit[appearance="minimal"]:hover {
cursor: pointer;
}
label {
-moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-label');
}

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

@ -0,0 +1,371 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Mozilla XForms support.
-
- The Initial Developer of the Original Code is
- Novell, Inc.
- Portions created by the Initial Developer are Copyright (C) 2005
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Allan Beaufour <abeaufour@novell.com>
- Olli Pettay <Olli.Pettay@helsinki.fi>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the GPL or the LGPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<bindings id="xformsBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:xforms="http://www.w3.org/2002/xforms">
<!-- BASE -->
<binding id="xformswidget-base">
<content><children/></content>
<implementation implements="nsIXFormsUIWidget">
<constructor>
this.delegate.widgetAttached();
</constructor>
<destructor>
_delegate = null;
</destructor>
<field name="_delegate">null</field>
<property name="delegate" readonly="true">
<getter>
if (!this._delegate)
this._delegate = this.QueryInterface(Components.interfaces.nsIXFormsDelegate);
return this._delegate;
</getter>
</property>
<property name="stringValue" readonly="true">
<getter>
var value = this.delegate.value;
return value != null ? value : "";
</getter>
</property>
<method name="refresh">
<body>
return true;
</body>
</method>
<method name="disable">
<parameter name="aDisable"/>
<body>
return true;
</body>
</method>
<method name="focus">
<body>
return false;
</body>
</method>
</implementation>
</binding>
<!-- OUTPUT: <DEFAULT> -->
<binding id="xformswidget-output"
extends="chrome://xforms/content/xforms.xml#xformswidget-base">
<content>
<children/>
<html:span anonid="content"></html:span>
</content>
<implementation implements="nsIXFormsUIWidget">
<method name="refresh">
<body>
document.getAnonymousElementByAttribute(this, "anonid", "content").textContent =
this.stringValue;
return true;
</body>
</method>
</implementation>
</binding>
<!-- LABEL: <DEFAULT> -->
<binding id="xformswidget-label"
extends="chrome://xforms/content/xforms.xml#xformswidget-base">
<content>
<html:span anonid="content"></html:span>
<html:span anonid="anoncontent">
<children/>
</html:span>
</content>
<implementation implements="nsIXFormsUIWidget">
<method name="refresh">
<body>
var anoncontent =
document.getAnonymousElementByAttribute(this, "anonid", "anoncontent");
if (this.delegate.hasBoundNode) {
anoncontent.setAttribute("style", "display:none");
} else {
anoncontent.removeAttribute("style");
}
document.getAnonymousElementByAttribute(this, "anonid", "content").textContent =
this.stringValue;
return true;
</body>
</method>
</implementation>
</binding>
<!-- INPUT: <DEFAULT> -->
<binding id="xformswidget-input"
extends="chrome://xforms/content/xforms.xml#xformswidget-base">
<content>
<children/>
<html:input anonid="control"
onblur="this.parentNode.delegate.value = this.value;"
onclick="this.parentNode._change();"
onkeyup="this.parentNode._change();"/>
</content>
<implementation implements="nsIXFormsUIWidget">
<field name="_inputField">null</field>
<property name="inputField" readonly="true">
<getter>
if (!this._inputField) {
this._inputField =
document.getAnonymousElementByAttribute(this, "anonid", "control");
}
return this._inputField;
</getter>
</property>
<method name="_change">
<body>
if (this.getAttribute("incremental") == "true") {
this.delegate.value = this.inputField.value;
}
return true;
</body>
</method>
<method name="refresh">
<body>
this.inputField.value = this.stringValue;
if (this.delegate.isReadonly) {
this.inputField.setAttribute("readonly", "readonly");
} else {
this.inputField.removeAttribute("readonly");
}
return true;
</body>
</method>
<method name="focus">
<body>
this.inputField.focus();
return true;
</body>
</method>
</implementation>
</binding>
<!-- INPUT: BOOLEAN -->
<binding id="xformswidget-input-boolean"
extends="chrome://xforms/content/xforms.xml#xformswidget-input">
<implementation>
<method name="refresh">
<body>
this.inputField.setAttribute("type","checkbox");
var value = this.stringValue;
if (value == "true" || value == "1") {
this.inputField.setAttribute("checked", "checked");
} else {
this.inputField.removeAttribute("checked");
}
this.inputField.value = value;
if (this.delegate.isReadonly) {
this.inputField.setAttribute("readonly", "readonly");
} else {
this.inputField.removeAttribute("readonly");
}
return true;
</body>
</method>
<method name="_change">
<body>
if (this.getAttribute("incremental") != "false") {
if (this.inputField.checked) {
this.delegate.value = "true";
} else {
this.delegate.value = "false";
}
}
</body>
</method>
</implementation>
</binding>
<!-- SECRET: <DEFAULT> -->
<binding id="xformswidget-secret"
extends="chrome://xforms/content/xforms.xml#xformswidget-input">
<implementation>
<method name="refresh">
<body>
this.inputField.setAttribute("type","password");
this.inputField.value = this.stringValue;
this.inputField.readonly = this.delegate.isReadonly;
return true;
</body>
</method>
</implementation>
</binding>
<!-- TEXTAREA: <DEFAULT> -->
<binding id="xformswidget-textarea"
extends="chrome://xforms/content/xforms.xml#xformswidget-base">
<content>
<children/>
<html:textarea anonid="control"
onblur="this.parentNode.delegate.value = this.value;"
onkeyup="this.parentNode._change();"/>
</content>
<implementation implements="nsIXFormsUIWidget">
<method name="refresh">
<body>
var control =
document.getAnonymousElementByAttribute(this, "anonid", "control");
control.readonly = this.delegate.isReadonly;
control.value = this.stringValue;
return true;
</body>
</method>
<method name="_change">
<body>
if (this.getAttribute("incremental") == "true") {
this.delegate.value = this.value;
}
return true;
</body>
</method>
<method name="focus">
<body>
document.getAnonymousElementByAttribute(this, "anonid", "control").focus();
return true;
</body>
</method>
</implementation>
</binding>
<!-- TRIGGER: BASE -->
<binding id="xformswidget-trigger-base"
extends="chrome://xforms/content/xforms.xml#xformswidget-base">
<content><children/></content>
<implementation implements="nsIXFormsUIWidget">
<method name="dispatchDOMActivate">
<body>
var ev = document.createEvent("UIEvents");
ev.initUIEvent("DOMActivate", true, true, window, 1);
this.dispatchEvent(ev);
return true;
</body>
</method>
</implementation>
</binding>
<!-- TRIGGER: <DEFAULT> -->
<binding id="xformswidget-trigger"
extends="chrome://xforms/content/xforms.xml#xformswidget-base">
<content>
<html:button anonid="thebutton">
<children/>
</html:button>
</content>
<implementation implements="nsIXFormsUIWidget">
<method name="disable">
<parameter name="aDisable"/>
<body>
var control =
document.getAnonymousElementByAttribute(this, "anonid", "thebutton");
if (aDisable) {
control.setAttribute("disabled", "disabled");
} else {
control.removeAttribute("disabled");
}
</body>
</method>
<method name="focus">
<body>
document.getAnonymousElementByAttribute(this, "anonid", "thebutton").focus();
return true;
</body>
</method>
</implementation>
</binding>
<!-- TRIGGER: MINIMAL -->
<binding id="xformswidget-trigger-minimal"
extends="chrome://xforms/content/xforms.xml#xformswidget-trigger-base">
<content>
<html:span anonid="thespan"
onclick="if (!this._disabled) this.parentNode.dispatchDOMActivate();">
<children/>
</html:span>
</content>
<implementation implements="nsIXFormsUIWidget">
<field name="_disabled">false</field>
<method name="disable">
<parameter name="aDisable"/>
<body>
this._disabled = aDisable;
</body>
</method>
<method name="focus">
<body>
document.getAnonymousElementByAttribute(this, "anonid", "thespan").focus();
return true;
</body>
</method>
</implementation>
</binding>
</bindings>

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

@ -0,0 +1,39 @@
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Mozilla XForms Support.
-
- The Initial Developer of the Original Code is
- IBM Corportation.
- Portions created by the Initial Developer are Copyright (C) 2005
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<!ENTITY xforms.crossdomain.ui.label "Allow XForms to submit data to other domains">
<!ENTITY xforms.crossdomain.ui.accesskey "X">

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

@ -1,3 +1,41 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla XForms Support.
#
# The Initial Developer of the Original Code is
# IBM Corporation.
# Portions created by the Initial Developer are Copyright (C) 2005
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
# Error Messages:
missingTypeName = XForms Error (1): type (%S) missing type name missingTypeName = XForms Error (1): type (%S) missing type name
schemaProcessError = XForms Error (2): Failed to process inline schema schemaProcessError = XForms Error (2): Failed to process inline schema
schemaLoadError = XForms Error (3): Failed to load schema schemaLoadError = XForms Error (3): Failed to load schema
@ -17,3 +55,8 @@ controlBindError = XForms Error (16): Could not bind control to instance dat
labelLinkLoadOrigin = XForms Error (17): Security check failed! Trying to load label data from a different domain than document labelLinkLoadOrigin = XForms Error (17): Security check failed! Trying to load label data from a different domain than document
labelLink1Error = XForms Error (18): External file (%S) for Label element not found labelLink1Error = XForms Error (18): External file (%S) for Label element not found
labelLink2Error = XForms Error (19): Failed to load Label element from external file: %S labelLink2Error = XForms Error (19): Failed to load Label element from external file: %S
# XForms Permission Messages:
xformsXDPermissionDialogTitle = Allowed Sites - XForms Cross Domain Access
xformsXDPermissionDialogIntro = You can specify which web sites containing XForms may submit data to other domains. Type the exact address of the site you want to allow and then press Allow.

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