| 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/scheduler/CancellableTaskFactory.h" | 237 #include "platform/scheduler/CancellableTaskFactory.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 3982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4242 | 4244 |
| 4243 const OriginAccessEntry& Document::accessEntryFromURL() { | 4245 const OriginAccessEntry& Document::accessEntryFromURL() { |
| 4244 if (!m_accessEntryFromURL) { | 4246 if (!m_accessEntryFromURL) { |
| 4245 m_accessEntryFromURL = wrapUnique( | 4247 m_accessEntryFromURL = wrapUnique( |
| 4246 new OriginAccessEntry(url().protocol(), url().host(), | 4248 new OriginAccessEntry(url().protocol(), url().host(), |
| 4247 OriginAccessEntry::AllowRegisterableDomains)); | 4249 OriginAccessEntry::AllowRegisterableDomains)); |
| 4248 } | 4250 } |
| 4249 return *m_accessEntryFromURL; | 4251 return *m_accessEntryFromURL; |
| 4250 } | 4252 } |
| 4251 | 4253 |
| 4254 void Document::sendSensitiveInputVisibility() { |
| 4255 if (m_sensitiveInputVisibilityTask.isActive()) |
| 4256 return; |
| 4257 |
| 4258 m_sensitiveInputVisibilityTask = |
| 4259 TaskRunnerHelper::get(TaskType::Internal, this) |
| 4260 ->postCancellableTask( |
| 4261 BLINK_FROM_HERE, |
| 4262 WTF::bind(&Document::sendSensitiveInputVisibilityInternal, |
| 4263 wrapWeakPersistent(this))); |
| 4264 } |
| 4265 |
| 4266 void Document::sendSensitiveInputVisibilityInternal() { |
| 4267 if (!frame()) |
| 4268 return; |
| 4269 |
| 4270 mojom::blink::SensitiveInputVisibilityServicePtr sensitiveInputServicePtr; |
| 4271 frame()->interfaceProvider()->getInterface( |
| 4272 mojo::GetProxy(&sensitiveInputServicePtr)); |
| 4273 if (m_passwordCount > 0) { |
| 4274 sensitiveInputServicePtr->PasswordFieldVisibleInInsecureContext(); |
| 4275 return; |
| 4276 } |
| 4277 sensitiveInputServicePtr->AllPasswordFieldsInInsecureContextInvisible(); |
| 4278 } |
| 4279 |
| 4252 void Document::registerEventFactory( | 4280 void Document::registerEventFactory( |
| 4253 std::unique_ptr<EventFactoryBase> eventFactory) { | 4281 std::unique_ptr<EventFactoryBase> eventFactory) { |
| 4254 DCHECK(!eventFactories().contains(eventFactory.get())); | 4282 DCHECK(!eventFactories().contains(eventFactory.get())); |
| 4255 eventFactories().add(std::move(eventFactory)); | 4283 eventFactories().add(std::move(eventFactory)); |
| 4256 } | 4284 } |
| 4257 | 4285 |
| 4258 Event* Document::createEvent(ExecutionContext* executionContext, | 4286 Event* Document::createEvent(ExecutionContext* executionContext, |
| 4259 const String& eventType, | 4287 const String& eventType, |
| 4260 ExceptionState& exceptionState) { | 4288 ExceptionState& exceptionState) { |
| 4261 Event* event = nullptr; | 4289 Event* event = nullptr; |
| (...skipping 2057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6319 | 6347 |
| 6320 PropertyRegistry* Document::propertyRegistry() { | 6348 PropertyRegistry* Document::propertyRegistry() { |
| 6321 // TODO(timloh): When the flag is removed, return a reference instead. | 6349 // TODO(timloh): When the flag is removed, return a reference instead. |
| 6322 if (!m_propertyRegistry && RuntimeEnabledFeatures::cssVariables2Enabled()) | 6350 if (!m_propertyRegistry && RuntimeEnabledFeatures::cssVariables2Enabled()) |
| 6323 m_propertyRegistry = PropertyRegistry::create(); | 6351 m_propertyRegistry = PropertyRegistry::create(); |
| 6324 return m_propertyRegistry; | 6352 return m_propertyRegistry; |
| 6325 } | 6353 } |
| 6326 | 6354 |
| 6327 void Document::incrementPasswordCount() { | 6355 void Document::incrementPasswordCount() { |
| 6328 ++m_passwordCount; | 6356 ++m_passwordCount; |
| 6357 if (isSecureContext() || m_passwordCount != 1) { |
| 6358 // The browser process only cares about passwords on pages where the |
| 6359 // top-level URL is not secure. Secure contexts must have a top-level |
| 6360 // URL that is secure, so there is no need to send notifications for |
| 6361 // password fields in secure contexts. |
| 6362 // |
| 6363 // Also, only send a message on the first visible password field; the |
| 6364 // browser process doesn't care about the presence of additional |
| 6365 // password fields beyond that. |
| 6366 return; |
| 6367 } |
| 6368 sendSensitiveInputVisibility(); |
| 6329 } | 6369 } |
| 6330 | 6370 |
| 6331 void Document::decrementPasswordCount() { | 6371 void Document::decrementPasswordCount() { |
| 6332 DCHECK_GT(m_passwordCount, 0u); | 6372 DCHECK_GT(m_passwordCount, 0u); |
| 6333 --m_passwordCount; | 6373 --m_passwordCount; |
| 6334 } | 6374 if (isSecureContext() || m_passwordCount > 0) |
| 6335 | 6375 return; |
| 6336 unsigned Document::passwordCount() const { | 6376 sendSensitiveInputVisibility(); |
| 6337 return m_passwordCount; | |
| 6338 } | 6377 } |
| 6339 | 6378 |
| 6340 DEFINE_TRACE(Document) { | 6379 DEFINE_TRACE(Document) { |
| 6341 visitor->trace(m_importsController); | 6380 visitor->trace(m_importsController); |
| 6342 visitor->trace(m_docType); | 6381 visitor->trace(m_docType); |
| 6343 visitor->trace(m_implementation); | 6382 visitor->trace(m_implementation); |
| 6344 visitor->trace(m_autofocusElement); | 6383 visitor->trace(m_autofocusElement); |
| 6345 visitor->trace(m_focusedElement); | 6384 visitor->trace(m_focusedElement); |
| 6346 visitor->trace(m_sequentialFocusNavigationStartingPoint); | 6385 visitor->trace(m_sequentialFocusNavigationStartingPoint); |
| 6347 visitor->trace(m_hoverNode); | 6386 visitor->trace(m_hoverNode); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6442 } | 6481 } |
| 6443 | 6482 |
| 6444 void showLiveDocumentInstances() { | 6483 void showLiveDocumentInstances() { |
| 6445 WeakDocumentSet& set = liveDocumentSet(); | 6484 WeakDocumentSet& set = liveDocumentSet(); |
| 6446 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6485 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6447 for (Document* document : set) | 6486 for (Document* document : set) |
| 6448 fprintf(stderr, "- Document %p URL: %s\n", document, | 6487 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6449 document->url().getString().utf8().data()); | 6488 document->url().getString().utf8().data()); |
| 6450 } | 6489 } |
| 6451 #endif | 6490 #endif |
| OLD | NEW |