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

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: Remove unique security origin 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
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/xmlviewer/no-unique-origin.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 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 : intValueForLength(style->marginBottom(), width); 2384 : intValueForLength(style->marginBottom(), width);
2385 marginLeft = style->marginLeft().isAuto() 2385 marginLeft = style->marginLeft().isAuto()
2386 ? marginLeft 2386 ? marginLeft
2387 : intValueForLength(style->marginLeft(), width); 2387 : intValueForLength(style->marginLeft(), width);
2388 } 2388 }
2389 2389
2390 void Document::setIsViewSource(bool isViewSource) { 2390 void Document::setIsViewSource(bool isViewSource) {
2391 m_isViewSource = isViewSource; 2391 m_isViewSource = isViewSource;
2392 if (!m_isViewSource) 2392 if (!m_isViewSource)
2393 return; 2393 return;
2394
2395 setSecurityOrigin(SecurityOrigin::createUnique());
2396 didUpdateSecurityOrigin();
2397 } 2394 }
2398 2395
2399 void Document::scheduleUseShadowTreeUpdate(SVGUseElement& element) { 2396 void Document::scheduleUseShadowTreeUpdate(SVGUseElement& element) {
2400 m_useElementsNeedingUpdate.insert(&element); 2397 m_useElementsNeedingUpdate.insert(&element);
2401 scheduleLayoutTreeUpdateIfNeeded(); 2398 scheduleLayoutTreeUpdateIfNeeded();
2402 } 2399 }
2403 2400
2404 void Document::unscheduleUseShadowTreeUpdate(SVGUseElement& element) { 2401 void Document::unscheduleUseShadowTreeUpdate(SVGUseElement& element) {
2405 m_useElementsNeedingUpdate.erase(&element); 2402 m_useElementsNeedingUpdate.erase(&element);
2406 } 2403 }
(...skipping 3219 matching lines...) Expand 10 before | Expand all | Expand 10 after
5626 if (reason == AboutToExecuteScript) { 5623 if (reason == AboutToExecuteScript) {
5627 addConsoleMessage(ConsoleMessage::create( 5624 addConsoleMessage(ConsoleMessage::create(
5628 SecurityMessageSource, ErrorMessageLevel, 5625 SecurityMessageSource, ErrorMessageLevel,
5629 "Blocked script execution in '" + url().elidedString() + 5626 "Blocked script execution in '" + url().elidedString() +
5630 "' because the document's frame is sandboxed and the " 5627 "' because the document's frame is sandboxed and the "
5631 "'allow-scripts' permission is not set.")); 5628 "'allow-scripts' permission is not set."));
5632 } 5629 }
5633 return false; 5630 return false;
5634 } 5631 }
5635 5632
5636 if (isViewSource()) {
5637 DCHECK(getSecurityOrigin()->isUnique());
5638 return true;
5639 }
5640
5641 DCHECK(frame()) 5633 DCHECK(frame())
5642 << "you are querying canExecuteScripts on a non contextDocument."; 5634 << "you are querying canExecuteScripts on a non contextDocument.";
5643 5635
5644 LocalFrameClient* client = frame()->loader().client(); 5636 LocalFrameClient* client = frame()->loader().client();
5645 if (!client) 5637 if (!client)
5646 return false; 5638 return false;
5647 5639
5648 Settings* settings = frame()->settings(); 5640 Settings* settings = frame()->settings();
5649 if (!client->allowScript(settings && settings->getScriptEnabled())) { 5641 if (!client->allowScript(settings && settings->getScriptEnabled())) {
5650 if (reason == AboutToExecuteScript) 5642 if (reason == AboutToExecuteScript)
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
6689 } 6681 }
6690 6682
6691 void showLiveDocumentInstances() { 6683 void showLiveDocumentInstances() {
6692 WeakDocumentSet& set = liveDocumentSet(); 6684 WeakDocumentSet& set = liveDocumentSet();
6693 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6685 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6694 for (blink::Document* document : set) 6686 for (blink::Document* document : set)
6695 fprintf(stderr, "- Document %p URL: %s\n", document, 6687 fprintf(stderr, "- Document %p URL: %s\n", document,
6696 document->url().getString().utf8().data()); 6688 document->url().getString().utf8().data());
6697 } 6689 }
6698 #endif 6690 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/xmlviewer/no-unique-origin.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698