Skip to content
Permalink
Browse files
[Win] Custom elements tests are failing.
https://bugs.webkit.org/show_bug.cgi?id=159139

Reviewed by Alex Christensen.

.:

Enable custom element API on Windows.

* Source/cmake/OptionsWin.cmake:

Source/WebCore:

Fix compile errors after enabling custom element API.

* bindings/js/JSHTMLElementCustom.cpp:
(WebCore::constructJSHTMLElement):
* dom/CustomElementDefinitions.cpp:
(WebCore::CustomElementDefinitions::addElementDefinition):
* dom/Document.cpp:
(WebCore::createHTMLElementWithNameValidation):
(WebCore::createFallbackHTMLElement):
* dom/Element.cpp:
(WebCore::Element::attributeChanged):
* dom/LifecycleCallbackQueue.cpp:
(WebCore::LifecycleQueueItem::LifecycleQueueItem):
(WebCore::LifecycleCallbackQueue::enqueueElementUpgrade):
(WebCore::LifecycleCallbackQueue::enqueueAttributeChangedCallback):
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::insertHTMLElementOrFindCustomElementInterface):
(WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::CustomElementConstructionData::CustomElementConstructionData):
(WebCore::HTMLTreeBuilder::insertGenericHTMLElement):
* html/parser/HTMLTreeBuilder.h:

Source/WebKit/win:

Add preference for enabling custom element API.

* Interfaces/IWebPreferencesPrivate.idl:
* WebPreferenceKeysPrivate.h:
* WebPreferences.cpp:
(WebPreferences::initializeDefaultSettings):
(WebPreferences::customElementsEnabled):
(WebPreferences::setCustomElementsEnabled):
* WebPreferences.h:
* WebView.cpp:
(WebView::notifyPreferencesChanged):

Tools:

Enable custom element API when running tests.

* DumpRenderTree/win/DumpRenderTree.cpp:
(resetWebPreferencesToConsistentValues):

LayoutTests:

Update test expectations for passing custom elements tests.

* platform/win/TestExpectations:


Canonical link: https://commits.webkit.org/177306@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
pvollan committed Jun 28, 2016
1 parent 7302d44 commit 74436b2776e94998ba57f5f5efa71875e1846949
@@ -1,3 +1,14 @@
2016-06-28 Per Arne Vollan <pvollan@apple.com>

[Win] Custom elements tests are failing.
https://bugs.webkit.org/show_bug.cgi?id=159139

Reviewed by Alex Christensen.

Enable custom element API on Windows.

* Source/cmake/OptionsWin.cmake:

2016-06-23 Carlos Garcia Campos <cgarcia@igalia.com>

Unreviewed. Update OptionsGTK.cmake and NEWS for 2.13.2 release.
@@ -1,3 +1,14 @@
2016-06-28 Per Arne Vollan <pvollan@apple.com>

[Win] Custom elements tests are failing.
https://bugs.webkit.org/show_bug.cgi?id=159139

Reviewed by Alex Christensen.

Update test expectations for passing custom elements tests.

* platform/win/TestExpectations:

2016-06-28 Philippe Normand <pnormand@igalia.com>

[GTK] Web audio tests failing since GStreamer 1.6 upgrade
@@ -3318,6 +3318,8 @@ webkit.org/b/152411 http/tests/contentdispositionattachmentsandbox/referer-heade
webkit.org/b/152411 http/tests/contentdispositionattachmentsandbox/referer-header-stripped-with-meta-referer-unsafe-url.html [ Failure ]
webkit.org/b/152411 http/tests/contentdispositionattachmentsandbox/referer-header-stripped.html [ Failure ]

webkit.org/b/150225 fast/custom-elements [ Pass ]

webkit.org/b/148695 fast/shadow-dom [ Pass ]

# Touch events is not enabled on Windows
@@ -1,3 +1,35 @@
2016-06-28 Per Arne Vollan <pvollan@apple.com>

[Win] Custom elements tests are failing.
https://bugs.webkit.org/show_bug.cgi?id=159139

Reviewed by Alex Christensen.

Fix compile errors after enabling custom element API.

