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

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

Issue 2102993002: Fix WebSocket to set first party for cookies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: a Created 4 years, 5 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 4149 matching lines...) Expand 10 before | Expand all | Expand 10 after
4160 date.setMillisecondsSinceEpochForDateTime(convertToLocalTime(currentTime MS())); 4160 date.setMillisecondsSinceEpochForDateTime(convertToLocalTime(currentTime MS()));
4161 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, dat e.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second()); 4161 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, dat e.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second());
4162 } 4162 }
4163 4163
4164 const KURL Document::firstPartyForCookies() const 4164 const KURL Document::firstPartyForCookies() const
4165 { 4165 {
4166 // If this is an imported document, grab its master document's first-party: 4166 // If this is an imported document, grab its master document's first-party:
4167 if (importsController() && importsController()->master() && importsControlle r()->master() != this) 4167 if (importsController() && importsController()->master() && importsControlle r()->master() != this)
4168 return importsController()->master()->firstPartyForCookies(); 4168 return importsController()->master()->firstPartyForCookies();
4169 4169
4170 if (!frame()) {
4171 return SecurityOrigin::urlWithUniqueSecurityOrigin();
4172 }
Mike West 2016/07/05 08:45:10 Nit: No {} for single line bodies. Would you mind
tyoshino (SeeGerritForStatus) 2016/07/05 14:41:27 Fixed
4173
4170 // TODO(mkwst): This doesn't correctly handle sandboxed documents; we want t o look at their URL, 4174 // TODO(mkwst): This doesn't correctly handle sandboxed documents; we want t o look at their URL,
4171 // but we can't because we don't know what it is. 4175 // but we can't because we don't know what it is.
4172 Frame* top = frame()->tree().top(); 4176 Frame* top = frame()->tree().top();
4173 KURL topDocumentURL = top->isLocalFrame() 4177 KURL topDocumentURL = top->isLocalFrame()
4174 ? toLocalFrame(top)->document()->url() 4178 ? toLocalFrame(top)->document()->url()
4175 : KURL(KURL(), top->securityContext()->getSecurityOrigin()->toString()); 4179 : KURL(KURL(), top->securityContext()->getSecurityOrigin()->toString());
4176 if (SchemeRegistry::shouldTreatURLSchemeAsFirstPartyWhenTopLevel(topDocument URL.protocol())) 4180 if (SchemeRegistry::shouldTreatURLSchemeAsFirstPartyWhenTopLevel(topDocument URL.protocol()))
4177 return topDocumentURL; 4181 return topDocumentURL;
4178 4182
4179 // We're intentionally using the URL of each document rather than the docume nt's SecurityOrigin. 4183 // We're intentionally using the URL of each document rather than the docume nt's SecurityOrigin.
(...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after
6030 } 6034 }
6031 6035
6032 void showLiveDocumentInstances() 6036 void showLiveDocumentInstances()
6033 { 6037 {
6034 WeakDocumentSet& set = liveDocumentSet(); 6038 WeakDocumentSet& set = liveDocumentSet();
6035 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6039 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6036 for (Document* document : set) 6040 for (Document* document : set)
6037 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6041 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6038 } 6042 }
6039 #endif 6043 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698