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

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

Issue 2860913002: [ES6 modules] accessing document.currentScript on module scripts should not crash (Closed)
Patch Set: remove bad title Created 3 years, 7 months 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 5271 matching lines...) Expand 10 before | Expand all | Expand 10 after
5282 UseCounter::Count(*this, osd_disposition); 5282 UseCounter::Count(*this, osd_disposition);
5283 5283
5284 return link_element->Href(); 5284 return link_element->Href();
5285 } 5285 }
5286 5286
5287 return KURL(); 5287 return KURL();
5288 } 5288 }
5289 5289
5290 void Document::currentScriptForBinding( 5290 void Document::currentScriptForBinding(
5291 HTMLScriptElementOrSVGScriptElement& script_element) const { 5291 HTMLScriptElementOrSVGScriptElement& script_element) const {
5292 if (!current_script_stack_.IsEmpty()) 5292 if (!current_script_stack_.IsEmpty()) {
5293 current_script_stack_.back()->SetScriptElementForBinding(script_element); 5293 if (ScriptElementBase* script_element_base = current_script_stack_.back())
5294 script_element_base->SetScriptElementForBinding(script_element);
5295 }
5294 } 5296 }
5295 5297
5296 void Document::PushCurrentScript(ScriptElementBase* new_current_script) { 5298 void Document::PushCurrentScript(ScriptElementBase* new_current_script) {
5297 current_script_stack_.push_back(new_current_script); 5299 current_script_stack_.push_back(new_current_script);
5298 } 5300 }
5299 5301
5300 void Document::PopCurrentScript(ScriptElementBase* script) { 5302 void Document::PopCurrentScript(ScriptElementBase* script) {
5301 DCHECK(!current_script_stack_.IsEmpty()); 5303 DCHECK(!current_script_stack_.IsEmpty());
5302 DCHECK_EQ(current_script_stack_.back(), script); 5304 DCHECK_EQ(current_script_stack_.back(), script);
5303 current_script_stack_.pop_back(); 5305 current_script_stack_.pop_back();
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
6779 } 6781 }
6780 6782
6781 void showLiveDocumentInstances() { 6783 void showLiveDocumentInstances() {
6782 WeakDocumentSet& set = liveDocumentSet(); 6784 WeakDocumentSet& set = liveDocumentSet();
6783 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6785 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6784 for (blink::Document* document : set) 6786 for (blink::Document* document : set)
6785 fprintf(stderr, "- Document %p URL: %s\n", document, 6787 fprintf(stderr, "- Document %p URL: %s\n", document,
6786 document->Url().GetString().Utf8().data()); 6788 document->Url().GetString().Utf8().data());
6787 } 6789 }
6788 #endif 6790 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/set-currentScript-on-window.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698