зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1453869 part 1. Remove the unused 3-arg constructor from DOMParser. r=mrbkap
MozReview-Commit-ID: 1fWzq6rMWf1
This commit is contained in:
Родитель
201660d151
Коммит
bada81a4e5
|
@ -362,24 +362,6 @@ DOMParser::Init(nsIPrincipal* principal, nsIURI* documentURI,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/*static */already_AddRefed<DOMParser>
|
||||
DOMParser::Constructor(const GlobalObject& aOwner,
|
||||
nsIPrincipal* aPrincipal, nsIURI* aDocumentURI,
|
||||
nsIURI* aBaseURI, ErrorResult& rv)
|
||||
{
|
||||
if (aOwner.CallerType() != CallerType::System) {
|
||||
rv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
RefPtr<DOMParser> domParser = new DOMParser(aOwner.GetAsSupports());
|
||||
rv = domParser->InitInternal(aOwner.GetAsSupports(), aPrincipal, aDocumentURI,
|
||||
aBaseURI);
|
||||
if (rv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
return domParser.forget();
|
||||
}
|
||||
|
||||
/*static */already_AddRefed<DOMParser>
|
||||
DOMParser::Constructor(const GlobalObject& aOwner,
|
||||
ErrorResult& rv)
|
||||
|
|
|
@ -44,11 +44,6 @@ public:
|
|||
Constructor(const GlobalObject& aOwner,
|
||||
mozilla::ErrorResult& rv);
|
||||
|
||||
static already_AddRefed<DOMParser>
|
||||
Constructor(const GlobalObject& aOwner,
|
||||
nsIPrincipal* aPrincipal, nsIURI* aDocumentURI, nsIURI* aBaseURI,
|
||||
mozilla::ErrorResult& rv);
|
||||
|
||||
already_AddRefed<nsIDocument>
|
||||
ParseFromString(const nsAString& aStr, mozilla::dom::SupportedType aType,
|
||||
mozilla::ErrorResult& rv);
|
||||
|
|
|
@ -16,31 +16,26 @@
|
|||
"use strict";
|
||||
/** Test for Bug 816410 **/
|
||||
|
||||
function throws(a, type, message) {
|
||||
for (let fn of Array.isArray(a) ? a : [a]) {
|
||||
try {
|
||||
fn();
|
||||
ok(false, message);
|
||||
} catch (e) {
|
||||
if (type) {
|
||||
is(e.name, type, message);
|
||||
} else {
|
||||
ok(true, message);
|
||||
}
|
||||
function throws(fn, type, message) {
|
||||
try {
|
||||
fn();
|
||||
ok(false, message);
|
||||
} catch (e) {
|
||||
if (type) {
|
||||
is(e.name, type, message);
|
||||
} else {
|
||||
ok(true, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DOMParser constructor should not throw for null arguments
|
||||
// DOMParser constructor should not throw for extra arguments
|
||||
new DOMParser(undefined);
|
||||
new DOMParser(null);
|
||||
|
||||
throws([
|
||||
function() { new DOMParser(false); },
|
||||
function() { new DOMParser(0); },
|
||||
function() { new DOMParser(""); },
|
||||
function() { new DOMParser({}); },
|
||||
], "TypeError", "DOMParser constructor should throw for extra arguments");
|
||||
new DOMParser(false);
|
||||
new DOMParser(0);
|
||||
new DOMParser("");
|
||||
new DOMParser({});
|
||||
|
||||
{
|
||||
let parser = new DOMParser();
|
||||
|
|
|
@ -19,9 +19,7 @@ enum SupportedType {
|
|||
};
|
||||
|
||||
// the latter is Mozilla-specific
|
||||
[Constructor,
|
||||
Constructor(Principal? prin, optional URI? documentURI = null,
|
||||
optional URI? baseURI = null)]
|
||||
[Constructor]
|
||||
interface DOMParser {
|
||||
[NewObject, Throws]
|
||||
Document parseFromString(DOMString str, SupportedType type);
|
||||
|
|
Загрузка…
Ссылка в новой задаче