Backed out changeset 6e675d6399ce (bug 1604296) for causing failures in layout/style tests.

This commit is contained in:
Mihai Alexandru Michis 2020-01-01 02:05:30 +02:00
Родитель 0f71a2db2b
Коммит 2f43e04863
5 изменённых файлов: 1 добавлений и 127 удалений

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

@ -5,7 +5,6 @@
*
* The origin of this IDL file is
* http://dev.w3.org/csswg/cssom/
* https://wicg.github.io/construct-stylesheets/
*/
enum CSSStyleSheetParsingMode {
@ -14,17 +13,8 @@ enum CSSStyleSheetParsingMode {
"agent"
};
dictionary CSSStyleSheetInit {
(MediaList or DOMString) media = "";
DOMString title = "";
boolean alternate = false;
boolean disabled = false;
};
[Exposed=Window]
interface CSSStyleSheet : StyleSheet {
[Throws, Pref="layout.css.constructable-stylesheets.enabled"]
constructor(optional CSSStyleSheetInit options = {});
[Pure, BinaryName="DOMOwnerRule"]
readonly attribute CSSRule? ownerRule;
[Throws, NeedsSubjectPrincipal]
@ -35,10 +25,6 @@ interface CSSStyleSheet : StyleSheet {
unsigned long insertRule(DOMString rule, optional unsigned long index = 0);
[Throws, NeedsSubjectPrincipal]
void deleteRule(unsigned long index);
[Throws, Pref="layout.css.constructable-stylesheets.enabled"]
Promise<CSSStyleSheet> replace(USVString text);
[Throws, Pref="layout.css.constructable-stylesheets.enabled"]
void replaceSync(USVString text);
// Non-standard WebKit things.
[Throws, NeedsSubjectPrincipal, BinaryName="cssRules"]

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

@ -11,7 +11,7 @@
*/
// Note: "persistent-usage-record" session type is unsupported yet, as
// it's marked as "at risk" in the spec, and Chrome doesn't support it.
// it's marked as "at risk" in the spec, and Chrome doesn't support it.
enum MediaKeySessionType {
"temporary",
"persistent-license",

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

@ -13,7 +13,6 @@
#include "mozilla/dom/CSSRuleList.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/MediaList.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/ShadowRoot.h"
#include "mozilla/dom/ShadowRootBinding.h"
#include "mozilla/NullPrincipal.h"
@ -33,7 +32,6 @@ using namespace dom;
StyleSheet::StyleSheet(css::SheetParsingMode aParsingMode, CORSMode aCORSMode,
const dom::SRIMetadata& aIntegrity)
: mParent(nullptr),
mConstructorDocument(nullptr),
mDocumentOrShadowRoot(nullptr),
mOwningNode(nullptr),
mOwnerRule(nullptr),
@ -49,7 +47,6 @@ StyleSheet::StyleSheet(const StyleSheet& aCopy, StyleSheet* aParentToUse,
dom::DocumentOrShadowRoot* aDocumentOrShadowRoot,
nsINode* aOwningNodeToUse)
: mParent(aParentToUse),
mConstructorDocument(aCopy.mConstructorDocument),
mTitle(aCopy.mTitle),
mDocumentOrShadowRoot(aDocumentOrShadowRoot),
mOwningNode(aOwningNodeToUse),
@ -81,43 +78,6 @@ StyleSheet::StyleSheet(const StyleSheet& aCopy, StyleSheet* aParentToUse,
}
}
/* static */
// https://wicg.github.io/construct-stylesheets/#dom-cssstylesheet-cssstylesheet
already_AddRefed<StyleSheet> StyleSheet::Constructor(
const dom::GlobalObject& aGlobal, const dom::CSSStyleSheetInit& aOptions,
ErrorResult& aRv) {
nsCOMPtr<nsPIDOMWindowInner> window =
do_QueryInterface(aGlobal.GetAsSupports());
if (!window) {
aRv.ThrowDOMException(NS_ERROR_DOM_NOT_SUPPORTED_ERR,
"CSSStyleSheet constructor not supported when there "
"is no document");
return nullptr;
}
Document* constructorDocument = window->GetExtantDoc();
if (!constructorDocument) {
aRv.ThrowDOMException(NS_ERROR_DOM_NOT_SUPPORTED_ERR,
"CSSStyleSheet constructor not supported when there "
"is no document");
return nullptr;
}
auto ss = MakeRefPtr<StyleSheet>(css::SheetParsingMode::eAuthorSheetFeatures,
CORSMode::CORS_NONE, dom::SRIMetadata());
ss->mConstructorDocument = constructorDocument;
// TODO(nordzilla) aOptions.mAlternate is currently unused.
// Functionality will be implemented later.
// There are still issues with the spec that I need to work out
// before I can fully test all of the options:
// https://github.com/WICG/construct-stylesheets/issues/105
return ss.forget();
}
StyleSheet::~StyleSheet() {
MOZ_ASSERT(!mInner, "Inner should have been dropped in LastRelease");
}
@ -211,7 +171,6 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(StyleSheet)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(StyleSheet)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMedia)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRuleList)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mConstructorDocument)
tmp->TraverseInner(cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@ -219,7 +178,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(StyleSheet)
tmp->DropMedia();
tmp->UnlinkInner();
tmp->DropRuleList();
NS_IMPL_CYCLE_COLLECTION_UNLINK(mConstructorDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@ -557,61 +515,6 @@ int32_t StyleSheet::AddRule(const nsAString& aSelector, const nsAString& aBlock,
return -1;
}
// https://wicg.github.io/construct-stylesheets/#dom-cssstylesheet-replace
already_AddRefed<dom::Promise> StyleSheet::Replace(const nsAString& aText,
ErrorResult& aRv) {
// TODO(nordzilla) This is a stub to land the Constructable Stylesheets
// API under a preference (Bug 1604296). Functionality will be added later.
// Step 1 and 4 are variable declarations
// 2.1 Check if sheet is constructed, else throw.
if (!mConstructorDocument) {
aRv.ThrowDOMException(
NS_ERROR_DOM_NOT_ALLOWED_ERR,
"The replace() method can only be called on constructed style sheets");
return nullptr;
}
// 2.2 Check if sheet is modifiable, else throw.
// 3. Disallow modifications until finished.
nsIGlobalObject* globalObject = mConstructorDocument->GetScopeObject();
RefPtr<dom::Promise> promise = dom::Promise::Create(globalObject, aRv);
if (!promise) {
return nullptr;
}
// In parallel
// 5.1 Parse aText into rules.
// 5.2 Load import rules, throw NetworkError if failed.
// 5.3 Set sheet's rules to new rules.
promise->MaybeResolve(this);
// 6. Return the promise
return promise.forget();
}
// https://wicg.github.io/construct-stylesheets/#dom-cssstylesheet-replacesync
void StyleSheet::ReplaceSync(const nsAString& aText, ErrorResult& aRv) {
// TODO(nordzilla) This is a stub to land the Constructable Stylesheets
// API under a preference (Bug 1604296). Functionality will be added later.
// Step 1 is a variable declaration
// 2.1 Check if sheet is constructed, else throw.
if (!mConstructorDocument) {
aRv.ThrowDOMException(NS_ERROR_DOM_NOT_ALLOWED_ERR,
"The replaceSync() method can only be called on "
"constructed style sheets");
return;
}
// 2.2 Check if sheet is modifiable, else throw.
// 3. Parse aText into rules.
// 4. If rules contain @imports, throw NotAllowedError
// 5. Set sheet's rules to rules.
}
nsresult StyleSheet::DeleteRuleFromGroup(css::GroupRule* aGroup,
uint32_t aIndex) {
NS_ENSURE_ARG_POINTER(aGroup);

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

@ -52,7 +52,6 @@ class DocumentOrShadowRoot;
class MediaList;
class ShadowRoot;
class SRIMetadata;
struct CSSStyleSheetInit;
} // namespace dom
enum class StyleSheetState : uint8_t {
@ -93,10 +92,6 @@ class StyleSheet final : public nsICSSLoaderObserver, public nsWrapperCache {
StyleSheet(css::SheetParsingMode aParsingMode, CORSMode aCORSMode,
const dom::SRIMetadata& aIntegrity);
static already_AddRefed<StyleSheet> Constructor(const dom::GlobalObject&,
const dom::CSSStyleSheetInit&,
ErrorResult&);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(StyleSheet)
@ -359,8 +354,6 @@ class StyleSheet final : public nsICSSLoaderObserver, public nsWrapperCache {
int32_t AddRule(const nsAString& aSelector, const nsAString& aBlock,
const dom::Optional<uint32_t>& aIndex,
nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv);
already_AddRefed<dom::Promise> Replace(const nsAString& aText, ErrorResult&);
void ReplaceSync(const nsAString& aText, ErrorResult&);
// WebIDL miscellaneous bits
inline dom::ParentObject GetParentObject() const;
@ -485,8 +478,6 @@ class StyleSheet final : public nsICSSLoaderObserver, public nsWrapperCache {
StyleSheet* mParent; // weak ref
RefPtr<dom::Document> mConstructorDocument;
nsString mTitle;
// weak ref; parents maintain this for their children

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

@ -4890,12 +4890,6 @@
value: 4096
mirror: always
# Whether Constructable Stylesheets are enabled in script.
- name: layout.css.constructable-stylesheets.enabled
type: bool
value: false
mirror: always
# Whether we get notified of history queries for visited even if unvisited.
- name: layout.css.notify-of-unvisited
type: RelaxedAtomicBool