And as is typical of your code very economical. :)
I'm quite astonished and delighted by your method of extracting the first tab from the nested lists object.
I hope someone still using Snow Leopard is able to test it for compatibility.
I'm not certain I've ever tried getting the window using contains target-tab, but I've been through too many permutations now and again over the last 12+ years to remember. In any case — well done.
I still had to resort to System Events. (I sure wish Apple would fix that...)
------------------------------------------------------------------------------
tell application "Safari"
try
repeat with tabOfInterest in (tabs of windows whose URL begins with urlOfInterest)
set tabOfInterest to contents of tabOfInterest
exit repeat
end repeat
set winOfInterest to first item of (windows whose tabs contains tabOfInterest)
tell winOfInterest
set current tab to tabOfInterest
if index is not 1 then
if visible = false then set visible to true -- *maybe* speeds things up a trifle if *not* visible.
set index to 1
raiseWindowOne() of me
end if
end tell
on error
if window 1 exists then
tell window 1
make new tab at end with properties {URL:urlOfInterest}
set current tab to last tab
end tell
else
make new document with properties {URL:urlOfInterest}
set bounds of front window to {228, 23, 1542, 1196}
end if
end try
end tell
------------------------------------------------------------------------------
--» HANDLERS
------------------------------------------------------------------------------
on raiseWindowOne()
tell application "System Events"
tell (first application process whose frontmost is true)
tell window 1 to perform action "AXRaise"
end tell
end tell
end raiseWindowOne
------------------------------------------------------------------------------