Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 450368 - Embedding strings could be better encapsulated
Summary: Embedding strings could be better encapsulated
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.4   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Lakshmi P Shanmugam CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-06 11:00 EST by Neil Rashbrook CLA
Modified: 2017-01-27 06:59 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Neil Rashbrook CLA 2014-11-06 11:00:50 EST
While working on bug 429739 I noticed that although a number of call sites were using the convenience nsEmbedString class, there were some omissions, and there was also no equivalent class for XULRunner's 8-bit strings which meant that all the relevant code was duplicated for each use.
Comment 1 Niraj Modi CLA 2014-11-11 07:10:14 EST
Similar refactoring effort was started sometime back in below Gerrit, but not yet completed:
"Deduplicate nsEmbed(C)String toString": https://git.eclipse.org/r/#/c/23605/

See if this can be taken forward.. currently it has few open comments to be resolved.Thanks!
Comment 2 Neil Rashbrook CLA 2014-11-11 11:19:48 EST
(In reply to Niraj Modi from comment #1)
> Similar refactoring effort was started sometime back in below Gerrit, but
> not yet completed:
> "Deduplicate nsEmbed(C)String toString": https://git.eclipse.org/r/#/c/23605/
> 
> See if this can be taken forward.. currently it has few open comments to be
> resolved.Thanks!

I notice that the patch you linked to doesn't wrap the calls to nsEmbedString_new so it's not as convenient as my approach.

Although I mentioned it in the original description, I was planning on creating an nsEmbedCString class separately, but I can address that here too if you prefer. I have already made the appropriate changes locally so I can comment on how they relate to your existing comments.

Comment on Mozilla.java: I don't append the HTML bytes to the stream in pages. As far as I can tell, the stream does not have a memory limit and can accept the entire byte array at once. The loop is therefore unnecessary.

Comments on nsEmbed(C)String.java: I don't change any stringification code, so I don't think there is anything to be done there.
Comment 3 Lakshmi P Shanmugam CLA 2015-03-18 05:39:13 EDT
Moving to M7.
Comment 4 Lakshmi P Shanmugam CLA 2015-04-30 08:07:10 EDT
One gerrit change https://git.eclipse.org/r/#/c/36154/ for the refactoring is already merged to master.
The second refactoring change request https://git.eclipse.org/r/#/c/39792/ needs to be reviewed and tested.
Will do this post 4.5.
Comment 5 Lakshmi P Shanmugam CLA 2016-04-14 06:03:15 EDT
No more development work is planned for XULRunner support. I think it's better to not touch the code now as it would require more testing on different versions & platforms.
Comment 6 Lakshmi P Shanmugam CLA 2017-01-27 06:59:32 EST
XULRunner has been deprecated and removed from the source tree, see
https://groups.google.com/d/msg/mozilla.dev.platform/_rFMunG2Bgw/C-4PcHj9IgAJ

Closing this request since makes little sense to invest in a dead technology.