ext/tk: remove $SAFE 2..4 code

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-09-24 01:37:14 +00:00
parent 61847a8279
commit c97a6987b6
11 changed files with 18 additions and 83 deletions

View file

@ -1785,9 +1785,7 @@ EOS
end
def appsend(interp, async, *args)
if $SAFE >= 4
fail SecurityError, "cannot send Tk commands at level 4"
elsif $SAFE >= 1 && args.find{|obj| obj.tainted?}
if $SAFE >= 1 && args.find{|obj| obj.tainted?}
fail SecurityError, "cannot send tainted Tk commands at level #{$SAFE}"
end
if async != true && async != false && async != nil
@ -1802,9 +1800,7 @@ EOS
end
def rb_appsend(interp, async, *args)
if $SAFE >= 4
fail SecurityError, "cannot send Ruby commands at level 4"
elsif $SAFE >= 1 && args.find{|obj| obj.tainted?}
if $SAFE >= 1 && args.find{|obj| obj.tainted?}
fail SecurityError, "cannot send tainted Ruby commands at level #{$SAFE}"
end
if async != true && async != false && async != nil
@ -1820,9 +1816,7 @@ EOS
end
def appsend_displayof(interp, win, async, *args)
if $SAFE >= 4
fail SecurityError, "cannot send Tk commands at level 4"
elsif $SAFE >= 1 && args.find{|obj| obj.tainted?}
if $SAFE >= 1 && args.find{|obj| obj.tainted?}
fail SecurityError, "cannot send tainted Tk commands at level #{$SAFE}"
end
win = '.' if win == nil
@ -1838,9 +1832,7 @@ EOS
end
def rb_appsend_displayof(interp, win, async, *args)
if $SAFE >= 4
fail SecurityError, "cannot send Ruby commands at level 4"
elsif $SAFE >= 1 && args.find{|obj| obj.tainted?}
if $SAFE >= 1 && args.find{|obj| obj.tainted?}
fail SecurityError, "cannot send tainted Ruby commands at level #{$SAFE}"
end
win = '.' if win == nil
@ -1899,7 +1891,7 @@ EOS
INTERP_ROOT_CHECK.wait(INTERP_MUTEX)
status = INTERP_THREAD_STATUS.value
if status && TkCore::INTERP.default_master?
INTERP_THREAD_STATUS.value = nil if $SAFE < 4
INTERP_THREAD_STATUS.value = nil
raise status if status.kind_of?(Exception)
end
}
@ -2209,9 +2201,6 @@ module Tk
# tk_split_simplelist(INTERP._invoke('set', 'tcl_libPath'))
when :PLATFORM, :TCL_PLATFORM
if $SAFE >= 4
fail SecurityError, "can't get #{sym} when $SAFE >= 4"
end
INTERP._invoke_without_enc('global', 'tcl_platform')
Hash[*tk_split_simplelist(INTERP._invoke_without_enc('array', 'get',
'tcl_platform'))]
@ -3746,7 +3735,6 @@ module TkConfigMethod
@mode || false
end
def TkConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode)
fail SecurityError, "can't change the mode" if $SAFE>=4
@mode = (mode)? true: false
end
@ -5650,9 +5638,6 @@ class TkWindow<TkObject
end
def wait_visibility(on_thread = true)
if $SAFE >= 4
fail SecurityError, "can't wait visibility at $SAFE >= 4"
end
on_thread &= (Thread.list.size != 1)
if on_thread
INTERP._thread_tkwait('visibility', path)
@ -5676,9 +5661,6 @@ class TkWindow<TkObject
alias thread_tkwait_visibility thread_wait_visibility
def wait_destroy(on_thread = true)
if $SAFE >= 4
fail SecurityError, "can't wait destroy at $SAFE >= 4"
end
on_thread &= (Thread.list.size != 1)
if on_thread
INTERP._thread_tkwait('window', epath)