| 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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 #include "platform/network/ContentSecurityPolicyParsers.h" | 235 #include "platform/network/ContentSecurityPolicyParsers.h" |
| 236 #include "platform/network/HTTPParsers.h" | 236 #include "platform/network/HTTPParsers.h" |
| 237 #include "platform/scroll/Scrollbar.h" | 237 #include "platform/scroll/Scrollbar.h" |
| 238 #include "platform/scroll/ScrollbarTheme.h" | 238 #include "platform/scroll/ScrollbarTheme.h" |
| 239 #include "platform/text/PlatformLocale.h" | 239 #include "platform/text/PlatformLocale.h" |
| 240 #include "platform/text/SegmentedString.h" | 240 #include "platform/text/SegmentedString.h" |
| 241 #include "platform/tracing/TraceEvent.h" | 241 #include "platform/tracing/TraceEvent.h" |
| 242 #include "platform/weborigin/OriginAccessEntry.h" | 242 #include "platform/weborigin/OriginAccessEntry.h" |
| 243 #include "platform/weborigin/SchemeRegistry.h" | 243 #include "platform/weborigin/SchemeRegistry.h" |
| 244 #include "platform/weborigin/SecurityOrigin.h" | 244 #include "platform/weborigin/SecurityOrigin.h" |
| 245 #include "public/platform/InterfaceProvider.h" |
| 245 #include "public/platform/Platform.h" | 246 #include "public/platform/Platform.h" |
| 246 #include "public/platform/WebAddressSpace.h" | 247 #include "public/platform/WebAddressSpace.h" |
| 247 #include "public/platform/WebFrameScheduler.h" | 248 #include "public/platform/WebFrameScheduler.h" |
| 248 #include "public/platform/WebPrerenderingSupport.h" | 249 #include "public/platform/WebPrerenderingSupport.h" |
| 249 #include "public/platform/WebScheduler.h" | 250 #include "public/platform/WebScheduler.h" |
| 251 #include "public/platform/modules/sensitive_input_visibility/sensitive_input_vis
ibility_service.mojom-blink.h" |
| 250 #include "wtf/AutoReset.h" | 252 #include "wtf/AutoReset.h" |
| 251 #include "wtf/CurrentTime.h" | 253 #include "wtf/CurrentTime.h" |
| 252 #include "wtf/DateMath.h" | 254 #include "wtf/DateMath.h" |
| 253 #include "wtf/Functional.h" | 255 #include "wtf/Functional.h" |
| 254 #include "wtf/HashFunctions.h" | 256 #include "wtf/HashFunctions.h" |
| 255 #include "wtf/PtrUtil.h" | 257 #include "wtf/PtrUtil.h" |
| 256 #include "wtf/StdLibExtras.h" | 258 #include "wtf/StdLibExtras.h" |
| 257 #include "wtf/text/CharacterNames.h" | 259 #include "wtf/text/CharacterNames.h" |
| 258 #include "wtf/text/StringBuffer.h" | 260 #include "wtf/text/StringBuffer.h" |
| 259 #include "wtf/text/TextEncodingRegistry.h" | 261 #include "wtf/text/TextEncodingRegistry.h" |
| (...skipping 4065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4325 | 4327 |
| 4326 const OriginAccessEntry& Document::accessEntryFromURL() { | 4328 const OriginAccessEntry& Document::accessEntryFromURL() { |
| 4327 if (!m_accessEntryFromURL) { | 4329 if (!m_accessEntryFromURL) { |
| 4328 m_accessEntryFromURL = wrapUnique( | 4330 m_accessEntryFromURL = wrapUnique( |
| 4329 new OriginAccessEntry(url().protocol(), url().host(), | 4331 new OriginAccessEntry(url().protocol(), url().host(), |
| 4330 OriginAccessEntry::AllowRegisterableDomains)); | 4332 OriginAccessEntry::AllowRegisterableDomains)); |
| 4331 } | 4333 } |
| 4332 return *m_accessEntryFromURL; | 4334 return *m_accessEntryFromURL; |
| 4333 } | 4335 } |
| 4334 | 4336 |
| 4337 void Document::sendSensitiveInputVisibility() { |
| 4338 if (m_sensitiveInputVisibilityTask.isActive()) |
| 4339 return; |
| 4340 |
| 4341 m_sensitiveInputVisibilityTask = |
| 4342 TaskRunnerHelper::get(TaskType::Internal, this) |
| 4343 ->postCancellableTask( |
| 4344 BLINK_FROM_HERE, |
| 4345 WTF::bind(&Document::sendSensitiveInputVisibilityInternal, |
| 4346 wrapWeakPersistent(this))); |
| 4347 } |
| 4348 |
| 4349 void Document::sendSensitiveInputVisibilityInternal() { |
| 4350 if (!frame()) |
| 4351 return; |
| 4352 |
| 4353 mojom::blink::SensitiveInputVisibilityServicePtr sensitiveInputServicePtr; |
| 4354 frame()->interfaceProvider()->getInterface( |
| 4355 mojo::GetProxy(&sensitiveInputServicePtr)); |
| 4356 if (m_passwordCount > 0) { |
| 4357 sensitiveInputServicePtr->PasswordFieldVisibleInInsecureContext(); |
| 4358 return; |
| 4359 } |
| 4360 sensitiveInputServicePtr->AllPasswordFieldsInInsecureContextInvisible(); |
| 4361 } |
| 4362 |
| 4335 void Document::registerEventFactory( | 4363 void Document::registerEventFactory( |
| 4336 std::unique_ptr<EventFactoryBase> eventFactory) { | 4364 std::unique_ptr<EventFactoryBase> eventFactory) { |
| 4337 DCHECK(!eventFactories().contains(eventFactory.get())); | 4365 DCHECK(!eventFactories().contains(eventFactory.get())); |
| 4338 eventFactories().add(std::move(eventFactory)); | 4366 eventFactories().add(std::move(eventFactory)); |
| 4339 } | 4367 } |
| 4340 | 4368 |
| 4341 Event* Document::createEvent(ExecutionContext* executionContext, | 4369 Event* Document::createEvent(ExecutionContext* executionContext, |
| 4342 const String& eventType, | 4370 const String& eventType, |
| 4343 ExceptionState& exceptionState) { | 4371 ExceptionState& exceptionState) { |
| 4344 Event* event = nullptr; | 4372 Event* event = nullptr; |
| (...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6423 | 6451 |
| 6424 PropertyRegistry* Document::propertyRegistry() { | 6452 PropertyRegistry* Document::propertyRegistry() { |
| 6425 // TODO(timloh): When the flag is removed, return a reference instead. | 6453 // TODO(timloh): When the flag is removed, return a reference instead. |
| 6426 if (!m_propertyRegistry && RuntimeEnabledFeatures::cssVariables2Enabled()) | 6454 if (!m_propertyRegistry && RuntimeEnabledFeatures::cssVariables2Enabled()) |
| 6427 m_propertyRegistry = PropertyRegistry::create(); | 6455 m_propertyRegistry = PropertyRegistry::create(); |
| 6428 return m_propertyRegistry; | 6456 return m_propertyRegistry; |
| 6429 } | 6457 } |
| 6430 | 6458 |
| 6431 void Document::incrementPasswordCount() { | 6459 void Document::incrementPasswordCount() { |
| 6432 ++m_passwordCount; | 6460 ++m_passwordCount; |
| 6461 if (isSecureContext() || m_passwordCount != 1) { |
| 6462 // The browser process only cares about passwords on pages where the |
| 6463 // top-level URL is not secure. Secure contexts must have a top-level |
| 6464 // URL that is secure, so there is no need to send notifications for |
| 6465 // password fields in secure contexts. |
| 6466 // |
| 6467 // Also, only send a message on the first visible password field; the |
| 6468 // browser process doesn't care about the presence of additional |
| 6469 // password fields beyond that. |
| 6470 return; |
| 6471 } |
| 6472 sendSensitiveInputVisibility(); |
| 6433 } | 6473 } |
| 6434 | 6474 |
| 6435 void Document::decrementPasswordCount() { | 6475 void Document::decrementPasswordCount() { |
| 6436 DCHECK_GT(m_passwordCount, 0u); | 6476 DCHECK_GT(m_passwordCount, 0u); |
| 6437 --m_passwordCount; | 6477 --m_passwordCount; |
| 6438 } | 6478 if (isSecureContext() || m_passwordCount > 0) |
| 6439 | 6479 return; |
| 6440 unsigned Document::passwordCount() const { | 6480 sendSensitiveInputVisibility(); |
| 6441 return m_passwordCount; | |
| 6442 } | 6481 } |
| 6443 | 6482 |
| 6444 DEFINE_TRACE(Document) { | 6483 DEFINE_TRACE(Document) { |
| 6445 visitor->trace(m_importsController); | 6484 visitor->trace(m_importsController); |
| 6446 visitor->trace(m_docType); | 6485 visitor->trace(m_docType); |
| 6447 visitor->trace(m_implementation); | 6486 visitor->trace(m_implementation); |
| 6448 visitor->trace(m_autofocusElement); | 6487 visitor->trace(m_autofocusElement); |
| 6449 visitor->trace(m_focusedElement); | 6488 visitor->trace(m_focusedElement); |
| 6450 visitor->trace(m_sequentialFocusNavigationStartingPoint); | 6489 visitor->trace(m_sequentialFocusNavigationStartingPoint); |
| 6451 visitor->trace(m_hoverNode); | 6490 visitor->trace(m_hoverNode); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6546 } | 6585 } |
| 6547 | 6586 |
| 6548 void showLiveDocumentInstances() { | 6587 void showLiveDocumentInstances() { |
| 6549 WeakDocumentSet& set = liveDocumentSet(); | 6588 WeakDocumentSet& set = liveDocumentSet(); |
| 6550 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6589 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6551 for (Document* document : set) | 6590 for (Document* document : set) |
| 6552 fprintf(stderr, "- Document %p URL: %s\n", document, | 6591 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6553 document->url().getString().utf8().data()); | 6592 document->url().getString().utf8().data()); |
| 6554 } | 6593 } |
| 6555 #endif | 6594 #endif |
| OLD | NEW |