Edit LastSession.plist in Xcode? (...to remove adware)
Looks like someone found a hole in Safari's javascript implementation; I've been seeing many more adware attacks.
The one that recently got me put up a modal dialog box with no way to dismiss it. It's possible there were buttons at the bottom of the dialog box, but it was filled with so much text that it extended off my screen. All options in the main menu bar were disabled, so I couldn't open preferences to turn off javascript. I had to force quit. When I relaunched Safari, all my windows from the previous session re-open. That includes the malicious one, of course.
So the way I thought I would be clever to get around this was I would edit the LastSession file. Just delete the bad page. And Xcode seems to do a good job of it. Everything is laid out neat and tidy when Xcode opens it. I deleted the bad "item" (as Xcode calls it.) Saved my changes. Verified in the Finder, using quicklook, that the change updated. Relaunched Safari and... No good. The nefarious site opened anyway.
And the LastSession file updated live in Xcode to reflect that the bad site was back.
I verified with my clone that this is not something spooky with the Adware. It's just how Safari works. I tried the editing trick on a non-malicious-javascript entry in the lastsession file, and it too came back with a Safari relaunch.
So either I'm doing something wrong in Xcode. Or Safari has a redundant way of reopening windows and tabs at launch.
I looked at the preferences file. Nothing.
I checked out the Saved Application State folder. There are some .data files there that I have no idea how to work with. (I could probably reverse engineer which file is related to which open window (from the way the lastsession file works, it looks like last in list means the window closest to the user. But then again, Apple uses z-axis terminology in other places which sometimes makes zero closest to you...) Anyway, then I would have to figure out how to update the accompanying .plist in that folder.
Does Safari have a bias toward using cached web pages instead of using the LastSession file like a master list?
Looking for any and all ideas,
Thanks.
Mac Pro, OS X Yosemite (10.10.5)