Massive rewrite of the key binding system and the command dispatcher. Key

bindings are now fully hierarchical.  In addition, DOM windows, input fields
and textareas can pull their key bindings from a separate XUL file.  This
allows configurable key bindings.

Massive rewrite of the command dispatcher system.  The command dispatcher now
deals with DOM windows in addition to DOM elements.  It now tracks both
successfully and works in conjunction with the new focus/blur architecture.

r=saari


git-svn-id: svn://10.0.0.236/trunk@55718 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
hyatt%netscape.com 1999-12-08 04:56:56 +00:00
parent d50cb261de
commit aba17d157e
31 changed files with 1561 additions and 796 deletions

View File

@ -46,6 +46,7 @@ class nsIRDFContentModelBuilder;
class nsIRDFResource;
class nsISupportsArray;
class nsIXULPrototypeDocument;
class nsIURI;
// {954F0811-81DC-11d2-B52A-000000000000}
#define NS_IRDFDOCUMENT_IID \
@ -56,6 +57,7 @@ class nsIXULPrototypeDocument;
*/
class nsIRDFDataSource;
class nsIXULPrototypeDocument;
class nsIXULDocument : public nsIXMLDocument
{
@ -105,6 +107,26 @@ public:
* Resolve the all of the document's forward references.
*/
NS_IMETHOD ResolveForwardReferences() = 0;
/**
* Set the master prototype.
*/
NS_IMETHOD SetMasterPrototype(nsIXULPrototypeDocument* aDocument) = 0;
/**
* Set the current prototype
*/
NS_IMETHOD SetCurrentPrototype(nsIXULPrototypeDocument* aDocument) = 0;
/**
* Set the doc's URL
*/
NS_IMETHOD SetDocumentURL(nsIURI* aURI) = 0;
/**
* Load inline and attribute style sheets
*/
NS_IMETHOD PrepareStyleSheets(nsIURI* aURI) = 0;
};
// factory functions

View File

