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

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

Issue 2744413002: Set view source without creating a unique origin in XMLDocumentParser (Closed)
Patch Set: Add test Created 3 years, 9 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 2369 matching lines...) Expand 10 before | Expand all | Expand 10 after
2380 2380
2381 void Document::setIsViewSource(bool isViewSource) { 2381 void Document::setIsViewSource(bool isViewSource) {
2382 m_isViewSource = isViewSource; 2382 m_isViewSource = isViewSource;
2383 if (!m_isViewSource) 2383 if (!m_isViewSource)
2384 return; 2384 return;
2385 2385
2386 setSecurityOrigin(SecurityOrigin::createUnique()); 2386 setSecurityOrigin(SecurityOrigin::createUnique());
2387 didUpdateSecurityOrigin(); 2387 didUpdateSecurityOrigin();
2388 } 2388 }
2389 2389
2390 void Document::setIsViewSourceWithoutUniqueOrigin() {
2391 m_isViewSource = true;
2392 }
2393
2390 void Document::scheduleUseShadowTreeUpdate(SVGUseElement& element) { 2394 void Document::scheduleUseShadowTreeUpdate(SVGUseElement& element) {
2391 m_useElementsNeedingUpdate.insert(&element); 2395 m_useElementsNeedingUpdate.insert(&element);
2392 scheduleLayoutTreeUpdateIfNeeded(); 2396 scheduleLayoutTreeUpdateIfNeeded();
2393 } 2397 }
2394 2398
2395 void Document::unscheduleUseShadowTreeUpdate(SVGUseElement& element) { 2399 void Document::unscheduleUseShadowTreeUpdate(SVGUseElement& element) {
2396 m_useElementsNeedingUpdate.erase(&element); 2400 m_useElementsNeedingUpdate.erase(&element);
2397 } 2401 }
2398 2402
2399 void Document::updateUseShadowTreesIfNeeded() { 2403 void Document::updateUseShadowTreesIfNeeded() {
(...skipping 3216 matching lines...) Expand 10 before | Expand all | Expand 10 after
5616 addConsoleMessage(ConsoleMessage::create( 5620 addConsoleMessage(ConsoleMessage::create(
5617 SecurityMessageSource, ErrorMessageLevel, 5621 SecurityMessageSource, ErrorMessageLevel,
5618 "Blocked script execution in '" + url().elidedString() + 5622 "Blocked script execution in '" + url().elidedString() +
5619 "' because the document's frame is sandboxed and the " 5623 "' because the document's frame is sandboxed and the "
5620 "'allow-scripts' permission is not set.")); 5624 "'allow-scripts' permission is not set."));
5621 } 5625 }
5622 return false; 5626 return false;
5623 } 5627 }
5624 5628
5625 if (isViewSource()) { 5629 if (isViewSource()) {
5626 DCHECK(getSecurityOrigin()->isUnique());
5627 return true; 5630 return true;
5628 } 5631 }
5629 5632
5630 DCHECK(frame()) 5633 DCHECK(frame())
5631 << "you are querying canExecuteScripts on a non contextDocument."; 5634 << "you are querying canExecuteScripts on a non contextDocument.";
5632 5635
5633 LocalFrameClient* client = frame()->loader().client(); 5636 LocalFrameClient* client = frame()->loader().client();
5634 if (!client) 5637 if (!client)
5635 return false; 5638 return false;
5636 5639
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
6678 } 6681 }
6679 6682
6680 void showLiveDocumentInstances() { 6683 void showLiveDocumentInstances() {
6681 WeakDocumentSet& set = liveDocumentSet(); 6684 WeakDocumentSet& set = liveDocumentSet();
6682 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6685 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6683 for (blink::Document* document : set) 6686 for (blink::Document* document : set)
6684 fprintf(stderr, "- Document %p URL: %s\n", document, 6687 fprintf(stderr, "- Document %p URL: %s\n", document,
6685 document->url().getString().utf8().data()); 6688 document->url().getString().utf8().data());
6686 } 6689 }
6687 #endif 6690 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698