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

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

Issue 2530243002: Crash in blink::getTypeExtension (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/custom/crash-in-getTypeExtension.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
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())
sof 2016/11/26 07:36:30 Is |exceptionState| intentionally ignored here?
Anton Obzhirov 2016/11/27 19:49:53 Previously getTypeExtension was called in createEl
703 return impl.is(); 703 return impl.is();
704 704
705 return toCoreString(dict.v8Value()->ToString()); 705 v8::Local<v8::String> stringObject;
sof 2016/11/26 07:36:30 The spec says "Let 'is' be the value of |is| membe
Anton Obzhirov 2016/11/27 19:49:53 Yes, stringification of the dictionary is for back
706 if (dict.v8Value()->IsString()) {
707 stringObject = dict.v8Value().As<v8::String>();
708 } else {
709 v8::TryCatch block(dict.isolate());
710 if (!v8Call(dict.v8Value()->ToString(dict.isolate()->GetCurrentContext()),
711 stringObject, block)) {
712 exceptionState.rethrowV8Exception(block.Exception());
713 return emptyString();
714 }
715 }
716
717 if (!stringObject.IsEmpty())
718 return toCoreString(stringObject);
706 } 719 }
707 720
708 return emptyString(); 721 return emptyString();
709 } 722 }
710 723
711 // https://dom.spec.whatwg.org/#dom-document-createelement 724 // https://dom.spec.whatwg.org/#dom-document-createelement
712 Element* Document::createElement(const AtomicString& localName, 725 Element* Document::createElement(const AtomicString& localName,
713 const StringOrDictionary& stringOrOptions, 726 const StringOrDictionary& stringOrOptions,
714 ExceptionState& exceptionState) { 727 ExceptionState& exceptionState) {
715 // 1. If localName does not match Name production, throw InvalidCharacterError 728 // 1. If localName does not match Name production, throw InvalidCharacterError
(...skipping 5827 matching lines...) Expand 10 before | Expand all | Expand 10 after
6543 } 6556 }
6544 6557
6545 void showLiveDocumentInstances() { 6558 void showLiveDocumentInstances() {
6546 WeakDocumentSet& set = liveDocumentSet(); 6559 WeakDocumentSet& set = liveDocumentSet();
6547 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6560 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6548 for (Document* document : set) 6561 for (Document* document : set)
6549 fprintf(stderr, "- Document %p URL: %s\n", document, 6562 fprintf(stderr, "- Document %p URL: %s\n", document,
6550 document->url().getString().utf8().data()); 6563 document->url().getString().utf8().data());
6551 } 6564 }
6552 #endif 6565 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/custom/crash-in-getTypeExtension.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698