@ -29,6 +29,8 @@
#include "nsIContent.h"
#include "nsIControllers.h"
#include "nsIDOMDocument.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMNSHTMLInputElement.h"
#include "nsIDOMNSHTMLTextAreaElement.h"
@ -51,7 +53,7 @@ static PRLogModuleInfo* gLog;
////////////////////////////////////////////////////////////////////////
nsXULCommandDispatcher::nsXULCommandDispatcher(void)
: mScriptObject(nsnull), mCurrentNode(nsnull), mUpdaters(nsnull)
: mScriptObject(nsnull), mUpdaters(nsnull)
{
NS_INIT_REFCNT();
@ -63,11 +65,11 @@ nsXULCommandDispatcher::nsXULCommandDispatcher(void)
nsXULCommandDispatcher::~nsXULCommandDispatcher(void)
{
while (mUpdaters) {
Updater* doomed = mUpdaters;
mUpdaters = mUpdaters->mNext;
delete doomed;
}
while (mUpdaters) {
Updater* doomed = mUpdaters;
mUpdaters = mUpdaters->mNext;
delete doomed;
}
}
NS_IMPL_ADDREF(nsXULCommandDispatcher)
@ -120,24 +122,37 @@ nsXULCommandDispatcher::Create(nsIDOMXULCommandDispatcher** aResult)
// nsIDOMXULTracker Interface
NS_IMETHODIMP
nsXULCommandDispatcher::GetFocusedNode(nsIDOMNode** aNode)
nsXULCommandDispatcher::GetFocusedElement(nsIDOMElement** aElement)
{
*aNode = mCurrentNode;
NS_IF_ADDREF(*aNode);
*aElement = mCurrentElement;
NS_IF_ADDREF(*aElement);
return NS_OK;
}
NS_IMETHODIMP
nsXULCommandDispatcher::SetFocusedNode(nsIDOMNode* aNode)
nsXULCommandDispatcher::GetFocusedWindow(nsIDOMWindow** aWindow)
{
// XXX On a blur, will need to fire an updatecommands (focus) on the
// parent window.
mCurrentNode = aNode;
if (mCurrentNode)
*aWindow = mCurrentWindow;
NS_IF_ADDREF(*aWindow);
return NS_OK;
}
NS_IMETHODIMP
nsXULCommandDispatcher::SetFocusedElement(nsIDOMElement* aElement)
{
mCurrentElement = aElement;
if (mCurrentElement)
UpdateCommands(nsAutoString("focus"));
return NS_OK;
}
NS_IMETHODIMP
nsXULCommandDispatcher::SetFocusedWindow(nsIDOMWindow* aWindow)
{
mCurrentWindow = aWindow;
return NS_OK;
}
NS_IMETHODIMP
nsXULCommandDispatcher::AddCommandUpdater(nsIDOMElement* aElement,
const nsString& aEvents,
@ -224,13 +239,12 @@ nsXULCommandDispatcher::UpdateCommands(const nsString& aEventName)
nsresult rv;
nsAutoString id;
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mCurrentNode);
if (element) {
rv = element->GetAttribute(nsAutoString("id"), id);
if (mCurrentElement) {
rv = mCurrentElement->GetAttribute(nsAutoString("id"), id);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get element's id");
if (NS_FAILED(rv)) return rv;
}
for (Updater* updater = mUpdaters; updater != nsnull; updater = updater->mNext) {
// Skip any nodes that don't match our 'events' or 'targets'
// filters.
@ -286,20 +300,21 @@ nsXULCommandDispatcher::GetControllers(nsIControllers** aResult)
{
//XXX: we should fix this so there's a generic interface that describes controllers,
// so this code would have no special knowledge of what object might have controllers.
if (mCurrentNode) {
nsCOMPtr<nsIDOMXULElement> xulElement = do_QueryInterface(mCurrentNode);
if (mCurrentElement) {
nsCOMPtr<nsIDOMXULElement> xulElement = do_QueryInterface(mCurrentElement);
if (xulElement)
return xulElement->GetControllers(aResult);
nsCOMPtr<nsIDOMNSHTMLTextAreaElement> htmlTextArea = do_QueryInterface(mCurrentNode);
nsCOMPtr<nsIDOMNSHTMLTextAreaElement> htmlTextArea = do_QueryInterface(mCurrentElement);
if (htmlTextArea)
return htmlTextArea->GetControllers(aResult);
nsCOMPtr<nsIDOMNSHTMLInputElement> htmlInputElement = do_QueryInterface(mCurrentNode);
nsCOMPtr<nsIDOMNSHTMLInputElement> htmlInputElement = do_QueryInterface(mCurrentElement);
if (htmlInputElement)
return htmlInputElement->GetControllers(aResult);
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(mCurrentNode);
}
else if (mCurrentWindow) {
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(mCurrentWindow);
if (domWindow)
return domWindow->GetControllers(aResult);
}
@ -318,10 +333,40 @@ nsXULCommandDispatcher::Focus(nsIDOMEvent* aEvent)
nsCOMPtr<nsIDOMNode> t;
aEvent->GetTarget(getter_AddRefs(t));
// XXX: Bad fix
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(t);
if(element) {
SetFocusedNode(t);
/*
printf("%d : Focus occurred on: ", this);
nsCOMPtr<nsIDOMElement> domDebugElement = do_QueryInterface(t);
if (domDebugElement) {
printf("A Focusable DOM Element");
}
nsCOMPtr<nsIDOMDocument> domDebugDocument = do_QueryInterface(t);
if (domDebugDocument) {
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(t);
if (htmlDoc) {
printf("Window with an HTML doc (happens twice)");
}
else printf("Window with a XUL doc (happens twice)");
}
printf("\n");
*/
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(t);
if (domElement && (domElement != mCurrentElement)) {
SetFocusedElement(domElement);
}
else {
// We're focusing a window. We only want to do an update commands
// if no element is focused.
nsCOMPtr<nsIDOMWindow> domWindow;
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(t);
if (domDoc) {
GetParentWindowFromDocument(domDoc, getter_AddRefs(domWindow));
if (domWindow && (domWindow != mCurrentWindow)) {
SetFocusedWindow(domWindow);
if (!mCurrentElement)
UpdateCommands(nsAutoString("focus"));
}
}
}
return NS_OK;
@ -332,8 +377,35 @@ nsXULCommandDispatcher::Blur(nsIDOMEvent* aEvent)
{
nsCOMPtr<nsIDOMNode> t;
aEvent->GetTarget(getter_AddRefs(t));
if( t == mCurrentNode ) {
SetFocusedNode(nsnull);
/*
printf("%d : Blur occurred on: ", this);
nsCOMPtr<nsIDOMElement> domDebugElement = do_QueryInterface(t);
if (domDebugElement) {
printf("A Focusable DOM Element");
}
nsCOMPtr<nsIDOMDocument> domDebugDocument = do_QueryInterface(t);
if (domDebugDocument) {
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(t);
if (htmlDoc) {
printf("Window with an HTML doc (happens twice)");
}
else printf("Window with a XUL doc (happens twice)");
}
printf("\n");
*/
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(t);
if (domElement) {
SetFocusedElement(nsnull);
}
nsCOMPtr<nsIDOMWindow> domWindow;
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(t);
if (domDoc) {
GetParentWindowFromDocument(domDoc, getter_AddRefs(domWindow));
if (domWindow)
SetFocusedWindow(nsnull);
}
return NS_OK;
@ -393,25 +465,19 @@ nsXULCommandDispatcher::Matches(const nsString& aList, const nsString& aElement)
}
NS_IMETHODIMP
nsXULCommandDispatcher::GetParentWindowFromElement(nsIDOMElement* aElement, nsPIDOMWindow** aPWindow)
nsresult
nsXULCommandDispatcher::GetParentWindowFromDocument(nsIDOMDocument* aDocument, nsIDOMWindow** aWindow)
{
nsCOMPtr<nsIDOMDocument> document;
aElement->GetOwnerDocument(getter_AddRefs(document));
if(!document) return NS_OK;
nsCOMPtr<nsIDocument> objectOwner = do_QueryInterface(document);
nsCOMPtr<nsIDocument> objectOwner = do_QueryInterface(aDocument);
if(!objectOwner) return NS_OK;
nsCOMPtr<nsIScriptGlobalObject> globalObject;
objectOwner->GetScriptGlobalObject(getter_AddRefs(globalObject));
if(!globalObject) return NS_OK;
nsCOMPtr<nsPIDOMWindow> privateDOMWindow = do_QueryInterface(globalObject);
if(!privateDOMWindow) return NS_OK;
privateDOMWindow->GetPrivateParent(aPWindow);
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(globalObject);
*aWindow = domWindow;
NS_IF_ADDREF(*aWindow);
return NS_OK;
}
@ -423,46 +489,47 @@ nsXULCommandDispatcher::GetControllerForCommand(const nsString& command, nsICont
nsCOMPtr<nsIControllers> controllers;
GetControllers(getter_AddRefs(controllers));
if(controllers) {
nsCOMPtr<nsIController> controller;
controllers->GetControllerForCommand(command.GetUnicode(), getter_AddRefs(controller));
if(controller) {
nsCOMPtr<nsIController> controller;
controllers->GetControllerForCommand(command.GetUnicode(), getter_AddRefs(controller));
if(controller) {
*_retval = controller;
NS_ADDREF(*_retval);
return NS_OK;
}
}
nsCOMPtr<nsPIDOMWindow> currentWindow;
if (mCurrentElement) {
// Move up to the window.
nsCOMPtr<nsIDOMDocument> domDoc;
mCurrentElement->GetOwnerDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDOMWindow> domWindow;
GetParentWindowFromDocument(domDoc, getter_AddRefs(domWindow));
currentWindow = do_QueryInterface(domWindow);
}
else if (mCurrentWindow) {
nsCOMPtr<nsPIDOMWindow> privateWin = do_QueryInterface(mCurrentWindow);
privateWin->GetPrivateParent(getter_AddRefs(currentWindow));
}
else return NS_OK;
while(currentWindow) {
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(currentWindow);
if(domWindow) {
nsCOMPtr<nsIControllers> controllers2;
domWindow->GetControllers(getter_AddRefs(controllers2));
if(controllers2) {
nsCOMPtr<nsIController> controller;
controllers2->GetControllerForCommand(command.GetUnicode(), getter_AddRefs(controller));
if(controller) {
*_retval = controller;
NS_ADDREF(*_retval);
return NS_OK;
}
}
}
if(!mCurrentNode) return NS_OK;
nsCOMPtr<nsPIDOMWindow> currentWindow;
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mCurrentNode);
if(element) {
GetParentWindowFromElement(element, getter_AddRefs(currentWindow));
} else {
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mCurrentNode);
if(!window) return NS_OK;
window->GetPrivateParent(getter_AddRefs(currentWindow));
}
while(currentWindow) {
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(currentWindow);
if(domWindow) {
nsCOMPtr<nsIControllers> controllers2;
domWindow->GetControllers(getter_AddRefs(controllers2));
if(controllers2) {
nsCOMPtr<nsIController> controller;
controllers2->GetControllerForCommand(command.GetUnicode(), getter_AddRefs(controller));
if(controller) {
*_retval = controller;
NS_ADDREF(*_retval);
return NS_OK;
}
}
}
nsCOMPtr<nsPIDOMWindow> parentPWindow = currentWindow;
parentPWindow->GetPrivateParent(getter_AddRefs(currentWindow));
}
nsCOMPtr<nsPIDOMWindow> parentPWindow = currentWindow;
parentPWindow->GetPrivateParent(getter_AddRefs(currentWindow));
}
return NS_OK;

View File

@ -73,15 +73,17 @@ public:
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
NS_IMETHOD SetScriptObject(void *aScriptObject);
protected:
NS_IMETHOD GetParentWindowFromElement(nsIDOMElement* aElement, nsPIDOMWindow** aPWindow);
public:
static nsresult GetParentWindowFromDocument(nsIDOMDocument* aElement, nsIDOMWindow** aWindow);
protected:
void* mScriptObject; // ????
// XXX THis was supposed to be WEAK, but c'mon, that's an accident
// waiting to happen! If somebody deletes the node, then asks us
// for the focus, we'll get killed!
nsCOMPtr<nsIDOMNode> mCurrentNode; // [OWNER]
nsCOMPtr<nsIDOMElement> mCurrentElement; // [OWNER]
nsCOMPtr<nsIDOMWindow> mCurrentWindow; // [OWNER]
class Updater {
public:

View File

@ -601,11 +601,11 @@ nsXULDocument::PrepareStyleSheets(nsIURI* anURL)
return NS_OK;
}
void
nsXULDocument::SetDocumentURLAndGroup(nsIURI* anURL)
NS_IMETHODIMP
nsXULDocument::SetDocumentURL(nsIURI* anURL)
{
mDocumentURL = dont_QueryInterface(anURL);
// XXX help
return NS_OK;
}
NS_IMETHODIMP
@ -2021,6 +2021,19 @@ nsXULDocument::ResolveForwardReferences()
return NS_OK;
}
NS_IMETHODIMP
nsXULDocument::SetMasterPrototype(nsIXULPrototypeDocument* aDocument)
{
mMasterPrototype = aDocument;
return NS_OK;
}
NS_IMETHODIMP
nsXULDocument::SetCurrentPrototype(nsIXULPrototypeDocument* aDocument)
{
mCurrentPrototype = aDocument;
return NS_OK;
}
//----------------------------------------------------------------------
//
@ -4360,8 +4373,7 @@ nsXULDocument::PrepareToWalk()
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
NS_ASSERTION(group != nsnull, "no load group");
if (group) {
rv = mPlaceholderChannel->SetLoadGroup(group);
if (NS_FAILED(rv)) return rv;

View File

@ -285,7 +285,11 @@ public:
NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm);
NS_IMETHOD AddForwardReference(nsForwardReference* aRef);
NS_IMETHOD ResolveForwardReferences();
NS_IMETHOD SetMasterPrototype(nsIXULPrototypeDocument* aDocument);
NS_IMETHOD SetCurrentPrototype(nsIXULPrototypeDocument* aDocument);
NS_IMETHOD SetDocumentURL(nsIURI* anURL);
NS_IMETHOD PrepareStyleSheets(nsIURI* anURL);
// nsIStreamLoadableDocument interface
NS_IMETHOD LoadFromStream(nsIInputStream& xulStream,
nsISupports* aContainer,
@ -413,9 +417,6 @@ protected:
nsresult
ParseTagString(const nsString& aTagName, nsIAtom*& aName, PRInt32& aNameSpaceID);
NS_IMETHOD PrepareStyleSheets(nsIURI* anURL);
void SetDocumentURLAndGroup(nsIURI* anURL);
void SetIsPopup(PRBool isPopup) { mIsPopup = isPopup; };
nsresult CreateElement(PRInt32 aNameSpaceID,

View File

@ -3,7 +3,8 @@ interface XULCommandDispatcher {
/* IID: { 0xf3c50361, 0x14fe, 0x11d3, \
{ 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } } */
attribute Node focusedNode;
attribute Element focusedElement;
attribute Window focusedWindow;
void addCommandUpdater(in Element updater, in DOMString events, in DOMString targets);
void removeCommandUpdater(in Element updater);

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
@ -26,7 +30,7 @@
class nsIController;
class nsIDOMElement;
class nsIDOMNode;
class nsIDOMWindow;
class nsIControllers;
#define NS_IDOMXULCOMMANDDISPATCHER_IID \
@ -37,8 +41,11 @@ class nsIDOMXULCommandDispatcher : public nsISupports {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULCOMMANDDISPATCHER_IID; return iid; }
NS_IMETHOD GetFocusedNode(nsIDOMNode** aFocusedNode)=0;
NS_IMETHOD SetFocusedNode(nsIDOMNode* aFocusedNode)=0;
NS_IMETHOD GetFocusedElement(nsIDOMElement** aFocusedElement)=0;
NS_IMETHOD SetFocusedElement(nsIDOMElement* aFocusedElement)=0;
NS_IMETHOD GetFocusedWindow(nsIDOMWindow** aFocusedWindow)=0;
NS_IMETHOD SetFocusedWindow(nsIDOMWindow* aFocusedWindow)=0;
NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsString& aEvents, const nsString& aTargets)=0;
@ -53,8 +60,10 @@ public:
#define NS_DECL_IDOMXULCOMMANDDISPATCHER \
NS_IMETHOD GetFocusedNode(nsIDOMNode** aFocusedNode); \
NS_IMETHOD SetFocusedNode(nsIDOMNode* aFocusedNode); \
NS_IMETHOD GetFocusedElement(nsIDOMElement** aFocusedElement); \
NS_IMETHOD SetFocusedElement(nsIDOMElement* aFocusedElement); \
NS_IMETHOD GetFocusedWindow(nsIDOMWindow** aFocusedWindow); \
NS_IMETHOD SetFocusedWindow(nsIDOMWindow* aFocusedWindow); \
NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsString& aEvents, const nsString& aTargets); \
NS_IMETHOD RemoveCommandUpdater(nsIDOMElement* aUpdater); \
NS_IMETHOD UpdateCommands(const nsString& aEventName); \
@ -64,8 +73,10 @@ public:
#define NS_FORWARD_IDOMXULCOMMANDDISPATCHER(_to) \
NS_IMETHOD GetFocusedNode(nsIDOMNode** aFocusedNode) { return _to GetFocusedNode(aFocusedNode); } \
NS_IMETHOD SetFocusedNode(nsIDOMNode* aFocusedNode) { return _to SetFocusedNode(aFocusedNode); } \
NS_IMETHOD GetFocusedElement(nsIDOMElement** aFocusedElement) { return _to GetFocusedElement(aFocusedElement); } \
NS_IMETHOD SetFocusedElement(nsIDOMElement* aFocusedElement) { return _to SetFocusedElement(aFocusedElement); } \
NS_IMETHOD GetFocusedWindow(nsIDOMWindow** aFocusedWindow) { return _to GetFocusedWindow(aFocusedWindow); } \
NS_IMETHOD SetFocusedWindow(nsIDOMWindow* aFocusedWindow) { return _to SetFocusedWindow(aFocusedWindow); } \
NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsString& aEvents, const nsString& aTargets) { return _to AddCommandUpdater(aUpdater, aEvents, aTargets); } \
NS_IMETHOD RemoveCommandUpdater(nsIDOMElement* aUpdater) { return _to RemoveCommandUpdater(aUpdater); } \
NS_IMETHOD UpdateCommands(const nsString& aEventName) { return _to UpdateCommands(aEventName); } \

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
@ -32,8 +36,8 @@
#include "nsString.h"
#include "nsIController.h"
#include "nsIDOMElement.h"
#include "nsIDOMNode.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIDOMWindow.h"
#include "nsIControllers.h"
@ -42,21 +46,22 @@ static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kIControllerIID, NS_ICONTROLLER_IID);
static NS_DEFINE_IID(kIElementIID, NS_IDOMELEMENT_IID);
static NS_DEFINE_IID(kINodeIID, NS_IDOMNODE_IID);
static NS_DEFINE_IID(kIXULCommandDispatcherIID, NS_IDOMXULCOMMANDDISPATCHER_IID);
static NS_DEFINE_IID(kIWindowIID, NS_IDOMWINDOW_IID);
static NS_DEFINE_IID(kIControllersIID, NS_ICONTROLLERS_IID);
NS_DEF_PTR(nsIController);
NS_DEF_PTR(nsIDOMElement);
NS_DEF_PTR(nsIDOMNode);
NS_DEF_PTR(nsIDOMXULCommandDispatcher);
NS_DEF_PTR(nsIDOMWindow);
NS_DEF_PTR(nsIControllers);
//
// XULCommandDispatcher property ids
//
enum XULCommandDispatcher_slots {
XULCOMMANDDISPATCHER_FOCUSEDNODE = -1
XULCOMMANDDISPATCHER_FOCUSEDELEMENT = -1,
XULCOMMANDDISPATCHER_FOCUSEDWINDOW = -2
};
/***********************************************************************/
@ -80,16 +85,35 @@ GetXULCommandDispatcherProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECMAN_ERR);
}
switch(JSVAL_TO_INT(id)) {
case XULCOMMANDDISPATCHER_FOCUSEDNODE:
case XULCOMMANDDISPATCHER_FOCUSEDELEMENT:
{
PRBool ok = PR_FALSE;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_FOCUSEDNODE, PR_FALSE, &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_FOCUSEDELEMENT, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
nsIDOMNode* prop;
nsIDOMElement* prop;
nsresult result = NS_OK;
result = a->GetFocusedNode(&prop);
result = a->GetFocusedElement(&prop);
if (NS_SUCCEEDED(result)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
}
else {
return nsJSUtils::nsReportError(cx, result);
}
break;
}
case XULCOMMANDDISPATCHER_FOCUSEDWINDOW:
{
PRBool ok = PR_FALSE;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_FOCUSEDWINDOW, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
nsIDOMWindow* prop;
nsresult result = NS_OK;
result = a->GetFocusedWindow(&prop);
if (NS_SUCCEEDED(result)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
@ -131,21 +155,39 @@ SetXULCommandDispatcherProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECMAN_ERR);
}
switch(JSVAL_TO_INT(id)) {
case XULCOMMANDDISPATCHER_FOCUSEDNODE:
case XULCOMMANDDISPATCHER_FOCUSEDELEMENT:
{
PRBool ok = PR_FALSE;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_FOCUSEDNODE, PR_TRUE, &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_FOCUSEDELEMENT, PR_TRUE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
nsIDOMNode* prop;
nsIDOMElement* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
kINodeIID, "Node",
kIElementIID, "Element",
cx, *vp)) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_NOT_OBJECT_ERR);
}
a->SetFocusedNode(prop);
a->SetFocusedElement(prop);
NS_IF_RELEASE(prop);
break;
}
case XULCOMMANDDISPATCHER_FOCUSEDWINDOW:
{
PRBool ok = PR_FALSE;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_FOCUSEDWINDOW, PR_TRUE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
nsIDOMWindow* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
kIWindowIID, "Window",
cx, *vp)) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_NOT_OBJECT_ERR);
}
a->SetFocusedWindow(prop);
NS_IF_RELEASE(prop);
break;
}
@ -212,7 +254,7 @@ XULCommandDispatcherAddCommandUpdater(JSContext *cx, JSObject *obj, uintN argc,
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_ADDCOMMANDUPDATER,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_ADDCOMMANDUPDATER, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -269,7 +311,7 @@ XULCommandDispatcherRemoveCommandUpdater(JSContext *cx, JSObject *obj, uintN arg
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_REMOVECOMMANDUPDATER,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_REMOVECOMMANDUPDATER, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -324,7 +366,7 @@ XULCommandDispatcherUpdateCommands(JSContext *cx, JSObject *obj, uintN argc, jsv
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_UPDATECOMMANDS,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_UPDATECOMMANDS, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -374,7 +416,7 @@ XULCommandDispatcherGetControllerForCommand(JSContext *cx, JSObject *obj, uintN
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_GETCONTROLLERFORCOMMAND,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_GETCONTROLLERFORCOMMAND, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -424,7 +466,7 @@ XULCommandDispatcherGetControllers(JSContext *cx, JSObject *obj, uintN argc, jsv
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_GETCONTROLLERS,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_GETCONTROLLERS, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -473,7 +515,8 @@ JSClass XULCommandDispatcherClass = {
//
static JSPropertySpec XULCommandDispatcherProperties[] =
{
{"focusedNode", XULCOMMANDDISPATCHER_FOCUSEDNODE, JSPROP_ENUMERATE},
{"focusedElement", XULCOMMANDDISPATCHER_FOCUSEDELEMENT, JSPROP_ENUMERATE},
{"focusedWindow", XULCOMMANDDISPATCHER_FOCUSEDWINDOW, JSPROP_ENUMERATE},
{0}
};

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
@ -269,7 +273,7 @@ XULDocumentGetElementById(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULDOCUMENT_GETELEMENTBYID,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULDOCUMENT_GETELEMENTBYID, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -320,7 +324,7 @@ XULDocumentGetElementsByAttribute(JSContext *cx, JSObject *obj, uintN argc, jsva
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULDOCUMENT_GETELEMENTSBYATTRIBUTE,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULDOCUMENT_GETELEMENTSBYATTRIBUTE, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -371,7 +375,7 @@ XULDocumentPersist(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULDOCUMENT_PERSIST,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULDOCUMENT_PERSIST, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
@ -342,7 +346,7 @@ XULElementAddBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsval *
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_ADDBROADCASTLISTENER,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_ADDBROADCASTLISTENER, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -399,7 +403,7 @@ XULElementRemoveBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsva
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_REMOVEBROADCASTLISTENER,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_REMOVEBROADCASTLISTENER, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -454,7 +458,7 @@ XULElementDoCommand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_DOCOMMAND,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_DOCOMMAND, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -500,7 +504,7 @@ XULElementGetElementsByAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_GETELEMENTSBYATTRIBUTE,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_GETELEMENTSBYATTRIBUTE, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
@ -207,7 +211,7 @@ XULTreeElementSelectItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTITEM,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTITEM, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -262,7 +266,7 @@ XULTreeElementSelectCell(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTCELL,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTCELL, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -316,7 +320,7 @@ XULTreeElementClearItemSelection(JSContext *cx, JSObject *obj, uintN argc, jsval
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_CLEARITEMSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_CLEARITEMSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -359,7 +363,7 @@ XULTreeElementClearCellSelection(JSContext *cx, JSObject *obj, uintN argc, jsval
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_CLEARCELLSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_CLEARCELLSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -403,7 +407,7 @@ XULTreeElementAddItemToSelection(JSContext *cx, JSObject *obj, uintN argc, jsval
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_ADDITEMTOSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_ADDITEMTOSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -458,7 +462,7 @@ XULTreeElementRemoveItemFromSelection(JSContext *cx, JSObject *obj, uintN argc,
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_REMOVEITEMFROMSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_REMOVEITEMFROMSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -513,7 +517,7 @@ XULTreeElementAddCellToSelection(JSContext *cx, JSObject *obj, uintN argc, jsval
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_ADDCELLTOSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_ADDCELLTOSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -568,7 +572,7 @@ XULTreeElementRemoveCellFromSelection(JSContext *cx, JSObject *obj, uintN argc,
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_REMOVECELLFROMSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_REMOVECELLFROMSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -623,7 +627,7 @@ XULTreeElementToggleItemSelection(JSContext *cx, JSObject *obj, uintN argc, jsva
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_TOGGLEITEMSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_TOGGLEITEMSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -678,7 +682,7 @@ XULTreeElementToggleCellSelection(JSContext *cx, JSObject *obj, uintN argc, jsva
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_TOGGLECELLSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_TOGGLECELLSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -734,7 +738,7 @@ XULTreeElementSelectItemRange(JSContext *cx, JSObject *obj, uintN argc, jsval *a
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTITEMRANGE,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTITEMRANGE, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -797,7 +801,7 @@ XULTreeElementSelectCellRange(JSContext *cx, JSObject *obj, uintN argc, jsval *a
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTCELLRANGE,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTCELLRANGE, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -858,7 +862,7 @@ XULTreeElementSelectAll(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTALL,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTALL, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -901,7 +905,7 @@ XULTreeElementInvertSelection(JSContext *cx, JSObject *obj, uintN argc, jsval *a
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_INVERTSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_INVERTSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}

View File

@ -3,7 +3,8 @@ interface XULCommandDispatcher {
/* IID: { 0xf3c50361, 0x14fe, 0x11d3, \
{ 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } } */
attribute Node focusedNode;
attribute Element focusedElement;
attribute Window focusedWindow;
void addCommandUpdater(in Element updater, in DOMString events, in DOMString targets);
void removeCommandUpdater(in Element updater);

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
@ -26,7 +30,7 @@
class nsIController;
class nsIDOMElement;
class nsIDOMNode;
class nsIDOMWindow;
class nsIControllers;
#define NS_IDOMXULCOMMANDDISPATCHER_IID \
@ -37,8 +41,11 @@ class nsIDOMXULCommandDispatcher : public nsISupports {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULCOMMANDDISPATCHER_IID; return iid; }
NS_IMETHOD GetFocusedNode(nsIDOMNode** aFocusedNode)=0;
NS_IMETHOD SetFocusedNode(nsIDOMNode* aFocusedNode)=0;
NS_IMETHOD GetFocusedElement(nsIDOMElement** aFocusedElement)=0;
NS_IMETHOD SetFocusedElement(nsIDOMElement* aFocusedElement)=0;
NS_IMETHOD GetFocusedWindow(nsIDOMWindow** aFocusedWindow)=0;
NS_IMETHOD SetFocusedWindow(nsIDOMWindow* aFocusedWindow)=0;
NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsString& aEvents, const nsString& aTargets)=0;
@ -53,8 +60,10 @@ public:
#define NS_DECL_IDOMXULCOMMANDDISPATCHER \
NS_IMETHOD GetFocusedNode(nsIDOMNode** aFocusedNode); \
NS_IMETHOD SetFocusedNode(nsIDOMNode* aFocusedNode); \
NS_IMETHOD GetFocusedElement(nsIDOMElement** aFocusedElement); \
NS_IMETHOD SetFocusedElement(nsIDOMElement* aFocusedElement); \
NS_IMETHOD GetFocusedWindow(nsIDOMWindow** aFocusedWindow); \
NS_IMETHOD SetFocusedWindow(nsIDOMWindow* aFocusedWindow); \
NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsString& aEvents, const nsString& aTargets); \
NS_IMETHOD RemoveCommandUpdater(nsIDOMElement* aUpdater); \
NS_IMETHOD UpdateCommands(const nsString& aEventName); \
@ -64,8 +73,10 @@ public:
#define NS_FORWARD_IDOMXULCOMMANDDISPATCHER(_to) \
NS_IMETHOD GetFocusedNode(nsIDOMNode** aFocusedNode) { return _to GetFocusedNode(aFocusedNode); } \
NS_IMETHOD SetFocusedNode(nsIDOMNode* aFocusedNode) { return _to SetFocusedNode(aFocusedNode); } \
NS_IMETHOD GetFocusedElement(nsIDOMElement** aFocusedElement) { return _to GetFocusedElement(aFocusedElement); } \
NS_IMETHOD SetFocusedElement(nsIDOMElement* aFocusedElement) { return _to SetFocusedElement(aFocusedElement); } \
NS_IMETHOD GetFocusedWindow(nsIDOMWindow** aFocusedWindow) { return _to GetFocusedWindow(aFocusedWindow); } \
NS_IMETHOD SetFocusedWindow(nsIDOMWindow* aFocusedWindow) { return _to SetFocusedWindow(aFocusedWindow); } \
NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsString& aEvents, const nsString& aTargets) { return _to AddCommandUpdater(aUpdater, aEvents, aTargets); } \
NS_IMETHOD RemoveCommandUpdater(nsIDOMElement* aUpdater) { return _to RemoveCommandUpdater(aUpdater); } \
NS_IMETHOD UpdateCommands(const nsString& aEventName) { return _to UpdateCommands(aEventName); } \

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */

View File

@ -46,6 +46,7 @@ class nsIRDFContentModelBuilder;
class nsIRDFResource;
class nsISupportsArray;
class nsIXULPrototypeDocument;
class nsIURI;
// {954F0811-81DC-11d2-B52A-000000000000}
#define NS_IRDFDOCUMENT_IID \
@ -56,6 +57,7 @@ class nsIXULPrototypeDocument;
*/
class nsIRDFDataSource;
class nsIXULPrototypeDocument;
class nsIXULDocument : public nsIXMLDocument
{
@ -105,6 +107,26 @@ public:
* Resolve the all of the document's forward references.
*/
NS_IMETHOD ResolveForwardReferences() = 0;
/**
* Set the master prototype.
*/
NS_IMETHOD SetMasterPrototype(nsIXULPrototypeDocument* aDocument) = 0;
/**
* Set the current prototype
*/
NS_IMETHOD SetCurrentPrototype(nsIXULPrototypeDocument* aDocument) = 0;
/**
* Set the doc's URL
*/
NS_IMETHOD SetDocumentURL(nsIURI* aURI) = 0;
/**
* Load inline and attribute style sheets
*/
NS_IMETHOD PrepareStyleSheets(nsIURI* aURI) = 0;
};
// factory functions

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
@ -32,8 +36,8 @@
#include "nsString.h"
#include "nsIController.h"
#include "nsIDOMElement.h"
#include "nsIDOMNode.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIDOMWindow.h"
#include "nsIControllers.h"
@ -42,21 +46,22 @@ static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kIControllerIID, NS_ICONTROLLER_IID);
static NS_DEFINE_IID(kIElementIID, NS_IDOMELEMENT_IID);
static NS_DEFINE_IID(kINodeIID, NS_IDOMNODE_IID);
static NS_DEFINE_IID(kIXULCommandDispatcherIID, NS_IDOMXULCOMMANDDISPATCHER_IID);
static NS_DEFINE_IID(kIWindowIID, NS_IDOMWINDOW_IID);
static NS_DEFINE_IID(kIControllersIID, NS_ICONTROLLERS_IID);
NS_DEF_PTR(nsIController);
NS_DEF_PTR(nsIDOMElement);
NS_DEF_PTR(nsIDOMNode);
NS_DEF_PTR(nsIDOMXULCommandDispatcher);
NS_DEF_PTR(nsIDOMWindow);
NS_DEF_PTR(nsIControllers);
//
// XULCommandDispatcher property ids
//
enum XULCommandDispatcher_slots {
XULCOMMANDDISPATCHER_FOCUSEDNODE = -1
XULCOMMANDDISPATCHER_FOCUSEDELEMENT = -1,
XULCOMMANDDISPATCHER_FOCUSEDWINDOW = -2
};
/***********************************************************************/
@ -80,16 +85,35 @@ GetXULCommandDispatcherProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECMAN_ERR);
}
switch(JSVAL_TO_INT(id)) {
case XULCOMMANDDISPATCHER_FOCUSEDNODE:
case XULCOMMANDDISPATCHER_FOCUSEDELEMENT:
{
PRBool ok = PR_FALSE;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_FOCUSEDNODE, PR_FALSE, &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_FOCUSEDELEMENT, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
nsIDOMNode* prop;
nsIDOMElement* prop;
nsresult result = NS_OK;
result = a->GetFocusedNode(&prop);
result = a->GetFocusedElement(&prop);
if (NS_SUCCEEDED(result)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
}
else {
return nsJSUtils::nsReportError(cx, result);
}
break;
}
case XULCOMMANDDISPATCHER_FOCUSEDWINDOW:
{
PRBool ok = PR_FALSE;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_FOCUSEDWINDOW, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
nsIDOMWindow* prop;
nsresult result = NS_OK;
result = a->GetFocusedWindow(&prop);
if (NS_SUCCEEDED(result)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
@ -131,21 +155,39 @@ SetXULCommandDispatcherProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECMAN_ERR);
}
switch(JSVAL_TO_INT(id)) {
case XULCOMMANDDISPATCHER_FOCUSEDNODE:
case XULCOMMANDDISPATCHER_FOCUSEDELEMENT:
{
PRBool ok = PR_FALSE;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_FOCUSEDNODE, PR_TRUE, &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_FOCUSEDELEMENT, PR_TRUE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
nsIDOMNode* prop;
nsIDOMElement* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
kINodeIID, "Node",
kIElementIID, "Element",
cx, *vp)) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_NOT_OBJECT_ERR);
}
a->SetFocusedNode(prop);
a->SetFocusedElement(prop);
NS_IF_RELEASE(prop);
break;
}
case XULCOMMANDDISPATCHER_FOCUSEDWINDOW:
{
PRBool ok = PR_FALSE;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_FOCUSEDWINDOW, PR_TRUE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
nsIDOMWindow* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
kIWindowIID, "Window",
cx, *vp)) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_NOT_OBJECT_ERR);
}
a->SetFocusedWindow(prop);
NS_IF_RELEASE(prop);
break;
}
@ -212,7 +254,7 @@ XULCommandDispatcherAddCommandUpdater(JSContext *cx, JSObject *obj, uintN argc,
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_ADDCOMMANDUPDATER,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_ADDCOMMANDUPDATER, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -269,7 +311,7 @@ XULCommandDispatcherRemoveCommandUpdater(JSContext *cx, JSObject *obj, uintN arg
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_REMOVECOMMANDUPDATER,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_REMOVECOMMANDUPDATER, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -324,7 +366,7 @@ XULCommandDispatcherUpdateCommands(JSContext *cx, JSObject *obj, uintN argc, jsv
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_UPDATECOMMANDS,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_UPDATECOMMANDS, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -374,7 +416,7 @@ XULCommandDispatcherGetControllerForCommand(JSContext *cx, JSObject *obj, uintN
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_GETCONTROLLERFORCOMMAND,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_GETCONTROLLERFORCOMMAND, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -424,7 +466,7 @@ XULCommandDispatcherGetControllers(JSContext *cx, JSObject *obj, uintN argc, jsv
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_GETCONTROLLERS,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_GETCONTROLLERS, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -473,7 +515,8 @@ JSClass XULCommandDispatcherClass = {
//
static JSPropertySpec XULCommandDispatcherProperties[] =
{
{"focusedNode", XULCOMMANDDISPATCHER_FOCUSEDNODE, JSPROP_ENUMERATE},
{"focusedElement", XULCOMMANDDISPATCHER_FOCUSEDELEMENT, JSPROP_ENUMERATE},
{"focusedWindow", XULCOMMANDDISPATCHER_FOCUSEDWINDOW, JSPROP_ENUMERATE},
{0}
};

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
@ -269,7 +273,7 @@ XULDocumentGetElementById(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULDOCUMENT_GETELEMENTBYID,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULDOCUMENT_GETELEMENTBYID, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -320,7 +324,7 @@ XULDocumentGetElementsByAttribute(JSContext *cx, JSObject *obj, uintN argc, jsva
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULDOCUMENT_GETELEMENTSBYATTRIBUTE,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULDOCUMENT_GETELEMENTSBYATTRIBUTE, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -371,7 +375,7 @@ XULDocumentPersist(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULDOCUMENT_PERSIST,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULDOCUMENT_PERSIST, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
@ -342,7 +346,7 @@ XULElementAddBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsval *
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_ADDBROADCASTLISTENER,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_ADDBROADCASTLISTENER, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -399,7 +403,7 @@ XULElementRemoveBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsva
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_REMOVEBROADCASTLISTENER,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_REMOVEBROADCASTLISTENER, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -454,7 +458,7 @@ XULElementDoCommand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_DOCOMMAND,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_DOCOMMAND, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -500,7 +504,7 @@ XULElementGetElementsByAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_GETELEMENTSBYATTRIBUTE,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULELEMENT_GETELEMENTSBYATTRIBUTE, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}

View File

@ -1,19 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
* The contents of this file are subject to the Netscape 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/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
* 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 Initial Developer of this code under the NPL is Netscape
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
@ -207,7 +211,7 @@ XULTreeElementSelectItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTITEM,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTITEM, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -262,7 +266,7 @@ XULTreeElementSelectCell(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTCELL,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTCELL, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -316,7 +320,7 @@ XULTreeElementClearItemSelection(JSContext *cx, JSObject *obj, uintN argc, jsval
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_CLEARITEMSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_CLEARITEMSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -359,7 +363,7 @@ XULTreeElementClearCellSelection(JSContext *cx, JSObject *obj, uintN argc, jsval
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_CLEARCELLSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_CLEARCELLSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -403,7 +407,7 @@ XULTreeElementAddItemToSelection(JSContext *cx, JSObject *obj, uintN argc, jsval
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_ADDITEMTOSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_ADDITEMTOSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -458,7 +462,7 @@ XULTreeElementRemoveItemFromSelection(JSContext *cx, JSObject *obj, uintN argc,
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_REMOVEITEMFROMSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_REMOVEITEMFROMSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -513,7 +517,7 @@ XULTreeElementAddCellToSelection(JSContext *cx, JSObject *obj, uintN argc, jsval
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_ADDCELLTOSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_ADDCELLTOSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -568,7 +572,7 @@ XULTreeElementRemoveCellFromSelection(JSContext *cx, JSObject *obj, uintN argc,
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_REMOVECELLFROMSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_REMOVECELLFROMSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -623,7 +627,7 @@ XULTreeElementToggleItemSelection(JSContext *cx, JSObject *obj, uintN argc, jsva
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_TOGGLEITEMSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_TOGGLEITEMSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -678,7 +682,7 @@ XULTreeElementToggleCellSelection(JSContext *cx, JSObject *obj, uintN argc, jsva
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_TOGGLECELLSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_TOGGLECELLSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -734,7 +738,7 @@ XULTreeElementSelectItemRange(JSContext *cx, JSObject *obj, uintN argc, jsval *a
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTITEMRANGE,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTITEMRANGE, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -797,7 +801,7 @@ XULTreeElementSelectCellRange(JSContext *cx, JSObject *obj, uintN argc, jsval *a
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTCELLRANGE,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTCELLRANGE, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -858,7 +862,7 @@ XULTreeElementSelectAll(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTALL,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_SELECTALL, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}
@ -901,7 +905,7 @@ XULTreeElementInvertSelection(JSContext *cx, JSObject *obj, uintN argc, jsval *a
}
{
PRBool ok;
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_INVERTSELECTION,PR_FALSE , &ok);
secMan->CheckScriptAccess(scriptCX, obj, NS_DOM_PROP_XULTREEELEMENT_INVERTSELECTION, PR_FALSE, &ok);
if (!ok) {
return nsJSUtils::nsReportError(cx, NS_ERROR_DOM_SECURITY_ERR);
}

View File

@ -29,6 +29,8 @@
#include "nsIContent.h"
#include "nsIControllers.h"
#include "nsIDOMDocument.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMNSHTMLInputElement.h"
#include "nsIDOMNSHTMLTextAreaElement.h"
@ -51,7 +53,7 @@ static PRLogModuleInfo* gLog;
////////////////////////////////////////////////////////////////////////
nsXULCommandDispatcher::nsXULCommandDispatcher(void)
: mScriptObject(nsnull), mCurrentNode(nsnull), mUpdaters(nsnull)
: mScriptObject(nsnull), mUpdaters(nsnull)
{
NS_INIT_REFCNT();
@ -63,11 +65,11 @@ nsXULCommandDispatcher::nsXULCommandDispatcher(void)
nsXULCommandDispatcher::~nsXULCommandDispatcher(void)
{
while (mUpdaters) {
Updater* doomed = mUpdaters;
mUpdaters = mUpdaters->mNext;
delete doomed;
}
while (mUpdaters) {
Updater* doomed = mUpdaters;
mUpdaters = mUpdaters->mNext;
delete doomed;
}
}
NS_IMPL_ADDREF(nsXULCommandDispatcher)
@ -120,24 +122,37 @@ nsXULCommandDispatcher::Create(nsIDOMXULCommandDispatcher** aResult)
// nsIDOMXULTracker Interface
NS_IMETHODIMP
nsXULCommandDispatcher::GetFocusedNode(nsIDOMNode** aNode)
nsXULCommandDispatcher::GetFocusedElement(nsIDOMElement** aElement)
{
*aNode = mCurrentNode;
NS_IF_ADDREF(*aNode);
*aElement = mCurrentElement;
NS_IF_ADDREF(*aElement);
return NS_OK;
}
NS_IMETHODIMP
nsXULCommandDispatcher::SetFocusedNode(nsIDOMNode* aNode)
nsXULCommandDispatcher::GetFocusedWindow(nsIDOMWindow** aWindow)
{
// XXX On a blur, will need to fire an updatecommands (focus) on the
// parent window.
mCurrentNode = aNode;
if (mCurrentNode)
*aWindow = mCurrentWindow;
NS_IF_ADDREF(*aWindow);
return NS_OK;
}
NS_IMETHODIMP
nsXULCommandDispatcher::SetFocusedElement(nsIDOMElement* aElement)
{
mCurrentElement = aElement;
if (mCurrentElement)
UpdateCommands(nsAutoString("focus"));
return NS_OK;
}
NS_IMETHODIMP
nsXULCommandDispatcher::SetFocusedWindow(nsIDOMWindow* aWindow)
{
mCurrentWindow = aWindow;
return NS_OK;
}
NS_IMETHODIMP
nsXULCommandDispatcher::AddCommandUpdater(nsIDOMElement* aElement,
const nsString& aEvents,
@ -224,13 +239,12 @@ nsXULCommandDispatcher::UpdateCommands(const nsString& aEventName)
nsresult rv;
nsAutoString id;
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mCurrentNode);
if (element) {
rv = element->GetAttribute(nsAutoString("id"), id);
if (mCurrentElement) {
rv = mCurrentElement->GetAttribute(nsAutoString("id"), id);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get element's id");
if (NS_FAILED(rv)) return rv;
}
for (Updater* updater = mUpdaters; updater != nsnull; updater = updater->mNext) {
// Skip any nodes that don't match our 'events' or 'targets'
// filters.
@ -286,20 +300,21 @@ nsXULCommandDispatcher::GetControllers(nsIControllers** aResult)
{
//XXX: we should fix this so there's a generic interface that describes controllers,
// so this code would have no special knowledge of what object might have controllers.
if (mCurrentNode) {
nsCOMPtr<nsIDOMXULElement> xulElement = do_QueryInterface(mCurrentNode);
if (mCurrentElement) {
nsCOMPtr<nsIDOMXULElement> xulElement = do_QueryInterface(mCurrentElement);
if (xulElement)
return xulElement->GetControllers(aResult);
nsCOMPtr<nsIDOMNSHTMLTextAreaElement> htmlTextArea = do_QueryInterface(mCurrentNode);
nsCOMPtr<nsIDOMNSHTMLTextAreaElement> htmlTextArea = do_QueryInterface(mCurrentElement);
if (htmlTextArea)
return htmlTextArea->GetControllers(aResult);
nsCOMPtr<nsIDOMNSHTMLInputElement> htmlInputElement = do_QueryInterface(mCurrentNode);
nsCOMPtr<nsIDOMNSHTMLInputElement> htmlInputElement = do_QueryInterface(mCurrentElement);
if (htmlInputElement)
return htmlInputElement->GetControllers(aResult);
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(mCurrentNode);
}
else if (mCurrentWindow) {
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(mCurrentWindow);
if (domWindow)
return domWindow->GetControllers(aResult);
}
@ -318,10 +333,40 @@ nsXULCommandDispatcher::Focus(nsIDOMEvent* aEvent)
nsCOMPtr<nsIDOMNode> t;
aEvent->GetTarget(getter_AddRefs(t));
// XXX: Bad fix
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(t);
if(element) {
SetFocusedNode(t);
/*
printf("%d : Focus occurred on: ", this);
nsCOMPtr<nsIDOMElement> domDebugElement = do_QueryInterface(t);
if (domDebugElement) {
printf("A Focusable DOM Element");
}
nsCOMPtr<nsIDOMDocument> domDebugDocument = do_QueryInterface(t);
if (domDebugDocument) {
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(t);
if (htmlDoc) {
printf("Window with an HTML doc (happens twice)");
}
else printf("Window with a XUL doc (happens twice)");
}
printf("\n");
*/
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(t);
if (domElement && (domElement != mCurrentElement)) {
SetFocusedElement(domElement);
}
else {
// We're focusing a window. We only want to do an update commands
// if no element is focused.
nsCOMPtr<nsIDOMWindow> domWindow;
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(t);
if (domDoc) {
GetParentWindowFromDocument(domDoc, getter_AddRefs(domWindow));
if (domWindow && (domWindow != mCurrentWindow)) {
SetFocusedWindow(domWindow);
if (!mCurrentElement)
UpdateCommands(nsAutoString("focus"));
}
}
}
return NS_OK;
@ -332,8 +377,35 @@ nsXULCommandDispatcher::Blur(nsIDOMEvent* aEvent)
{
nsCOMPtr<nsIDOMNode> t;
aEvent->GetTarget(getter_AddRefs(t));
if( t == mCurrentNode ) {
SetFocusedNode(nsnull);
/*
printf("%d : Blur occurred on: ", this);
nsCOMPtr<nsIDOMElement> domDebugElement = do_QueryInterface(t);
if (domDebugElement) {
printf("A Focusable DOM Element");
}
nsCOMPtr<nsIDOMDocument> domDebugDocument = do_QueryInterface(t);
if (domDebugDocument) {
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(t);
if (htmlDoc) {
printf("Window with an HTML doc (happens twice)");
}
else printf("Window with a XUL doc (happens twice)");
}
printf("\n");
*/
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(t);
if (domElement) {
SetFocusedElement(nsnull);
}
nsCOMPtr<nsIDOMWindow> domWindow;
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(t);
if (domDoc) {
GetParentWindowFromDocument(domDoc, getter_AddRefs(domWindow));
if (domWindow)
SetFocusedWindow(nsnull);
}
return NS_OK;
@ -393,25 +465,19 @@ nsXULCommandDispatcher::Matches(const nsString& aList, const nsString& aElement)
}
NS_IMETHODIMP
nsXULCommandDispatcher::GetParentWindowFromElement(nsIDOMElement* aElement, nsPIDOMWindow** aPWindow)
nsresult
nsXULCommandDispatcher::GetParentWindowFromDocument(nsIDOMDocument* aDocument, nsIDOMWindow** aWindow)
{
nsCOMPtr<nsIDOMDocument> document;
aElement->GetOwnerDocument(getter_AddRefs(document));
if(!document) return NS_OK;
nsCOMPtr<nsIDocument> objectOwner = do_QueryInterface(document);
nsCOMPtr<nsIDocument> objectOwner = do_QueryInterface(aDocument);
if(!objectOwner) return NS_OK;
nsCOMPtr<nsIScriptGlobalObject> globalObject;
objectOwner->GetScriptGlobalObject(getter_AddRefs(globalObject));
if(!globalObject) return NS_OK;
nsCOMPtr<nsPIDOMWindow> privateDOMWindow = do_QueryInterface(globalObject);
if(!privateDOMWindow) return NS_OK;
privateDOMWindow->GetPrivateParent(aPWindow);
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(globalObject);
*aWindow = domWindow;
NS_IF_ADDREF(*aWindow);
return NS_OK;
}
@ -423,46 +489,47 @@ nsXULCommandDispatcher::GetControllerForCommand(const nsString& command, nsICont
nsCOMPtr<nsIControllers> controllers;
GetControllers(getter_AddRefs(controllers));
if(controllers) {
nsCOMPtr<nsIController> controller;
controllers->GetControllerForCommand(command.GetUnicode(), getter_AddRefs(controller));
if(controller) {
nsCOMPtr<nsIController> controller;
controllers->GetControllerForCommand(command.GetUnicode(), getter_AddRefs(controller));
if(controller) {
*_retval = controller;
NS_ADDREF(*_retval);
return NS_OK;
}
}
nsCOMPtr<nsPIDOMWindow> currentWindow;
if (mCurrentElement) {
// Move up to the window.
nsCOMPtr<nsIDOMDocument> domDoc;
mCurrentElement->GetOwnerDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDOMWindow> domWindow;
GetParentWindowFromDocument(domDoc, getter_AddRefs(domWindow));
currentWindow = do_QueryInterface(domWindow);
}
else if (mCurrentWindow) {
nsCOMPtr<nsPIDOMWindow> privateWin = do_QueryInterface(mCurrentWindow);
privateWin->GetPrivateParent(getter_AddRefs(currentWindow));
}
else return NS_OK;
while(currentWindow) {
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(currentWindow);
if(domWindow) {
nsCOMPtr<nsIControllers> controllers2;
domWindow->GetControllers(getter_AddRefs(controllers2));
if(controllers2) {
nsCOMPtr<nsIController> controller;
controllers2->GetControllerForCommand(command.GetUnicode(), getter_AddRefs(controller));
if(controller) {
*_retval = controller;
NS_ADDREF(*_retval);
return NS_OK;
}
}
}
if(!mCurrentNode) return NS_OK;
nsCOMPtr<nsPIDOMWindow> currentWindow;
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mCurrentNode);
if(element) {
GetParentWindowFromElement(element, getter_AddRefs(currentWindow));
} else {
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mCurrentNode);
if(!window) return NS_OK;
window->GetPrivateParent(getter_AddRefs(currentWindow));
}
while(currentWindow) {
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(currentWindow);
if(domWindow) {
nsCOMPtr<nsIControllers> controllers2;
domWindow->GetControllers(getter_AddRefs(controllers2));
if(controllers2) {
nsCOMPtr<nsIController> controller;
controllers2->GetControllerForCommand(command.GetUnicode(), getter_AddRefs(controller));
if(controller) {
*_retval = controller;
NS_ADDREF(*_retval);
return NS_OK;
}
}
}
nsCOMPtr<nsPIDOMWindow> parentPWindow = currentWindow;
parentPWindow->GetPrivateParent(getter_AddRefs(currentWindow));
}
nsCOMPtr<nsPIDOMWindow> parentPWindow = currentWindow;
parentPWindow->GetPrivateParent(getter_AddRefs(currentWindow));
}
return NS_OK;

View File

@ -73,15 +73,17 @@ public:
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
NS_IMETHOD SetScriptObject(void *aScriptObject);
protected:
NS_IMETHOD GetParentWindowFromElement(nsIDOMElement* aElement, nsPIDOMWindow** aPWindow);
public:
static nsresult GetParentWindowFromDocument(nsIDOMDocument* aElement, nsIDOMWindow** aWindow);
protected:
void* mScriptObject; // ????
// XXX THis was supposed to be WEAK, but c'mon, that's an accident
// waiting to happen! If somebody deletes the node, then asks us
// for the focus, we'll get killed!
nsCOMPtr<nsIDOMNode> mCurrentNode; // [OWNER]
nsCOMPtr<nsIDOMElement> mCurrentElement; // [OWNER]
nsCOMPtr<nsIDOMWindow> mCurrentWindow; // [OWNER]
class Updater {
public:

View File

@ -601,11 +601,11 @@ nsXULDocument::PrepareStyleSheets(nsIURI* anURL)
return NS_OK;
}
void
nsXULDocument::SetDocumentURLAndGroup(nsIURI* anURL)
NS_IMETHODIMP
nsXULDocument::SetDocumentURL(nsIURI* anURL)
{
mDocumentURL = dont_QueryInterface(anURL);
// XXX help
return NS_OK;
}
NS_IMETHODIMP
@ -2021,6 +2021,19 @@ nsXULDocument::ResolveForwardReferences()
return NS_OK;
}
NS_IMETHODIMP
nsXULDocument::SetMasterPrototype(nsIXULPrototypeDocument* aDocument)
{
mMasterPrototype = aDocument;
return NS_OK;
}
NS_IMETHODIMP
nsXULDocument::SetCurrentPrototype(nsIXULPrototypeDocument* aDocument)
{
mCurrentPrototype = aDocument;
return NS_OK;
}
//----------------------------------------------------------------------
//
@ -4360,8 +4373,7 @@ nsXULDocument::PrepareToWalk()
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
NS_ASSERTION(group != nsnull, "no load group");
if (group) {
rv = mPlaceholderChannel->SetLoadGroup(group);
if (NS_FAILED(rv)) return rv;

View File

@ -285,7 +285,11 @@ public:
NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm);
NS_IMETHOD AddForwardReference(nsForwardReference* aRef);
NS_IMETHOD ResolveForwardReferences();
NS_IMETHOD SetMasterPrototype(nsIXULPrototypeDocument* aDocument);
NS_IMETHOD SetCurrentPrototype(nsIXULPrototypeDocument* aDocument);
NS_IMETHOD SetDocumentURL(nsIURI* anURL);
NS_IMETHOD PrepareStyleSheets(nsIURI* anURL);
// nsIStreamLoadableDocument interface
NS_IMETHOD LoadFromStream(nsIInputStream& xulStream,
nsISupports* aContainer,
@ -413,9 +417,6 @@ protected:
nsresult
ParseTagString(const nsString& aTagName, nsIAtom*& aName, PRInt32& aNameSpaceID);
NS_IMETHOD PrepareStyleSheets(nsIURI* anURL);
void SetDocumentURLAndGroup(nsIURI* anURL);
void SetIsPopup(PRBool isPopup) { mIsPopup = isPopup; };
nsresult CreateElement(PRInt32 aNameSpaceID,

File diff suppressed because it is too large Load Diff