Closed Bug 1131911 Opened 10 years ago Closed 10 years ago

Extract page metadata extraction from Social.jsm to its own JSM

Categories

(Toolkit :: General, defect, P1)

defect
Points:
8

Tracking

()

RESOLVED FIXED
mozilla39
Iteration:
39.1 - 9 Mar
Tracking Status
firefox38 --- fixed
firefox39 --- fixed

People

(Reporter: Unfocused, Assigned: Unfocused)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

We currently have two (that I know of) implementations of page metadata extraction - primarily relying on OpenGraph. These are: * OpenGraphBuilder in browser/modules/Social.jsm (also handles microdata) * _getExcerpt in toolkit/components/reader/content/Readability.js (only excerpt, but also handles Twitter cards) (This is of course ignoring Microformats, which is another thing again) And we have the following uses for metadata extraction: * Social API (https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Social_API/Bookmarks#OpenGraphData_DOM_Event) * ReaderMode * ReadingList To clean that up, we should extract the relevant parts from Social.jsm and Readability.js into a JSM in Toolkit, which gives us one API for all three consumers to use. Non-exhaustive list of relevant noodles of spaghetti: https://hg.mozilla.org/mozilla-central/file/2cb22c058add/browser/base/content/browser-social.js#l640 https://hg.mozilla.org/mozilla-central/file/2cb22c058add/browser/base/content/content.js#l1008 https://hg.mozilla.org/mozilla-central/file/2cb22c058add/browser/modules/Social.jsm#l490 https://hg.mozilla.org/mozilla-central/file/2cb22c058add/browser/modules/Social.jsm#l671 https://hg.mozilla.org/mozilla-central/file/2cb22c058add/toolkit/components/reader/content/Readability.js#l743 https://hg.mozilla.org/mozilla-central/file/2cb22c058add/mobile/android/chrome/content/Reader.js#l218 https://hg.mozilla.org/mozilla-central/file/2cb22c058add/browser/base/content/content.js#l520
Flags: qe-verify-
Flags: firefox-backlog+
Summary: Extract page metadata extraction from Social.jsm and Readability.js to it's own JSM → Extract page metadata extraction from Social.jsm and Readability.js to its own JSM
Additional notes: This won't just be a JSM - that'll just be the public API. The actual metadata extraction should be in a frame script. And ideally, this should be lazily done, and cached for the lifetime of the page so it isn't extracted twice.
Adding Shane who wrote the Social API code. Shane, any thoughts?
There is probably some useful combination of the two. I do eventually also need to add microformats2 support, so we'd need to be able to expand on what would be in the jsm.
Blocks: 1132074
Assignee: nobody → bmcbride
Status: NEW → ASSIGNED
Iteration: --- → 38.3 - 23 Feb
Iteration: 38.3 - 23 Feb → 39.1 - 9 Mar
Attached patch Patch v1Splinter Review
Wasn't sure what to do with generateEndpointURL - it doesn't really fit in the new module. So I've left it as-is. Also haven't touched Readability.js, which does some extraction too. Figured that would be best left to a separate Fennec bug, since only Fennec uses that part. Otherwise: * Split out into separate toolkit module * Added an initial basic test, which is a start for more in the future * Updated the code style a bit * Added documentation * Fixed a couple of latent bugs. IIRC, around adding extra sanity checks
Attachment #8570988 - Flags: review?(mixedpuppy)
Oh, and Try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=18e2ee243829 Customary unrelated intermittent oranges included for free.
Priority: -- → P1
Comment on attachment 8570988 [details] [diff] [review] Patch v1 The ftp support (_validateURL) could probably be removed. It might also be worthwhile move the tests over (would require a little reworking of them) from browser_share.js (see testSharePage and testShareMicrodata).
Attachment #8570988 - Flags: review?(mixedpuppy) → review+
(In reply to Shane Caraveo (:mixedpuppy) from comment #6) > Comment on attachment 8570988 [details] [diff] [review] > Patch v1 > > The ftp support (_validateURL) could probably be removed. Done. > It might also be > worthwhile move the tests over (would require a little reworking of them) > from browser_share.js (see testSharePage and testShareMicrodata). These looked like useful integration tests for Social, so I've left them as-is. I've filed bug 1140347 for more unit test coverage. https://hg.mozilla.org/integration/fx-team/rev/5b40873e617b
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Blair, do we need any follow up bugs? The original comment feels more extensive than what is done so far.
Flags: needinfo?(bmcbride)
Thanks for the reminder. So many balls in the air, hard to keep track of it all. Filing stuff now.
Flags: needinfo?(bmcbride)
Summary: Extract page metadata extraction from Social.jsm and Readability.js to its own JSM → Extract page metadata extraction from Social.jsm to its own JSM
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: