Bug 908576 part 7. Move the various DOMProxyHandler classes into the binding implementation files. r=smaug

This commit is contained in:
Boris Zbarsky 2013-08-23 22:42:42 -04:00
Родитель 1be13ddcad
Коммит 831b3fcdcf
10 изменённых файлов: 52 добавлений и 5 удалений

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

@ -7,6 +7,7 @@
#define _CANVASUTILS_H_
#include "mozilla/CheckedInt.h"
#include "jsapi.h"
class nsIPrincipal;

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

@ -21,6 +21,7 @@
#include "nsRefPtrHashtable.h"
#include "nsDataHashtable.h"
#include "nsAsyncDOMEvent.h"
#include "jsfriendapi.h" // For js::ExpandoAndGeneration
class nsIMutableArray;
class nsIURI;

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

@ -13,6 +13,7 @@
#include "nsString.h"
#include "nsWrapperCache.h"
#include "nsGenericHTMLElement.h"
#include "jsfriendapi.h" // For js::ExpandoAndGeneration
namespace mozilla {
class ErrorResult;

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

@ -9,6 +9,7 @@
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "jsdbgapi.h"
#include "jsfriendapi.h"
using namespace mozilla;

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

@ -7706,6 +7706,33 @@ class CGDOMJSProxyHandler(CGClass):
constructors=constructors,
methods=methods)
class CGDOMJSProxyHandlerDeclarer(CGThing):
"""
A class for declaring a DOMProxyHandler.
"""
def __init__(self, handlerThing):
self.handlerThing = handlerThing
def declare(self):
# Our class declaration should happen when we're defining
return ""
def define(self):
return self.handlerThing.declare()
class CGDOMJSProxyHandlerDefiner(CGThing):
"""
A class for defining a DOMProxyHandler.
"""
def __init__(self, handlerThing):
self.handlerThing = handlerThing
def declare(self):
return ""
def define(self):
return self.handlerThing.define()
def stripTrailingWhitespace(text):
tail = '\n' if text.endswith('\n') else ''
lines = text.splitlines()
@ -7873,10 +7900,12 @@ class CGDescriptor(CGThing):
if not descriptor.wrapperCache:
raise TypeError("We need a wrappercache to support expandos for proxy-based "
"bindings (" + descriptor.name + ")")
handlerThing = CGDOMJSProxyHandler(descriptor)
cgThings.append(CGDOMJSProxyHandlerDeclarer(handlerThing))
cgThings.append(CGProxyIsProxy(descriptor))
cgThings.append(CGProxyUnwrap(descriptor))
cgThings.append(CGDOMJSProxyHandlerDOMClass(descriptor))
cgThings.append(CGDOMJSProxyHandler(descriptor))
cgThings.append(CGDOMJSProxyHandlerDefiner(handlerThing))
else:
cgThings.append(CGDOMJSClass(descriptor))
cgThings.append(CGGetJSClassMethod(descriptor))
@ -8161,7 +8190,6 @@ if (""",
initializerCtor = ClassConstructor([],
bodyInHeader=True,
visibility="public",
body=(
"// Safe to pass a null context if we pass a null value\n"
@ -8593,6 +8621,7 @@ class CGBindingRoot(CGThing):
requiresPreferences = any(descriptorRequiresPreferences(d) for d in descriptors)
hasOwnedDescriptors = any(d.nativeOwnership == 'owned' for d in descriptors)
requiresContentUtils = any(d.interface.hasInterfaceObject() for d in descriptors)
hasProxies = any(d.concrete and d.proxy for d in descriptors)
def descriptorHasChromeOnly(desc):
return (any(isChromeOnly(a) for a in desc.interface.members) or
desc.interface.getExtendedAttribute("ChromeOnly") is not None or
@ -8696,7 +8725,9 @@ class CGBindingRoot(CGThing):
callbackDescriptors,
['mozilla/dom/BindingDeclarations.h',
'mozilla/ErrorResult.h',
'mozilla/dom/DOMJSProxyHandler.h'],
'jspubtd.h',
'js/RootingAPI.h',
],
['mozilla/dom/BindingUtils.h',
'mozilla/dom/Nullable.h',
'PrimitiveConversions.h',
@ -8709,6 +8740,7 @@ class CGBindingRoot(CGThing):
+ (['nsContentUtils.h'] if requiresContentUtils else [])
+ (['nsCxPusher.h'] if dictionaries else [])
+ (['AccessCheck.h'] if hasChromeOnly else [])
+ (['mozilla/dom/DOMJSProxyHandler.h'] if hasProxies else [])
+ (['xpcprivate.h'] if isEventTarget else [])
+ (['nsPIDOMWindow.h'] if len(jsImplemented) != 0 else [])
+ (['nsDOMQS.h'] if needsDOMQS["value"] else [])

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

@ -24,6 +24,7 @@
#include "nsDOMFile.h"
#include "nsProxyRelease.h"
#include "nsThreadUtils.h"
#include "jsapi.h"
#include "ContentChild.h"
#include "ContentParent.h"

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

@ -12,6 +12,7 @@
#include "mozilla/dom/XMLHttpRequestUploadBinding.h"
#include "mozilla/dom/WorkerLocationBinding.h"
#include "mozilla/dom/WorkerNavigatorBinding.h"
#include "jsfriendapi.h"
BEGIN_WORKERS_NAMESPACE

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

@ -9,7 +9,7 @@
*/
#include "nsNthIndexCache.h"
#include "nsIContent.h"
#include "mozilla/dom/Element.h"
nsNthIndexCache::nsNthIndexCache()
{

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

@ -5,7 +5,15 @@
#ifndef nsContentIndexCache_h__
#define nsContentIndexCache_h__
#include "mozilla/dom/Element.h"
#include "js/HashTable.h"
class nsIContent;
namespace mozilla {
namespace dom {
class Element;
} // namespace dom
} // namespace mozilla
/*
* A class that computes and caches the indices used for :nth-* pseudo-class

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

@ -35,6 +35,7 @@
#include "mozilla/ipc/URIUtils.h"
#include "nsPrintfCString.h"
#include "nsTHashtable.h"
#include "jsapi.h"
// Initial size for the cache holding visited status observers.
#define VISIT_OBSERVERS_INITIAL_CACHE_SIZE 128