From a25638dfb68e2752a224ab7716cb5edc491e4033 Mon Sep 17 00:00:00 2001 From: Alex Rodionov Date: Fri, 3 May 2019 08:02:22 +0600 Subject: [PATCH] Support installing web extensions with applications.gecko.id --- rb/lib/selenium/webdriver/firefox/extension.rb | 8 ++++++++ .../selenium/webdriver/firefox/profile_spec.rb | 9 ++++++++- .../firebug/favourite_colour-1.1-an+fx.xpi | Bin 0 -> 6677 bytes 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 third_party/firebug/favourite_colour-1.1-an+fx.xpi diff --git a/rb/lib/selenium/webdriver/firefox/extension.rb b/rb/lib/selenium/webdriver/firefox/extension.rb index 1f268d6021e76..674eac2acd8c7 100644 --- a/rb/lib/selenium/webdriver/firefox/extension.rb +++ b/rb/lib/selenium/webdriver/firefox/extension.rb @@ -87,6 +87,14 @@ def read_id_from_manifest_json(directory) return unless File.exist?(manifest_path) manifest = JSON.parse(File.read(manifest_path)) + applications_gecko_id(manifest) || name_and_version(manifest) + end + + def applications_gecko_id(manifest) + manifest.dig('applications', 'gecko', 'id')&.strip + end + + def name_and_version(manifest) [manifest['name'].delete(' '), manifest['version']].join('@') end end # Extension diff --git a/rb/spec/integration/selenium/webdriver/firefox/profile_spec.rb b/rb/spec/integration/selenium/webdriver/firefox/profile_spec.rb index bc3ce1e6bedeb..38f76c67501e9 100644 --- a/rb/spec/integration/selenium/webdriver/firefox/profile_spec.rb +++ b/rb/spec/integration/selenium/webdriver/firefox/profile_spec.rb @@ -147,13 +147,20 @@ def read_generated_prefs(from = nil) expect(Dir.exist?(extension_directory)).to eq(true) end - it 'can install web extension' do + it 'can install web extension without id' do mooltipass = File.expand_path('../../../../../../third_party/firebug/mooltipass-1.1.87.xpi', __dir__) profile.add_extension(mooltipass) extension_directory = File.expand_path('extensions/MooltipassExtension@1.1.87', profile.layout_on_disk) expect(Dir.exist?(extension_directory)).to eq(true) end + it 'can install web extension with id' do + ext = File.expand_path('../../../../../../third_party/firebug/favourite_colour-1.1-an+fx.xpi', __dir__) + profile.add_extension(ext) + extension_directory = File.expand_path('extensions/favourite-colour-examples@mozilla.org', profile.layout_on_disk) + expect(Dir.exist?(extension_directory)).to eq(true) + end + describe 'with browser' do before do profile['browser.startup.homepage'] = url_for('simpleTest.html') diff --git a/third_party/firebug/favourite_colour-1.1-an+fx.xpi b/third_party/firebug/favourite_colour-1.1-an+fx.xpi new file mode 100644 index 0000000000000000000000000000000000000000..1982a588bc02578300f8d1494a00cc14b2eb08db GIT binary patch literal 6677 zcmZu$1z1$wx*oc_L!`SUB?X2C=?kr z|Jl#lduBiDU3-18-}SC$jO zsr)$xotRoGaV{qbn@YT(AGD}b0n%y?Ik=!%x|s57>bY5hNKSc3^*|PTAX!tdLaY~G zAm8k}{x~FY4kA&eJNXi7Z6;0(;N7L=2m!vL!e&QyyLU!lwRTpI8#qQ~?64yyCk~RC zxeV{Q0Vz{=J=<@+0dSL|E3&t_hU}uJkWdGQ85vs2NyE6>g5}Z(WacF#Oc_rxPt~ERJ?>;yj+AaRK)p49!2)_hKw0gy-?I_ zH7CiylJ8qPwGXMwem_-a&Po7vPBHy(xwK)4hFqIXhkUd03hmzED?yWV#iMz0H4T#7 zf)Gtz1i@XQl|?C9#W%Ovs`pgobg*k*as>Pu6oYs3pfG?-Aeom7#!D}M{0Q3<$$&B7 z=AAe(D#r1hW$#fsi9E*qNjysO07bI23}AHOacnn%xUjyRfBDx}MLfECew77}Y3rr{$O$WNEHN0B zZ3}C(iH(|FNB_|U)Nr~Rb!CGF4%X`GO=cRThtzzM=g{^Q zMptVa`IuJypt2`KfJD)F>{tw95b9=zFNN$=kjjUo$c8zyT?yLT)Fc!q<5aidJEl#5 zPzOU^s@H;X7DWX+kJdO~F_hvT&VMv%A(tHfTn+e^m`siSF-*j4z)ZO&B0M-%>*#2^ zdRm!-d6|HwT-7T}xVpO_vtP2ksqbgA&>4QZ`kO5ot_qwv-Z`I{ZTxxi`mhZZu2u4> zGliszqsSQbDFN7*bBTai$vq=><0eV>qt{7f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