WebKit Bugzilla
Attachment 360259 Details for
Bug 193863
: Web Inspector: provide a way to edit page WebRTC settings on a remote target
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193863-20190126174741.patch (text/plain), 33.89 KB, created by
Devin Rousso
on 2019-01-26 17:47:42 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Devin Rousso
Created:
2019-01-26 17:47:42 PST
Size:
33.89 KB
patch
obsolete
>diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 64b553ed70d30bc84e1b306ae116da25e7ddecb3..7046ca097fa6e12647375a788ce41486c2aca3fa 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,17 @@ >+2019-01-26 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: provide a way to edit page WebRTC settings on a remote target >+ https://bugs.webkit.org/show_bug.cgi?id=193863 >+ <rdar://problem/47572764> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * inspector/protocol/Page.json: >+ Add more values to the `Setting` enum type: >+ - `ICECandidateFilteringEnabled` >+ - `MediaCaptureRequiresSecureConnection` >+ - `MockCaptureDevicesEnabled` >+ > 2019-01-26 Devin Rousso <drousso@apple.com> > > Web Inspector: provide a way to edit the user agent of a remote target >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 6bd8de6ee1f659b3aad59ce16ada5b68c256dfe0..6ee4048350afd5f343bc7fa92557324735e2063d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,43 @@ >+2019-01-26 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: provide a way to edit page WebRTC settings on a remote target >+ https://bugs.webkit.org/show_bug.cgi?id=193863 >+ <rdar://problem/47572764> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test: inspector/page/overrideSetting.html >+ >+ * inspector/agents/InspectorPageAgent.cpp: >+ (WebCore::InspectorPageAgent::disable): >+ (WebCore::InspectorPageAgent::overrideSetting): >+ >+ * page/Settings.yaml: >+ * page/SettingsBase.h: >+ * page/SettingsBase.cpp: >+ (SettingsBase::mockCaptureDevicesEnabledChanged): Added. >+ * Scripts/SettingsTemplates/Settings.cpp.erb: >+ Add page-level settings for WebRTC preferences. >+ >+ * Modules/mediastream/UserMediaController.cpp: >+ (WebCore::UserMediaController::canCallGetUserMedia): >+ >+ * testing/InternalSettings.cpp: >+ (WebCore::InternalSettings::setMediaCaptureRequiresSecureConnection): >+ >+ * testing/Internals.h: >+ * testing/Internals.cpp: >+ (WebCore::Internals::Internals): >+ (WebCore::Internals::setMockMediaCaptureDevicesEnabled): >+ (WebCore::Internals::setMediaCaptureRequiresSecureConnection): Added. >+ >+ * page/DeprecatedGlobalSettings.h: >+ * page/DeprecatedGlobalSettings.cpp: >+ (WebCore::DeprecatedGlobalSettings::mockCaptureDevicesEnabled): Deleted. >+ (WebCore::DeprecatedGlobalSettings::setMockCaptureDevicesEnabled): Deleted. >+ (WebCore::DeprecatedGlobalSettings::mediaCaptureRequiresSecureConnection): Deleted. >+ (WebCore::DeprecatedGlobalSettings::setMediaCaptureRequiresSecureConnection): Deleted. >+ > 2019-01-26 Devin Rousso <drousso@apple.com> > > Web Inspector: provide a way to edit the user agent of a remote target >diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index d44512a4776c90aacb84c787f230d86211d886e7..b11c6466bbaf5f273c153008ed5a2149273954d6 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,21 @@ >+2019-01-26 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: provide a way to edit page WebRTC settings on a remote target >+ https://bugs.webkit.org/show_bug.cgi?id=193863 >+ <rdar://problem/47572764> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UserInterface/Base/Main.js: >+ (WI.loaded): >+ (WI.initializeTarget): >+ (WI._handleDeviceSettingsToolbarButtonClicked): >+ (WI._handleDeviceSettingsToolbarButtonClicked.createCheckbox): >+ * UserInterface/Views/Main.css: >+ (.device-settings-content .container): Added. >+ >+ * Localizations/en.lproj/localizedStrings.js: >+ > 2019-01-26 Devin Rousso <drousso@apple.com> > > Web Inspector: provide a way to edit the user agent of a remote target >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 6aae160ba07f1b6ecb14a86ac29d0a3111717493..662649b6d7f8092df1e8aed317b0011886ff2e52 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,15 @@ >+2019-01-26 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: provide a way to edit page WebRTC settings on a remote target >+ https://bugs.webkit.org/show_bug.cgi?id=193863 >+ <rdar://problem/47572764> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Shared/WebPreferences.yaml: >+ * Shared/WebPreferencesDefaultValues.h: >+ Add page-level settings for WebRTC preferences. >+ > 2019-01-25 Tim Horton <timothy_horton@apple.com> > > REGRESSION (r238818): Snapshot is removed too late after swiping back on Twitter >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index 3c6d71db37f7ba5bc917c242e8aa5f098e327462..85e39b914d34558ebb973602275622e756267365 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,15 @@ >+2019-01-26 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: provide a way to edit page WebRTC settings on a remote target >+ https://bugs.webkit.org/show_bug.cgi?id=193863 >+ <rdar://problem/47572764> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebView/WebView.mm: >+ (-[WebView _preferencesChanged:]): >+ Add page-level settings for WebRTC preferences. >+ > 2019-01-25 Keith Rollin <krollin@apple.com> > > Update WebKitAdditions.xcconfig with correct order of variable definitions >diff --git a/Source/JavaScriptCore/inspector/protocol/Page.json b/Source/JavaScriptCore/inspector/protocol/Page.json >index 7142a0e582ea6a20049c0268d40a62639410ab43..769bf4b3b8f98e6c4ed39f5506955727e72f0815 100644 >--- a/Source/JavaScriptCore/inspector/protocol/Page.json >+++ b/Source/JavaScriptCore/inspector/protocol/Page.json >@@ -9,7 +9,10 @@ > "description": "List of settings able to be overridden by WebInspector. Keep this in sync with FOR_EACH_INSPECTOR_OVERRIDE_SETTING.", > "enum": [ > "AuthorAndUserStylesEnabled", >+ "ICECandidateFilteringEnabled", > "ImagesEnabled", >+ "MediaCaptureRequiresSecureConnection", >+ "MockCaptureDevicesEnabled", > "NeedsSiteSpecificQuirks", > "ScriptEnabled", > "WebSecurityEnabled" >diff --git a/Source/WebCore/Modules/mediastream/UserMediaController.cpp b/Source/WebCore/Modules/mediastream/UserMediaController.cpp >index 6251a7ec05da629b8b450dbe37396ce8be866ce5..21ea1b574b481a89c968bdc80db8394a27ffbd55 100644 >--- a/Source/WebCore/Modules/mediastream/UserMediaController.cpp >+++ b/Source/WebCore/Modules/mediastream/UserMediaController.cpp >@@ -29,13 +29,13 @@ > #if ENABLE(MEDIA_STREAM) > > #include "DOMWindow.h" >-#include "DeprecatedGlobalSettings.h" > #include "Document.h" > #include "DocumentLoader.h" > #include "Frame.h" > #include "HTMLIFrameElement.h" > #include "HTMLParserIdioms.h" > #include "SchemeRegistry.h" >+#include "Settings.h" > #include "UserMediaRequest.h" > > namespace WebCore { >@@ -113,7 +113,9 @@ UserMediaController::GetUserMediaAccess UserMediaController::canCallGetUserMedia > { > ASSERT(!types.isEmpty()); > >- bool requiresSecureConnection = DeprecatedGlobalSettings::mediaCaptureRequiresSecureConnection(); >+ bool requiresSecureConnection = true; >+ if (auto page = document.page()) >+ requiresSecureConnection = page->settings().mediaCaptureRequiresSecureConnection(); > auto& documentLoader = *document.loader(); > if (requiresSecureConnection && !isSecure(documentLoader)) > return GetUserMediaAccess::InsecureDocument; >diff --git a/Source/WebCore/Scripts/SettingsTemplates/Settings.cpp.erb b/Source/WebCore/Scripts/SettingsTemplates/Settings.cpp.erb >index c56e7ae7d4f0faa39adcd1982a5ec2efc52af461..036867c59df3b30d32dd3af28a54271d0b0b7425 100644 >--- a/Source/WebCore/Scripts/SettingsTemplates/Settings.cpp.erb >+++ b/Source/WebCore/Scripts/SettingsTemplates/Settings.cpp.erb >@@ -125,7 +125,13 @@ void Settings::<%= @setting.setterFunctionName %>InspectorOverride(Optional<<%= > if (m_<%= @setting.name %>InspectorOverride == <%= @setting.name %>InspectorOverride) > return; > m_<%= @setting.name %>InspectorOverride = <%= @setting.name %>InspectorOverride; >+<%- if @setting.conditional -%> >+#if ENABLE(<%= @setting.conditional %>) >+<%- end -%> > <%= @setting.onChange %>(); >+<%- if @setting.conditional -%> >+#endif >+<%- end -%> > } > > <%- end -%> >diff --git a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp >index 6cd1fd7e252c8daf6ff1e9c89e592dad709ea1e7..20bc5a79a9ab694ee0d6d0e2c94d1a078ee4d3ab 100644 >--- a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp >+++ b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp >@@ -83,9 +83,12 @@ namespace WebCore { > > using namespace Inspector; > >+// Keep this in sync with Page.Setting > #define FOR_EACH_INSPECTOR_OVERRIDE_SETTING(macro) \ > macro(AuthorAndUserStylesEnabled) \ > macro(ImagesEnabled) \ >+ macro(MediaCaptureRequiresSecureConnection) \ >+ macro(MockCaptureDevicesEnabled) \ > macro(NeedsSiteSpecificQuirks) \ > macro(ScriptEnabled) \ > macro(WebSecurityEnabled) >@@ -330,6 +333,8 @@ void InspectorPageAgent::disable(ErrorString&) > FOR_EACH_INSPECTOR_OVERRIDE_SETTING(DISABLE_INSPECTOR_OVERRIDE_SETTING) > > #undef DISABLE_INSPECTOR_OVERRIDE_SETTING >+ >+ m_page.enableICECandidateFiltering(); > } > > void InspectorPageAgent::reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources) >@@ -387,6 +392,13 @@ void InspectorPageAgent::overrideSetting(ErrorString& errorString, const String& > FOR_EACH_INSPECTOR_OVERRIDE_SETTING(CASE_INSPECTOR_OVERRIDE_SETTING) > > #undef CASE_INSPECTOR_OVERRIDE_SETTING >+ >+ case Inspector::Protocol::Page::Setting::ICECandidateFilteringEnabled: { >+ if (value && !*value) >+ m_page.disableICECandidateFiltering(); >+ else >+ m_page.enableICECandidateFiltering(); >+ } > } > > ASSERT_NOT_REACHED(); >diff --git a/Source/WebCore/page/DeprecatedGlobalSettings.cpp b/Source/WebCore/page/DeprecatedGlobalSettings.cpp >index f4995d3870c2bda06e13f019f9de5ec203059eff..cf4ccc80e93936d568cd550e028b68152eb94d2d 100644 >--- a/Source/WebCore/page/DeprecatedGlobalSettings.cpp >+++ b/Source/WebCore/page/DeprecatedGlobalSettings.cpp >@@ -31,11 +31,6 @@ > #include "RuntimeApplicationChecks.h" > #include <wtf/NeverDestroyed.h> > >-#if ENABLE(MEDIA_STREAM) >-#include "MockRealtimeMediaSourceCenter.h" >- >-#endif >- > namespace WebCore { > > #if USE(AVFOUNDATION) >@@ -51,11 +46,6 @@ bool DeprecatedGlobalSettings::gMockScrollbarsEnabled = false; > bool DeprecatedGlobalSettings::gUsesOverlayScrollbars = false; > bool DeprecatedGlobalSettings::gMockScrollAnimatorEnabled = false; > >-#if ENABLE(MEDIA_STREAM) >-bool DeprecatedGlobalSettings::gMockCaptureDevicesEnabled = false; >-bool DeprecatedGlobalSettings::gMediaCaptureRequiresSecureConnection = true; >-#endif >- > #if PLATFORM(WIN) > bool DeprecatedGlobalSettings::gShouldUseHighResolutionTimers = true; > #endif >@@ -113,29 +103,6 @@ void DeprecatedGlobalSettings::setGStreamerEnabled(bool enabled) > } > #endif > >-#if ENABLE(MEDIA_STREAM) >-bool DeprecatedGlobalSettings::mockCaptureDevicesEnabled() >-{ >- return gMockCaptureDevicesEnabled; >-} >- >-void DeprecatedGlobalSettings::setMockCaptureDevicesEnabled(bool enabled) >-{ >- gMockCaptureDevicesEnabled = enabled; >- MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled(enabled); >-} >- >-bool DeprecatedGlobalSettings::mediaCaptureRequiresSecureConnection() >-{ >- return gMediaCaptureRequiresSecureConnection; >-} >- >-void DeprecatedGlobalSettings::setMediaCaptureRequiresSecureConnection(bool mediaCaptureRequiresSecureConnection) >-{ >- gMediaCaptureRequiresSecureConnection = mediaCaptureRequiresSecureConnection; >-} >-#endif >- > // It's very important that this setting doesn't change in the middle of a document's lifetime. > // The Mac port uses this flag when registering and deregistering platform-dependent scrollbar > // objects. Therefore, if this changes at an unexpected time, deregistration may not happen >diff --git a/Source/WebCore/page/DeprecatedGlobalSettings.h b/Source/WebCore/page/DeprecatedGlobalSettings.h >index 216da09f87de45a7d7216b2965fe1291a191e7bf..620d12a18aef92a62d5fc74a7c3aab7a976e7944 100644 >--- a/Source/WebCore/page/DeprecatedGlobalSettings.h >+++ b/Source/WebCore/page/DeprecatedGlobalSettings.h >@@ -103,14 +103,6 @@ public: > static void setShouldManageAudioSessionCategory(bool flag) { gManageAudioSession = flag; } > static bool shouldManageAudioSessionCategory() { return gManageAudioSession; } > #endif >- >-#if ENABLE(MEDIA_STREAM) >- static bool mockCaptureDevicesEnabled(); >- WEBCORE_EXPORT static void setMockCaptureDevicesEnabled(bool); >- >- static bool mediaCaptureRequiresSecureConnection(); >- WEBCORE_EXPORT static void setMediaCaptureRequiresSecureConnection(bool); >-#endif > > WEBCORE_EXPORT static void setAllowsAnySSLCertificate(bool); > static bool allowsAnySSLCertificate(); >@@ -140,11 +132,6 @@ private: > WEBCORE_EXPORT static bool gDisableScreenSizeOverride; > #endif > WEBCORE_EXPORT static bool gManageAudioSession; >- >-#if ENABLE(MEDIA_STREAM) >- static bool gMockCaptureDevicesEnabled; >- static bool gMediaCaptureRequiresSecureConnection; >-#endif > > static bool gLowPowerVideoAudioBufferSizeEnabled; > static bool gResourceLoadStatisticsEnabledEnabled; >diff --git a/Source/WebCore/page/Settings.yaml b/Source/WebCore/page/Settings.yaml >index ca4c57c869f4950881ba840d8bb649102eb3257e..b5447de7565d0e5343022d9f6bf6d108aebf5a69 100644 >--- a/Source/WebCore/page/Settings.yaml >+++ b/Source/WebCore/page/Settings.yaml >@@ -796,3 +796,16 @@ editableImagesEnabled: > > adClickAttributionEnabled: > initial: false >+ >+# Deprecated >+ >+mockCaptureDevicesEnabled: >+ initial: false >+ conditional: MEDIA_STREAM >+ onChange: mockCaptureDevicesEnabledChanged >+ inspectorOverride: true >+ >+mediaCaptureRequiresSecureConnection: >+ initial: true >+ conditional: MEDIA_STREAM >+ inspectorOverride: true >diff --git a/Source/WebCore/page/SettingsBase.cpp b/Source/WebCore/page/SettingsBase.cpp >index cd4c4e8118f151520a2c02b2b41343fcedd2e782..aab41d12317a05bc311826b0eaaeae3df74f41bf 100644 >--- a/Source/WebCore/page/SettingsBase.cpp >+++ b/Source/WebCore/page/SettingsBase.cpp >@@ -48,6 +48,10 @@ > #include <limits> > #include <wtf/StdLibExtras.h> > >+#if ENABLE(MEDIA_STREAM) >+#include "MockRealtimeMediaSourceCenter.h" >+#endif >+ > namespace WebCore { > > static void invalidateAfterGenericFamilyChange(Page* page) >@@ -314,6 +318,17 @@ void SettingsBase::shouldEnableTextAutosizingBoostChanged() > > #endif > >+#if ENABLE(MEDIA_STREAM) >+void SettingsBase::mockCaptureDevicesEnabledChanged() >+{ >+ bool enabled = false; >+ if (m_page) >+ enabled = m_page->settings().mockCaptureDevicesEnabled(); >+ >+ MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled(enabled); >+} >+#endif >+ > void SettingsBase::userStyleSheetLocationChanged() > { > if (m_page) >diff --git a/Source/WebCore/page/SettingsBase.h b/Source/WebCore/page/SettingsBase.h >index d6471c24d9ebc70da937afab59bcbad01e119dfd..c720c7f81152755795d030374cfec0f5048f5745 100644 >--- a/Source/WebCore/page/SettingsBase.h >+++ b/Source/WebCore/page/SettingsBase.h >@@ -191,6 +191,9 @@ protected: > #if ENABLE(TEXT_AUTOSIZING) > void shouldEnableTextAutosizingBoostChanged(); > #endif >+#if ENABLE(MEDIA_STREAM) >+ void mockCaptureDevicesEnabledChanged(); >+#endif > > Page* m_page; > >diff --git a/Source/WebCore/testing/InternalSettings.cpp b/Source/WebCore/testing/InternalSettings.cpp >index 6f7e519630954856bfcf95d75b993db88946c3f2..5dfb065056d47ab178234c06e359fff4499b32a3 100644 >--- a/Source/WebCore/testing/InternalSettings.cpp >+++ b/Source/WebCore/testing/InternalSettings.cpp >@@ -462,7 +462,7 @@ ExceptionOr<void> InternalSettings::setMediaCaptureRequiresSecureConnection(bool > if (!m_page) > return Exception { InvalidAccessError }; > #if ENABLE(MEDIA_STREAM) >- DeprecatedGlobalSettings::setMediaCaptureRequiresSecureConnection(requires); >+ m_page->settings().setMediaCaptureRequiresSecureConnection(requires); > #else > UNUSED_PARAM(requires); > #endif >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index 1c84704b7b3965298a872894bcfad2e12b4da602..4856f7f94604ab92f20efe8509d36ffa1cafd81b 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -534,7 +534,7 @@ Internals::Internals(Document& document) > > #if ENABLE(MEDIA_STREAM) > setMockMediaCaptureDevicesEnabled(true); >- WebCore::DeprecatedGlobalSettings::setMediaCaptureRequiresSecureConnection(false); >+ setMediaCaptureRequiresSecureConnection(false); > #endif > > #if ENABLE(WIRELESS_PLAYBACK_TARGET) >@@ -1472,7 +1472,16 @@ void Internals::applyRotationForOutgoingVideoSources(RTCPeerConnection& connecti > > void Internals::setMockMediaCaptureDevicesEnabled(bool enabled) > { >- WebCore::DeprecatedGlobalSettings::setMockCaptureDevicesEnabled(enabled); >+ Document* document = contextDocument(); >+ if (auto* page = document->page()) >+ page->settings().setMockCaptureDevicesEnabled(enabled); >+} >+ >+void Internals::setMediaCaptureRequiresSecureConnection(bool enabled) >+{ >+ Document* document = contextDocument(); >+ if (auto* page = document->page()) >+ page->settings().setMediaCaptureRequiresSecureConnection(enabled); > } > > static std::unique_ptr<MediaRecorderPrivate> createRecorderMockSource() >diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h >index f70b7b6b93e7bf017364036002da4686a6eece94..37c5490d477ff54852a1400bb24975ffed86b429 100644 >--- a/Source/WebCore/testing/Internals.h >+++ b/Source/WebCore/testing/Internals.h >@@ -507,6 +507,7 @@ public: > > #if ENABLE(MEDIA_STREAM) > void setMockMediaCaptureDevicesEnabled(bool); >+ void setMediaCaptureRequiresSecureConnection(bool); > void setCustomPrivateRecorderCreator(); > #endif > >diff --git a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >index bf92bafb669cd61242f3c629d9fde46533667564..a9842da4a54ba4aa5069df56f5a11689442374b6 100644 >--- a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >+++ b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >@@ -59,6 +59,7 @@ localizedStrings["%s cannot be modified"] = "%s cannot be modified"; > localizedStrings["%s delay"] = "%s delay"; > localizedStrings["%s eval\n%s async"] = "%s eval\n%s async"; > localizedStrings["%s interval"] = "%s interval"; >+localizedStrings["%s:"] = "%s:"; > localizedStrings["(Action %s)"] = "(Action %s)"; > localizedStrings["(Disk)"] = "(Disk)"; > localizedStrings["(Index)"] = "(Index)"; >@@ -104,6 +105,7 @@ localizedStrings["All Storage"] = "All Storage"; > localizedStrings["All items in \u0022%s\u0022 must be error objects"] = "All items in \u0022%s\u0022 must be error objects"; > localizedStrings["All items in \u0022%s\u0022 must be non-empty strings"] = "All items in \u0022%s\u0022 must be non-empty strings"; > localizedStrings["All items in \u0022%s\u0022 must be valid DOM nodes"] = "All items in \u0022%s\u0022 must be valid DOM nodes"; >+localizedStrings["Allow Media Capture on Insecure Sites"] = "Allow Media Capture on Insecure Sites"; > localizedStrings["An error occurred trying to load the resource."] = "An error occurred trying to load the resource."; > localizedStrings["An error occurred trying to read the \u201C%s\u201D table."] = "An error occurred trying to read the \u201C%s\u201D table."; > localizedStrings["An unexpected error %s occurred."] = "An unexpected error %s occurred."; >@@ -302,6 +304,7 @@ localizedStrings["Dimensions"] = "Dimensions"; > localizedStrings["Disable Breakpoint"] = "Disable Breakpoint"; > localizedStrings["Disable Breakpoints"] = "Disable Breakpoints"; > localizedStrings["Disable Event Listener"] = "Disable Event Listener"; >+localizedStrings["Disable ICE Candidate Restrictions"] = "Disable ICE Candidate Restrictions"; > localizedStrings["Disable Program"] = "Disable Program"; > localizedStrings["Disable all breakpoints (%s)"] = "Disable all breakpoints (%s)"; > localizedStrings["Disable paint flashing"] = "Disable paint flashing"; >@@ -1018,6 +1021,7 @@ localizedStrings["Unsupported property value"] = "Unsupported property value"; > localizedStrings["Untitled"] = "Untitled"; > localizedStrings["Use Default Appearance"] = "Use Default Appearance"; > localizedStrings["Use Default Media Styles"] = "Use Default Media Styles"; >+localizedStrings["Use Mock Capture Devices"] = "Use Mock Capture Devices"; > localizedStrings["Use the resource cache when loading resources"] = "Use the resource cache when loading resources"; > localizedStrings["User Agent"] = "User Agent"; > localizedStrings["User Agent Stylesheet"] = "User Agent Stylesheet"; >diff --git a/Source/WebInspectorUI/UserInterface/Base/Main.js b/Source/WebInspectorUI/UserInterface/Base/Main.js >index 3e0e136ce76170a21b95de038168eb3c5b7f7229..0380dfe275f07c5352b37e1f7d6f77a9ade0841e 100644 >--- a/Source/WebInspectorUI/UserInterface/Base/Main.js >+++ b/Source/WebInspectorUI/UserInterface/Base/Main.js >@@ -162,7 +162,7 @@ WI.loaded = function() > this._windowKeydownListeners = []; > this._targetsAvailablePromise = new WI.WrappedPromise; > WI._overridenDeviceUserAgent = null; >- WI._overridenDeviceSettings = new Set; >+ WI._overridenDeviceSettings = new Map; > > // Targets. > WI.backendTarget = null; >@@ -612,8 +612,8 @@ WI.initializeTarget = function(target) > > // COMPATIBILITY (iOS 12.2): Page.overrideSetting did not exist. > if (target.PageAgent.overrideSetting) { >- for (let setting of WI._overridenDeviceSettings) >- target.PageAgent.overrideSetting(setting, true); >+ for (let [setting, value] of WI._overridenDeviceSettings) >+ target.PageAgent.overrideSetting(setting, value); > } > > // COMPATIBILITY (iOS 8): Page.setShowPaintRects did not exist. >@@ -1990,7 +1990,7 @@ WI._handleDeviceSettingsToolbarButtonClicked = function(event) > } > } > >- function applyOverriddenSetting(setting, callback) { >+ function applyOverriddenSetting(setting, value, callback) { > if (WI._overridenDeviceSettings.has(setting)) { > // We've just "disabled" the checkbox, so clear the override instead of applying it. > PageAgent.overrideSetting(setting, (error) => { >@@ -2004,15 +2004,13 @@ WI._handleDeviceSettingsToolbarButtonClicked = function(event) > updateActivatedState(); > }); > } else { >- // Override to false since the labels are the inverse of the setting. >- const value = false; > PageAgent.overrideSetting(setting, value, (error) => { > if (error) { > console.error(error); > return; > } > >- WI._overridenDeviceSettings.add(setting); >+ WI._overridenDeviceSettings.set(setting, value); > callback(true); > updateActivatedState(); > }); >@@ -2044,14 +2042,17 @@ WI._handleDeviceSettingsToolbarButtonClicked = function(event) > return columns; > } > >- function createCheckbox(container, label, setting) { >+ function createCheckbox(container, label, setting, value) { >+ if (!setting) >+ return; >+ > let labelElement = container.appendChild(document.createElement("label")); > > let checkboxElement = labelElement.appendChild(document.createElement("input")); > checkboxElement.type = "checkbox"; > checkboxElement.checked = WI._overridenDeviceSettings.has(setting); > checkboxElement.addEventListener("change", (event) => { >- applyOverriddenSetting(setting, (enabled) => { >+ applyOverriddenSetting(setting, value, (enabled) => { > checkboxElement.checked = enabled; > }); > }); >@@ -2168,12 +2169,21 @@ WI._handleDeviceSettingsToolbarButtonClicked = function(event) > } > }); > >- let disableColumns = createColumns(createContainer(contentElement, WI.UIString("Disable:")), 2); >- createCheckbox(disableColumns[0], WI.UIString("Images"), PageAgent.Setting.ImagesEnabled); >- createCheckbox(disableColumns[0], WI.UIString("Styles"), PageAgent.Setting.AuthorAndUserStylesEnabled); >- createCheckbox(disableColumns[0], WI.UIString("JavaScript"), PageAgent.Setting.ScriptEnabled); >- createCheckbox(disableColumns[1], WI.UIString("Site-specific Hacks"), PageAgent.Setting.NeedsSiteSpecificQuirks); >- createCheckbox(disableColumns[1], WI.UIString("Cross-Origin Restrictions"), PageAgent.Setting.WebSecurityEnabled); >+ if (PageAgent.Setting.ImagesEnabled || PageAgent.Setting.AuthorAndUserStylesEnabled || PageAgent.Setting.ScriptEnabled || PageAgent.Setting.NeedsSiteSpecificQuirks || PageAgent.Setting.WebSecurityEnabled) { >+ let disableColumns = createColumns(createContainer(contentElement, WI.UIString("Disable:")), 2); >+ createCheckbox(disableColumns[0], WI.UIString("Images"), PageAgent.Setting.ImagesEnabled, false); >+ createCheckbox(disableColumns[0], WI.UIString("Styles"), PageAgent.Setting.AuthorAndUserStylesEnabled, false); >+ createCheckbox(disableColumns[0], WI.UIString("JavaScript"), PageAgent.Setting.ScriptEnabled, false); >+ createCheckbox(disableColumns[1], WI.UIString("Site-specific Hacks"), PageAgent.Setting.NeedsSiteSpecificQuirks, false); >+ createCheckbox(disableColumns[1], WI.UIString("Cross-Origin Restrictions"), PageAgent.Setting.WebSecurityEnabled, false); >+ } >+ >+ if (PageAgent.Setting.MediaCaptureRequiresSecureConnection || PageAgent.Setting.ICECandidateFilteringEnabled || PageAgent.Setting.MockCaptureDevicesEnabled) { >+ let webRTCColumns = createColumns(createContainer(contentElement, WI.UIString("%s:").format(WI.unlocalizedString("WebRTC"))), 1); >+ createCheckbox(webRTCColumns[0], WI.UIString("Allow Media Capture on Insecure Sites"), PageAgent.Setting.MediaCaptureRequiresSecureConnection, false); >+ createCheckbox(webRTCColumns[0], WI.UIString("Disable ICE Candidate Restrictions"), PageAgent.Setting.ICECandidateFilteringEnabled, false); >+ createCheckbox(webRTCColumns[0], WI.UIString("Use Mock Capture Devices"), PageAgent.Setting.MockCaptureDevicesEnabled, true); >+ } > > WI._deviceSettingsPopover.presentNewContentWithFrame(contentElement, calculateTargetFrame(), preferredEdges); > }; >diff --git a/Source/WebInspectorUI/UserInterface/Views/Main.css b/Source/WebInspectorUI/UserInterface/Views/Main.css >index 15a71ef104f7d4c3389626809a0bd8707a372d3a..cfbaead215f87492cdbfed2f64e1a6bf20a2939c 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/Main.css >+++ b/Source/WebInspectorUI/UserInterface/Views/Main.css >@@ -391,6 +391,10 @@ body[dir=rtl] .go-to-arrow { > padding: 8px; > } > >+.device-settings-content .container { >+ margin-top: 8px; >+} >+ > .device-settings-content .columns { > display: flex; > } >diff --git a/Source/WebKit/Shared/WebPreferences.yaml b/Source/WebKit/Shared/WebPreferences.yaml >index 9b0eacaa9b7a79c21fda40dcbd6b7dcc77dae73c..6fb1f786f764499c5683613defad69477260378c 100644 >--- a/Source/WebKit/Shared/WebPreferences.yaml >+++ b/Source/WebKit/Shared/WebPreferences.yaml >@@ -629,23 +629,11 @@ HTTPEquivEnabled: > defaultValue: true > webcoreName: httpEquivEnabled > >-MockCaptureDevicesEnabled: >- type: bool >- defaultValue: DEFAULT_MOCK_CAPTURE_DEVICES_ENABLED >- webcoreBinding: DeprecatedGlobalSettings >- condition: ENABLE(MEDIA_STREAM) >- > MockCaptureDevicesPromptEnabled: > type: bool > defaultValue: true > webcoreBinding: none > >-MediaCaptureRequiresSecureConnection: >- type: bool >- defaultValue: true >- webcoreBinding: DeprecatedGlobalSettings >- condition: ENABLE(MEDIA_STREAM) >- > # FIXME: What is this for? > EnumeratingAllNetworkInterfacesEnabled: > type: bool >@@ -1551,3 +1539,15 @@ AdClickAttributionEnabled: > humanReadableDescription: "Enable Ad Click Attribution for Cross-Site Link Navigations" > webcoreBinding: RuntimeEnabledFeatures > category: internal >+ >+# Deprecated >+ >+MockCaptureDevicesEnabled: >+ type: bool >+ defaultValue: false >+ condition: ENABLE(MEDIA_STREAM) >+ >+MediaCaptureRequiresSecureConnection: >+ type: bool >+ defaultValue: true >+ condition: ENABLE(MEDIA_STREAM) >diff --git a/Source/WebKit/Shared/WebPreferencesDefaultValues.h b/Source/WebKit/Shared/WebPreferencesDefaultValues.h >index 0a52167c20fa5ae0404734784a49ec91c9106ff7..ff191f14b6ae63ecbd99c4a5688c69c9d25c0a91 100644 >--- a/Source/WebKit/Shared/WebPreferencesDefaultValues.h >+++ b/Source/WebKit/Shared/WebPreferencesDefaultValues.h >@@ -112,11 +112,9 @@ > #if PLATFORM(IOS_FAMILY_SIMULATOR) > #define DEFAULT_ACCELERATED_DRAWING_ENABLED false > #define DEFAULT_CANVAS_USES_ACCELERATED_DRAWING false >-#define DEFAULT_MOCK_CAPTURE_DEVICES_ENABLED true > #else > #define DEFAULT_ACCELERATED_DRAWING_ENABLED true > #define DEFAULT_CANVAS_USES_ACCELERATED_DRAWING true >-#define DEFAULT_MOCK_CAPTURE_DEVICES_ENABLED false > #endif > > #if PLATFORM(COCOA) >diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm >index eaef8ff160fb4eb30a890e6bcf53afda6ad55017..2835ef51585de16757827c98919aa357eb95d6d9 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebView.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebView.mm >@@ -3054,8 +3054,8 @@ - (void)_preferencesChanged:(WebPreferences *)preferences > #endif > > #if ENABLE(MEDIA_STREAM) >- DeprecatedGlobalSettings::setMockCaptureDevicesEnabled(false); >- DeprecatedGlobalSettings::setMediaCaptureRequiresSecureConnection(true); >+ settings.setMockCaptureDevicesEnabled(false); >+ settings.setMediaCaptureRequiresSecureConnection(true); > RuntimeEnabledFeatures::sharedFeatures().setMediaStreamEnabled(false); > RuntimeEnabledFeatures::sharedFeatures().setMediaDevicesEnabled(false); > RuntimeEnabledFeatures::sharedFeatures().setMediaRecorderEnabled(preferences.mediaRecorderEnabled); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 39ae751f113f099026ffcec864e563c353d4a9f5..6c010baca1b576a1e483262dd449c45d94ef9a5c 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2019-01-26 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: provide a way to edit page WebRTC settings on a remote target >+ https://bugs.webkit.org/show_bug.cgi?id=193863 >+ <rdar://problem/47572764> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * inspector/page/overrideSetting.html: >+ * inspector/page/overrideSetting-expected.txt: >+ > 2019-01-26 Devin Rousso <drousso@apple.com> > > Web Inspector: provide a way to edit the user agent of a remote target >diff --git a/LayoutTests/inspector/page/overrideSetting-expected.txt b/LayoutTests/inspector/page/overrideSetting-expected.txt >index 9cb53e595972d461521892fa49993413134fea55..134ccc484c94cc90179abc5433d673c9a68df5d5 100644 >--- a/LayoutTests/inspector/page/overrideSetting-expected.txt >+++ b/LayoutTests/inspector/page/overrideSetting-expected.txt >@@ -9,3 +9,10 @@ Property "color" equals "rgb(0, 0, 0)" > Removing AuthorAndUserStylesEnabled override... > Property "color" equals "rgb(255, 0, 0)" > >+-- Running test case: Page.overrideSetting.MockCaptureDevicesEnabled >+Expected Error: The I/O read operation failed. >+Overriding MockCaptureDevicesEnabled to true... >+PASS: getUserMedia should not fail when no devices are available >+Removing MockCaptureDevicesEnabled override... >+Expected Error: The I/O read operation failed. >+ >diff --git a/LayoutTests/inspector/page/overrideSetting.html b/LayoutTests/inspector/page/overrideSetting.html >index d75df8802c24b6ae00806cee0135a8d837c9e7d2..a069db3d1355d0b4651d199ae76f338db867948a 100644 >--- a/LayoutTests/inspector/page/overrideSetting.html >+++ b/LayoutTests/inspector/page/overrideSetting.html >@@ -4,12 +4,21 @@ > <script src="../../http/tests/inspector/resources/inspector-test.js"></script> > <script> > >+if (window.internals) >+ window.internals.setMockMediaCaptureDevicesEnabled(false); >+ > function printStyleProperty(property) { > let computedStyle = window.getComputedStyle(document.body); > let propertyValue = computedStyle.getPropertyValue(property); > TestPage.addResult(`Property "${property}" equals "${propertyValue}"`); > } > >+function requestGetUserMedia() { >+ navigator.mediaDevices.getUserMedia({audio: {}, video: {}}) >+ .then(() => TestPage.dispatchEventToFrontend("GetUserMedia", {success: true})) >+ .catch((error) => TestPage.dispatchEventToFrontend("GetUserMedia", {error: error.message})); >+} >+ > function test() > { > let suite = InspectorTest.createAsyncSuite("Page.overrideSetting"); >@@ -32,6 +41,36 @@ function test() > }, > }); > >+ suite.addTestCase({ >+ name: "Page.overrideSetting.MockCaptureDevicesEnabled", >+ description: "Test that changing whether mock capture devices are enabled has an effect.", >+ async test() { >+ let [defaultResult] = await Promise.all([ >+ InspectorTest.awaitEvent("GetUserMedia"), >+ InspectorTest.evaluateInPage(`requestGetUserMedia()`), >+ ]); >+ InspectorTest.log("Expected Error: " + defaultResult.data.error); >+ >+ InspectorTest.log("Overriding MockCaptureDevicesEnabled to true..."); >+ await PageAgent.overrideSetting(PageAgent.Setting.MockCaptureDevicesEnabled, true); >+ >+ let [overriddenResult] = await Promise.all([ >+ InspectorTest.awaitEvent("GetUserMedia"), >+ InspectorTest.evaluateInPage(`requestGetUserMedia()`), >+ ]) >+ InspectorTest.expectTrue(overriddenResult.data.success, "getUserMedia should not fail when no devices are available"); >+ >+ InspectorTest.log("Removing MockCaptureDevicesEnabled override..."); >+ await PageAgent.overrideSetting(PageAgent.Setting.MockCaptureDevicesEnabled); >+ >+ let [originalResult] = await Promise.all([ >+ InspectorTest.awaitEvent("GetUserMedia"), >+ InspectorTest.evaluateInPage(`requestGetUserMedia()`), >+ ]) >+ InspectorTest.log("Expected Error: " + originalResult.data.error); >+ }, >+ }); >+ > suite.runTestCasesAndFinish(); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193863
:
360232
|
360233
|
360234
|
360257
|
360259
|
360260
|
360267
|
360269
|
360356
|
360372
|
360428