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

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

Issue 2009453002: service worker: Don't control a subframe of an insecure context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: selfreview 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 return toLayoutPart(layoutObject)->widget(); 346 return toLayoutPart(layoutObject)->widget();
347 } 347 }
348 348
349 static bool acceptsEditingFocus(const Element& element) 349 static bool acceptsEditingFocus(const Element& element)
350 { 350 {
351 DCHECK(element.hasEditableStyle()); 351 DCHECK(element.hasEditableStyle());
352 352
353 return element.document().frame() && element.rootEditableElement(); 353 return element.document().frame() && element.rootEditableElement();
354 } 354 }
355 355
356 static bool isOriginPotentiallyTrustworthy(SecurityOrigin* origin, String* error Message)
357 {
358 if (origin->isPotentiallyTrustworthy())
359 return true;
360 if (errorMessage)
361 *errorMessage = origin->isPotentiallyTrustworthyErrorMessage();
362 return false;
363 }
364
365 uint64_t Document::s_globalTreeVersion = 0; 356 uint64_t Document::s_globalTreeVersion = 0;
366 357
367 static bool s_threadedParsingEnabledForTesting = true; 358 static bool s_threadedParsingEnabledForTesting = true;
368 359
369 Document::WeakDocumentSet& Document::liveDocumentSet() 360 Document::WeakDocumentSet& Document::liveDocumentSet()
370 { 361 {
371 DEFINE_STATIC_LOCAL(WeakDocumentSet, set, (new WeakDocumentSet)); 362 DEFINE_STATIC_LOCAL(WeakDocumentSet, set, (new WeakDocumentSet));
372 return set; 363 return set;
373 } 364 }
374 365
(...skipping 3003 matching lines...) Expand 10 before | Expand all | Expand 10 after
3378 // Additionally, with 3369 // Additionally, with
3379 // <iframe src="scheme-has-exception://host"> 3370 // <iframe src="scheme-has-exception://host">
3380 // <iframe src="http://host"></iframe> 3371 // <iframe src="http://host"></iframe>
3381 // <iframe sandbox src="http://host"></iframe> 3372 // <iframe sandbox src="http://host"></iframe>
3382 // </iframe> 3373 // </iframe>
3383 // both inner iframes would fail the check, even though the outermost iframe 3374 // both inner iframes would fail the check, even though the outermost iframe
3384 // passes. 3375 // passes.
3385 // 3376 //
3386 // In all cases, a frame must be potentially trustworthy in addition to 3377 // In all cases, a frame must be potentially trustworthy in addition to
3387 // having an exception listed in order for the exception to be granted. 3378 // having an exception listed in order for the exception to be granted.
3388 if (!isOriginPotentiallyTrustworthy(getSecurityOrigin(), errorMessage)) 3379 if (!getSecurityOrigin()->isPotentiallyTrustworthy(errorMessage))
3389 return false; 3380 return false;
3390 3381
3391 if (SchemeRegistry::schemeShouldBypassSecureContextCheck(getSecurityOrigin() ->protocol())) 3382 if (SchemeRegistry::schemeShouldBypassSecureContextCheck(getSecurityOrigin() ->protocol()))
3392 return true; 3383 return true;
3393 3384
3394 if (privilegeContextCheck == StandardSecureContextCheck) { 3385 if (privilegeContextCheck == StandardSecureContextCheck) {
3395 if (!m_frame) 3386 Frame* parent = m_frame ? m_frame->tree().parent() : nullptr;
3396 return true; 3387 if (parent)
3397 Frame* parent = m_frame->tree().parent(); 3388 return parent->canHaveSecureChild(errorMessage);
3398 while (parent) {
3399 if (!isOriginPotentiallyTrustworthy(parent->securityContext()->getSe curityOrigin(), errorMessage))
3400 return false;
3401 parent = parent->tree().parent();
3402 }
3403 } 3389 }
3404 return true; 3390 return true;
3405 } 3391 }
3406 3392
3407 StyleSheetList& Document::styleSheets() 3393 StyleSheetList& Document::styleSheets()
3408 { 3394 {
3409 if (!m_styleSheetList) 3395 if (!m_styleSheetList)
3410 m_styleSheetList = StyleSheetList::create(this); 3396 m_styleSheetList = StyleSheetList::create(this);
3411 return *m_styleSheetList; 3397 return *m_styleSheetList;
3412 } 3398 }
(...skipping 2620 matching lines...) Expand 10 before | Expand all | Expand 10 after
6033 #ifndef NDEBUG 6019 #ifndef NDEBUG
6034 using namespace blink; 6020 using namespace blink;
6035 void showLiveDocumentInstances() 6021 void showLiveDocumentInstances()
6036 { 6022 {
6037 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 6023 Document::WeakDocumentSet& set = Document::liveDocumentSet();
6038 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6024 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6039 for (Document* document : set) 6025 for (Document* document : set)
6040 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6026 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6041 } 6027 }
6042 #endif 6028 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698