| Index: Source/bindings/scripts/code_generator_v8.pm
 | 
| diff --git a/Source/bindings/scripts/code_generator_v8.pm b/Source/bindings/scripts/code_generator_v8.pm
 | 
| index 4cf55465b56d8a197a3b92c9ac842c80e7e32329..239b85acd62bbcea3927d3279fd2190a8adae665 100644
 | 
| --- a/Source/bindings/scripts/code_generator_v8.pm
 | 
| +++ b/Source/bindings/scripts/code_generator_v8.pm
 | 
| @@ -3109,7 +3109,7 @@ END
 | 
|          #    and thus passing it around would cause leakage.
 | 
|          # 2) Errors cannot be cloned (or serialized):
 | 
|          # http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#safe-passing-of-structured-data
 | 
| -        $implementation{nameSpaceInternal}->add("    if (isolatedWorldForIsolate(info.GetIsolate())) {\n");
 | 
| +        $implementation{nameSpaceInternal}->add("    if (DOMWrapperWorld::current(info.GetIsolate())->isIsolatedWorld()) {\n");
 | 
|          foreach my $attrName (@anyAttributeNames) {
 | 
|              my $setter = "setSerialized" . FirstLetterToUpperCase($attrName);
 | 
|              $implementation{nameSpaceInternal}->add(<<END);
 | 
| @@ -5138,9 +5138,10 @@ END
 | 
|          $code .= <<END;
 | 
|      if (wrapper.IsEmpty())
 | 
|          return wrapper;
 | 
| -    if (!isolatedWorldForEnteredContext(isolate)) {
 | 
| +    DOMWrapperWorld* world = DOMWrapperWorld::current(isolate);
 | 
| +    if (world->isMainWorld()) {
 | 
|          if (Frame* frame = impl->frame())
 | 
| -            frame->script().windowShell(DOMWrapperWorld::mainWorld())->updateDocumentWrapper(wrapper);
 | 
| +            frame->script().windowShell(world)->updateDocumentWrapper(wrapper);
 | 
|      }
 | 
|  END
 | 
|      }
 | 
| 
 |