[
https://issues.apache.org/jira/browse/CB-8002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14316857#comment-14316857
]
Rajat Paharia commented on CB-8002:
-----------------------------------
Based on the idea from [~Hirbod], while waiting for the official 3.8.0 release,
I put this function into my app, and call it from some user-initiated actions
that I know happen relatively frequently: (note that it's not totally generic
as it references frameworks and variables from my app, but it's just to give
you an idea).
{code:title=killZombies|borderStyle=solid|language=JavaScript}
killZombies: function() {
//// Temporary JS workaround until iOS Platform 3.80 is
available to deal with this bug in 3.70
// https://issues.apache.org/jira/browse/CB-8002
// delete extra gap://ready iframes.
$ionicPlatform.ready(function() {
if ($rootScope.vars.isCordovaApp &&
angular.isDefined(device.platform) &&
device.platform.toUpperCase() == "IOS") {
var frames = document.getElementsByTagName("iframe");
var gapFrames = [];
angular.forEach(frames, function(value) {
if (value.src == "gap://ready") {
gapFrames.push(value);
}
});
// delete all but the last one.
var deleteCounter = 0;
var totalLength = gapFrames.length;
if (gapFrames.length > 1) {
for (var i = gapFrames.length -2; i >= 0; i--) {
//console.log ("Deleting gapFrame " + i + " of
" + totalLength);
angular.element(gapFrames[i]).remove();
deleteCounter++;
}
}
console.log ("Deleted " + deleteCounter + " gapFrames");
}
});
},
{code}
> Creating a new div for every Js -> Native exec() call
> -----------------------------------------------------
>
> Key: CB-8002
> URL: https://issues.apache.org/jira/browse/CB-8002
> Project: Apache Cordova
> Issue Type: Bug
> Components: iOS
> Affects Versions: 3.7.0
> Environment: Tested on multiple iOS 8.1 devices, simulators
> Reporter: Serdar Onal
> Assignee: Andrew Grieve
> Priority: Critical
> Fix For: 3.8.0
>
>
> Since the 3.7.0 update, when cordova does a Js to Native call using exec(),
> somehow the underlying cordova.js is creating a "gap://ready" iframe on every
> call. This means that if you made 1000 native calls you'll have 1000 divs on
> the DOM.
> I believe this issue is of critical priority as it incurs a huge memory leak.
> Screenshot from safari inspector
> https://drive.google.com/file/d/0B94TXiq5ycp1anp6aGpTbjhPdG8/view?usp=sharing
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]