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

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

Issue 2080653002: SameSite: Correctly set requests' initiator for new tabs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: firstPartyForCookiesFix Created 4 years, 6 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 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 4141 matching lines...) Expand 10 before | Expand all | Expand 10 after
4152 // FIXME: If this document came from the file system, the HTML5 4152 // FIXME: If this document came from the file system, the HTML5
4153 // specificiation tells us to read the last modification date from the file 4153 // specificiation tells us to read the last modification date from the file
4154 // system. 4154 // system.
4155 if (!foundDate) 4155 if (!foundDate)
4156 date.setMillisecondsSinceEpochForDateTime(convertToLocalTime(currentTime MS())); 4156 date.setMillisecondsSinceEpochForDateTime(convertToLocalTime(currentTime MS()));
4157 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, dat e.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second()); 4157 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, dat e.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second());
4158 } 4158 }
4159 4159
4160 const KURL Document::firstPartyForCookies() const 4160 const KURL Document::firstPartyForCookies() const
4161 { 4161 {
4162 // If this is an imported document, grab its master document's first-party:
4163 if (importsController() && importsController()->master() && importsControlle r()->master() != this)
4164 return importsController()->master()->firstPartyForCookies();
Mike West 2016/06/21 09:01:01 Note also: I could split this and the 'render_fram
4165
4162 // TODO(mkwst): This doesn't correctly handle sandboxed documents; we want t o look at their URL, 4166 // TODO(mkwst): This doesn't correctly handle sandboxed documents; we want t o look at their URL,
4163 // but we can't because we don't know what it is. 4167 // but we can't because we don't know what it is.
4164 Frame* top = frame()->tree().top(); 4168 Frame* top = frame()->tree().top();
4165 KURL topDocumentURL = top->isLocalFrame() 4169 KURL topDocumentURL = top->isLocalFrame()
4166 ? toLocalFrame(top)->document()->url() 4170 ? toLocalFrame(top)->document()->url()
4167 : KURL(KURL(), top->securityContext()->getSecurityOrigin()->toString()); 4171 : KURL(KURL(), top->securityContext()->getSecurityOrigin()->toString());
4168 if (SchemeRegistry::shouldTreatURLSchemeAsFirstPartyWhenTopLevel(topDocument URL.protocol())) 4172 if (SchemeRegistry::shouldTreatURLSchemeAsFirstPartyWhenTopLevel(topDocument URL.protocol()))
4169 return topDocumentURL; 4173 return topDocumentURL;
4170 4174
4171 // We're intentionally using the URL of each document rather than the docume nt's SecurityOrigin. 4175 // We're intentionally using the URL of each document rather than the docume nt's SecurityOrigin.
(...skipping 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after
6018 } 6022 }
6019 6023
6020 void showLiveDocumentInstances() 6024 void showLiveDocumentInstances()
6021 { 6025 {
6022 WeakDocumentSet& set = liveDocumentSet(); 6026 WeakDocumentSet& set = liveDocumentSet();
6023 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6027 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6024 for (Document* document : set) 6028 for (Document* document : set)
6025 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6029 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6026 } 6030 }
6027 #endif 6031 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698