So, I had a minute and wanted to test the new auto-fitting text frames against the usual textFrame.fit(FitOptions.FRAME_TO_CONTENT) from a performance standpoint.
The auto-fitting seemed to work fine in very limited testing. When I went to compare the older method, with auto-fitting turned off, I started with this:
The repeated part of my script looked like this:
var frame = app.activeDocument.textFrames; frame.contents += frame.contents; frame.fit(FitOptions.FRAME_TO_CONTENT);
I got this:
Uh oh. The frame resized out to the pasteboard margins.
It works fine, as it always has, in the UI. And it will do okay from the scripting interface with two different scripts:
var frame = app.activeDocument.textFrames; frame.contents += frame.contents;
var frame = app.activeDocument.textFrames; frame.fit(FitOptions.FRAME_TO_CONTENT);
But not together. I tried putting in an alert and some other stuff in between the text doubling and the fit, but that didn't fix it.
Anyone with CS6 care to try to replicate this one? (I'm on OS X 10.6.8.)
For inserting the contents can you try something like this,
frame.insertionPoints[-1].contents = frame.contents;
I don't think it will solve your problem, but anyway give a blind guess/try and see what will happen.
Edit: I don't have CS6 to test it...
Doubling the text your way doesn't trigger the bug. Other modifications made to the entire story (like setting frame.parentStory.pointSize += 1 or frame.parentStory.tracking = 999) will trigger it; but smaller changes, like frame.words[-1].pointSize *= 2 won't, even if they overset the frame. But setting frame.contents += "a", though it's a modification to the entire story, won't trigger it. It seems that InDesign is tracking the text frames' fit, even with auto-fitting turned off, and doesn't refresh itself properly after (some) scripted modifications to the frame's contents. Or something? I don't know. I'll report the bug.