mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 833412 - Remove AddBinding/RemoveBinding and remove dead code. r=bz
This commit is contained in:
parent
36383885bc
commit
c865dc3ca6
@ -1946,10 +1946,6 @@ public:
|
||||
Element* GetAnonymousElementByAttribute(Element& aElement,
|
||||
const nsAString& aAttrName,
|
||||
const nsAString& aAttrValue);
|
||||
void AddBinding(Element& aElement, const nsAString& aURI,
|
||||
mozilla::ErrorResult& rv);
|
||||
void RemoveBinding(Element& aElement, const nsAString& aURI,
|
||||
mozilla::ErrorResult& rv);
|
||||
Element* GetBindingParent(nsINode& aNode);
|
||||
void LoadBindingDocument(const nsAString& aURI, mozilla::ErrorResult& rv);
|
||||
already_AddRefed<nsIDOMXPathExpression>
|
||||
|
@ -404,8 +404,7 @@ Element::WrapObject(JSContext *aCx, JSObject *aScope,
|
||||
}
|
||||
|
||||
nsRefPtr<nsXBLBinding> binding;
|
||||
xblService->LoadBindings(this, uri, principal, false, getter_AddRefs(binding),
|
||||
&dummy);
|
||||
xblService->LoadBindings(this, uri, principal, getter_AddRefs(binding), &dummy);
|
||||
|
||||
if (binding) {
|
||||
if (nsContentUtils::IsSafeToRunScript()) {
|
||||
|
@ -5174,77 +5174,6 @@ nsIDocument::ImportNode(nsINode& aNode, bool aDeep, ErrorResult& rv) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::AddBinding(nsIDOMElement* aContent, const nsAString& aURI)
|
||||
{
|
||||
nsCOMPtr<Element> element = do_QueryInterface(aContent);
|
||||
NS_ENSURE_ARG_POINTER(element);
|
||||
ErrorResult rv;
|
||||
nsIDocument::AddBinding(*element, aURI, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::AddBinding(Element& aContent, const nsAString& aURI, ErrorResult& rv)
|
||||
{
|
||||
rv = nsContentUtils::CheckSameOrigin(this, &aContent);
|
||||
if (rv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = NS_NewURI(getter_AddRefs(uri), aURI);
|
||||
if (rv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Figure out the right principal to use
|
||||
nsCOMPtr<nsIPrincipal> subject;
|
||||
nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
|
||||
if (secMan) {
|
||||
rv = secMan->GetSubjectPrincipal(getter_AddRefs(subject));
|
||||
if (rv.Failed()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!subject) {
|
||||
// Fall back to our principal. Or should we fall back to the null
|
||||
// principal? The latter would just mean no binding loads....
|
||||
subject = NodePrincipal();
|
||||
}
|
||||
|
||||
rv = BindingManager()->AddLayeredBinding(&aContent, uri, subject);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::RemoveBinding(nsIDOMElement* aContent, const nsAString& aURI)
|
||||
{
|
||||
nsCOMPtr<Element> element = do_QueryInterface(aContent);
|
||||
NS_ENSURE_ARG_POINTER(element);
|
||||
ErrorResult rv;
|
||||
nsIDocument::RemoveBinding(*element, aURI, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::RemoveBinding(Element& aContent, const nsAString& aURI,
|
||||
ErrorResult& rv)
|
||||
{
|
||||
rv = nsContentUtils::CheckSameOrigin(this, &aContent);
|
||||
if (rv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = NS_NewURI(getter_AddRefs(uri), aURI);
|
||||
if (rv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
rv = BindingManager()->RemoveLayeredBinding(&aContent, uri);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::LoadBindingDocument(const nsAString& aURI)
|
||||
{
|
||||
|
@ -834,34 +834,6 @@ nsBindingManager::GetSingleInsertionPoint(nsIContent* aParent,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsBindingManager::AddLayeredBinding(nsIContent* aContent, nsIURI* aURL,
|
||||
nsIPrincipal* aOriginPrincipal)
|
||||
{
|
||||
// First we need to load our binding.
|
||||
nsXBLService* xblService = nsXBLService::GetInstance();
|
||||
if (!xblService)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Load the bindings.
|
||||
nsRefPtr<nsXBLBinding> binding;
|
||||
bool dummy;
|
||||
xblService->LoadBindings(aContent, aURL, aOriginPrincipal, true,
|
||||
getter_AddRefs(binding), &dummy);
|
||||
if (binding) {
|
||||
AddToAttachedQueue(binding);
|
||||
ProcessAttachedQueue();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsBindingManager::RemoveLayeredBinding(nsIContent* aContent, nsIURI* aURL)
|
||||
{
|
||||
return ClearBinding(aContent);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsBindingManager::ClearBinding(nsIContent* aContent)
|
||||
{
|
||||
|
@ -157,10 +157,7 @@ public:
|
||||
nsIContent* GetNestedSingleInsertionPoint(nsIContent* aParent,
|
||||
bool* aMultipleInsertionPoints);
|
||||
|
||||
nsresult AddLayeredBinding(nsIContent* aContent, nsIURI* aURL,
|
||||
nsIPrincipal* aOriginPrincipal);
|
||||
nsresult ClearBinding(nsIContent* aContent);
|
||||
nsresult RemoveLayeredBinding(nsIContent* aContent, nsIURI* aURL);
|
||||
nsresult LoadBindingDocument(nsIDocument* aBoundDoc, nsIURI* aURL,
|
||||
nsIPrincipal* aOriginPrincipal);
|
||||
|
||||
|
@ -459,7 +459,7 @@ nsXBLService::IsChromeOrResourceURI(nsIURI* aURI)
|
||||
// onto the element.
|
||||
nsresult
|
||||
nsXBLService::LoadBindings(nsIContent* aContent, nsIURI* aURL,
|
||||
nsIPrincipal* aOriginPrincipal, bool aAugmentFlag,
|
||||
nsIPrincipal* aOriginPrincipal,
|
||||
nsXBLBinding** aBinding, bool* aResolveStyle)
|
||||
{
|
||||
NS_PRECONDITION(aOriginPrincipal, "Must have an origin principal");
|
||||
@ -482,7 +482,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, nsIURI* aURL,
|
||||
nsBindingManager *bindingManager = document->BindingManager();
|
||||
|
||||
nsXBLBinding *binding = bindingManager->GetBinding(aContent);
|
||||
if (binding && !aAugmentFlag) {
|
||||
if (binding) {
|
||||
nsXBLBinding *styleBinding = binding->GetFirstStyleBinding();
|
||||
if (styleBinding) {
|
||||
if (binding->MarkedForDeath()) {
|
||||
@ -520,22 +520,6 @@ nsXBLService::LoadBindings(nsIContent* aContent, nsIURI* aURL,
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
if (aAugmentFlag) {
|
||||
nsXBLBinding *baseBinding;
|
||||
nsXBLBinding *nextBinding = newBinding;
|
||||
do {
|
||||
baseBinding = nextBinding;
|
||||
nextBinding = baseBinding->GetBaseBinding();
|
||||
baseBinding->SetIsStyleBinding(false);
|
||||
} while (nextBinding);
|
||||
|
||||
// XXX Handle adjusting the prototype chain! We need to somehow indicate to
|
||||
// InstallImplementation that the whole chain should just be whacked and rebuilt.
|
||||
// We are becoming the new binding.
|
||||
baseBinding->SetBaseBinding(binding);
|
||||
bindingManager->SetBinding(aContent, newBinding);
|
||||
}
|
||||
else {
|
||||
// We loaded a style binding. It goes on the end.
|
||||
if (binding) {
|
||||
// Get the last binding that is in the append layer.
|
||||
@ -545,7 +529,6 @@ nsXBLService::LoadBindings(nsIContent* aContent, nsIURI* aURL,
|
||||
// Install the binding on the content node.
|
||||
bindingManager->SetBinding(aContent, newBinding);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
|
@ -47,7 +47,7 @@ class nsXBLService : public nsIObserver,
|
||||
// This function loads a particular XBL file and installs all of the bindings
|
||||
// onto the element. aOriginPrincipal must not be null here.
|
||||
nsresult LoadBindings(nsIContent* aContent, nsIURI* aURL,
|
||||
nsIPrincipal* aOriginPrincipal, bool aAugmentFlag,
|
||||
nsIPrincipal* aOriginPrincipal,
|
||||
nsXBLBinding** aBinding, bool* aResolveStyle);
|
||||
|
||||
// Indicates whether or not a binding is fully loaded.
|
||||
|
@ -147,7 +147,7 @@ nsXMLPrettyPrinter::PrettyPrint(nsIDocument* aDocument,
|
||||
// Load the bindings.
|
||||
nsRefPtr<nsXBLBinding> unused;
|
||||
bool ignored;
|
||||
rv = xblService->LoadBindings(rootCont, bindingUri, sysPrincipal, false,
|
||||
rv = xblService->LoadBindings(rootCont, bindingUri, sysPrincipal,
|
||||
getter_AddRefs(unused), &ignored);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -7598,8 +7598,7 @@ nsElementSH::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
NS_ENSURE_TRUE(xblService, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
nsRefPtr<nsXBLBinding> binding;
|
||||
xblService->LoadBindings(element, uri, principal, false,
|
||||
getter_AddRefs(binding), &dummy);
|
||||
xblService->LoadBindings(element, uri, principal, getter_AddRefs(binding), &dummy);
|
||||
|
||||
if (binding) {
|
||||
if (nsContentUtils::IsSafeToRunScript()) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "domstubs.idl"
|
||||
|
||||
[scriptable, uuid(1a38762b-4da5-4f61-80fb-9317e198cb92)]
|
||||
[scriptable, uuid(af628000-e3fa-40d2-9118-fbaa9f3ec6b9)]
|
||||
interface nsIDOMDocumentXBL : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -16,11 +16,6 @@ interface nsIDOMDocumentXBL : nsISupports
|
||||
in DOMString attrName,
|
||||
in DOMString attrValue);
|
||||
|
||||
void addBinding(in nsIDOMElement elt,
|
||||
in DOMString bindingURL);
|
||||
void removeBinding(in nsIDOMElement elt,
|
||||
in DOMString bindingURL);
|
||||
|
||||
nsIDOMElement getBindingParent(in nsIDOMNode node);
|
||||
void loadBindingDocument(in DOMString documentURL);
|
||||
};
|
||||
|
@ -390,10 +390,6 @@ partial interface Document {
|
||||
NodeList? getAnonymousNodes(Element elt);
|
||||
Element? getAnonymousElementByAttribute(Element elt, DOMString attrName,
|
||||
DOMString attrValue);
|
||||
[Throws]
|
||||
void addBinding(Element elt, DOMString bindingURL);
|
||||
[Throws]
|
||||
void removeBinding(Element elt, DOMString bindingURL);
|
||||
Element? getBindingParent(Node node);
|
||||
[Throws]
|
||||
void loadBindingDocument(DOMString documentURL);
|
||||
|
@ -2355,8 +2355,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
|
||||
nsRefPtr<nsXBLBinding> binding;
|
||||
rv = xblService->LoadBindings(aDocElement, display->mBinding->GetURI(),
|
||||
display->mBinding->mOriginPrincipal,
|
||||
false, getter_AddRefs(binding),
|
||||
&resolveStyle);
|
||||
getter_AddRefs(binding), &resolveStyle);
|
||||
if (NS_FAILED(rv) && rv != NS_ERROR_XBL_BLOCKED)
|
||||
return NS_OK; // Binding will load asynchronously.
|
||||
|
||||
@ -5161,7 +5160,6 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
||||
|
||||
nsresult rv = xblService->LoadBindings(aContent, display->mBinding->GetURI(),
|
||||
display->mBinding->mOriginPrincipal,
|
||||
false,
|
||||
getter_AddRefs(newPendingBinding->mBinding),
|
||||
&resolveStyle);
|
||||
if (NS_FAILED(rv) && rv != NS_ERROR_XBL_BLOCKED)
|
||||
|
Loading…
Reference in New Issue
Block a user