зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central into build-system
dom/interfaces/svg/Makefile.in and dom/media/Makefile.in had merge conflicts. They were resolved by hand. The former needed 2 IDLs removed. The latter had a context conflict for EXPORTS_NAMESPACES.
This commit is contained in:
Коммит
de55b5242b
2
CLOBBER
2
CLOBBER
|
@ -15,4 +15,4 @@
|
|||
#
|
||||
# Note: The description below will be part of the error message shown to users.
|
||||
#
|
||||
Bug 847120 needs a clobber
|
||||
Bug 825341 appears to need a clobber
|
||||
|
|
|
@ -235,6 +235,7 @@ HyperTextAccessible::GetPosAndText(int32_t& aStartOffset, int32_t& aEndOffset,
|
|||
}
|
||||
|
||||
nsIFrame *startFrame = nullptr;
|
||||
nsIFrame* endFrame = nullptr;
|
||||
if (aEndFrame) {
|
||||
*aEndFrame = nullptr;
|
||||
}
|
||||
|
@ -264,6 +265,7 @@ HyperTextAccessible::GetPosAndText(int32_t& aStartOffset, int32_t& aEndOffset,
|
|||
continue;
|
||||
}
|
||||
nsIFrame *primaryFrame = frame;
|
||||
endFrame = frame;
|
||||
if (nsAccUtils::IsText(childAcc)) {
|
||||
// We only need info up to rendered offset -- that is what we're
|
||||
// converting to content offset
|
||||
|
@ -389,9 +391,9 @@ HyperTextAccessible::GetPosAndText(int32_t& aStartOffset, int32_t& aEndOffset,
|
|||
NS_IF_ADDREF(*aStartAcc = lastAccessible);
|
||||
}
|
||||
if (aEndFrame && !*aEndFrame) {
|
||||
*aEndFrame = startFrame;
|
||||
if (aStartAcc && aEndAcc)
|
||||
NS_IF_ADDREF(*aEndAcc = *aStartAcc);
|
||||
*aEndFrame = endFrame;
|
||||
if (aEndAcc && !*aEndAcc)
|
||||
NS_IF_ADDREF(*aEndAcc = lastAccessible);
|
||||
}
|
||||
|
||||
return startFrame;
|
||||
|
@ -1824,7 +1826,7 @@ HyperTextAccessible::SetSelectionBounds(int32_t aSelectionNum,
|
|||
|
||||
nsRefPtr<nsRange> range;
|
||||
if (aSelectionNum == rangeCount)
|
||||
range = new nsRange();
|
||||
range = new nsRange(mContent);
|
||||
else
|
||||
range = domSel->GetRangeAt(aSelectionNum);
|
||||
|
||||
|
@ -1886,7 +1888,7 @@ HyperTextAccessible::ScrollSubstringTo(int32_t aStartIndex, int32_t aEndIndex,
|
|||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsRefPtr<nsRange> range = new nsRange();
|
||||
nsRefPtr<nsRange> range = new nsRange(mContent);
|
||||
nsresult rv = HypertextOffsetsToDOMRange(aStartIndex, aEndIndex, range);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1910,7 +1912,7 @@ HyperTextAccessible::ScrollSubstringToPoint(int32_t aStartIndex,
|
|||
nsIntPoint coords = nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType,
|
||||
this);
|
||||
|
||||
nsRefPtr<nsRange> range = new nsRange();
|
||||
nsRefPtr<nsRange> range = new nsRange(mContent);
|
||||
nsresult rv = HypertextOffsetsToDOMRange(aStartIndex, aEndIndex, range);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ TextLeafAccessibleWrap::scrollToSubstring(
|
|||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
|
||||
nsRefPtr<nsRange> range = new nsRange();
|
||||
nsRefPtr<nsRange> range = new nsRange(mContent);
|
||||
if (NS_FAILED(range->SetStart(mContent, aStartIndex)))
|
||||
return E_FAIL;
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
|
|||
|
||||
<script type="application/javascript">
|
||||
if (navigator.platform.startsWith("Mac")) {
|
||||
SimpleTest.expectAssertions(0, 3);
|
||||
SimpleTest.expectAssertions(0, 1);
|
||||
} else {
|
||||
SimpleTest.expectAssertions(3);
|
||||
SimpleTest.expectAssertions(1);
|
||||
}
|
||||
|
||||
function addTestEditable(aID, aTestRun, aTrailChar)
|
||||
|
|
|
@ -74,6 +74,15 @@
|
|||
testCharacterCount(IDs, 5);
|
||||
testText(IDs, 0, 5, "1.foo");
|
||||
|
||||
testText(["testbr"], 0, 4, "foo\n");
|
||||
|
||||
testTextAtOffset(2, nsIAccessibleText.BOUNDARY_CHAR, "o", 2, 3, "testbr",
|
||||
kOk, kOk, kOk);
|
||||
testTextAtOffset(2, nsIAccessibleText.BOUNDARY_WORD_START, "foo\n", 0, 4,
|
||||
"testbr", kTodo, kOk, kTodo);
|
||||
testTextBeforeOffset(2, nsIAccessibleText.BOUNDARY_LINE_START, "foo\n",
|
||||
0, 4, "testbr", kTodo, kOk, kTodo);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -122,5 +131,7 @@
|
|||
<h6 role="presentation" class="gencontent">heading</h6>
|
||||
</div>
|
||||
|
||||
<div id="testbr">foo<br/></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -396,7 +396,7 @@ pref("dom.mozAlarms.enabled", true);
|
|||
// NetworkStats
|
||||
#ifdef MOZ_B2G_RIL
|
||||
pref("dom.mozNetworkStats.enabled", true);
|
||||
pref("ril.lastKnownMcc", 724);
|
||||
pref("ril.lastKnownMcc", "724");
|
||||
#endif
|
||||
|
||||
// WebSettings
|
||||
|
|
|
@ -66,6 +66,9 @@ var gPermissionManager = {
|
|||
case nsIPermissionManager.DENY_ACTION:
|
||||
stringKey = "cannot";
|
||||
break;
|
||||
case nsICookiePermission.ACCESS_ALLOW_FIRST_PARTY_ONLY:
|
||||
stringKey = "canAccessFirstParty";
|
||||
break;
|
||||
case nsICookiePermission.ACCESS_SESSION:
|
||||
stringKey = "canSession";
|
||||
break;
|
||||
|
|
|
@ -20,7 +20,7 @@ function test() {
|
|||
//ss.currentEngine = engine;
|
||||
break;
|
||||
case "engine-current":
|
||||
ok(ss.currentEngine.name == ENGINE_NAME, "currentEngine set");
|
||||
is(ss.currentEngine.name, ENGINE_NAME, "currentEngine set");
|
||||
startTest();
|
||||
break;
|
||||
case "engine-removed":
|
||||
|
@ -40,16 +40,16 @@ function test() {
|
|||
ok(contextMenu, "Got context menu XUL");
|
||||
|
||||
doOnloadOnce(testContextMenu);
|
||||
var tab = gBrowser.addTab("data:text/plain,test%20search");
|
||||
var tab = gBrowser.addTab("data:text/plain;charset=utf8,test%20search");
|
||||
gBrowser.selectedTab = tab;
|
||||
}
|
||||
|
||||
function testContextMenu() {
|
||||
function rightClickOnDocument(){
|
||||
function rightClickOnDocument() {
|
||||
waitForBrowserContextMenu(checkContextMenu);
|
||||
var clickTarget = content.document.body;
|
||||
var eventDetails = { type: "contextmenu", button: 2 };
|
||||
EventUtils.synthesizeMouseAtCenter(clickTarget, eventDetails, content);
|
||||
SimpleTest.executeSoon(checkContextMenu);
|
||||
}
|
||||
|
||||
// check the search menu item and then perform a search
|
||||
|
|
|
@ -17,3 +17,16 @@ function isSubObjectOf(expectedObj, actualObj, name) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function waitForPopupShown(aPopupId, aCallback) {
|
||||
let popup = document.getElementById(aPopupId);
|
||||
function onPopupShown() {
|
||||
popup.removeEventListener("popupshown", onPopupShown);
|
||||
SimpleTest.executeSoon(aCallback);
|
||||
}
|
||||
popup.addEventListener("popupshown", onPopupShown);
|
||||
}
|
||||
|
||||
function waitForBrowserContextMenu(aCallback) {
|
||||
waitForPopupShown(gBrowser.selectedBrowser.contextMenu, aCallback);
|
||||
}
|
||||
|
|
|
@ -88,6 +88,7 @@ forSecureOnly=Encrypted connections only
|
|||
forAnyConnection=Any type of connection
|
||||
expireAtEndOfSession=At end of session
|
||||
can=Allow
|
||||
canAccessFirstParty=Allow first party only
|
||||
canSession=Allow for Session
|
||||
cannot=Block
|
||||
noCookieSelected=<no cookie selected>
|
||||
|
@ -130,4 +131,4 @@ syncUnlinkConfirm.label=Unlink
|
|||
# LOCALIZATION NOTE (featureEnableRequiresRestart, featureDisableRequiresRestart, restartTitle): %S = brandShortName
|
||||
featureEnableRequiresRestart=%S must restart to enable this feature.
|
||||
featureDisableRequiresRestart=%S must restart to disable this feature.
|
||||
shouldRestartTitle=Restart %S
|
||||
shouldRestartTitle=Restart %S
|
||||
|
|
|
@ -39,17 +39,20 @@ ContentPermissionPrompt.prototype = {
|
|||
return chromeWin;
|
||||
},
|
||||
|
||||
getChromeWindowForRequest: function getChromeWindowForRequest(aRequest) {
|
||||
if (aRequest.window)
|
||||
return this.getChromeWindow(aRequest.window.top).wrappedJSObject;
|
||||
return aRequest.element.ownerDocument.defaultView;
|
||||
},
|
||||
|
||||
getNotificationBoxForRequest: function getNotificationBoxForRequest(request) {
|
||||
let notificationBox = null;
|
||||
let chromeWin = this.getChromeWindowForRequest(request);
|
||||
if (request.window) {
|
||||
let requestingWindow = request.window.top;
|
||||
let chromeWin = this.getChromeWindow(requestingWindow).wrappedJSObject;
|
||||
let windowID = request.window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
|
||||
let browser = chromeWin.Browser.getBrowserForWindowId(windowID);
|
||||
return chromeWin.getNotificationBox(browser);
|
||||
}
|
||||
|
||||
let chromeWin = request.element.ownerDocument.defaultView;
|
||||
return chromeWin.Browser.getNotificationBox(request.element);
|
||||
},
|
||||
|
||||
|
@ -113,6 +116,20 @@ ContentPermissionPrompt.prototype = {
|
|||
icon,
|
||||
notificationBox.PRIORITY_WARNING_MEDIUM,
|
||||
buttons);
|
||||
|
||||
if (request.type == "geolocation") {
|
||||
// Add the "learn more" link.
|
||||
let link = newBar.ownerDocument.createElement("label");
|
||||
link.setAttribute("value", browserBundle.GetStringFromName("geolocation.learnMore"));
|
||||
link.setAttribute("class", "text-link notification-link");
|
||||
newBar.insertBefore(link, newBar.firstChild);
|
||||
|
||||
let win = this.getChromeWindowForRequest(request);
|
||||
link.addEventListener("click", function() {
|
||||
let url = Services.urlFormatter.formatURLPref("browser.geolocation.warning.infoURL");
|
||||
win.BrowserUI.newTab(url, win.Browser.selectedTab);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ contentPermissions.neverForSite=Never for this Site
|
|||
geolocation2.allow=Share Location
|
||||
geolocation2.wantsTo=Share your location with %S?
|
||||
|
||||
geolocation.learnMore=Learn more…
|
||||
|
||||
# Error Console
|
||||
typeError=Error:
|
||||
typeWarning=Warning:
|
||||
|
|
|
@ -644,11 +644,6 @@ flyoutpanel > settings:first-child {
|
|||
background-position: right bottom;
|
||||
}
|
||||
|
||||
#about-flyoutpanel label.text-link {
|
||||
text-decoration: none;
|
||||
color: #1167bd;
|
||||
}
|
||||
|
||||
#about-product-label {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
font-size: @font_normal@;
|
||||
}
|
||||
|
||||
.text-link {
|
||||
text-decoration: none;
|
||||
color: #1167bd;
|
||||
}
|
||||
|
||||
textbox,
|
||||
menulist {
|
||||
-moz-appearance: none;
|
||||
|
@ -44,7 +49,6 @@ menulist:not([disabled]):hover:active {
|
|||
background: @field_foreground_color@;
|
||||
}
|
||||
|
||||
|
||||
/* Button ------------------------------------------------------------------ */
|
||||
|
||||
button {
|
||||
|
@ -433,6 +437,11 @@ notification {
|
|||
-moz-image-region: rect(0, 120px, 40px, 80px);
|
||||
}
|
||||
|
||||
.notification-link {
|
||||
/* Make the link take up all the space before the buttons. */
|
||||
-moz-box-flex: 9999;
|
||||
}
|
||||
|
||||
|
||||
/* Rich Grid ---------------------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -468,6 +468,7 @@ user_pref("test.mousescroll", true);
|
|||
user_pref("security.default_personal_cert", "Select Automatically"); // Need to client auth test be w/o any dialogs
|
||||
user_pref("network.http.prompt-temp-redirect", false);
|
||||
user_pref("media.cache_size", 100);
|
||||
user_pref("media.volume_scale", "0.01");
|
||||
user_pref("security.warn_viewing_mixed", false);
|
||||
user_pref("app.update.enabled", false);
|
||||
user_pref("app.update.staging.enabled", false);
|
||||
|
|
|
@ -8279,6 +8279,9 @@ if test "$MOZ_ENABLE_SKIA"; then
|
|||
AC_DEFINE(USE_SKIA)
|
||||
if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
|
||||
AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
|
||||
elif test "$OS_ARCH" = "WINNT"; then
|
||||
AC_DEFINE(SKIA_DLL)
|
||||
AC_DEFINE(GR_DLL)
|
||||
fi
|
||||
else
|
||||
MOZ_SKIA_LIBS=
|
||||
|
|
|
@ -887,8 +887,8 @@ public:
|
|||
nsIDOMHTMLCollection** aResult);
|
||||
void GetClassList(nsISupports** aClassList);
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *aCx, JSObject *aScope,
|
||||
bool *aTriedToWrap) MOZ_FINAL;
|
||||
virtual JSObject* WrapObject(JSContext *aCx,
|
||||
JSObject *aScope) MOZ_FINAL MOZ_OVERRIDE;
|
||||
|
||||
/**
|
||||
* Locate an nsIEditor rooted at this content node, if there is one.
|
||||
|
|
|
@ -54,8 +54,7 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsChildContentList)
|
||||
|
||||
// nsWrapperCache
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
// nsIDOMNodeList interface
|
||||
NS_DECL_NSIDOMNODELIST
|
||||
|
|
|
@ -112,6 +112,7 @@ namespace layers {
|
|||
} // namespace layers
|
||||
|
||||
namespace dom {
|
||||
class DocumentFragment;
|
||||
class Element;
|
||||
} // namespace dom
|
||||
|
||||
|
@ -366,6 +367,7 @@ public:
|
|||
|
||||
// Check if the (JS) caller can access aNode.
|
||||
static bool CanCallerAccess(nsIDOMNode *aNode);
|
||||
static bool CanCallerAccess(nsINode* aNode);
|
||||
|
||||
// Check if the (JS) caller can access aWindow.
|
||||
// aWindow can be either outer or inner window.
|
||||
|
@ -1084,6 +1086,10 @@ public:
|
|||
const nsAString& aFragment,
|
||||
bool aPreventScriptExecution,
|
||||
nsIDOMDocumentFragment** aReturn);
|
||||
static already_AddRefed<mozilla::dom::DocumentFragment>
|
||||
CreateContextualFragment(nsINode* aContextNode, const nsAString& aFragment,
|
||||
bool aPreventScriptExecution,
|
||||
mozilla::ErrorResult& aRv);
|
||||
|
||||
/**
|
||||
* Invoke the fragment parsing algorithm (innerHTML) using the HTML parser.
|
||||
|
|
|
@ -437,8 +437,7 @@ public:
|
|||
|
||||
NS_DECL_NSIDOMFILELIST
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
nsISupports* GetParentObject()
|
||||
{
|
||||
|
|
|
@ -2472,6 +2472,10 @@ nsresult
|
|||
NS_NewVideoDocument(nsIDocument** aInstancePtrResult);
|
||||
#endif
|
||||
|
||||
already_AddRefed<mozilla::dom::DocumentFragment>
|
||||
NS_NewDocumentFragment(nsNodeInfoManager* aNodeInfoManager,
|
||||
mozilla::ErrorResult& aRv);
|
||||
|
||||
nsresult
|
||||
NS_NewDocumentFragment(nsIDOMDocumentFragment** aInstancePtrResult,
|
||||
nsNodeInfoManager *aNodeInfoManager);
|
||||
|
|
|
@ -379,8 +379,7 @@ public:
|
|||
*/
|
||||
virtual bool IsNodeOfType(uint32_t aFlags) const = 0;
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *aCx, JSObject *aScope,
|
||||
bool *aTriedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *aCx, JSObject *aScope) MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -388,11 +387,9 @@ protected:
|
|||
* does some additional checks and fix-up that's common to all nodes. WrapNode
|
||||
* should just call the DOM binding's Wrap function.
|
||||
*/
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
|
||||
bool *aTriedToWrap)
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope)
|
||||
{
|
||||
MOZ_ASSERT(!IsDOMBinding(), "Someone forgot to override WrapNode");
|
||||
*aTriedToWrap = false;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ interface nsIURI;
|
|||
* interface to mirror this interface when changing it.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(e9102696-4bb4-4a98-a31f-be9da5a3d18e)]
|
||||
[scriptable, uuid(b6c5ae8a-5e30-41f1-975a-be73cd6f71db)]
|
||||
interface nsIObjectLoadingContent : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -165,6 +165,12 @@ interface nsIObjectLoadingContent : nsISupports
|
|||
|
||||
readonly attribute unsigned long pluginFallbackType;
|
||||
|
||||
/**
|
||||
* If this object currently owns a running plugin, regardless of whether or
|
||||
* not one is pending spawn/despawn.
|
||||
*/
|
||||
readonly attribute bool hasRunningPlugin;
|
||||
|
||||
/**
|
||||
* This method will disable the play-preview plugin state.
|
||||
*/
|
||||
|
|
|
@ -82,9 +82,9 @@ Comment::List(FILE* out, int32_t aIndent) const
|
|||
#endif
|
||||
|
||||
JSObject*
|
||||
Comment::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
|
||||
Comment::WrapNode(JSContext *aCx, JSObject *aScope)
|
||||
{
|
||||
return CommentBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
return CommentBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -54,8 +54,7 @@ public:
|
|||
#endif
|
||||
|
||||
protected:
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
|
||||
bool *aTriedToWrap) MOZ_OVERRIDE;
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -25,10 +25,9 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMImplementation)
|
|||
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMImplementation)
|
||||
|
||||
JSObject*
|
||||
DOMImplementation::WrapObject(JSContext* aCx, JSObject* aScope,
|
||||
bool* aTriedToWrap)
|
||||
DOMImplementation::WrapObject(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return DOMImplementationBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
return DOMImplementationBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -52,8 +52,7 @@ public:
|
|||
return mOwner;
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope,
|
||||
bool* aTriedToWrap) MOZ_OVERRIDE;
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
|
||||
|
||||
bool HasFeature(const nsAString& aFeature, const nsAString& aVersion);
|
||||
|
||||
|
|
|
@ -21,21 +21,34 @@
|
|||
nsresult
|
||||
NS_NewDocumentFragment(nsIDOMDocumentFragment** aInstancePtrResult,
|
||||
nsNodeInfoManager *aNodeInfoManager)
|
||||
{
|
||||
mozilla::ErrorResult rv;
|
||||
*aInstancePtrResult = NS_NewDocumentFragment(aNodeInfoManager, rv).get();
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
already_AddRefed<mozilla::dom::DocumentFragment>
|
||||
NS_NewDocumentFragment(nsNodeInfoManager* aNodeInfoManager,
|
||||
mozilla::ErrorResult& aRv)
|
||||
{
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_ENSURE_ARG(aNodeInfoManager);
|
||||
if (!aNodeInfoManager) {
|
||||
aRv.Throw(NS_ERROR_INVALID_ARG);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = aNodeInfoManager->GetNodeInfo(nsGkAtoms::documentFragmentNodeName,
|
||||
nullptr, kNameSpaceID_None,
|
||||
nsIDOMNode::DOCUMENT_FRAGMENT_NODE);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo =
|
||||
aNodeInfoManager->GetNodeInfo(nsGkAtoms::documentFragmentNodeName,
|
||||
nullptr, kNameSpaceID_None,
|
||||
nsIDOMNode::DOCUMENT_FRAGMENT_NODE);
|
||||
if (!nodeInfo) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DocumentFragment *it = new DocumentFragment(nodeInfo.forget());
|
||||
NS_ADDREF(*aInstancePtrResult = it);
|
||||
|
||||
return NS_OK;
|
||||
nsRefPtr<DocumentFragment> it = new DocumentFragment(nodeInfo.forget());
|
||||
return it.forget();
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -54,9 +67,9 @@ DocumentFragment::DocumentFragment(already_AddRefed<nsINodeInfo> aNodeInfo)
|
|||
}
|
||||
|
||||
JSObject*
|
||||
DocumentFragment::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
|
||||
DocumentFragment::WrapNode(JSContext *aCx, JSObject *aScope)
|
||||
{
|
||||
return DocumentFragmentBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
return DocumentFragmentBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -41,8 +41,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
|
||||
bool *aTriedToWrap);
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope) MOZ_OVERRIDE;
|
||||
|
||||
// nsIContent
|
||||
virtual already_AddRefed<nsINodeInfo>
|
||||
|
|
|
@ -64,9 +64,9 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
|
||||
JSObject*
|
||||
DocumentType::WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap)
|
||||
DocumentType::WrapNode(JSContext *cx, JSObject *scope)
|
||||
{
|
||||
return DocumentTypeBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
return DocumentTypeBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
DocumentType::DocumentType(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
|
||||
protected:
|
||||
virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap) MOZ_OVERRIDE;
|
||||
virtual JSObject* WrapNode(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
nsString mPublicId;
|
||||
nsString mSystemId;
|
||||
|
|
|
@ -339,10 +339,9 @@ Element::GetBindingURL(nsIDocument *aDocument, css::URLValue **aResult)
|
|||
}
|
||||
|
||||
JSObject*
|
||||
Element::WrapObject(JSContext *aCx, JSObject *aScope,
|
||||
bool *aTriedToWrap)
|
||||
Element::WrapObject(JSContext *aCx, JSObject *aScope)
|
||||
{
|
||||
JSObject* obj = nsINode::WrapObject(aCx, aScope, aTriedToWrap);
|
||||
JSObject* obj = nsINode::WrapObject(aCx, aScope);
|
||||
if (!obj) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -278,9 +278,9 @@ EventSource::Init(nsISupports* aOwner,
|
|||
}
|
||||
|
||||
/* virtual */ JSObject*
|
||||
EventSource::WrapObject(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap)
|
||||
EventSource::WrapObject(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return EventSourceBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
return EventSourceBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<EventSource>
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
|
||||
// nsWrapperCache
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap) MOZ_OVERRIDE;
|
||||
WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
|
||||
|
||||
// WebIDL
|
||||
nsPIDOMWindow*
|
||||
|
|
|
@ -381,10 +381,9 @@ NS_INTERFACE_TABLE_HEAD(nsChildContentList)
|
|||
NS_INTERFACE_MAP_END
|
||||
|
||||
JSObject*
|
||||
nsChildContentList::WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap)
|
||||
nsChildContentList::WrapObject(JSContext *cx, JSObject *scope)
|
||||
{
|
||||
return NodeListBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
return NodeListBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -476,9 +476,9 @@ WebSocket::~WebSocket()
|
|||
}
|
||||
|
||||
JSObject*
|
||||
WebSocket::WrapObject(JSContext* cx, JSObject* scope, bool* triedToWrap)
|
||||
WebSocket::WrapObject(JSContext* cx, JSObject* scope)
|
||||
{
|
||||
return WebSocketBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
return WebSocketBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -86,9 +86,7 @@ public:
|
|||
// nsWrapperCache
|
||||
nsPIDOMWindow* GetParentObject() { return GetOwner(); }
|
||||
|
||||
JSObject* WrapObject(JSContext *cx,
|
||||
JSObject *scope,
|
||||
bool *triedToWrap);
|
||||
JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
public: // static helpers:
|
||||
|
||||
|
|
|
@ -155,10 +155,9 @@ NS_IMPL_ADDREF_INHERITED(nsSimpleContentList, nsBaseContentList)
|
|||
NS_IMPL_RELEASE_INHERITED(nsSimpleContentList, nsBaseContentList)
|
||||
|
||||
JSObject*
|
||||
nsSimpleContentList::WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap)
|
||||
nsSimpleContentList::WrapObject(JSContext *cx, JSObject *scope)
|
||||
{
|
||||
return NodeListBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
return NodeListBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
// nsFormContentList
|
||||
|
@ -289,18 +288,16 @@ const nsCacheableFuncStringContentList::ContentListType
|
|||
#endif
|
||||
|
||||
JSObject*
|
||||
nsCacheableFuncStringNodeList::WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap)
|
||||
nsCacheableFuncStringNodeList::WrapObject(JSContext *cx, JSObject *scope)
|
||||
{
|
||||
return NodeListBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
return NodeListBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
|
||||
JSObject*
|
||||
nsCacheableFuncStringHTMLCollection::WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap)
|
||||
nsCacheableFuncStringHTMLCollection::WrapObject(JSContext *cx, JSObject *scope)
|
||||
{
|
||||
return HTMLCollectionBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
return HTMLCollectionBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
// Hashtable for storing nsCacheableFuncStringContentList
|
||||
|
@ -516,9 +513,9 @@ nsContentList::~nsContentList()
|
|||
}
|
||||
|
||||
JSObject*
|
||||
nsContentList::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap)
|
||||
nsContentList::WrapObject(JSContext *cx, JSObject *scope)
|
||||
{
|
||||
return HTMLCollectionBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
return HTMLCollectionBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED3(nsContentList, nsBaseContentList,
|
||||
|
|
|
@ -105,8 +105,8 @@ public:
|
|||
|
||||
virtual int32_t IndexOf(nsIContent *aContent, bool aDoFlush);
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap) = 0;
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope)
|
||||
MOZ_OVERRIDE = 0;
|
||||
|
||||
protected:
|
||||
nsTArray< nsCOMPtr<nsIContent> > mElements;
|
||||
|
@ -129,8 +129,7 @@ public:
|
|||
{
|
||||
return mRoot;
|
||||
}
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
// This has to be a strong reference, the root might go away before the list.
|
||||
|
@ -261,8 +260,7 @@ public:
|
|||
|
||||
// nsWrapperCache
|
||||
using nsWrapperCache::GetWrapperPreserveColor;
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
// nsIDOMHTMLCollection
|
||||
NS_DECL_NSIDOMHTMLCOLLECTION
|
||||
|
@ -539,8 +537,7 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
#ifdef DEBUG
|
||||
static const ContentListType sType;
|
||||
|
@ -564,8 +561,7 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
#ifdef DEBUG
|
||||
static const ContentListType sType;
|
||||
|
|
|
@ -168,6 +168,7 @@
|
|||
#include "nsSVGFeatures.h"
|
||||
#include "MediaDecoder.h"
|
||||
#include "DecoderTraits.h"
|
||||
#include "mozilla/dom/DocumentFragment.h"
|
||||
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#include "nsViewportInfo.h"
|
||||
|
@ -1588,6 +1589,15 @@ nsContentUtils::CanCallerAccess(nsIPrincipal* aSubjectPrincipal,
|
|||
// static
|
||||
bool
|
||||
nsContentUtils::CanCallerAccess(nsIDOMNode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
NS_ENSURE_TRUE(node, false);
|
||||
return CanCallerAccess(node);
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
nsContentUtils::CanCallerAccess(nsINode* aNode)
|
||||
{
|
||||
// XXXbz why not check the IsCapabilityEnabled thing up front, and not bother
|
||||
// with the system principal games? But really, there should be a simpler
|
||||
|
@ -1602,10 +1612,7 @@ nsContentUtils::CanCallerAccess(nsIDOMNode *aNode)
|
|||
return true;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
NS_ENSURE_TRUE(node, false);
|
||||
|
||||
return CanCallerAccess(subjectPrincipal, node->NodePrincipal());
|
||||
return CanCallerAccess(subjectPrincipal, aNode->NodePrincipal());
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -4045,8 +4052,22 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
|
|||
bool aPreventScriptExecution,
|
||||
nsIDOMDocumentFragment** aReturn)
|
||||
{
|
||||
*aReturn = nullptr;
|
||||
NS_ENSURE_ARG(aContextNode);
|
||||
ErrorResult rv;
|
||||
*aReturn = CreateContextualFragment(aContextNode, aFragment,
|
||||
aPreventScriptExecution, rv).get();
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
already_AddRefed<DocumentFragment>
|
||||
nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
|
||||
const nsAString& aFragment,
|
||||
bool aPreventScriptExecution,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (!aContextNode) {
|
||||
aRv.Throw(NS_ERROR_INVALID_ARG);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// If we don't have a document here, we can't get the right security context
|
||||
// for compiling event handlers... so just bail out.
|
||||
|
@ -4058,8 +4079,8 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
|
|||
#endif
|
||||
|
||||
if (isHTML) {
|
||||
nsCOMPtr<nsIDOMDocumentFragment> frag;
|
||||
NS_NewDocumentFragment(getter_AddRefs(frag), document->NodeInfoManager());
|
||||
nsRefPtr<DocumentFragment> frag =
|
||||
NS_NewDocumentFragment(document->NodeInfoManager(), aRv);
|
||||
|
||||
nsCOMPtr<nsIContent> contextAsContent = do_QueryInterface(aContextNode);
|
||||
if (contextAsContent && !contextAsContent->IsElement()) {
|
||||
|
@ -4070,28 +4091,23 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
|
|||
}
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIContent> fragment = do_QueryInterface(frag);
|
||||
if (contextAsContent && !contextAsContent->IsHTML(nsGkAtoms::html)) {
|
||||
rv = ParseFragmentHTML(aFragment,
|
||||
fragment,
|
||||
contextAsContent->Tag(),
|
||||
contextAsContent->GetNameSpaceID(),
|
||||
(document->GetCompatibilityMode() ==
|
||||
aRv = ParseFragmentHTML(aFragment, frag,
|
||||
contextAsContent->Tag(),
|
||||
contextAsContent->GetNameSpaceID(),
|
||||
(document->GetCompatibilityMode() ==
|
||||
eCompatibility_NavQuirks),
|
||||
aPreventScriptExecution);
|
||||
aPreventScriptExecution);
|
||||
} else {
|
||||
rv = ParseFragmentHTML(aFragment,
|
||||
fragment,
|
||||
nsGkAtoms::body,
|
||||
kNameSpaceID_XHTML,
|
||||
(document->GetCompatibilityMode() ==
|
||||
aRv = ParseFragmentHTML(aFragment, frag,
|
||||
nsGkAtoms::body,
|
||||
kNameSpaceID_XHTML,
|
||||
(document->GetCompatibilityMode() ==
|
||||
eCompatibility_NavQuirks),
|
||||
aPreventScriptExecution);
|
||||
aPreventScriptExecution);
|
||||
}
|
||||
|
||||
frag.forget(aReturn);
|
||||
return rv;
|
||||
return frag.forget();
|
||||
}
|
||||
|
||||
nsAutoTArray<nsString, 32> tagStack;
|
||||
|
@ -4103,7 +4119,10 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
|
|||
|
||||
while (content && content->IsElement()) {
|
||||
nsString& tagName = *tagStack.AppendElement();
|
||||
NS_ENSURE_TRUE(&tagName, NS_ERROR_OUT_OF_MEMORY);
|
||||
if (!&tagName) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
tagName = content->NodeInfo()->QualifiedName();
|
||||
|
||||
|
@ -4149,11 +4168,10 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
|
|||
content = content->GetParent();
|
||||
}
|
||||
|
||||
return ParseFragmentXML(aFragment,
|
||||
document,
|
||||
tagStack,
|
||||
aPreventScriptExecution,
|
||||
aReturn);
|
||||
nsCOMPtr<nsIDOMDocumentFragment> frag;
|
||||
aRv = ParseFragmentXML(aFragment, document, tagStack,
|
||||
aPreventScriptExecution, getter_AddRefs(frag));
|
||||
return static_cast<DocumentFragment*>(frag.forget().get());
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -294,7 +294,7 @@ nsCopySupport::GetTransferableForNode(nsINode* aNode,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aNode);
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_FAILURE);
|
||||
nsRefPtr<nsRange> range = new nsRange();
|
||||
nsRefPtr<nsRange> range = new nsRange(aNode);
|
||||
rv = range->SelectNode(node);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = selection->AddRange(range);
|
||||
|
|
|
@ -22,10 +22,9 @@ nsINode* nsDOMCaretPosition::GetOffsetNode() const
|
|||
}
|
||||
|
||||
JSObject*
|
||||
nsDOMCaretPosition::WrapObject(JSContext *aCx, JSObject *aScope,
|
||||
bool *aTried)
|
||||
nsDOMCaretPosition::WrapObject(JSContext *aCx, JSObject *aScope)
|
||||
{
|
||||
return mozilla::dom::CaretPositionBinding::Wrap(aCx, aScope, this, aTried);
|
||||
return mozilla::dom::CaretPositionBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(nsDOMCaretPosition, mOffsetNode)
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
return GetOffsetNode();
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *aCx, JSObject *aScope, bool *aTried)
|
||||
virtual JSObject* WrapObject(JSContext *aCx, JSObject *aScope)
|
||||
MOZ_OVERRIDE MOZ_FINAL;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -741,10 +741,9 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMFileList)
|
|||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMFileList)
|
||||
|
||||
JSObject*
|
||||
nsDOMFileList::WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap)
|
||||
nsDOMFileList::WrapObject(JSContext *cx, JSObject *scope)
|
||||
{
|
||||
return FileListBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
return FileListBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -44,11 +44,9 @@ public:
|
|||
return mOwner;
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope,
|
||||
bool* aTriedToWrap)
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::MutationRecordBinding::Wrap(aCx, aScope, this,
|
||||
aTriedToWrap);
|
||||
return mozilla::dom::MutationRecordBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
@ -359,11 +357,9 @@ public:
|
|||
mozilla::dom::MutationCallback& aCb,
|
||||
mozilla::ErrorResult& aRv);
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope,
|
||||
bool* aTriedToWrap)
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::MutationObserverBinding::Wrap(aCx, aScope,
|
||||
this, aTriedToWrap);
|
||||
return mozilla::dom::MutationObserverBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
nsISupports* GetParentObject() const
|
||||
|
|
|
@ -67,11 +67,9 @@ public:
|
|||
return mOwner;
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope,
|
||||
bool* aTriedToWrap) MOZ_OVERRIDE
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::DOMParserBinding::Wrap(aCx, aScope, this,
|
||||
aTriedToWrap);
|
||||
return mozilla::dom::DOMParserBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -49,11 +49,9 @@ public:
|
|||
return mOwner;
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope,
|
||||
bool* aTriedToWrap) MOZ_OVERRIDE
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::XMLSerializerBinding::Wrap(aCx, aScope, this,
|
||||
aTriedToWrap);
|
||||
return mozilla::dom::XMLSerializerBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -21,9 +21,7 @@ nsDOMSettableTokenList::SetValue(const nsAString& aValue, mozilla::ErrorResult&
|
|||
}
|
||||
|
||||
JSObject*
|
||||
nsDOMSettableTokenList::WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap)
|
||||
nsDOMSettableTokenList::WrapObject(JSContext *cx, JSObject *scope)
|
||||
{
|
||||
return mozilla::dom::DOMSettableTokenListBinding::Wrap(cx, scope, this,
|
||||
triedToWrap);
|
||||
return mozilla::dom::DOMSettableTokenListBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
|
|
@ -22,8 +22,7 @@ public:
|
|||
nsDOMSettableTokenList(mozilla::dom::Element* aElement, nsIAtom* aAttrAtom)
|
||||
: nsDOMTokenList(aElement, aAttrAtom) {}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
// WebIDL
|
||||
void GetValue(nsAString& aResult) { Stringify(aResult); }
|
||||
|
|
|
@ -261,8 +261,8 @@ nsDOMTokenList::Stringify(nsAString& aResult)
|
|||
}
|
||||
|
||||
JSObject*
|
||||
nsDOMTokenList::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap)
|
||||
nsDOMTokenList::WrapObject(JSContext *cx, JSObject *scope)
|
||||
{
|
||||
return DOMTokenListBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
return DOMTokenListBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,7 @@ public:
|
|||
|
||||
void DropReference();
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
Element* GetParentObject()
|
||||
{
|
||||
|
|
|
@ -5573,7 +5573,7 @@ nsDocument::CreateRange(nsIDOMRange** aReturn)
|
|||
already_AddRefed<nsRange>
|
||||
nsIDocument::CreateRange(ErrorResult& rv)
|
||||
{
|
||||
nsRefPtr<nsRange> range = new nsRange();
|
||||
nsRefPtr<nsRange> range = new nsRange(this);
|
||||
nsresult res = range->Set(this, 0, this, 0);
|
||||
if (NS_FAILED(res)) {
|
||||
rv.Throw(res);
|
||||
|
|
|
@ -102,9 +102,9 @@ nsFormData::Append(const nsAString& aName, nsIVariant* aValue)
|
|||
}
|
||||
|
||||
/* virtual */ JSObject*
|
||||
nsFormData::WrapObject(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap)
|
||||
nsFormData::WrapObject(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return FormDataBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
return FormDataBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<nsFormData>
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
|
||||
// nsWrapperCache
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap) MOZ_OVERRIDE;
|
||||
WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
|
||||
|
||||
// WebIDL
|
||||
nsISupports*
|
||||
|
|
|
@ -2346,7 +2346,7 @@ nsINode::QuerySelectorAll(const nsAString& aSelector, ErrorResult& aResult)
|
|||
}
|
||||
|
||||
JSObject*
|
||||
nsINode::WrapObject(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
|
||||
nsINode::WrapObject(JSContext *aCx, JSObject *aScope)
|
||||
{
|
||||
MOZ_ASSERT(IsDOMBinding());
|
||||
|
||||
|
@ -2364,11 +2364,10 @@ nsINode::WrapObject(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
|
|||
!hasHadScriptHandlingObject &&
|
||||
!nsContentUtils::IsCallerChrome()) {
|
||||
Throw<true>(aCx, NS_ERROR_UNEXPECTED);
|
||||
*aTriedToWrap = true;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSObject* obj = WrapNode(aCx, aScope, aTriedToWrap);
|
||||
JSObject* obj = WrapNode(aCx, aScope);
|
||||
if (obj && ChromeOnlyAccess() &&
|
||||
!nsContentUtils::IsSystemPrincipal(NodePrincipal()))
|
||||
{
|
||||
|
|
|
@ -2645,6 +2645,14 @@ nsObjectLoadingContent::GetPluginFallbackType(uint32_t* aPluginFallbackType)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::GetHasRunningPlugin(bool *aHasPlugin)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);
|
||||
*aHasPlugin = HasRunningPlugin();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::CancelPlayPreview()
|
||||
{
|
||||
|
@ -2652,7 +2660,7 @@ nsObjectLoadingContent::CancelPlayPreview()
|
|||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
mPlayPreviewCanceled = true;
|
||||
|
||||
|
||||
// If we're in play preview state already, reload
|
||||
if (mType == eType_Null && mFallbackType == eFallbackPlayPreview) {
|
||||
return LoadObject(true, true);
|
||||
|
|
|
@ -197,6 +197,10 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
|||
{
|
||||
return mFallbackType;
|
||||
}
|
||||
bool HasRunningPlugin() const
|
||||
{
|
||||
return !!mInstanceOwner;
|
||||
}
|
||||
void CancelPlayPreview(mozilla::ErrorResult& aRv)
|
||||
{
|
||||
aRv = CancelPlayPreview();
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -12,17 +12,32 @@
|
|||
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "prmon.h"
|
||||
#include "nsStubMutationObserver.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
class nsRange : public nsIDOMRange,
|
||||
public nsStubMutationObserver
|
||||
class nsClientRectList;
|
||||
class nsIDOMDocumentFragment;
|
||||
|
||||
namespace mozilla {
|
||||
class ErrorResult;
|
||||
namespace dom {
|
||||
class DocumentFragment;
|
||||
}
|
||||
}
|
||||
|
||||
class nsRange MOZ_FINAL : public nsIDOMRange,
|
||||
public nsStubMutationObserver,
|
||||
public nsWrapperCache
|
||||
{
|
||||
typedef mozilla::ErrorResult ErrorResult;
|
||||
|
||||
public:
|
||||
nsRange()
|
||||
nsRange(nsINode* aNode)
|
||||
: mRoot(nullptr)
|
||||
, mStartOffset(0)
|
||||
, mEndOffset(0)
|
||||
|
@ -36,7 +51,11 @@ public:
|
|||
, mAssertNextInsertOrAppendIndex(-1)
|
||||
, mAssertNextInsertOrAppendNode(nullptr)
|
||||
#endif
|
||||
{}
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
MOZ_ASSERT(aNode, "range isn't in a document!");
|
||||
mOwner = aNode->OwnerDoc();
|
||||
}
|
||||
virtual ~nsRange();
|
||||
|
||||
static nsresult CreateRange(nsIDOMNode* aStartParent, int32_t aStartOffset,
|
||||
|
@ -47,7 +66,7 @@ public:
|
|||
nsIDOMRange** aRange);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsRange, nsIDOMRange)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsRange, nsIDOMRange)
|
||||
|
||||
// nsIDOMRange interface
|
||||
NS_DECL_NSIDOMRANGE
|
||||
|
@ -82,12 +101,6 @@ public:
|
|||
return mIsPositioned;
|
||||
}
|
||||
|
||||
bool Collapsed() const
|
||||
{
|
||||
return mIsPositioned && mStartParent == mEndParent &&
|
||||
mStartOffset == mEndOffset;
|
||||
}
|
||||
|
||||
void SetMaySpanAnonymousSubtrees(bool aMaySpanAnonymousSubtrees)
|
||||
{
|
||||
mMaySpanAnonymousSubtrees = aMaySpanAnonymousSubtrees;
|
||||
|
@ -146,6 +159,45 @@ public:
|
|||
NS_DECL_NSIMUTATIONOBSERVER_PARENTCHAINCHANGED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
||||
|
||||
// WebIDL
|
||||
bool Collapsed() const
|
||||
{
|
||||
return mIsPositioned && mStartParent == mEndParent &&
|
||||
mStartOffset == mEndOffset;
|
||||
}
|
||||
already_AddRefed<mozilla::dom::DocumentFragment>
|
||||
CreateContextualFragment(const nsAString& aString, ErrorResult& aError);
|
||||
already_AddRefed<mozilla::dom::DocumentFragment>
|
||||
CloneContents(ErrorResult& aErr);
|
||||
int16_t CompareBoundaryPoints(uint16_t aHow, nsRange& aOther,
|
||||
ErrorResult& aErr);
|
||||
int16_t ComparePoint(nsINode& aParent, uint32_t aOffset, ErrorResult& aErr);
|
||||
void DeleteContents(ErrorResult& aRv);
|
||||
already_AddRefed<mozilla::dom::DocumentFragment>
|
||||
ExtractContents(ErrorResult& aErr);
|
||||
nsINode* GetCommonAncestorContainer(ErrorResult& aRv) const;
|
||||
nsINode* GetStartContainer(ErrorResult& aRv) const;
|
||||
uint32_t GetStartOffset(ErrorResult& aRv) const;
|
||||
nsINode* GetEndContainer(ErrorResult& aRv) const;
|
||||
uint32_t GetEndOffset(ErrorResult& aRv) const;
|
||||
void InsertNode(nsINode& aNode, ErrorResult& aErr);
|
||||
bool IntersectsNode(nsINode& aNode, ErrorResult& aRv);
|
||||
bool IsPointInRange(nsINode& aParent, uint32_t aOffset, ErrorResult& aErr);
|
||||
void SelectNode(nsINode& aNode, ErrorResult& aErr);
|
||||
void SelectNodeContents(nsINode& aNode, ErrorResult& aErr);
|
||||
void SetEnd(nsINode& aNode, uint32_t aOffset, ErrorResult& aErr);
|
||||
void SetEndAfter(nsINode& aNode, ErrorResult& aErr);
|
||||
void SetEndBefore(nsINode& aNode, ErrorResult& aErr);
|
||||
void SetStart(nsINode& aNode, uint32_t aOffset, ErrorResult& aErr);
|
||||
void SetStartAfter(nsINode& aNode, ErrorResult& aErr);
|
||||
void SetStartBefore(nsINode& aNode, ErrorResult& aErr);
|
||||
void SurroundContents(nsINode& aNode, ErrorResult& aErr);
|
||||
already_AddRefed<nsIDOMClientRect> GetBoundingClientRect();
|
||||
already_AddRefed<nsClientRectList> GetClientRects(ErrorResult& aErr);
|
||||
|
||||
nsINode* GetParentObject() const { return mOwner; }
|
||||
virtual JSObject* WrapObject(JSContext* cx, JSObject* scope) MOZ_OVERRIDE MOZ_FINAL;
|
||||
|
||||
private:
|
||||
// no copy's or assigns
|
||||
nsRange(const nsRange&);
|
||||
|
@ -157,7 +209,7 @@ private:
|
|||
* @param aFragment nsIDOMDocumentFragment containing the nodes.
|
||||
* May be null to indicate the caller doesn't want a fragment.
|
||||
*/
|
||||
nsresult CutContents(nsIDOMDocumentFragment** frag);
|
||||
nsresult CutContents(mozilla::dom::DocumentFragment** frag);
|
||||
|
||||
static nsresult CloneParentsBetween(nsIDOMNode *aAncestor,
|
||||
nsIDOMNode *aNode,
|
||||
|
@ -224,7 +276,8 @@ protected:
|
|||
#endif
|
||||
static bool mIsNested;
|
||||
};
|
||||
|
||||
|
||||
nsCOMPtr<nsIDocument> mOwner;
|
||||
nsCOMPtr<nsINode> mRoot;
|
||||
nsCOMPtr<nsINode> mStartParent;
|
||||
nsCOMPtr<nsINode> mEndParent;
|
||||
|
|
|
@ -121,9 +121,9 @@ NS_IMPL_ISUPPORTS_INHERITED3(nsTextNode, nsGenericDOMDataNode, nsIDOMNode,
|
|||
nsIDOMText, nsIDOMCharacterData)
|
||||
|
||||
JSObject*
|
||||
nsTextNode::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
|
||||
nsTextNode::WrapNode(JSContext *aCx, JSObject *aScope)
|
||||
{
|
||||
return TextBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
return TextBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -66,8 +66,7 @@ public:
|
|||
#endif
|
||||
|
||||
protected:
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
|
||||
bool *aTriedToWrap) MOZ_OVERRIDE;
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // nsTextNode_h
|
||||
|
|
|
@ -94,10 +94,9 @@ public:
|
|||
NS_FORWARD_NSIDOMEVENTTARGET(nsXHREventTarget::)
|
||||
NS_DECL_NSIXMLHTTPREQUESTUPLOAD
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap)
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::XMLHttpRequestUploadBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
return mozilla::dom::XMLHttpRequestUploadBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
nsISupports* GetParentObject()
|
||||
{
|
||||
|
@ -132,10 +131,9 @@ public:
|
|||
nsXMLHttpRequest();
|
||||
virtual ~nsXMLHttpRequest();
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap)
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::XMLHttpRequestBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
return mozilla::dom::XMLHttpRequestBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
nsISupports* GetParentObject()
|
||||
{
|
||||
|
|
|
@ -618,6 +618,7 @@ MOCHITEST_FILES_C= \
|
|||
file_bothCSPheaders.html^headers^ \
|
||||
badMessageEvent2.eventsource \
|
||||
badMessageEvent2.eventsource^headers^ \
|
||||
test_object.html \
|
||||
$(NULL)
|
||||
|
||||
# OOP tests don't work on Windows (bug 763081) or native-fennec
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
This is used in test_object.html to test loading by extension (.tst -> application/x-test).
|
|
@ -0,0 +1,505 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Plugin instantiation</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SpecialPowers.js"></script>
|
||||
<meta charset="utf-8">
|
||||
<body onload="onLoad()">
|
||||
<script class="testbody" type="text/javascript;version=1.8">
|
||||
|
||||
"use strict";
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// This can go away once embed also is on WebIDL
|
||||
let OBJLC = Components.interfaces.nsIObjectLoadingContent;
|
||||
|
||||
// Use string modes in this test to make the test easier to read/debug.
|
||||
// nsIObjectLoadingContent refers to this as "type", but I am using "mode"
|
||||
// in the test to avoid confusing with content-type.
|
||||
let prettyModes = {};
|
||||
prettyModes[OBJLC.TYPE_LOADING] = "loading";
|
||||
prettyModes[OBJLC.TYPE_IMAGE] = "image";
|
||||
prettyModes[OBJLC.TYPE_PLUGIN] = "plugin";
|
||||
prettyModes[OBJLC.TYPE_DOCUMENT] = "document";
|
||||
prettyModes[OBJLC.TYPE_NULL] = "none";
|
||||
|
||||
let body = document.body;
|
||||
// A single-pixel white png
|
||||
let testPNG = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3AoIFiETNqbNRQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAACklEQVQIHWP4DwABAQEANl9ngAAAAABJRU5ErkJggg==';
|
||||
// An empty, but valid, SVG
|
||||
let testSVG = 'data:image/svg+xml,<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"></svg>';
|
||||
// executeSoon wrapper to count pending callbacks
|
||||
let pendingCalls = 0;
|
||||
let afterPendingCalls = false;
|
||||
|
||||
function runWhenDone(func) {
|
||||
if (!pendingCalls)
|
||||
func();
|
||||
else
|
||||
afterPendingCalls = func;
|
||||
}
|
||||
function runSoon(func) {
|
||||
pendingCalls++;
|
||||
SimpleTest.executeSoon(function() {
|
||||
func();
|
||||
if (--pendingCalls < 1 && afterPendingCalls)
|
||||
afterPendingCalls();
|
||||
});
|
||||
}
|
||||
function src(obj, state, uri) {
|
||||
// If we have a running plugin, src changing should always throw it out,
|
||||
// even if it causes us to load the same plugin again.
|
||||
if (uri && runningPlugin(obj, state)) {
|
||||
if (!state.oldPlugins)
|
||||
state.oldPlugins = [];
|
||||
try {
|
||||
state.oldPlugins.push(obj.getObjectValue());
|
||||
} catch (e) {
|
||||
ok(false, "Running plugin but cannot call getObjectValue?");
|
||||
}
|
||||
}
|
||||
|
||||
var srcattr;
|
||||
if (state.tagName == "object")
|
||||
srcattr = "data";
|
||||
else if (state.tagName == "embed")
|
||||
srcattr = "src";
|
||||
else
|
||||
ok(false, "Internal test fail: Why are we setting the src of an applet");
|
||||
|
||||
// Plugins should always go away immediately on src/data change
|
||||
state.initialPlugin = false;
|
||||
if (uri === null) {
|
||||
removeAttr(obj, srcattr);
|
||||
// TODO Bug 767631 - we don't trigger loadObject on UnsetAttr :(
|
||||
forceReload(obj, state);
|
||||
} else {
|
||||
setAttr(obj, srcattr, uri);
|
||||
}
|
||||
}
|
||||
// We have to be careful not to reach past the nsObjectLoadingContent
|
||||
// prototype to touch generic element attributes, as this will try to
|
||||
// spawn the plugin, breaking our ability to test for that.
|
||||
function getAttr(obj, attr) {
|
||||
return document.body.constructor.prototype.getAttribute.call(obj, attr);
|
||||
}
|
||||
function setAttr(obj, attr, val) {
|
||||
return document.body.constructor.prototype.setAttribute.call(obj, attr, val);
|
||||
}
|
||||
function hasAttr(obj, attr) {
|
||||
return document.body.constructor.prototype.hasAttribute.call(obj, attr);
|
||||
}
|
||||
function removeAttr(obj, attr) {
|
||||
return document.body.constructor.prototype.removeAttribute.call(obj, attr);
|
||||
}
|
||||
function setDisplay(obj, val) {
|
||||
if (val)
|
||||
removeAttr(obj, 'style');
|
||||
else
|
||||
setAttr(obj, 'style', "display none;");
|
||||
}
|
||||
function displayed(obj) {
|
||||
// Hacky, but that's all we use style for.
|
||||
return !hasAttr(obj, 'style');
|
||||
}
|
||||
function actualType(obj, state) {
|
||||
return state.getActualType.call(obj);
|
||||
}
|
||||
function getMode(obj, state) {
|
||||
return prettyModes[state.getDisplayedType.call(obj)];
|
||||
}
|
||||
function runningPlugin(obj, state) {
|
||||
return state.getHasRunningPlugin.call(obj);
|
||||
}
|
||||
|
||||
// TODO this is hacky and might hide some failures, but is needed until
|
||||
// Bug 767635 lands -- which itself will probably mean tweaking this test.
|
||||
function forceReload(obj, state) {
|
||||
let attr;
|
||||
if (state.tagName == "object")
|
||||
attr = "data";
|
||||
else if (state.tagName == "embed")
|
||||
attr = "src";
|
||||
|
||||
if (attr && hasAttr(obj, attr)) {
|
||||
src(obj, state, getAttr(obj, attr));
|
||||
} else if (body.contains(obj)) {
|
||||
body.appendChild(obj);
|
||||
} else {
|
||||
// Out of document nodes without data attributes simply can't be
|
||||
// reloaded currently. Bug 767635
|
||||
}
|
||||
};
|
||||
|
||||
// Make a list of combinations of sub-lists, e.g.:
|
||||
// [ [a, b], [c, d] ]
|
||||
// ->
|
||||
// [ [a, c], [a, d], [b, c], [b, d] ]
|
||||
function eachList() {
|
||||
let all = [];
|
||||
if (!arguments.length)
|
||||
return all;
|
||||
let list = Array.prototype.slice.call(arguments, 0);
|
||||
for (let c of list[0]) {
|
||||
if (list.length > 1) {
|
||||
for (let x of eachList.apply(this,list.slice(1))) {
|
||||
all.push((c.length ? [c] : []).concat(x));
|
||||
}
|
||||
} else if (c.length) {
|
||||
all.push([c]);
|
||||
}
|
||||
}
|
||||
return all;
|
||||
}
|
||||
|
||||
let states = {
|
||||
svg: function(obj, state) {
|
||||
removeAttr(obj, "type");
|
||||
src(obj, state, testSVG);
|
||||
state.noChannel = false;
|
||||
state.expectedType = "image/svg";
|
||||
// SVGs are actually image-like subdocuments
|
||||
state.expectedMode = "document";
|
||||
},
|
||||
image: function(obj, state) {
|
||||
removeAttr(obj, "type");
|
||||
src(obj, state, testPNG);
|
||||
state.noChannel = false;
|
||||
state.expectedMode = "image";
|
||||
state.expectedType = "image/png";
|
||||
},
|
||||
plugin: function(obj, state) {
|
||||
removeAttr(obj, "type");
|
||||
src(obj, state, "data:application/x-test,foo");
|
||||
state.noChannel = false;
|
||||
state.expectedType = "application/x-test";
|
||||
state.expectedMode = "plugin";
|
||||
},
|
||||
pluginExtension: function(obj, state) {
|
||||
src(obj, state, "./fake_plugin.tst");
|
||||
state.expectedMode = "plugin";
|
||||
state.pluginExtension = true;
|
||||
state.noChannel = false;
|
||||
},
|
||||
document: function(obj, state) {
|
||||
removeAttr(obj, "type");
|
||||
src(obj, state, "data:text/plain,I am a document");
|
||||
state.noChannel = false;
|
||||
state.expectedType = "text/plain";
|
||||
state.expectedMode = "document";
|
||||
},
|
||||
fallback: function(obj, state) {
|
||||
removeAttr(obj, "type");
|
||||
state.expectedType = "application/x-unknown";
|
||||
state.expectedMode = "none";
|
||||
state.noChannel = true;
|
||||
src(obj, state, null);
|
||||
},
|
||||
addToDoc: function(obj, state) {
|
||||
body.appendChild(obj);
|
||||
},
|
||||
removeFromDoc: function(obj, state) {
|
||||
if (body.contains(obj))
|
||||
body.removeChild(obj);
|
||||
},
|
||||
// Set the proper type
|
||||
setType: function(obj, state) {
|
||||
if (state.expectedType) {
|
||||
state.badType = false;
|
||||
setAttr(obj, 'type', state.expectedType);
|
||||
forceReload(obj, state);
|
||||
}
|
||||
},
|
||||
// Set an improper type
|
||||
setWrongType: function(obj, state) {
|
||||
// This should break no-channel-plugins but nothing else
|
||||
state.badType = true;
|
||||
setAttr(obj, 'type', "application/x-unknown");
|
||||
forceReload(obj, state);
|
||||
},
|
||||
// Set a plugin type
|
||||
setPluginType: function(obj, state) {
|
||||
// If an object/embed has a type set to a plugin type, it should not
|
||||
// use the channel type.
|
||||
state.badType = false;
|
||||
setAttr(obj, 'type', 'application/x-test');
|
||||
state.expectedType = "application/x-test";
|
||||
state.expectedMode = "plugin";
|
||||
forceReload(obj, state);
|
||||
},
|
||||
noChannel: function(obj, state) {
|
||||
src(obj, state, null);
|
||||
state.noChannel = true;
|
||||
state.pluginExtension = false;
|
||||
},
|
||||
displayNone: function(obj, state) {
|
||||
setDisplay(obj, "none");
|
||||
},
|
||||
displayInherit: function(obj, state) {
|
||||
setDisplay(obj, "inherit");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function testObject(obj, state) {
|
||||
// If our test combination both sets noChannel but no explicit type
|
||||
// it shouldn't load ever.
|
||||
let expectedMode = state.expectedMode;
|
||||
let actualMode = getMode(obj, state);
|
||||
|
||||
if (state.noChannel && !getAttr(obj, 'type')) {
|
||||
// Some combinations of test both set no type and no channel. This is
|
||||
// worth testing with the various combinations, but shouldn't load.
|
||||
expectedMode = "none";
|
||||
}
|
||||
|
||||
// Embed tags should always try to load a plugin by type or extension
|
||||
// before falling back to opening a channel. See bug 803159
|
||||
if (state.tagName == "embed" &&
|
||||
(getAttr(obj, 'type') == "application/x-test" || state.pluginExtension)) {
|
||||
state.noChannel = true;
|
||||
}
|
||||
|
||||
// with state.loading, unless we're loading with no channel, these types
|
||||
// should still be in loading state pending a channel.
|
||||
if (state.loading && (expectedMode == "image" || expectedMode == "document" ||
|
||||
(expectedMode == "plugin" && !state.initialPlugin && !state.noChannel))) {
|
||||
expectedMode = "loading";
|
||||
}
|
||||
|
||||
// With the exception of plugins with a proper type, nothing should
|
||||
// load without a channel
|
||||
if (state.noChannel && (expectedMode != "plugin" || state.badType) &&
|
||||
body.contains(obj)) {
|
||||
expectedMode = "none";
|
||||
}
|
||||
|
||||
// embed tags should reject documents, except for SVG images which
|
||||
// render as such
|
||||
if (state.tagName == "embed" && expectedMode == "document" &&
|
||||
actualType(obj, state) != "image/svg+xml") {
|
||||
expectedMode = "none";
|
||||
}
|
||||
|
||||
// Embeds with a plugin type should skip opening a channel prior to
|
||||
// loading, taking only type into account.
|
||||
if (state.tagName == 'embed' && getAttr(obj, 'type') == 'application/x-test' &&
|
||||
body.contains(obj)) {
|
||||
expectedMode = "plugin";
|
||||
}
|
||||
|
||||
if (!body.contains(obj)
|
||||
&& (!state.loading || expectedMode != "image")
|
||||
&& (!state.initialPlugin || expectedMode != "plugin")) {
|
||||
// Images are handled by nsIImageLoadingContent so we dont track
|
||||
// their state change as they're detached and reattached. All other
|
||||
// types switch to state "loading", and are completely unloaded
|
||||
expectedMode = "loading";
|
||||
}
|
||||
|
||||
is(actualMode, expectedMode, "check loaded mode");
|
||||
|
||||
// If we're a plugin, check that we spawned successfully
|
||||
// Except for _loading...
|
||||
let shouldSpawn = expectedMode == "plugin" && (!state.loading || state.initialPlugin);
|
||||
let didSpawn = runningPlugin(obj, state);
|
||||
is(didSpawn, !!shouldSpawn, "check plugin spawned is " + !!shouldSpawn);
|
||||
|
||||
// If we are a plugin, scripting should work. If we're not spawned we
|
||||
// should spawn synchronously.
|
||||
if (expectedMode == "plugin") {
|
||||
let scripted = false;
|
||||
try {
|
||||
let x = obj.getObjectValue();
|
||||
scripted = true;
|
||||
} catch(e) {}
|
||||
ok(scripted, "check plugin scriptability");
|
||||
}
|
||||
|
||||
// If this tag previously had other spawned plugins, make sure it
|
||||
// respawned between then and now
|
||||
if (state.oldPlugins && didSpawn) {
|
||||
let didRespawn = false;
|
||||
for (let oldp of state.oldPlugins) {
|
||||
// If this returns false or throws, it's not the same plugin
|
||||
try {
|
||||
didRespawn = !obj.checkObjectValue(oldp);
|
||||
} catch (e) {
|
||||
didRespawn = true;
|
||||
}
|
||||
}
|
||||
is(didRespawn, true, "Plugin should have re-spawned since old state ("+state.oldPlugins.length+")");
|
||||
}
|
||||
}
|
||||
|
||||
let total = 0;
|
||||
let test_modes = {
|
||||
// Just apply from_state then to_state
|
||||
"immediate": function(obj, from_state, to_state, state) {
|
||||
for (let from of from_state)
|
||||
states[from](obj, state);
|
||||
for (let to of to_state)
|
||||
states[to](obj, state);
|
||||
|
||||
// We don't spin the event loop between applying to_state and
|
||||
// running tests, so some types are still loading
|
||||
state.loading = true;
|
||||
info("["+(++total)+"] Testing [ " + from_state + " ] -> [ " + to_state + " ] / " + state.tagName + " / immediate");
|
||||
testObject(obj, state);
|
||||
|
||||
if (body.contains(obj))
|
||||
body.removeChild(obj);
|
||||
|
||||
},
|
||||
// Apply states, spin event loop, run tests.
|
||||
"cycle": function(obj, from_state, to_state, state) {
|
||||
for (let from of from_state)
|
||||
states[from](obj, state);
|
||||
for (let to of to_state)
|
||||
states[to](obj, state);
|
||||
// Because re-appending to the document creates a script blocker, but
|
||||
// plugins spawn asynchronously, we need to return to the event loop
|
||||
// twice to ensure the plugin has been given a chance to lazily spawn.
|
||||
runSoon(function() { runSoon(function() {
|
||||
info("["+(++total)+"] Testing [ " + from_state + " ] -> [ " + to_state + " ] / " + state.tagName + " / cycle");
|
||||
testObject(obj, state);
|
||||
|
||||
if (body.contains(obj))
|
||||
body.removeChild(obj);
|
||||
}); });
|
||||
},
|
||||
// Apply initial state, spin event loop, apply final state, spin event
|
||||
// loop again.
|
||||
"cycleboth": function(obj, from_state, to_state, state) {
|
||||
for (let from of from_state) {
|
||||
states[from](obj, state);
|
||||
}
|
||||
runSoon(function() {
|
||||
for (let to of to_state) {
|
||||
states[to](obj, state);
|
||||
}
|
||||
// Because re-appending to the document creates a script blocker,
|
||||
// but plugins spawn asynchronously, we need to return to the event
|
||||
// loop twice to ensure the plugin has been given a chance to lazily
|
||||
// spawn.
|
||||
runSoon(function() { runSoon(function() {
|
||||
info("["+(++total)+"] Testing [ " + from_state + " ] -> [ " + to_state + " ] / " + state.tagName + " / cycleboth");
|
||||
testObject(obj, state);
|
||||
|
||||
if (body.contains(obj))
|
||||
body.removeChild(obj);
|
||||
}); });
|
||||
});
|
||||
},
|
||||
// Apply initial state, spin event loop, apply later state, test
|
||||
// immediately
|
||||
"cyclefirst": function(obj, from_state, to_state, state) {
|
||||
for (let from of from_state) {
|
||||
states[from](obj, state);
|
||||
}
|
||||
runSoon(function() {
|
||||
state.initialPlugin = runningPlugin(obj, state);
|
||||
for (let to of to_state) {
|
||||
states[to](obj, state);
|
||||
}
|
||||
info("["+(++total)+"] Testing [ " + from_state + " ] -> [ " + to_state + " ] / " + state.tagName + " / cyclefirst");
|
||||
// We don't spin the event loop between applying to_state and
|
||||
// running tests, so some types are still loading
|
||||
state.loading = true;
|
||||
testObject(obj, state);
|
||||
|
||||
if (body.contains(obj))
|
||||
body.removeChild(obj);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
function test(testdat) {
|
||||
for (let from_state of testdat['from_states']) {
|
||||
for (let to_state of testdat['to_states']) {
|
||||
for (let mode of testdat['test_modes']) {
|
||||
for (let type of testdat['tag_types']) {
|
||||
runSoon(function () {
|
||||
let obj = document.createElement(type);
|
||||
obj.width = 1; obj.height = 1;
|
||||
let state = {};
|
||||
state.noChannel = true;
|
||||
state.tagName = type;
|
||||
// Part of the test checks whether a plugin spawned or not,
|
||||
// but touching the object prototype will attempt to
|
||||
// synchronously spawn a plugin! We use this terrible hack to
|
||||
// get a privileged getter for the attributes we want to touch
|
||||
// prior to applying any attributes.
|
||||
// TODO when embed goes away we wont need to check for
|
||||
// QueryInterface any longer.
|
||||
var lookup_on = obj.QueryInterface ? obj.QueryInterface(OBJLC): obj;
|
||||
state.getDisplayedType = SpecialPowers.do_lookupGetter(lookup_on, 'displayedType');
|
||||
state.getHasRunningPlugin = SpecialPowers.do_lookupGetter(lookup_on, 'hasRunningPlugin');
|
||||
state.getActualType = SpecialPowers.do_lookupGetter(lookup_on, 'actualType');
|
||||
test_modes[mode](obj, from_state, to_state, state);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onLoad() {
|
||||
// Generic tests
|
||||
test({
|
||||
'tag_types': [ 'embed', 'object' ],
|
||||
// In all three modes
|
||||
'test_modes': [ 'immediate', 'cycle', 'cyclefirst', 'cycleboth' ],
|
||||
// Starting from a blank tag in and out of the document, a loading
|
||||
// plugin, and no-channel plugin (initial types only really have
|
||||
// odd cases with plugins)
|
||||
'from_states': [
|
||||
[ 'addToDoc' ],
|
||||
[ 'plugin' ],
|
||||
[ 'plugin', 'addToDoc' ],
|
||||
[ 'plugin', 'noChannel', 'setType', 'addToDoc' ],
|
||||
[],
|
||||
],
|
||||
// To various combinations of loaded objects
|
||||
'to_states': eachList(
|
||||
[ 'svg', 'image', 'plugin', 'document', '' ],
|
||||
[ 'setType', 'setWrongType', 'setPluginType', '' ],
|
||||
[ 'noChannel', '' ],
|
||||
[ 'displayNone', 'displayInherit', '' ]
|
||||
)});
|
||||
// Special case test for embed tags with plugin-by-extension
|
||||
// TODO object tags should be tested here too -- they have slightly
|
||||
// different behavior, but waiting on a file load requires a loaded
|
||||
// event handler and wont work with just our event loop spinning.
|
||||
test({
|
||||
'tag_types': [ 'embed' ],
|
||||
'test_modes': [ 'immediate', 'cyclefirst', 'cycle', 'cycleboth' ],
|
||||
'from_states': eachList(
|
||||
[ 'svg', 'plugin', 'image', 'document' ],
|
||||
[ 'addToDoc' ]
|
||||
),
|
||||
// Set extension along with valid ty
|
||||
'to_states': [
|
||||
[ 'pluginExtension' ]
|
||||
]});
|
||||
// Test plugin add/remove from document with adding/removing frame, with
|
||||
// and without a channel.
|
||||
test({
|
||||
'tag_types': [ 'embed', 'object' ], // Ideally we'd test object too, but this gets exponentially long.
|
||||
'test_modes': [ 'immediate', 'cyclefirst', 'cycle' ],
|
||||
'from_states': [ [ 'displayNone', 'plugin', 'addToDoc' ],
|
||||
[ 'displayNone', 'plugin', 'noChannel', 'addToDoc' ],
|
||||
[ 'plugin', 'noChannel', 'addToDoc' ],
|
||||
[ 'plugin', 'noChannel' ] ],
|
||||
'to_states': eachList(
|
||||
[ 'displayNone', '' ],
|
||||
[ 'removeFromDoc' ],
|
||||
[ 'image', 'displayNone', '' ],
|
||||
[ 'image', 'displayNone', '' ],
|
||||
[ 'addToDoc' ],
|
||||
[ 'displayInherit' ]
|
||||
)});
|
||||
runWhenDone(function() SimpleTest.finish());
|
||||
}
|
||||
</script>
|
|
@ -569,10 +569,9 @@ CanvasRenderingContext2D::~CanvasRenderingContext2D()
|
|||
}
|
||||
|
||||
JSObject*
|
||||
CanvasRenderingContext2D::WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap)
|
||||
CanvasRenderingContext2D::WrapObject(JSContext *cx, JSObject *scope)
|
||||
{
|
||||
return CanvasRenderingContext2DBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
return CanvasRenderingContext2DBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -139,8 +139,7 @@ public:
|
|||
CanvasRenderingContext2D();
|
||||
virtual ~CanvasRenderingContext2D();
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
HTMLCanvasElement* GetCanvas() const
|
||||
{
|
||||
|
|
|
@ -56,8 +56,8 @@ WebGLBuffer::ElementArrayCacheBufferSubData(size_t pos, const void* ptr, size_t
|
|||
}
|
||||
|
||||
JSObject*
|
||||
WebGLBuffer::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) {
|
||||
return dom::WebGLBufferBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
WebGLBuffer::WrapObject(JSContext *cx, JSObject *scope) {
|
||||
return dom::WebGLBufferBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLBuffer)
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
return Context();
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLBuffer)
|
||||
|
|
|
@ -207,11 +207,9 @@ WebGLContext::~WebGLContext()
|
|||
}
|
||||
|
||||
JSObject*
|
||||
WebGLContext::WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap)
|
||||
WebGLContext::WrapObject(JSContext *cx, JSObject *scope)
|
||||
{
|
||||
return dom::WebGLRenderingContextBinding::Wrap(cx, scope, this,
|
||||
triedToWrap);
|
||||
return dom::WebGLRenderingContextBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -196,8 +196,7 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(WebGLContext,
|
||||
nsIDOMWebGLRenderingContext)
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
NS_DECL_NSIDOMWEBGLRENDERINGCONTEXT
|
||||
|
||||
|
|
|
@ -28,12 +28,12 @@ public:
|
|||
};
|
||||
|
||||
#define DECL_WEBGL_EXTENSION_GOOP \
|
||||
JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap);
|
||||
JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
#define IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionType) \
|
||||
JSObject* \
|
||||
WebGLExtensionType::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { \
|
||||
return dom::WebGLExtensionType##Binding::Wrap(cx, scope, this, triedToWrap); \
|
||||
WebGLExtensionType::WrapObject(JSContext *cx, JSObject *scope) { \
|
||||
return dom::WebGLExtensionType##Binding::Wrap(cx, scope, this); \
|
||||
}
|
||||
|
||||
class WebGLExtensionCompressedTextureATC
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
using namespace mozilla;
|
||||
|
||||
JSObject*
|
||||
WebGLFramebuffer::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) {
|
||||
return dom::WebGLFramebufferBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
WebGLFramebuffer::WrapObject(JSContext *cx, JSObject *scope) {
|
||||
return dom::WebGLFramebufferBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
WebGLFramebuffer::WebGLFramebuffer(WebGLContext *context)
|
||||
|
|
|
@ -158,7 +158,7 @@ public:
|
|||
return Context();
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLFramebuffer)
|
||||
|
|
|
@ -44,8 +44,8 @@ static bool SplitLastSquareBracket(nsACString& string, nsCString& bracketPart)
|
|||
}
|
||||
|
||||
JSObject*
|
||||
WebGLProgram::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) {
|
||||
return dom::WebGLProgramBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
WebGLProgram::WrapObject(JSContext *cx, JSObject *scope) {
|
||||
return dom::WebGLProgramBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
WebGLProgram::WebGLProgram(WebGLContext *context)
|
||||
|
|
|
@ -102,7 +102,7 @@ public:
|
|||
return Context();
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLProgram)
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
using namespace mozilla;
|
||||
|
||||
JSObject*
|
||||
WebGLRenderbuffer::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) {
|
||||
return dom::WebGLRenderbufferBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
WebGLRenderbuffer::WrapObject(JSContext *cx, JSObject *scope) {
|
||||
return dom::WebGLRenderbufferBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
WebGLRenderbuffer::WebGLRenderbuffer(WebGLContext *context)
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
return Context();
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLRenderbuffer)
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
using namespace mozilla;
|
||||
|
||||
JSObject*
|
||||
WebGLShader::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) {
|
||||
return dom::WebGLShaderBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
WebGLShader::WrapObject(JSContext *cx, JSObject *scope) {
|
||||
return dom::WebGLShaderBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
WebGLShader::WebGLShader(WebGLContext *context, WebGLenum stype)
|
||||
|
|
|
@ -115,7 +115,7 @@ public:
|
|||
return Context();
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLShader)
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
using namespace mozilla;
|
||||
|
||||
JSObject*
|
||||
WebGLTexture::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) {
|
||||
return dom::WebGLTextureBinding::Wrap(cx, scope, this, triedToWrap);
|
||||
WebGLTexture::WrapObject(JSContext *cx, JSObject *scope) {
|
||||
return dom::WebGLTextureBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
WebGLTexture::WebGLTexture(WebGLContext *context)
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
return Context();
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLTexture)
|
||||
|
|
|
@ -671,27 +671,27 @@ NON_IDL_EVENT(underflow,
|
|||
NON_IDL_EVENT(SVGLoad,
|
||||
NS_SVG_LOAD,
|
||||
EventNameType_None,
|
||||
NS_SVG_EVENT)
|
||||
NS_EVENT)
|
||||
NON_IDL_EVENT(SVGUnload,
|
||||
NS_SVG_UNLOAD,
|
||||
EventNameType_None,
|
||||
NS_SVG_EVENT)
|
||||
NS_EVENT)
|
||||
NON_IDL_EVENT(SVGAbort,
|
||||
NS_SVG_ABORT,
|
||||
EventNameType_None,
|
||||
NS_SVG_EVENT)
|
||||
NS_EVENT)
|
||||
NON_IDL_EVENT(SVGError,
|
||||
NS_SVG_ERROR,
|
||||
EventNameType_None,
|
||||
NS_SVG_EVENT)
|
||||
NS_EVENT)
|
||||
NON_IDL_EVENT(SVGResize,
|
||||
NS_SVG_RESIZE,
|
||||
EventNameType_None,
|
||||
NS_SVG_EVENT)
|
||||
NS_EVENT)
|
||||
NON_IDL_EVENT(SVGScroll,
|
||||
NS_SVG_SCROLL,
|
||||
EventNameType_None,
|
||||
NS_SVG_EVENT)
|
||||
NS_EVENT)
|
||||
|
||||
NON_IDL_EVENT(SVGZoom,
|
||||
NS_SVG_ZOOM,
|
||||
|
|
|
@ -515,7 +515,7 @@ nsContentEventHandler::OnQueryTextContent(nsQueryContentEvent* aEvent)
|
|||
NS_ASSERTION(aEvent->mReply.mString.IsEmpty(),
|
||||
"The reply string must be empty");
|
||||
|
||||
nsRefPtr<nsRange> range = new nsRange();
|
||||
nsRefPtr<nsRange> range = new nsRange(mRootContent);
|
||||
rv = SetRangeFromFlatTextOffset(range, aEvent->mInput.mOffset,
|
||||
aEvent->mInput.mLength, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -572,7 +572,7 @@ nsContentEventHandler::OnQueryTextRect(nsQueryContentEvent* aEvent)
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsRefPtr<nsRange> range = new nsRange();
|
||||
nsRefPtr<nsRange> range = new nsRange(mRootContent);
|
||||
rv = SetRangeFromFlatTextOffset(range, aEvent->mInput.mOffset,
|
||||
aEvent->mInput.mLength, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -716,7 +716,7 @@ nsContentEventHandler::OnQueryCaretRect(nsQueryContentEvent* aEvent)
|
|||
}
|
||||
|
||||
// Otherwise, we should set the guessed caret rect.
|
||||
nsRefPtr<nsRange> range = new nsRange();
|
||||
nsRefPtr<nsRange> range = new nsRange(mRootContent);
|
||||
rv = SetRangeFromFlatTextOffset(range, aEvent->mInput.mOffset, 0, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -899,9 +899,10 @@ nsContentEventHandler::GetFlatTextOffsetOfRange(nsIContent* aRootContent,
|
|||
int32_t aNodeOffset,
|
||||
uint32_t* aNativeOffset)
|
||||
{
|
||||
NS_ENSURE_STATE(aRootContent);
|
||||
NS_ASSERTION(aNativeOffset, "param is invalid");
|
||||
|
||||
nsRefPtr<nsRange> prev = new nsRange();
|
||||
nsRefPtr<nsRange> prev = new nsRange(aRootContent);
|
||||
nsCOMPtr<nsIDOMNode> rootDOMNode(do_QueryInterface(aRootContent));
|
||||
prev->SetStart(rootDOMNode, 0);
|
||||
|
||||
|
@ -1033,7 +1034,7 @@ nsContentEventHandler::OnSelectionEvent(nsSelectionEvent* aEvent)
|
|||
}
|
||||
|
||||
// Get range from offset and length
|
||||
nsRefPtr<nsRange> range = new nsRange();
|
||||
nsRefPtr<nsRange> range = new nsRange(mRootContent);
|
||||
NS_ENSURE_TRUE(range, NS_ERROR_OUT_OF_MEMORY);
|
||||
rv = SetRangeFromFlatTextOffset(range, aEvent->mOffset, aEvent->mLength,
|
||||
aEvent->mExpandToClusterBoundary);
|
||||
|
|
|
@ -760,13 +760,6 @@ nsDOMEvent::DuplicatePrivateData()
|
|||
static_cast<nsUIEvent*>(mEvent)->detail);
|
||||
break;
|
||||
}
|
||||
case NS_SVG_EVENT:
|
||||
{
|
||||
newEvent = new nsEvent(false, msg);
|
||||
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
newEvent->eventStructType = NS_SVG_EVENT;
|
||||
break;
|
||||
}
|
||||
case NS_SVGZOOM_EVENT:
|
||||
{
|
||||
newEvent = new nsGUIEvent(false, msg, nullptr);
|
||||
|
|
|
@ -79,9 +79,9 @@ public:
|
|||
return mOwner;
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap)
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::EventBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
return mozilla::dom::EventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
// nsIDOMEvent Interface
|
||||
|
@ -176,6 +176,11 @@ public:
|
|||
return d;
|
||||
}
|
||||
|
||||
bool MultipleActionsPrevented()
|
||||
{
|
||||
return mEvent->mFlags.mMultipleActionsPrevented;
|
||||
}
|
||||
|
||||
bool IsTrusted()
|
||||
{
|
||||
bool i;
|
||||
|
|
|
@ -744,9 +744,6 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
|
|||
case NS_CLIPBOARD_EVENT:
|
||||
return NS_NewDOMClipboardEvent(aDOMEvent, aOwner, aPresContext,
|
||||
static_cast<nsClipboardEvent*>(aEvent));
|
||||
case NS_SVG_EVENT:
|
||||
return NS_NewDOMSVGEvent(aDOMEvent, aOwner, aPresContext,
|
||||
aEvent);
|
||||
case NS_SVGZOOM_EVENT:
|
||||
return NS_NewDOMSVGZoomEvent(aDOMEvent, aOwner, aPresContext,
|
||||
static_cast<nsGUIEvent*>(aEvent));
|
||||
|
@ -807,11 +804,10 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
|
|||
return NS_NewDOMUIEvent(aDOMEvent, aOwner, aPresContext, nullptr);
|
||||
if (aEventType.LowerCaseEqualsLiteral("event") ||
|
||||
aEventType.LowerCaseEqualsLiteral("events") ||
|
||||
aEventType.LowerCaseEqualsLiteral("htmlevents"))
|
||||
return NS_NewDOMEvent(aDOMEvent, aOwner, aPresContext, nullptr);
|
||||
if (aEventType.LowerCaseEqualsLiteral("svgevent") ||
|
||||
aEventType.LowerCaseEqualsLiteral("htmlevents") ||
|
||||
aEventType.LowerCaseEqualsLiteral("svgevent") ||
|
||||
aEventType.LowerCaseEqualsLiteral("svgevents"))
|
||||
return NS_NewDOMSVGEvent(aDOMEvent, aOwner, aPresContext, nullptr);
|
||||
return NS_NewDOMEvent(aDOMEvent, aOwner, aPresContext, nullptr);
|
||||
if (aEventType.LowerCaseEqualsLiteral("svgzoomevent") ||
|
||||
aEventType.LowerCaseEqualsLiteral("svgzoomevents"))
|
||||
return NS_NewDOMSVGZoomEvent(aDOMEvent, aOwner, aPresContext, nullptr);
|
||||
|
|
|
@ -25,9 +25,9 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsPaintRequest)
|
|||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsPaintRequest)
|
||||
|
||||
/* virtual */ JSObject*
|
||||
nsPaintRequest::WrapObject(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap)
|
||||
nsPaintRequest::WrapObject(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return PaintRequestBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
return PaintRequestBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
already_AddRefed<nsClientRect>
|
||||
|
@ -65,11 +65,9 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsPaintRequestList)
|
|||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsPaintRequestList)
|
||||
|
||||
JSObject*
|
||||
nsPaintRequestList::WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap)
|
||||
nsPaintRequestList::WrapObject(JSContext *cx, JSObject *scope)
|
||||
{
|
||||
return mozilla::dom::PaintRequestListBinding::Wrap(cx, scope, this,
|
||||
triedToWrap);
|
||||
return mozilla::dom::PaintRequestListBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -29,8 +29,7 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsPaintRequest)
|
||||
NS_DECL_NSIDOMPAINTREQUEST
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope,
|
||||
bool* aTriedToWrap) MOZ_OVERRIDE;
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
|
||||
|
||||
nsIDOMEvent* GetParentObject() const
|
||||
{
|
||||
|
@ -66,8 +65,7 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsPaintRequestList)
|
||||
NS_DECL_NSIDOMPAINTREQUESTLIST
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap);
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
|
||||
nsISupports* GetParentObject()
|
||||
{
|
||||
return mParent;
|
||||
|
|
|
@ -76,8 +76,7 @@ public:
|
|||
CallQueryInterface(this, &cache);
|
||||
return cache->GetWrapperPreserveColor();
|
||||
}
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||
bool *triedToWrap) = 0;
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLCollection, NS_IHTMLCOLLECTION_IID)
|
||||
|
|
|
@ -57,9 +57,9 @@ NS_HTML_CONTENT_INTERFACE_MAP_END
|
|||
NS_IMPL_ELEMENT_CLONE(HTMLAnchorElement)
|
||||
|
||||
JSObject*
|
||||
HTMLAnchorElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
|
||||
HTMLAnchorElement::WrapNode(JSContext *aCx, JSObject *aScope)
|
||||
{
|
||||
return HTMLAnchorElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
return HTMLAnchorElementBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
NS_IMPL_STRING_ATTR(HTMLAnchorElement, Charset, charset)
|
||||
|
|
|
@ -201,8 +201,7 @@ public:
|
|||
protected:
|
||||
virtual void GetItemValueText(nsAString& text);
|
||||
virtual void SetItemValueText(const nsAString& text);
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
|
||||
bool *aTriedToWrap) MOZ_OVERRIDE;
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -244,9 +244,9 @@ HTMLAreaElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
|||
}
|
||||
|
||||
JSObject*
|
||||
HTMLAreaElement::WrapNode(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap)
|
||||
HTMLAreaElement::WrapNode(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return HTMLAreaElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
return HTMLAreaElementBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -161,8 +161,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope,
|
||||
bool* aTriedToWrap) MOZ_OVERRIDE;
|
||||
virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
|
||||
|
||||
virtual void GetItemValueText(nsAString& text);
|
||||
virtual void SetItemValueText(const nsAString& text);
|
||||
|
|
|
@ -106,10 +106,9 @@ HTMLBRElement::GetAttributeMappingFunction() const
|
|||
}
|
||||
|
||||
JSObject*
|
||||
HTMLBRElement::WrapNode(JSContext *aCx, JSObject *aScope,
|
||||
bool* aTriedToWrap)
|
||||
HTMLBRElement::WrapNode(JSContext *aCx, JSObject *aScope)
|
||||
{
|
||||
return HTMLBRElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
return HTMLBRElementBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -53,8 +53,7 @@ public:
|
|||
return SetHTMLAttr(nsGkAtoms::clear, aClear, aError);
|
||||
}
|
||||
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
|
||||
bool *aTriedToWrap);
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -194,9 +194,9 @@ HTMLBodyElement::~HTMLBodyElement()
|
|||
}
|
||||
|
||||
JSObject*
|
||||
HTMLBodyElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
|
||||
HTMLBodyElement::WrapNode(JSContext *aCx, JSObject *aScope)
|
||||
{
|
||||
return HTMLBodyElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
return HTMLBodyElementBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(HTMLBodyElement, Element)
|
||||
|
|
|
@ -149,8 +149,7 @@ private:
|
|||
nsresult GetColorHelper(nsIAtom* aAtom, nsAString& aColor);
|
||||
|
||||
protected:
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
|
||||
bool *aTriedToWrap) MOZ_OVERRIDE;
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope) MOZ_OVERRIDE;
|
||||
|
||||
nsRefPtr<BodyRule> mContentStyleRule;
|
||||
};
|
||||
|
|
|
@ -548,10 +548,9 @@ HTMLButtonElement::IntrinsicState() const
|
|||
}
|
||||
|
||||
JSObject*
|
||||
HTMLButtonElement::WrapNode(JSContext* aCx, JSObject* aScope,
|
||||
bool* aTriedToWrap)
|
||||
HTMLButtonElement::WrapNode(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return HTMLButtonElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
return HTMLButtonElementBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const;
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
virtual JSObject*
|
||||
WrapNode(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap) MOZ_OVERRIDE;
|
||||
WrapNode(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
|
||||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче