Skip to content
Browse files

Reuse test frame src if content is identical.

This fixes the problem of Firefox issuing requests for 'undefined', so
we can close #75. There is a question about whether this is the right
approach -- it's faster, but if tests modify the dom/styles of the test
frame, things get unpredictable...
  • Loading branch information...
1 parent c50bbf4 commit 38574236d33d458d5aea9fe63f997e5b5e330c51 @joseph joseph committed
Showing with 5 additions and 8 deletions.
  1. +5 −8 src/compat/env.js
View
13 src/compat/env.js
@@ -15,7 +15,7 @@ Monocle.Env = function () {
var frameLoadCallback = null;
var testFrame = null;
var testFrameCntr = null;
- var testFrameLoadedWithStandard = false;
+ var testFrameLastSrc = null;
var testFrameSize = 100;
var surveyCallback = null;
@@ -90,14 +90,11 @@ Monocle.Env = function () {
if (!testFrame) { testFrame = createTestFrame(); }
frameLoadCallback = cb;
- if (typeof src == "undefined") {
- if (testFrameLoadedWithStandard) {
- frameLoadCallback(testFrame);
- } else {
- testFrameLoadedWithStandard = true;
- src = 4;
- }
+ src = src || 4;
+ if (src == testFrameLastSrc) {
+ return frameLoadCallback();
}
+ testFrameLastSrc = src;
if (typeof src == "number") {
var pgs = [];

0 comments on commit 3857423

Please sign in to comment.
Something went wrong with that request. Please try again.