i'm having a lot of problems with scripting permissions in trusted
forms.
i am using InfoPath RTM, and as an easy exercise, am trying to get the
UIBASICS.XSN sample working as a trusted form.
if i create a new form instance using either the UIBASICS.XSN (or the
extracted manifest.xsf) the form template works just fine: all the
taskpane scripting works as expected.
i then created a fully trusted installer using the following:
regform.exe /U urn:UIBasics:myCompany /FT UIBasics /T Yes /MSI
UIBasics.xsn
i also extracted the form files so that i could inspect the taskpane
and other support scripts.
having installed the trusted form template, i attempted to create a
new form using the template under "Custom Installed Forms".
upon opening the new form, InfoPath renders the form and the taskpane,
but immediately displays the following error message:
Permission denied
File: script.js
Line: 90
the error occurs in the SetTaskPaneState function in script.js:
// Call a script function defined in the task pane HTML page.
gobjTaskPane.HTMLDocument.parentWindow.SelectView(strTaskPaneViewId);
if i ignore the error, another occurs:
Line: 28
Error: Permission denied
using the debugger i found that the error occurs in the Init function
in the script block within taskpane.htm:
// Set the initial state of the task pane contents.
gobjXDocument.Extension.SetTaskPaneState();
this suggests two fundamental permission issues:
1. that InfoPath itself is failing to call a script function using
the TaskPane.HTMLDocument.parentWindow calling mechanism.
2. that the Internet Explorer host is failing to call back into
InfoPath using the window.external.Window.XDocument.Extension calling
mechanism.
and these two issues exist even though the form is fully trusted.
this is a serious problem for me: i thought that the whole point of
"Fully Trusted" means just that ?
i'm hoping that there's something i've missed, either in the form
registration itself or some other security configuration.
i've also read all the other threads dealing with permissions with no
luck, including this rather elusive post:
http://groups.google.com/groups?selm=3dd701c3763a%24bf9f6160%24a301280a%40phx.gbl
is there a reason why this is happening, or why the concept of
"trusted" seems to break down when it comes to scripting ?
is there a genuine solution, or is this some limitation within
InfoPath ?
any help appreciated!
thanks
roland
>hi all
>
>i'm having a lot of problems with scripting permissions in trusted
>forms.
>
>i am using InfoPath RTM, and as an easy exercise, am trying to get the
>UIBASICS.XSN sample working as a trusted form.
>
>upon opening the new form, InfoPath renders the form and the taskpane,
>but immediately displays the following error message:
>
> Permission denied
> File: script.js
> Line: 90
>
>the error occurs in the SetTaskPaneState function in script.js:
>
> // Call a script function defined in the task pane HTML page.
> gobjTaskPane.HTMLDocument.parentWindow.SelectView(strTaskPaneViewId);
>
>this suggests two fundamental permission issues:
>1. that InfoPath itself is failing to call a script function using
>the TaskPane.HTMLDocument.parentWindow calling mechanism.
>2. that the Internet Explorer host is failing to call back into
>InfoPath using the window.external.Window.XDocument.Extension calling
>mechanism.
>
>and these two issues exist even though the form is fully trusted.
>
>this is a serious problem for me: i thought that the whole point of
>"Fully Trusted" means just that ?
>
>i'm hoping that there's something i've missed, either in the form
>registration itself or some other security configuration.
>
>i've also read all the other threads dealing with permissions with no
>luck, including this rather elusive post:
>
> http://groups.google.com/groups?selm=3dd701c3763a%24bf9f6160%24a301280a%40phx.gbl
>
>is there a reason why this is happening, or why the concept of
>"trusted" seems to break down when it comes to scripting ?
As I said in that thread you referenced, some OM methods/properties
have to be used differently in a trusted form. Don't ask why... :(
Here's the list for anyone using Google.
1. Getting the window object of a custom task pane
Untrusted:
<Taskpane Object>.HTMLDocument.parentWindow
Trusted:
<Taskpane Object>.HTMLWindow
2. Displaying a modal dialog
Untrusted:
<Taskpane Window Object>.showModalDialog( ... )
Trusted:
XDocument.UI.ShowModalDialog( ... )
3. Creating an ADO Connection object
Untrusted:
new ActiveXObject("ADODO.Connection")
Trusted:
Application.NewADOConnection()
4. Creating an ADO RecordSet object
Untrusted:
new ActiveXObject("ADODO.RecordSet")
Trusted:
Application.NewADORecordSet()
I do something like this when I develop both normal and fully trusted
versions of the same form...
var fFullTrust = false;
var oTaskPane = null;
function XDocument::OnLoad(eventObj)
{
fFullTrust = (null !=
XDocument.Solution.DOM.selectSingleNode("/xsf:xDocumentClass[@requireFullTrust='yes']"));
}
function GetADOConnection()
{
if (fFullTrust)
return Application.NewADODBConnection();
else
return new ActiveXObject("ADODB.Connection");
}
function GetTaskPaneWindow()
{
if (null == oTaskPane)
oTaskPane = XDocument.View.Window.TaskPanes.Item(0);
if (fFullTrust)
return oTaskPane.HTMLWindow;
else
return oTaskPane.HTMLDocument.parentWindow;
}
function ShowModalDialog(url, .. blah blah blah)
{
if (fFullTrust)
return XDocument.UI.ShowModalDialog(url, ....);
else
return
XDocument.View.Window.TaskPanes.Item(0).HTMLDocument.parentWindow.showModalDialog(url,
...)
Regards,
Steve
--
Please post questions to the newsgroup; everyone benefits.
This post is provided "AS IS" with no warranties, and confers no rights
Sample code subject to http://www.microsoft.com/info/cpyright.htm
thanks a whole lot, steve, that's invaluable!
regards
roland