Changeset 232159 in webkit
- Timestamp:
- May 24, 2018, 12:23:15 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
page/Navigator.cpp (modified) (1 diff)
-
page/Navigator.h (modified) (2 diffs)
-
page/NavigatorBase.h (modified) (1 diff)
-
page/NavigatorID.idl (modified) (1 diff)
-
page/WorkerNavigator.cpp (modified) (1 diff)
-
page/WorkerNavigator.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r232158 r232159 1 2018-05-24 Chris Dumez <cdumez@apple.com> 2 3 Cache navigator.userAgent for performance 4 https://bugs.webkit.org/show_bug.cgi?id=185952 5 6 Reviewed by Geoffrey Garen. 7 8 Cache navigator.userAgent for performance. Previously, we would ask the client 5 times 9 while loading apple.com. 10 11 * page/Navigator.cpp: 12 (WebCore::Navigator::userAgent const): 13 * page/Navigator.h: 14 * page/NavigatorBase.h: 15 * page/NavigatorID.idl: 16 * page/WorkerNavigator.cpp: 17 (WebCore::WorkerNavigator::userAgent const): 18 * page/WorkerNavigator.h: 19 1 20 2018-05-24 Chris Dumez <cdumez@apple.com> 2 21 -
trunk/Source/WebCore/page/Navigator.cpp
r230007 r232159 78 78 } 79 79 80 StringNavigator::userAgent() const80 const String& Navigator::userAgent() const 81 81 { 82 if (!m_frame) 83 return String(); 84 85 // If the frame is already detached, FrameLoader::userAgent may malfunction, because it calls a client method 86 // that uses frame's WebView (at least, in Mac WebKit). 87 if (!m_frame->page()) 88 return String(); 89 90 return m_frame->loader().userAgent(m_frame->document()->url()); 82 if (m_userAgent.isNull() && m_frame && m_frame->page()) 83 m_userAgent = m_frame->loader().userAgent(m_frame->document()->url()); 84 return m_userAgent; 91 85 } 92 86 -
trunk/Source/WebCore/page/Navigator.h
r224321 r232159 40 40 bool cookieEnabled() const; 41 41 bool javaEnabled() const; 42 StringuserAgent() const final;42 const String& userAgent() const final; 43 43 bool onLine() const final; 44 44 … … 54 54 mutable RefPtr<DOMPluginArray> m_plugins; 55 55 mutable RefPtr<DOMMimeTypeArray> m_mimeTypes; 56 mutable String m_userAgent; 56 57 }; 57 58 -
trunk/Source/WebCore/page/NavigatorBase.h
r227639 r232159 43 43 static String appName(); 44 44 String appVersion() const; 45 virtual StringuserAgent() const = 0;45 virtual const String& userAgent() const = 0; 46 46 static String platform(); 47 47 -
trunk/Source/WebCore/page/NavigatorID.idl
r215403 r232159 36 36 readonly attribute DOMString product; 37 37 [Exposed=Window] readonly attribute DOMString productSub; 38 readonly attribute DOMString userAgent;38 [CachedAttribute] readonly attribute DOMString userAgent; 39 39 [Exposed=Window] readonly attribute DOMString vendor; 40 40 [Exposed=Window] readonly attribute DOMString vendorSub; -
trunk/Source/WebCore/page/WorkerNavigator.cpp
r224321 r232159 37 37 } 38 38 39 StringWorkerNavigator::userAgent() const39 const String& WorkerNavigator::userAgent() const 40 40 { 41 41 return m_userAgent; -
trunk/Source/WebCore/page/WorkerNavigator.h
r224321 r232159 36 36 static Ref<WorkerNavigator> create(ScriptExecutionContext& context, const String& userAgent, bool isOnline) { return adoptRef(*new WorkerNavigator(context, userAgent, isOnline)); } 37 37 38 StringuserAgent() const final;38 const String& userAgent() const final; 39 39 bool onLine() const final; 40 40 void setIsOnline(bool isOnline) { m_isOnline = isOnline; }
Note:
See TracChangeset
for help on using the changeset viewer.