Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2479243002: If 'is' is not null and custom element definition not found, NotFoundError should be thrown (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 AtomicString localName = convertLocalName(name); 675 AtomicString localName = convertLocalName(name);
676 if (CustomElement::shouldCreateCustomElement(localName)) 676 if (CustomElement::shouldCreateCustomElement(localName))
677 return CustomElement::createCustomElementSync(*this, localName); 677 return CustomElement::createCustomElementSync(*this, localName);
678 return HTMLElementFactory::createHTMLElement(localName, *this, 0, 678 return HTMLElementFactory::createHTMLElement(localName, *this, 0,
679 CreatedByCreateElement); 679 CreatedByCreateElement);
680 } 680 }
681 681
682 return Element::create(QualifiedName(nullAtom, name, nullAtom), this); 682 return Element::create(QualifiedName(nullAtom, name, nullAtom), this);
683 } 683 }
684 684
685 String getTypeExtension(Document* document, 685 String getTypeExtension(Document* document,
dominicc (has gone to gerrit) 2016/11/08 08:48:36 I'm pretty sure this isn't how we should implement
686 const StringOrDictionary& stringOrOptions, 686 const StringOrDictionary& stringOrOptions,
687 ExceptionState& exceptionState) { 687 ExceptionState& exceptionState) {
688 if (stringOrOptions.isNull()) 688 if (stringOrOptions.isNull())
689 return emptyString(); 689 return emptyString();
690 690
691 if (stringOrOptions.isString()) { 691 if (stringOrOptions.isString()) {
692 UseCounter::count(document, 692 UseCounter::count(document,
693 UseCounter::DocumentCreateElement2ndArgStringHandling); 693 UseCounter::DocumentCreateElement2ndArgStringHandling);
694 return stringOrOptions.getAsString(); 694 return stringOrOptions.getAsString();
695 } 695 }
696 696
697 if (stringOrOptions.isDictionary()) { 697 if (stringOrOptions.isDictionary()) {
698 Dictionary dict = stringOrOptions.getAsDictionary(); 698 Dictionary dict = stringOrOptions.getAsDictionary();
699 ElementCreationOptions impl; 699 ElementCreationOptions impl;
700 V8ElementCreationOptions::toImpl(dict.isolate(), dict.v8Value(), impl, 700 V8ElementCreationOptions::toImpl(dict.isolate(), dict.v8Value(), impl,
701 exceptionState); 701 exceptionState);
702 if (impl.hasIs()) 702 if (impl.hasIs()) {
703 AtomicString type(impl.is());
704 if (document->registrationContext() &&
dominicc (has gone to gerrit) 2016/11/16 02:46:41 I need to see this patch based on top of yurak's p
705 !document->registrationContext()->nameIsDefined(type) &&
706 !document->registrationContext()->v1NameIsDefined(type)) {
707 exceptionState.throwDOMException(NotFoundError,
708 "The type provided ('" + type + "') is not found.");
709 return emptyString();
710 }
703 return impl.is(); 711 return impl.is();
712 }
704 713
705 return toCoreString(dict.v8Value()->ToString()); 714 return toCoreString(dict.v8Value()->ToString());
706 } 715 }
707 716
708 return emptyString(); 717 return emptyString();
709 } 718 }
710 719
711 Element* Document::createElement(const AtomicString& localName, 720 Element* Document::createElement(const AtomicString& localName,
712 const StringOrDictionary& stringOrOptions, 721 const StringOrDictionary& stringOrOptions,
713 ExceptionState& exceptionState) { 722 ExceptionState& exceptionState) {
(...skipping 5750 matching lines...) Expand 10 before | Expand all | Expand 10 after
6464 } 6473 }
6465 6474
6466 void showLiveDocumentInstances() { 6475 void showLiveDocumentInstances() {
6467 WeakDocumentSet& set = liveDocumentSet(); 6476 WeakDocumentSet& set = liveDocumentSet();
6468 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6477 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6469 for (Document* document : set) 6478 for (Document* document : set)
6470 fprintf(stderr, "- Document %p URL: %s\n", document, 6479 fprintf(stderr, "- Document %p URL: %s\n", document,
6471 document->url().getString().utf8().data()); 6480 document->url().getString().utf8().data());
6472 } 6481 }
6473 #endif 6482 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698