cobbap
(cobbap)
April 15, 2017, 3:30pm
#1
I’m not sure if this is related is Safari 10.1 update or something else, but I’m getting a Safari crash from SD with this simple script
tell application “Safari” to make new document
running same script from Script Editor runs okay.
From SD, I get the following:
estockly
(Ed Stockly)
April 15, 2017, 5:48pm
#2
This works for me
tell application "Safari" to set myWindow to make new document at beginning
suzume
(Jean-Christophe Helary)
April 15, 2017, 11:34pm
#3
I confirm @cobbap ’s issue here. And the same happens in Safari Technology Preview.
estockly
(Ed Stockly)
April 16, 2017, 4:12am
#4
Crashes SD but not SE on this system too:
–>Script Debugger 6.0.5 (6A202) on Mac OS 10.11.6 (15G1421)
tell application "Safari"
activate
set myWindow to make new document at beginning
end tell
–The application “Safari.app” appears to have crashed, responding to the following Apple Event:
–AppleScript: get source of document “Favorites”
–AEPrint: ‘core’‘getd’{ ‘----’:'obj '{ ‘want’:‘prop’, ‘from’:'obj '{ ‘form’:‘name’, ‘want’:‘docu’, ‘seld’:‘utxt’(“Favorites”), ‘from’:null() }, ‘form’:‘prop’, ‘seld’:‘conT’ } }
alldritt
(Mark Alldritt)
October 21, 2017, 11:14pm
#5
Turns out the crash is caused by Script Debugger’s Result explorer asking Safari for the source
property of the newly created document. Switching the Result view from Best to Source avoids the crash.
sphil
(Phil Stokes)
December 1, 2017, 2:45am
#6
Just encountered this in SD 6.0.6.
Will this bug be addressed in the future?
alldritt
(Mark Alldritt)
December 1, 2017, 4:19am
#7
I don’t think this is Script Debugger’s bug to fix. I would suggest filing a bug with Apple for this one.
sphil
(Phil Stokes)
December 1, 2017, 4:39am
#8
It seems to me that the crash is caused by SD asking for the source before the page has loaded. With ‘Best’ view selected, this works fine:
tell application "Safari"
make new document
end tell
delay 3
tell application "Safari"
get front document's source
end tell
But if I take the delay out Safari will crash. Given that, it’s not clear to me how I can implicate Safari to file a bug against it.
alldritt
(Mark Alldritt)
December 1, 2017, 4:43am
#9
Running this code in the Script Editor causes Safari to crash. This excludes Script Debugger from the test case:
tell application "Safari"
make new document
end tell
--delay 3
tell application "Safari"
get front document's source
end tell
2 Likes
sphil
(Phil Stokes)
December 7, 2017, 7:13am
#10
It looks like this bug is already resolved on High Sierra. Source just returns “” if the page hasn’ loaded in time and doesn’t crash (in either SD or SE).
1 Like
estockly
(Ed Stockly)
April 24, 2018, 6:19pm
#11
What’s happening is that SD automatically gets the document’s source as part of the result. Safari only return a reference to the open window, not the properties, etc.
This causes safari to crash the same way:
tell application "Safari"
set myResult to source of (make new document)
end tell
ccstone
(Christopher Stone)
April 29, 2018, 8:40pm
#12
Hey Ed,
On my MacOS 10.12.6 system Safari 11.1 (12605.1.33.1.4) does NOT crash with that code.
Where are you seeing this?
-Chris