Re: [Tails-dev] [review'n'merge:1.3] feature/5525-sandbox-we…

Nachricht löschen

Nachricht beantworten
Autor: anonym
Datum:  
To: The Tails public development discussion list
Betreff: Re: [Tails-dev] [review'n'merge:1.3] feature/5525-sandbox-web-browser
On 10/02/15 18:23, intrigeri wrote:
> intrigeri wrote (10 Feb 2015 16:52:08 GMT) :
>> anonym wrote (10 Feb 2015 15:29:58 GMT) :
>>> I'd suggest the following so a special case doesn't have to be added for
>>> each key:
>
>> Looks good. I admit I was too lazy to learn Ruby's meta-programming
>> features, although this idea did occur to me. Going to test it locally
>> and add this to the branch.
>
> Unfortunately, it doesn't work:
>
>     And I press the "ENTER" key                                                  # features/step_definitions/common_steps.rb:810
>       Fail: unknown method name `method_defined?' (RuntimeError)
>       ./features/step_definitions/common_steps.rb:812:in `method_missing'

>
> I suspect that the crazy rjb stuff we're doing doesn't produce modules
> (classes) that inherit from the Module module. So I had to go back to
> my initial implementation.


Ah, sorry for the bad suggestion! Indeed, RJB doesn't actually make Ruby
aware of any Java methods of "imported" objects, but sort of
optimisticallt proxies any method call to Java, or something like that.
To actually look if a method is defined we'd have to use RJB to do some
Java introspection... nice! :)

A much simpler approach is to just catch the exception that RJB throws
and instead throw ours:

    When /^I press the "([^"]+)" key$/ do |key|
      next if @skip_steps_while_restoring_background
      begin
        @screen.type(eval("Sikuli::Key.#{key}"))
      rescue RuntimeError
        raise "unsupported key #{key}"
      end
    end


Let's forget it for now. Filed as #8885.

>>> Lastly, one scenario fails consistently for me:
>
>>>   Scenario: Importing an OpenPGP key from website
>>> [...]
>>>     Then I see "KeyImportedNotification.png" after at most 10 seconds
>>>       FindFailed: can not find KeyImportedNotification.png on the screen.

>
>>> The failure screen shot still shows the "Save file" dialog so it seems
>>> the ENTER key press was lost. I guess we have to click the dialog's OK
>>> button instead.
>
>> OK, will look into it right now.
>
> Implemented what you suggest, still works for me. Better for you?


All green now so I've merged the branch now. Congrats!

Cheers!