Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 439638

Summary: Markdown viewer does not use URL.revokeObjectURL properly.
Product: [ECD] Orion Reporter: libing wang <libingw>
Component: ClientAssignee: libing wang <libingw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 5.0   
Target Milestone: 7.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description libing wang CLA 2014-07-15 12:19:38 EDT
Using the latest Chrome v37 and v38.
When open a readme file by the markdown viewer, the images inside the readme are not shown.

According tothe spec of the revokeObjectURL api, https://developer.mozilla.org/en-US/docs/Web/API/URL.revokeObjectURL, we should call this API when the image is loaded:
function loadImage(array_buffer, onload) {
    var img = new Image();
    img.src = URL.createObjectURL(new Blob([array_buffer], {type:'image/jpeg'}));
    img.onload = function() {
        URL.revokeObjectURL(img.src);
    };
}
Comment 1 libing wang CLA 2014-07-15 12:25:09 EDT
								document.getElementById(id).src = objectURL;
								URL.revokeObjectURL(objectURL);

If we look at the code above, it was wrong. We should not have revoke the Object URL right away. We should've done it after the image is loaded/rendered. It just worked luckily before.