More workarounds for Direct tests use of JavaScript

RestService*IT should now pass in with all three engines.

This is all quite delicate, but I don't see much alternative other than removing Direct and its tests.