OLD | NEW |
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 Loading... |
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 using WeakDocumentSet = PersistentHeapHashSet<WeakMember<Document>>; | 360 using WeakDocumentSet = PersistentHeapHashSet<WeakMember<Document>>; |
370 | 361 |
371 static WeakDocumentSet& liveDocumentSet() | 362 static WeakDocumentSet& liveDocumentSet() |
372 { | 363 { |
373 DEFINE_STATIC_LOCAL(WeakDocumentSet, set, ()); | 364 DEFINE_STATIC_LOCAL(WeakDocumentSet, set, ()); |
374 return set; | 365 return set; |
(...skipping 3005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3380 // Additionally, with | 3371 // Additionally, with |
3381 // <iframe src="scheme-has-exception://host"> | 3372 // <iframe src="scheme-has-exception://host"> |
3382 // <iframe src="http://host"></iframe> | 3373 // <iframe src="http://host"></iframe> |
3383 // <iframe sandbox src="http://host"></iframe> | 3374 // <iframe sandbox src="http://host"></iframe> |
3384 // </iframe> | 3375 // </iframe> |
3385 // both inner iframes would fail the check, even though the outermost iframe | 3376 // both inner iframes would fail the check, even though the outermost iframe |
3386 // passes. | 3377 // passes. |
3387 // | 3378 // |
3388 // In all cases, a frame must be potentially trustworthy in addition to | 3379 // In all cases, a frame must be potentially trustworthy in addition to |
3389 // having an exception listed in order for the exception to be granted. | 3380 // having an exception listed in order for the exception to be granted. |
3390 if (!isOriginPotentiallyTrustworthy(getSecurityOrigin(), errorMessage)) | 3381 if (!getSecurityOrigin()->isPotentiallyTrustworthy(errorMessage)) |
3391 return false; | 3382 return false; |
3392 | 3383 |
3393 if (SchemeRegistry::schemeShouldBypassSecureContextCheck(getSecurityOrigin()
->protocol())) | 3384 if (SchemeRegistry::schemeShouldBypassSecureContextCheck(getSecurityOrigin()
->protocol())) |
3394 return true; | 3385 return true; |
3395 | 3386 |
3396 if (privilegeContextCheck == StandardSecureContextCheck) { | 3387 if (privilegeContextCheck == StandardSecureContextCheck) { |
3397 if (!m_frame) | 3388 Frame* parent = m_frame ? m_frame->tree().parent() : nullptr; |
3398 return true; | 3389 if (parent) |
3399 Frame* parent = m_frame->tree().parent(); | 3390 return parent->canHaveSecureChild(errorMessage); |
3400 while (parent) { | |
3401 if (!isOriginPotentiallyTrustworthy(parent->securityContext()->getSe
curityOrigin(), errorMessage)) | |
3402 return false; | |
3403 parent = parent->tree().parent(); | |
3404 } | |
3405 } | 3391 } |
3406 return true; | 3392 return true; |
3407 } | 3393 } |
3408 | 3394 |
3409 StyleSheetList& Document::styleSheets() | 3395 StyleSheetList& Document::styleSheets() |
3410 { | 3396 { |
3411 if (!m_styleSheetList) | 3397 if (!m_styleSheetList) |
3412 m_styleSheetList = StyleSheetList::create(this); | 3398 m_styleSheetList = StyleSheetList::create(this); |
3413 return *m_styleSheetList; | 3399 return *m_styleSheetList; |
3414 } | 3400 } |
(...skipping 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6036 #ifndef NDEBUG | 6022 #ifndef NDEBUG |
6037 using namespace blink; | 6023 using namespace blink; |
6038 void showLiveDocumentInstances() | 6024 void showLiveDocumentInstances() |
6039 { | 6025 { |
6040 WeakDocumentSet& set = liveDocumentSet(); | 6026 WeakDocumentSet& set = liveDocumentSet(); |
6041 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6027 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6042 for (Document* document : set) | 6028 for (Document* document : set) |
6043 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()); |
6044 } | 6030 } |
6045 #endif | 6031 #endif |
OLD | NEW |