* bindings/js/JSHTMLElementCustom.cpp:
(WebCore::constructJSHTMLElement):
* dom/CustomElementDefinitions.cpp:
(WebCore::CustomElementDefinitions::addElementDefinition):
* dom/Document.cpp:
(WebCore::createHTMLElementWithNameValidation):
(WebCore::createFallbackHTMLElement):
* dom/Element.cpp:
(WebCore::Element::attributeChanged):
* dom/LifecycleCallbackQueue.cpp:
(WebCore::LifecycleQueueItem::LifecycleQueueItem):
(WebCore::LifecycleCallbackQueue::enqueueElementUpgrade):
(WebCore::LifecycleCallbackQueue::enqueueAttributeChangedCallback):
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::insertHTMLElementOrFindCustomElementInterface):
(WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::CustomElementConstructionData::CustomElementConstructionData):
(WebCore::HTMLTreeBuilder::insertGenericHTMLElement):
* html/parser/HTMLTreeBuilder.h:

2016-06-28 Philippe Normand <pnormand@igalia.com>

[GStreamer] usec rounding is wrong during accurate seeking
@@ -54,25 +54,25 @@ EncodedJSValue JSC_HOST_CALL constructJSHTMLElement(ExecState* state)
VM& vm = state->vm();
JSValue newTargetValue = state->thisValue();
JSObject* newTarget = newTargetValue.getObject();
auto* interface = definitions->findInterface(newTarget);
if (!interface)
auto* elementInterface = definitions->findInterface(newTarget);
if (!elementInterface)
return throwVMTypeError(state, "new.target does not define a custom element");

if (!interface->isUpgradingElement()) {
if (!elementInterface->isUpgradingElement()) {
auto* globalObject = jsConstructor->globalObject();
Structure* baseStructure = getDOMStructure<JSHTMLElement>(vm, *globalObject);
auto* newElementStructure = InternalFunction::createSubclassStructure(state, newTargetValue, baseStructure);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());

Ref<HTMLElement> element = HTMLElement::create(interface->name(), document);
Ref<HTMLElement> element = HTMLElement::create(elementInterface->name(), document);
element->setIsUnresolvedCustomElement();
auto* jsElement = JSHTMLElement::create(newElementStructure, globalObject, element.get());
cacheWrapper(globalObject->world(), element.ptr(), jsElement);
return JSValue::encode(jsElement);
}

Element* elementToUpgrade = interface->lastElementInConstructionStack();
Element* elementToUpgrade = elementInterface->lastElementInConstructionStack();
if (!elementToUpgrade) {
throwInvalidStateError(*state, "Cannot instantiate a custom element inside its own constrcutor during upgrades");
return JSValue::encode(jsUndefined());
@@ -90,7 +90,7 @@ EncodedJSValue JSC_HOST_CALL constructJSHTMLElement(ExecState* state)
if (state->hadException())
return JSValue::encode(jsUndefined());

interface->didUpgradeLastElementInConstructionStack();
elementInterface->didUpgradeLastElementInConstructionStack();

return JSValue::encode(elementWrapperValue);
}
@@ -39,12 +39,12 @@

