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

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

Issue 1075163002: Ancestors count towards first-partyness. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Tests. Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/platform/RuntimeEnabledFeatures.in » ('j') | 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 r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 3961 matching lines...) Expand 10 before | Expand all | Expand 10 after
3972 // FIXME: If this document came from the file system, the HTML5 3972 // FIXME: If this document came from the file system, the HTML5
3973 // specificiation tells us to read the last modification date from the file 3973 // specificiation tells us to read the last modification date from the file
3974 // system. 3974 // system.
3975 if (!foundDate) 3975 if (!foundDate)
3976 date.setMillisecondsSinceEpochForDateTime(convertToLocalTime(currentTime MS())); 3976 date.setMillisecondsSinceEpochForDateTime(convertToLocalTime(currentTime MS()));
3977 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, dat e.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second()); 3977 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, dat e.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second());
3978 } 3978 }
3979 3979
3980 const KURL& Document::firstPartyForCookies() const 3980 const KURL& Document::firstPartyForCookies() const
3981 { 3981 {
3982 if (!RuntimeEnabledFeatures::firstPartyIncludesAncestorsEnabled())
3983 return topDocument().url();
3984
3985 // We're intentionally using the URL of each document rather than the docume nt's SecurityOrigin.
3986 // Sandboxing a document into a unique origin shouldn't effect first-/third- party status for
3987 // cookies and site data.
3988 RefPtr<SecurityOrigin> topOrigin = SecurityOrigin::create(topDocument().url( ));
3989 const Document* currentDocument = this;
3990 while (currentDocument) {
3991 // Skip over srcdoc documents, as they are always same-origin with their closest non-srcdoc parent.
3992 while (currentDocument->isSrcdocDocument())
3993 currentDocument = currentDocument->parentDocument();
3994 ASSERT(currentDocument);
3995
3996 if (!topOrigin->canRequest(currentDocument->url()))
3997 return SecurityOrigin::urlWithUniqueSecurityOrigin();
3998
3999 currentDocument = currentDocument->parentDocument();
4000 }
4001
3982 return topDocument().url(); 4002 return topDocument().url();
3983 } 4003 }
3984 4004
3985 static bool isValidNameNonASCII(const LChar* characters, unsigned length) 4005 static bool isValidNameNonASCII(const LChar* characters, unsigned length)
3986 { 4006 {
3987 if (!isValidNameStart(characters[0])) 4007 if (!isValidNameStart(characters[0]))
3988 return false; 4008 return false;
3989 4009
3990 for (unsigned i = 1; i < length; ++i) { 4010 for (unsigned i = 1; i < length; ++i) {
3991 if (!isValidNamePart(characters[i])) 4011 if (!isValidNamePart(characters[i]))
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
5700 #ifndef NDEBUG 5720 #ifndef NDEBUG
5701 using namespace blink; 5721 using namespace blink;
5702 void showLiveDocumentInstances() 5722 void showLiveDocumentInstances()
5703 { 5723 {
5704 WeakDocumentSet& set = liveDocumentSet(); 5724 WeakDocumentSet& set = liveDocumentSet();
5705 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5725 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5706 for (Document* document : set) 5726 for (Document* document : set)
5707 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5727 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5708 } 5728 }
5709 #endif 5729 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698