Added exception handling to the setMainFrameHeight calls to handle XSS exceptions. Some code layout changes.