namespace WebCore {

void CustomElementDefinitions::addElementDefinition(Ref<JSCustomElementInterface>&& interface)
void CustomElementDefinitions::addElementDefinition(Ref<JSCustomElementInterface>&& elementInterface)
{
AtomicString localName = interface->name().localName();
AtomicString localName = elementInterface->name().localName();
ASSERT(!m_nameMap.contains(localName));
m_constructorMap.add(interface->constructor(), interface.ptr());
m_nameMap.add(localName, interface.copyRef());
m_constructorMap.add(elementInterface->constructor(), elementInterface.ptr());
m_nameMap.add(localName, elementInterface.copyRef());

auto candidateList = m_upgradeCandidatesMap.find(localName);
if (candidateList == m_upgradeCandidatesMap.end())
@@ -56,7 +56,7 @@ void CustomElementDefinitions::addElementDefinition(Ref<JSCustomElementInterface

for (auto& candidate : list) {
ASSERT(candidate);
interface->upgradeElement(*candidate);
elementInterface->upgradeElement(*candidate);
}

// We should not be adding more upgrade candidate for this local name.
@@ -883,8 +883,8 @@ static RefPtr<Element> createHTMLElementWithNameValidation(Document& document, c
#if ENABLE(CUSTOM_ELEMENTS)
auto* definitions = document.customElementDefinitions();
if (UNLIKELY(definitions)) {
if (auto* interface = definitions->findInterface(localName))
return interface->constructElement(localName, JSCustomElementInterface::ShouldClearException::DoNotClear);
if (auto* elementInterface = definitions->findInterface(localName))
return elementInterface->constructElement(localName, JSCustomElementInterface::ShouldClearException::DoNotClear);
}
#endif

@@ -1074,10 +1074,10 @@ static Ref<HTMLElement> createFallbackHTMLElement(Document& document, const Qual
#if ENABLE(CUSTOM_ELEMENTS)
auto* definitions = document.customElementDefinitions();
if (UNLIKELY(definitions)) {
if (auto* interface = definitions->findInterface(name)) {
if (auto* elementInterface = definitions->findInterface(name)) {
Ref<HTMLElement> element = HTMLElement::create(name, document);
element->setIsUnresolvedCustomElement();
LifecycleCallbackQueue::enqueueElementUpgrade(element.get(), *interface);
LifecycleCallbackQueue::enqueueElementUpgrade(element.get(), *elementInterface);
return element;
}
}
@@ -1280,9 +1280,9 @@ void Element::attributeChanged(const QualifiedName& name, const AtomicString& ol
#if ENABLE(CUSTOM_ELEMENTS)
if (UNLIKELY(isCustomElement())) {
auto* definitions = document().customElementDefinitions();
auto* interface = definitions->findInterface(tagQName());
RELEASE_ASSERT(interface);
LifecycleCallbackQueue::enqueueAttributeChangedCallback(*this, *interface, name, oldValue, newValue);
auto* elementInterface = definitions->findInterface(tagQName());
RELEASE_ASSERT(elementInterface);
LifecycleCallbackQueue::enqueueAttributeChangedCallback(*this, *elementInterface, name, oldValue, newValue);
}
#endif

@@ -45,16 +45,16 @@ class LifecycleQueueItem {
AttributeChanged,
};

LifecycleQueueItem(Type type, Element& element, JSCustomElementInterface& interface)
LifecycleQueueItem(Type type, Element& element, JSCustomElementInterface& elementInterface)
: m_type(type)
, m_element(element)
, m_interface(interface)
, m_interface(elementInterface)
{ }

LifecycleQueueItem(Element& element, JSCustomElementInterface& interface, const QualifiedName& attributeName, const AtomicString& oldValue, const AtomicString& newValue)
LifecycleQueueItem(Element& element, JSCustomElementInterface& elementInterface, const QualifiedName& attributeName, const AtomicString& oldValue, const AtomicString& newValue)
: m_type(Type::AttributeChanged)
, m_element(element)
, m_interface(interface)
, m_interface(elementInterface)
, m_attributeName(attributeName)
, m_oldValue(oldValue)
, m_newValue(newValue)
@@ -90,17 +90,17 @@ LifecycleCallbackQueue::~LifecycleCallbackQueue()
ASSERT(m_items.isEmpty());
}

void LifecycleCallbackQueue::enqueueElementUpgrade(Element& element, JSCustomElementInterface& interface)
void LifecycleCallbackQueue::enqueueElementUpgrade(Element& element, JSCustomElementInterface& elementInterface)
{
if (auto* queue = CustomElementLifecycleProcessingStack::ensureCurrentQueue())
queue->m_items.append(LifecycleQueueItem(LifecycleQueueItem::Type::ElementUpgrade, element, interface));
queue->m_items.append(LifecycleQueueItem(LifecycleQueueItem::Type::ElementUpgrade, element, elementInterface));
}

void LifecycleCallbackQueue::enqueueAttributeChangedCallback(Element& element, JSCustomElementInterface& interface,
void LifecycleCallbackQueue::enqueueAttributeChangedCallback(Element& element, JSCustomElementInterface& elementInterface,
const QualifiedName& attributeName, const AtomicString& oldValue, const AtomicString& newValue)
{
if (auto* queue = CustomElementLifecycleProcessingStack::ensureCurrentQueue())
queue->m_items.append(LifecycleQueueItem(element, interface, attributeName, oldValue, newValue));
queue->m_items.append(LifecycleQueueItem(element, elementInterface, attributeName, oldValue, newValue));
}

void LifecycleCallbackQueue::invokeAll()
@@ -482,10 +482,10 @@ void HTMLConstructionSite::insertHTMLElement(AtomicHTMLToken& token)

JSCustomElementInterface* HTMLConstructionSite::insertHTMLElementOrFindCustomElementInterface(AtomicHTMLToken& token)
{
JSCustomElementInterface* interface = nullptr;
RefPtr<Element> element = createHTMLElementOrFindCustomElementInterface(token, &interface);
if (UNLIKELY(interface))
return interface;
JSCustomElementInterface* elementInterface = nullptr;
RefPtr<Element> element = createHTMLElementOrFindCustomElementInterface(token, &elementInterface);
if (UNLIKELY(elementInterface))
return elementInterface;
attachLater(currentNode(), *element);
m_openElements.push(HTMLStackItem::create(element.releaseNonNull(), token));
return nullptr;
@@ -661,8 +661,8 @@ RefPtr<Element> HTMLConstructionSite::createHTMLElementOrFindCustomElementInterf
if (customElementInterface) {
auto* definitions = ownerDocument.customElementDefinitions();
if (UNLIKELY(definitions)) {
if (auto* interface = definitions->findInterface(localName)) {
*customElementInterface = interface;
if (auto* elementInterface = definitions->findInterface(localName)) {
*customElementInterface = elementInterface;
return nullptr;
}
}
@@ -194,7 +194,7 @@ void HTMLDocumentParser::runScriptsForPausedTreeBuilder()
if (std::unique_ptr<CustomElementConstructionData> constructionData = m_treeBuilder->takeCustomElementConstructionData()) {
ASSERT(!m_treeBuilder->hasParserBlockingScriptWork());

RefPtr<Element> newElement = constructionData->interface->constructElement(constructionData->name, JSCustomElementInterface::ShouldClearException::Clear);
RefPtr<Element> newElement = constructionData->elementInterface->constructElement(constructionData->name, JSCustomElementInterface::ShouldClearException::Clear);
if (!newElement) {
ASSERT(!m_treeBuilder->isParsingTemplateContents());
newElement = HTMLUnknownElement::create(QualifiedName(nullAtom, constructionData->name, xhtmlNamespaceURI), *document());
@@ -55,8 +55,8 @@ using namespace HTMLNames;

#if ENABLE(CUSTOM_ELEMENTS)

CustomElementConstructionData::CustomElementConstructionData(Ref<JSCustomElementInterface>&& interface, const AtomicString& name, const Vector<Attribute>& attributes)
: interface(WTFMove(interface))
CustomElementConstructionData::CustomElementConstructionData(Ref<JSCustomElementInterface>&& customElementInterface, const AtomicString& name, const Vector<Attribute>& attributes)
: elementInterface(WTFMove(customElementInterface))
, name(name)
, attributes(attributes) // FIXME: Avoid copying attributes.
{ }
@@ -909,9 +909,9 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken& token)
inline void HTMLTreeBuilder::insertGenericHTMLElement(AtomicHTMLToken& token)
{
#if ENABLE(CUSTOM_ELEMENTS)
auto* interface = m_tree.insertHTMLElementOrFindCustomElementInterface(token);
if (UNLIKELY(interface))
m_customElementToConstruct = std::make_unique<CustomElementConstructionData>(*interface, token.name(), token.attributes());
auto* elementInterface = m_tree.insertHTMLElementOrFindCustomElementInterface(token);
if (UNLIKELY(elementInterface))
m_customElementToConstruct = std::make_unique<CustomElementConstructionData>(*elementInterface, token.name(), token.attributes());
#else
m_tree.insertHTMLElement(token);
#endif
@@ -42,7 +42,7 @@ struct CustomElementConstructionData {
CustomElementConstructionData(Ref<JSCustomElementInterface>&&, const AtomicString& name, const Vector<Attribute>&);
~CustomElementConstructionData();

Ref<JSCustomElementInterface> interface;
Ref<JSCustomElementInterface> elementInterface;
AtomicString name;
Vector<Attribute> attributes;
};
@@ -1,3 +1,22 @@
2016-06-28 Per Arne Vollan <pvollan@apple.com>

[Win] Custom elements tests are failing.
https://bugs.webkit.org/show_bug.cgi?id=159139

Reviewed by Alex Christensen.

Add preference for enabling custom element API.

* Interfaces/IWebPreferencesPrivate.idl:
* WebPreferenceKeysPrivate.h:
* WebPreferences.cpp:
(WebPreferences::initializeDefaultSettings):
(WebPreferences::customElementsEnabled):
(WebPreferences::setCustomElementsEnabled):
* WebPreferences.h:
* WebView.cpp:
(WebView::notifyPreferencesChanged):

2016-06-23 Per Arne Vollan <pvollan@apple.com>

[Win] The test accessibility/aria-labelledby-overrides-label.html is failing.
@@ -179,5 +179,7 @@ interface IWebPreferencesPrivate3 : IWebPreferencesPrivate2
HRESULT setFetchAPIEnabled([in] BOOL enabled);
HRESULT shadowDOMEnabled([out, retval] BOOL* enabled);
HRESULT setShadowDOMEnabled([in] BOOL enabled);
HRESULT customElementsEnabled([out, retval] BOOL* enabled);
HRESULT setCustomElementsEnabled([in] BOOL enabled);
}

@@ -171,3 +171,5 @@
#define WebKitFetchAPIEnabledPreferenceKey "WebKitFetchAPIEnabled"

#define WebKitShadowDOMEnabledPreferenceKey "WebKitShadowDOMEnabled"

#define WebKitCustomElementsEnabledPreferenceKey "WebKitCustomElementsEnabled"
@@ -295,6 +295,8 @@ void WebPreferences::initializeDefaultSettings()

CFDictionaryAddValue(defaults, CFSTR(WebKitShadowDOMEnabledPreferenceKey), kCFBooleanFalse);

CFDictionaryAddValue(defaults, CFSTR(WebKitCustomElementsEnabledPreferenceKey), kCFBooleanFalse);

defaultSettings = defaults;
}

@@ -1949,3 +1951,17 @@ HRESULT WebPreferences::setShadowDOMEnabled(BOOL enabled)
setBoolValue(WebKitShadowDOMEnabledPreferenceKey, enabled);
return S_OK;
}

HRESULT WebPreferences::customElementsEnabled(_Out_ BOOL* enabled)
{
if (!enabled)
return E_POINTER;
*enabled = boolValueForKey(WebKitCustomElementsEnabledPreferenceKey);
return S_OK;
}

HRESULT WebPreferences::setCustomElementsEnabled(BOOL enabled)
{
setBoolValue(WebKitCustomElementsEnabledPreferenceKey, enabled);
return S_OK;
}
@@ -237,6 +237,8 @@ class WebPreferences : public IWebPreferences, public IWebPreferencesPrivate3 {
virtual HRESULT STDMETHODCALLTYPE setFetchAPIEnabled(BOOL);
virtual HRESULT STDMETHODCALLTYPE shadowDOMEnabled(_Out_ BOOL*);
virtual HRESULT STDMETHODCALLTYPE setShadowDOMEnabled(BOOL);
virtual HRESULT STDMETHODCALLTYPE customElementsEnabled(_Out_ BOOL*);
virtual HRESULT STDMETHODCALLTYPE setCustomElementsEnabled(BOOL);

// WebPreferences

@@ -5052,6 +5052,13 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
return hr;
RuntimeEnabledFeatures::sharedFeatures().setShadowDOMEnabled(!!enabled);

#if ENABLE(CUSTOM_ELEMENTS)
hr = prefsPrivate->customElementsEnabled(&enabled);
if (FAILED(hr))
return hr;
RuntimeEnabledFeatures::sharedFeatures().setCustomElementsEnabled(!!enabled);
#endif

hr = preferences->privateBrowsingEnabled(&enabled);
if (FAILED(hr))
return hr;
@@ -20,7 +20,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_REGIONS PUBLIC ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SELECTORS_LEVEL4 PUBLIC ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SHAPES PUBLIC ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CURSOR_VISIBILITY PUBLIC ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CUSTOM_ELEMENTS PRIVATE OFF)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CUSTOM_ELEMENTS PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CUSTOM_SCHEME_HANDLER PUBLIC OFF)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATALIST_ELEMENT PUBLIC OFF)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATA_TRANSFER_ITEMS PUBLIC OFF)

0 comments on commit 74436b2

Please sign in to comment.